|
@@ -57,11 +57,11 @@
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
<div class="flex w-full justify-between pt-2 pb-1">
|
|
<div class="flex w-full justify-between pt-2 pb-1">
|
|
- <div>整单折扣率(%)</div>
|
|
|
|
|
|
+ <div>整单折扣率(<span class="text-[red]">{{ discountEfficiency }}</span>)</div>
|
|
<div class="flex">
|
|
<div class="flex">
|
|
<div>已选中产品:<span class="text-[red] pr-2">{{ selectedQuantity }}</span>个</div>
|
|
<div>已选中产品:<span class="text-[red] pr-2">{{ selectedQuantity }}</span>个</div>
|
|
<div class="pl-4">
|
|
<div class="pl-4">
|
|
- 总金额:<span class="pr-1">{{ totalAmount }}</span> 元
|
|
|
|
|
|
+ 总金额:<span class="pr-1 text-[red]">{{ totalAmount }}</span> 元
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -158,6 +158,15 @@ const totalAmount = computed(() => {
|
|
}, 0)
|
|
}, 0)
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+const discountEfficiency = computed(() => {
|
|
|
|
+ const newProductTable = productTable.value.filter((item: any) => item.productId && item.sellingPrice && item.quantity && item.discount && item.totalPrice)
|
|
|
|
+ const list = JSON.parse(JSON.stringify(newProductTable || []))
|
|
|
|
+ const totalAmount = list.reduce((pre: number, cur: any) => { return pre + (cur.totalPrice || 0) }, 0)
|
|
|
|
+ const totalPrice = list.reduce((pre: number, cur: any) => { return pre + (cur.price * cur.quantity || 0) }, 0)
|
|
|
|
+ const num = totalAmount / totalPrice * 100
|
|
|
|
+ return num > 0 ? Number(num.toFixed(2)) + '%' : ''
|
|
|
|
+})
|
|
|
|
+
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
const { productTableList, height, productTableListValue = [] } = props
|
|
const { productTableList, height, productTableListValue = [] } = props
|
|
console.log(productTableListValue, '<==== 数据')
|
|
console.log(productTableListValue, '<==== 数据')
|