修改订单详情金额展示

This commit is contained in:
2024-11-23 17:44:21 +08:00
parent 862812caa3
commit 5076efee3a
7 changed files with 199 additions and 77 deletions

View File

@@ -1065,16 +1065,11 @@
</div>
<div class="detail_form_item">
<div class="left">积分抵扣</div>
<div class="right">-¥{{ points.toMoney | to2 }}</div>
<div class="right">-¥{{ pointsDiscountAmount | to2 }}</div>
</div>
<div class="detail_form_item">
<div class="left">整单改价</div>
<div class="right">
-¥{{
((1 - createOrder.discount) * createOrder.data.amount)
| to2
}}
</div>
<div class="right">-¥{{ gaijia | to2 }}</div>
</div>
<div class="detail_form_item" v-if="createOrder.data.packFee">
<div class="left">打包费</div>
@@ -1718,6 +1713,22 @@ export default {
};
},
computed: {
pointsDiscountAmount() {
if (this.points.selected) {
return this.points.toMoney;
} else {
return 0;
}
},
gaijia() {
const disCountOriginPrice =
this.createOrder.data.amount - this.coupdiscount;
const disocunt = (1 - this.createOrder.discount) * disCountOriginPrice;
return disocunt.toFixed(2);
},
pointsCanDicountMoney() {
return (this.yinFuJinE - this.points.toMoney).toFixed(2);
},
isShowVipPrice() {
if (!this.shopInfo.isMemberPrice) {
return false;
@@ -1725,44 +1736,22 @@ export default {
return this.vipUser.isVip ? true : false;
},
coupdiscount() {
return (this.createOrder.discount*returnCouponAllPrice(
this.quansSelArr,
this.createOrder.data.detailList || [],
this.vipUser
)).toFixed(2)
const n = this.quansSelArr.reduce((prve, cur) => {
return prve + cur.discountAmount * 1;
}, 0);
return n;
},
goodsDisCount() {
const goodsQuanArr = this.quansSelArr.filter((v) => v.type == 2);
let result = 0;
if (goodsQuanArr.length < 0) {
result = 0;
} else {
result = goodsQuanArr.reduce((a, b) => {
const item = this.createOrder.data.detailList.find(
(v) => v.productId == b.proId
);
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item
? this.vipUser.isVip
? memberPrice
: item.price
: 0;
return a + price;
}, 0);
}
return result.toFixed(2);
},
currentPayMoney() {
const amount = this.createOrder.data.amount || 0;
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
const total = (amount) * this.createOrder.discount - this.coupdiscount;
const total = amount - this.gaijia - this.coupdiscount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
const total = this.currentPayMoney - (this.points.toMoney || 0);
console.log(total)
const total =
this.currentPayMoney - (this.points.selected ? this.points.toMoney : 0);
console.log(total);
if (this.isCreateOrder) {
return total.toFixed(2);
} else {
@@ -1886,13 +1875,20 @@ export default {
const seatFee =
this.order.seatFee.totalAmount *
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
// return (
// (oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
// this.createOrder.discount
// ).toFixed(2);
return (
(oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
this.createOrder.discount
oldPrice +
price +
+packFee +
seatFee -
this.youhuiAllPrice
).toFixed(2);
},
vipDiscountPrice() {
if (!this.vipUser.isVip) {
if (!this.vipUser.isVip || !this.shopInfo.isMemberPrice) {
return 0;
}
const oldMemberPrice = this.order.old.list.reduce((a, b) => {
@@ -1990,10 +1986,15 @@ export default {
this.goods.status = "loadmore";
this.getGoods();
},
pointsCanDicountMoney: function (newval) {
this.getCalcUsablePoints();
},
currentPayMoney: function (newval) {
if (this.createOrder.data.memberId || this.vipUser.id) {
this.getCalcUsablePoints().then((res) => {
this.pointsValueChange(this.points.value);
if (this.points.selected) {
this.pointsValueChange(this.points.value);
}
});
}
},
@@ -2054,8 +2055,12 @@ export default {
if (this.order.status == "finish") {
return;
}
if(!this.table.tableId&&(this.order.list.length<=0&&this.order.old.list.length<=0)){
return ;
if (
!this.table.tableId &&
this.order.list.length <= 0 &&
this.order.old.list.length <= 0
) {
return;
}
$setUser({
tableId: this.table.tableId,
@@ -2194,13 +2199,18 @@ export default {
//相同商品抵扣券数组
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id);
const item = this.createOrder.data.detailList.find(
(v) => v.productId == row.proId
);
if (index != -1) {
const n=returnProductCoupAllPrice(
const n = returnProductCoupAllPrice(
$goodsPayPriceMap[row.proId],
index,
row.num
)
return (n*this.createOrder.discount).toFixed(2);
row.num,
item.isMember
);
return (n * this.createOrder.discount).toFixed(2);
} else {
return 0;
}
@@ -2213,6 +2223,13 @@ export default {
console.log(index);
if (index != -1) {
this.quansSelArr.splice(index, 1);
this.quansSelArr
.map((v, index) => {
return {
...v,
discountAmount:v.type==2?this.returnProDiscount(v):v.discountAmount,
};
});
}
},
async getCalcUsablePoints() {
@@ -2232,6 +2249,9 @@ export default {
this.vipUser.accountPoints,
this.points.res.maxUsablePoints || 0
);
if(!pointsRes.usable){
this.points.selected=false
}
}
return pointsRes;
},
@@ -2266,13 +2286,21 @@ export default {
id: this.createOrder.data.id,
memberId: this.createOrder.data.memberId || this.vipUser.id,
orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
discount:this.createOrder.discount
discount: this.createOrder.discount,
},
[...this.quansSelArr]
);
},
quansConfirm(e, goodsPayPriceMap) {
console.log(e);
this.createOrder.discount = 1;
this.points.selected = "";
e.map((v, index) => {
return {
...v,
discountAmount:v.type==2? this.returnProDiscount(v):v.discountAmount,
};
});
this.quansSelArr = [...e];
$goodsPayPriceMap = goodsPayPriceMap;
},
@@ -2320,7 +2348,7 @@ export default {
// return
// }
await this.returnCreateOrderData();
this.payBeforeClear();
// this.payBeforeClear();
// this.order.payType = "";
},
async cashPayClick() {
@@ -2413,10 +2441,13 @@ export default {
if (!canJiesuan) {
return;
}
const order = await this.returnCreateOrderData();
this.order.payType = "scanCode";
this.payTypeItemClick({ payType: "scanCode", order });
this.payBeforeClear();
if (!this.isCreateOrder) {
const order = await this.returnCreateOrderData();
this.order.payType = "scanCode";
this.payTypeItemClick({ payType: "scanCode", order });
return;
}
this.payTypeItemClick({ payType: "scanCode" });
},
async changeOrderUseType(useType) {
if (useType && this.order.list.length) {
@@ -2553,10 +2584,11 @@ export default {
},
//退菜
async refReturnCartConfirm(e) {
console.log(this.order.selGoods);
const res = await $returnCart({
...e,
cartId: this.order.selGoods.cartId,
cartId: this.isCreateOrder
? this.order.selGoods.id
: this.order.selGoods.cartId,
tableId: this.table.tableId,
});
this.order.selGoods.status = "return";
@@ -2675,14 +2707,41 @@ export default {
}
},
ChangeDiscount(discount) {
const fullCoupIndex = this.quansSelArr.findIndex((v) => v.type == 1);
const fullCoup = this.quansSelArr[fullCoupIndex];
this.createOrder.discount = discount;
if (fullCoup && this.yinFuJinE < fullCoup.fullAmount) {
return this.$confirm(
"改价后价格不满足满减券最低满减需求" + fullCoup.fullAmount + "元",
"提示",
{
confirmButtonText: "删除满减券",
cancelButtonText: "取消改价",
type: "warning",
}
)
.then(() => {
this.quansSelArr.splice(fullCoupIndex, 1);
this.createOrder.discount = discount;
})
.catch((action) => {
this.createOrder.discount = 1;
this.$message({
type: "info",
message: "已取消改价",
});
});
}
},
async disCountShow() {
const canDiscount = await hasPermission("允许打折");
if (!canDiscount) {
return;
}
const amount = this.createOrder.data.amount;
const amount = (this.createOrder.data.amount - this.coupdiscount).toFixed(
2
);
console.log(amount);
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
@@ -4516,11 +4575,13 @@ input[type="number"]::-webkit-outer-spin-button {
font-weight: 600;
}
::v-deep input[aria-hidden="true"] {
display: none !important;
display: none !important;
}
::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
box-shadow: none !important;
::v-deep
.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
.el-radio__inner {
box-shadow: none !important;
}
::v-deep .categorys .el-tag--plain.el-tag--info {