|
@@ -158,9 +158,15 @@ const productTableListValue = ref([])
|
|
function saveOrder(flag: boolean) {
|
|
function saveOrder(flag: boolean) {
|
|
orderTemplateRef.value?.getData().then((res: any) => {
|
|
orderTemplateRef.value?.getData().then((res: any) => {
|
|
let productTableListData = relatedProductsRef?.value?.returnData()
|
|
let productTableListData = relatedProductsRef?.value?.returnData()
|
|
|
|
+ for(var i in productTableListData) {
|
|
|
|
+ productTableListData[i].sealPrice = productTableListData[i].sellingPrice,
|
|
|
|
+ productTableListData[i].discount = productTableListData[i].discount,
|
|
|
|
+ productTableListData[i].num = productTableListData[i].quantity
|
|
|
|
+ }
|
|
const produt = productTableListData ? JSON.stringify(productTableListData) : []
|
|
const produt = productTableListData ? JSON.stringify(productTableListData) : []
|
|
allLoading.editSaveLading = true
|
|
allLoading.editSaveLading = true
|
|
post(URL_OEDERUPDATE, {
|
|
post(URL_OEDERUPDATE, {
|
|
|
|
+ ...orderTemplateValue.value,
|
|
...res,
|
|
...res,
|
|
orderEndDate: res.orderEndDate ? formatDate(res.orderEndDate) : '',
|
|
orderEndDate: res.orderEndDate ? formatDate(res.orderEndDate) : '',
|
|
orderStartDate: res.orderStartDate ? formatDate(res.orderStartDate) : '',
|
|
orderStartDate: res.orderStartDate ? formatDate(res.orderStartDate) : '',
|
|
@@ -187,12 +193,12 @@ function editOrder(item: any) {
|
|
if (item) {
|
|
if (item) {
|
|
editProduct(item)
|
|
editProduct(item)
|
|
const templateKey = getTemplateKey(orderTemplate.value.list)
|
|
const templateKey = getTemplateKey(orderTemplate.value.list)
|
|
- let formVal: templateKey = {}
|
|
|
|
|
|
+ let formVal: templateKey = { id: item.id }
|
|
for (let i = 0; i < orderTemplate.value.list.length; i++) {
|
|
for (let i = 0; i < orderTemplate.value.list.length; i++) {
|
|
const key = templateKey[i]
|
|
const key = templateKey[i]
|
|
formVal[key] = item[key]
|
|
formVal[key] = item[key]
|
|
}
|
|
}
|
|
- orderTemplateValue.value = JSON.parse(JSON.stringify(item))
|
|
|
|
|
|
+ orderTemplateValue.value = formVal
|
|
allText.orderEditText = '编辑订单'
|
|
allText.orderEditText = '编辑订单'
|
|
}
|
|
}
|
|
if (!item) {
|
|
if (!item) {
|
|
@@ -201,7 +207,6 @@ function editOrder(item: any) {
|
|
allText.orderEditText = '新增订单'
|
|
allText.orderEditText = '新增订单'
|
|
}
|
|
}
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- orderTemplateRef.value && orderTemplateRef.value.reset()
|
|
|
|
orderTemplateKey.value++
|
|
orderTemplateKey.value++
|
|
allLoading.orderTemplateLoadinng = false
|
|
allLoading.orderTemplateLoadinng = false
|
|
}, 500)
|
|
}, 500)
|
|
@@ -292,8 +297,13 @@ function setFilterItems() {
|
|
function editProduct(row: any) {
|
|
function editProduct(row: any) {
|
|
post(URL_PRODUTWITHORDER, { id: row.id }).then(({ data }) => {
|
|
post(URL_PRODUTWITHORDER, { id: row.id }).then(({ data }) => {
|
|
const list = data.map((item: any) => {
|
|
const list = data.map((item: any) => {
|
|
- const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice } = item
|
|
|
|
- return { id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory, quantity, discount, totalPrice }
|
|
|
|
|
|
+ const { id, productName, productCode, unit, unitName, typeName, type, price, inventory, orderProductDetail } = item
|
|
|
|
+ return { id, productId: id, productName, productCode, unit, unitName, typeName, type, price, inventory,
|
|
|
|
+ quantity: +orderProductDetail?.num,
|
|
|
|
+ discount: +orderProductDetail?.discount,
|
|
|
|
+ sellingPrice: +orderProductDetail?.sealPrice,
|
|
|
|
+ totalPrice: +orderProductDetail?.totalPrice
|
|
|
|
+ }
|
|
})
|
|
})
|
|
console.log('开始执行', list)
|
|
console.log('开始执行', list)
|
|
productTableListValue.value = list
|
|
productTableListValue.value = list
|