fix:折上折bug修复
parent
d55fc11e24
commit
a5b4446202
|
|
@ -30,7 +30,7 @@
|
||||||
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
||||||
<td>{{ formatCurrency(product.price) }}</td>
|
<td>{{ formatCurrency(product.price) }}</td>
|
||||||
<td>{{ selectedDiscountLabel }}</td>
|
<td>{{ selectedDiscountLabel }}</td>
|
||||||
<td>{{ formatCurrency(product.allPrice) }}</td>
|
<td>{{ formatCurrency(getDisplayAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
||||||
<td>{{ formatCurrency(product.price) }}</td>
|
<td>{{ formatCurrency(product.price) }}</td>
|
||||||
<td>{{ selectedDiscountLabel }}</td>
|
<td>{{ selectedDiscountLabel }}</td>
|
||||||
<td>{{ formatCurrency(product.allPrice) }}</td>
|
<td>{{ formatCurrency(getDisplayAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
<td v-if="!hidePrice">{{ product.discount ? (product.discount * 100).toFixed(2) + '%' : '-' }}</td>
|
||||||
<td>{{ formatCurrency(product.price) }}</td>
|
<td>{{ formatCurrency(product.price) }}</td>
|
||||||
<td>{{ selectedDiscountLabel }}</td>
|
<td>{{ selectedDiscountLabel }}</td>
|
||||||
<td>{{ formatCurrency(product.allPrice) }}</td>
|
<td>{{ formatCurrency(getDisplayAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
<td>{{ formatCurrency(getDiscountedAllPrice(product, selectedDiscount)) }}</td>
|
||||||
<td>
|
<td>
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -302,19 +302,22 @@ export default {
|
||||||
// 税率变化时通知父组件
|
// 税率变化时通知父组件
|
||||||
this.$emit('tax-rate-change', product);
|
this.$emit('tax-rate-change', product);
|
||||||
},
|
},
|
||||||
getDiscountedAllPrice(product, discount) {
|
getDisplayAllPrice(product, discount) {
|
||||||
if (discount === 1) {
|
const allPrice = product.allPrice || 0;
|
||||||
return product.allPrice;
|
if (this.order.orderStatus === '2' || this.order.orderStatus === 2) {
|
||||||
|
return this.$calc.div(allPrice, discount || 1);
|
||||||
}
|
}
|
||||||
const roundedDiscountedUnitPrice = this.$calc.mul( product.price,discount);
|
return allPrice;
|
||||||
|
},
|
||||||
return this.$calc.mul(roundedDiscountedUnitPrice , product.quantity);
|
getDiscountedAllPrice(product, discount) {
|
||||||
|
const allPrice = product.allPrice || 0;
|
||||||
|
if (this.order.orderStatus === '2' || this.order.orderStatus === 2) {
|
||||||
|
return allPrice;
|
||||||
|
}
|
||||||
|
return this.$calc.mul(allPrice, discount);
|
||||||
},
|
},
|
||||||
calculateTotal(productList, discount) {
|
calculateTotal(productList, discount) {
|
||||||
if (!productList) return 0;
|
if (!productList) return 0;
|
||||||
if (this.order.orderStatus === '2' || this.order.orderStatus === 2) {
|
|
||||||
return productList.reduce((sum, product) => sum + (product.allPrice || 0), 0);
|
|
||||||
}
|
|
||||||
return productList.reduce((sum, product) => sum + (this.getDiscountedAllPrice(product, discount) || 0), 0);
|
return productList.reduce((sum, product) => sum + (this.getDiscountedAllPrice(product, discount) || 0), 0);
|
||||||
},
|
},
|
||||||
formatCurrency(value) {
|
formatCurrency(value) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue