|
@@ -66,6 +66,9 @@ export default {
|
|
...mapState({
|
|
...mapState({
|
|
orderDetail: state => state.order.orderDetail,
|
|
orderDetail: state => state.order.orderDetail,
|
|
}),
|
|
}),
|
|
|
|
+ isBackstageOrder () {
|
|
|
|
+ return this.orderData?.is_backstage_order === 1;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
async init(val) {
|
|
async init(val) {
|
|
@@ -179,17 +182,11 @@ export default {
|
|
// 设置合同金额合计和标准售价合计,以及计算折扣率总和。
|
|
// 设置合同金额合计和标准售价合计,以及计算折扣率总和。
|
|
setTotalAmounts(productData) {
|
|
setTotalAmounts(productData) {
|
|
this.orderData = this.orderDetail.orderData || {};
|
|
this.orderData = this.orderDetail.orderData || {};
|
|
- const totalFinalPrice = productData.reduce((acc, cur) => acc + Number(cur.final_price), 0).toFixed(2);
|
|
|
|
- const totalOriginalPrice = productData.reduce((acc, cur) => acc + Number(cur.original_price), 0).toFixed(2);
|
|
|
|
|
|
+ const totalFinalPrice = this.isBackstageOrder ? (this.formatNumber(this.orderData.pay_money) || '0.00') : (this.formatNumber(this.orderData.order_money) || '0.00')
|
|
|
|
+ let totalOriginalPrice = productData.reduce((acc, cur) => acc + Number(cur.original_price), 0).toFixed(2);
|
|
const totalDiscountRate = div(totalFinalPrice, totalOriginalPrice) * 100
|
|
const totalDiscountRate = div(totalFinalPrice, totalOriginalPrice) * 100
|
|
const rateTotal = totalDiscountRate ? (div(totalFinalPrice, totalOriginalPrice) * 100).toFixed(2) + '%' : '0%'
|
|
const rateTotal = totalDiscountRate ? (div(totalFinalPrice, totalOriginalPrice) * 100).toFixed(2) + '%' : '0%'
|
|
- // 判断productData中每一项的original_price是否为0,如果有,则返回true
|
|
|
|
- // const isAllOriginalPriceZero = productData.map(item => item.original_price === 0);
|
|
|
|
- // console.log(isAllOriginalPriceZero, 'isAllOriginalPriceZero')
|
|
|
|
- // const isAllOriginalPriceZeroBool = !isAllOriginalPriceZero.includes(true)
|
|
|
|
-
|
|
|
|
// 无标准售价产品,标准售价合计展示为无法计算
|
|
// 无标准售价产品,标准售价合计展示为无法计算
|
|
- // const noOriginalPriceProduct = ['企业商机管理', '医械通', '物业数字化营销', '运营商专版']
|
|
|
|
let noOriginalPriceProductBool = false
|
|
let noOriginalPriceProductBool = false
|
|
productData.forEach(product => {
|
|
productData.forEach(product => {
|
|
if(!product.original_price) {
|
|
if(!product.original_price) {
|
|
@@ -197,6 +194,9 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
const originalPriceTotal = !noOriginalPriceProductBool
|
|
const originalPriceTotal = !noOriginalPriceProductBool
|
|
|
|
+ if(originalPriceTotal) {
|
|
|
|
+ totalOriginalPrice = this.isBackstageOrder ? this.formatNumber(this.orderData.order_money || '0.00') : this.formatNumber(this.orderData.original_price || '0.00')
|
|
|
|
+ }
|
|
this.orderData = {
|
|
this.orderData = {
|
|
...this.orderData,
|
|
...this.orderData,
|
|
final_price_total: totalFinalPrice,
|
|
final_price_total: totalFinalPrice,
|