Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-pc-cloud
This commit is contained in:
commit
2feab8cb7f
2 files changed
+94
-176
No files matched your search
@@ -113,9 +113,19 @@
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="selectedUnitObj" title="包装单位" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<el-select v-model="row.selectedUnitObj" value-key="id" placeholder="请选择包装单位">
|
||||
<el-option v-for="item in row.erpUnitVos" :key="item.id" :label="item.unit" :value="item" />
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-select
|
||||
v-model="row.selectedUnitObj"
|
||||
value-key="id"
|
||||
placeholder="请选择包装单位"
|
||||
@change="reComputeTotalAmount(row, $rowIndex)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in row.erpUnitVos"
|
||||
:key="item.id"
|
||||
:label="item.spec ? item.unit + '-' + item.spec : item.unit"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- <el-select v-else v-model="row.unitId" value-key="id" placeholder="请选择包装单位">
|
||||
<el-option :key="row.id" :label="row.unit" :value="row.unitId" />
|
||||
@@ -126,11 +136,11 @@
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="quantity" title="数量" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
<el-input v-model.number="row.quantity" />
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-input v-model.number="row.quantity" @change="reComputeTotalAmount(row, $rowIndex)" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="unitPrice" title="原进价">
|
||||
<vxe-column field="purchasePrice" title="原进价">
|
||||
<template #default="{ row }">
|
||||
{{ displayPrice(row.selectedUnitObj?.purchasePrice || 0) }}
|
||||
</template>
|
||||
@@ -139,15 +149,25 @@
|
||||
<template #default="{ row }">
|
||||
{{ row?.selectedUnitObj?.realPrice || 0 }}
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.realPrice" :min="0" :precision="2" />
|
||||
<template #edit="{ row, $rowIndex }">
|
||||
<el-input-number
|
||||
v-if="row.selectedUnitObj"
|
||||
v-model="row.selectedUnitObj.realPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
@change="reComputeTotalAmount(row, $rowIndex)"
|
||||
/>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="totalAmount" title="累计总金额">
|
||||
<vxe-column field="totalAmount" title="累计总金额" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.selectedUnitObj && row.quantity">
|
||||
{{ Number(row.quantity * parseFloat(row.selectedUnitObj.realPrice || 0)).toFixed(2) }}
|
||||
</span>
|
||||
{{ row?.selectedUnitObj?.totalAmount }}
|
||||
<!-- <span v-if="row.selectedUnitObj && row.quantity">
|
||||
{{ Number((row.quantity * parseFloat(row.selectedUnitObj.realPrice || 0)).toFixed(2)) }}
|
||||
</span> -->
|
||||
</template>
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-if="row.selectedUnitObj" v-model="row.selectedUnitObj.totalAmount" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
@@ -265,7 +285,11 @@ const getInitData = async () => {
|
||||
const selectedUnitObj = item.erpUnitVos.find((unit: any) => unit.id === item.unitId)
|
||||
return {
|
||||
...item,
|
||||
selectedUnitObj: { ...selectedUnitObj, realPrice: displayPrice(item?.realPrice, "") || 0 },
|
||||
selectedUnitObj: {
|
||||
...selectedUnitObj,
|
||||
realPrice: Number(displayPrice(item?.realPrice, "")) || 0,
|
||||
totalAmount: Number(displayPrice(item?.totalAmount, "")),
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -315,8 +339,12 @@ const getSelectedRows = (selectionRows: any) => {
|
||||
// if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||
return {
|
||||
...addItem,
|
||||
erpUnitVos: addItem.erpUnitVos.map((item: any) => ({ ...item, realPrice: displayPrice(item.purchasePrice, "") })),
|
||||
selectedUnitObj: addItem.erpUnitVos[0],
|
||||
erpUnitVos: addItem.erpUnitVos.map((item: any) => ({ ...item, realPrice: Number(displayPrice(item.purchasePrice, "")) })),
|
||||
selectedUnitObj: {
|
||||
...addItem.erpUnitVos[0],
|
||||
realPrice: parseFloat(displayPrice(addItem.erpUnitVos[0].purchasePrice, "")),
|
||||
totalAmount: 1 * parseFloat(displayPrice(addItem.erpUnitVos[0].purchasePrice, "")),
|
||||
},
|
||||
unitId: addItem.erpUnitVos[0].id,
|
||||
quantity: 1,
|
||||
isNew: true,
|
||||
@@ -347,6 +375,11 @@ const removeRow = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 重新计算累计总金额
|
||||
const reComputeTotalAmount = (row: any, index: number) => {
|
||||
vxeTableData.value[index].selectedUnitObj.totalAmount = Number((row.quantity * parseFloat(row.selectedUnitObj.realPrice || 0)).toFixed(2))
|
||||
}
|
||||
|
||||
// 整理table数据
|
||||
const settledTableItems = computed(() => {
|
||||
return vxeTableData.value.map((item: any) => {
|
||||
@@ -357,7 +390,7 @@ const settledTableItems = computed(() => {
|
||||
quantity: item.quantity,
|
||||
unitPrice: selectedUnitObj.purchasePrice ? Number(selectedUnitObj?.purchasePrice) : 0,
|
||||
realPrice: selectedUnitObj.realPrice ? storePrice(selectedUnitObj?.realPrice) : 0,
|
||||
totalAmount: storePrice(Number(selectedUnitObj?.realPrice || 0) * item.quantity),
|
||||
totalAmount: storePrice(Number(selectedUnitObj?.totalAmount || 0)),
|
||||
remark: item.remark,
|
||||
unitId: selectedUnitObj.id,
|
||||
orderType: baseDataForm.orderType,
|
||||
|
||||
Reference in new issue
Block a user