增加会员价展示

This commit is contained in:
2024-11-06 14:58:46 +08:00
parent dfe65e0ae6
commit ef8cd6da3a
5 changed files with 167 additions and 39 deletions

View File

@@ -32,7 +32,12 @@
<i class="el-icon-user"></i>
</div>
<div>
<div class="ft-13 color-000">{{ vipUser.nickName }}</div>
<div class="u-flex">
<div class="ft-13 color-000">{{ vipUser.nickName }}</div>
<div class="vip" v-if="vipUser.isVip">
VIP{{ vipUser.isVip }}
</div>
</div>
<div style="margin-top: 2px" class="color-666 ft-12">
余额{{ vipUser.amount }}
</div>
@@ -277,6 +282,7 @@
<!-- 当前购物车列表 -->
<template v-if="order.list.length">
<cart-item
:isShowVipPrice="isShowVipPrice"
@itemClick="changeOrderSel"
@changeOrderNumber="changeOrderNumber"
@cartGoodsNumberInput="cartGoodsNumberInput"
@@ -327,6 +333,7 @@
{{ orderItem.placeNum }}次下单
</div>
<cart-item
:isShowVipPrice="isShowVipPrice"
@itemClick="changeOrderOldSel"
:canChangeNumber="false"
v-for="(item, index) in orderItem.info"
@@ -382,15 +389,23 @@
<div class="w-full bottom">
<div class="border-top">
<div class="flex row-right youhui" v-if="giftLen">
<span> 已优惠{{ allGiftMoney }} </span>
<i class="el-icon-arrow-right"></i>
<div class="flex row-right youhui" v-if="youhuiAllPrice > 0">
<el-tooltip placement="top" effect="light" popper-class="youhui-tips">
<div slot="content">
<div class="u-flex">
<span>会员优惠{{ vipDiscountPrice }} </span>
</div>
</div>
<span> 已优惠{{ youhuiAllPrice }} </span>
<i class="el-icon-arrow-right"></i>
</el-tooltip>
</div>
<div class="flex row-between">
<el-button type="text" @click="printOrder"
>打印制作单</el-button
>
<!-- <span v-if="youhuiAllPrice>0" class="youhuiAllPrice">已优惠{{youhuiAllPrice}} ></span> -->
<!-- <el-checkbox
v-model="order.allPack"
:disabled="!this.order.list.length"
@@ -1378,6 +1393,7 @@ import {
returnGiftArr,
returnPackFee,
formatOrderGoodsList,
returnVipDiscountPrice,
} from "./util.js";
import { $status } from "@/utils/table.js";
@@ -1610,6 +1626,9 @@ export default {
};
},
computed: {
isShowVipPrice() {
return this.vipUser.isVip ? true : false;
},
manjian() {
let result = 0;
if (this.quansSelArr.length < 0) {
@@ -1630,8 +1649,8 @@ export default {
const total = (amount - this.manjian) * this.createOrder.discount;
return total <= 0 ? 0 : total;
},
yinFuJinE(){
const total=this.currentPayMoney-( this.points.toMoney||0)
yinFuJinE() {
const total = this.currentPayMoney - (this.points.toMoney || 0);
return total.toFixed(2);
},
disableTuicai() {
@@ -1724,6 +1743,7 @@ export default {
}, "");
return result.substring(0, result.length - 1);
},
allPrice() {
const oldPrice = this.order.old.list.reduce((a, b) => {
const bTotal = b.info
@@ -1747,10 +1767,40 @@ export default {
this.order.seatFee.totalAmount *
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
return (
(oldPrice + price + +packFee + seatFee) *
(oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
this.createOrder.discount
).toFixed(2);
},
vipDiscountPrice() {
if (!this.vipUser.isVip) {
return 0;
}
const oldMemberPrice = this.order.old.list.reduce((a, b) => {
const bTotal = b.info
.filter(
(v) =>
v.isGift !== "true" &&
v.memberPrice &&
v.memberPrice != v.salePrice
)
.reduce((prve, cur) => {
return prve + cur.number * (cur.salePrice - cur.memberPrice);
}, 0);
return a + bTotal;
}, 0);
const nowMemberprice = this.order.list
.filter(
(v) =>
v.isGift !== "true" && v.memberPrice && v.memberPrice != v.salePrice
)
.reduce((a, b) => {
return a + b.number * (b.salePrice - b.memberPrice);
}, 0);
return (oldMemberPrice + nowMemberprice).toFixed(2);
},
youhuiAllPrice() {
return (this.vipDiscountPrice * 1 + this.allGiftMoney * 1).toFixed(2);
},
allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => {
@@ -1810,7 +1860,7 @@ export default {
this.getGoods();
},
currentPayMoney: function (newval) {
if (this.createOrder.data.memberId||this.vipUser.id) {
if (this.createOrder.data.memberId || this.vipUser.id) {
this.getCalcUsablePoints().then((res) => {
this.pointsValueChange(this.points.value);
});
@@ -1857,7 +1907,7 @@ export default {
this.createOrder.discount = 1;
}
},
"vipUser.id": function (val) {
"vipUser.id": function (val) {
// if (!this.table.tableId) {
// return;
// }
@@ -1996,18 +2046,18 @@ export default {
},
methods: {
async getCalcUsablePoints() {
const memberId= this.createOrder.data.memberId || this.vipUser.id
if(!memberId){
return
const memberId = this.createOrder.data.memberId || this.vipUser.id;
if (!memberId) {
return;
}
const pointsRes = await $calcUsablePoints({
memberId:memberId,
memberId: memberId,
orderAmount: this.currentPayMoney.toFixed(2),
});
this.points.res = pointsRes;
this.points.minDeductionPoints = pointsRes.minDeductionPoints;
this.points.maxUsablePoints = pointsRes.maxUsablePoints;
if(this.points.selected){
if (this.points.selected) {
this.points.value = Math.min(
this.vipUser.accountPoints,
this.points.res.maxUsablePoints || 0
@@ -3736,6 +3786,22 @@ export default {
</script>
<style scoped lang="scss">
.youhui-tips{
background: #fff;
min-width: 150px;
border-radius: 4px;
border: 1px solid #ebeef5;
padding: 12px;
color: #606266;
line-height: 1.4;
text-align: justify;
font-size: 14px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
word-break: break-all;
}
::v-deep .youhui-tips .popper__arrow{
border-top-color: #ebeef5;
}
.selQuan {
border: 1px solid #d9d9d9;
border-radius: 4px;
@@ -3926,7 +3992,15 @@ input[type="number"]::-webkit-outer-spin-button {
font-size: 13px;
line-height: 16px;
}
.vip {
font-size: 10px;
padding: 2px 5px;
background: #f7793d;
color: #fff;
border-radius: 4px;
margin-left: 10px;
font-size: 10px;
}
::v-deep .el-dialog__footer {
border-top: 1px solid #efefef;
}
@@ -4034,6 +4108,11 @@ input[type="number"]::-webkit-outer-spin-button {
.mt-14 {
margin-top: 14px;
}
.youhuiAllPrice {
color: #c12a2a;
font-size: 13px;
line-height: 16px;
}
.my-btn {
outline: none;