增加会员价展示
This commit is contained in:
parent
dfe65e0ae6
commit
ef8cd6da3a
|
|
@ -364,4 +364,20 @@ text {
|
|||
|
||||
.filter-gray {
|
||||
filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
.youhui-tips{
|
||||
background: #fff;
|
||||
min-width: 150px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ebeef5!important;
|
||||
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;
|
||||
}
|
||||
|
|
@ -30,9 +30,7 @@
|
|||
</div>
|
||||
|
||||
<div class="" v-if="placeNum == 0">
|
||||
<div class="note" v-if="item.note">
|
||||
备注:{{ item.note || "" }}
|
||||
</div>
|
||||
<div class="note" v-if="item.note">备注:{{ item.note || "" }}</div>
|
||||
<div class="note flex" v-else>
|
||||
<span>备注:</span>
|
||||
<span class="el-icon-edit u-font-12" @click="editNote"></span>
|
||||
|
|
@ -69,15 +67,22 @@
|
|||
</div>
|
||||
|
||||
<div class="color-333 total-price">
|
||||
<div v-if="item.isGift === 'true' || item.status == 'return'">¥0</div>
|
||||
<div
|
||||
:class="{
|
||||
'free-price': item.isGift === 'true' || item.status == 'return',
|
||||
}"
|
||||
>
|
||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ (item.salePrice*item.number+(item.packAmount||0)).toFixed(2) }}</span>
|
||||
</div>
|
||||
<template v-if="item.isGift === 'true' || item.status == 'return'">
|
||||
<div>¥0</div>
|
||||
<div class="free-price">
|
||||
<span v-if="isSeatFee"> ¥{{ item.totalAmount }}</span>
|
||||
<span v-else> ¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="isSeatFee">¥{{ item.totalAmount }}</div>
|
||||
<div v-else>
|
||||
<div v-if="isShowVipPrice&&vipAllPrice!=allPrice">¥{{ vipAllPrice }}</div>
|
||||
<div :class="{ 'free-price': isShowVipPrice&&vipAllPrice!=allPrice }">
|
||||
<span> ¥{{ allPrice }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -86,6 +91,10 @@
|
|||
<script>
|
||||
export default {
|
||||
props: {
|
||||
isShowVipPrice: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
//是否是餐位费
|
||||
isSeatFee: {
|
||||
type: Boolean,
|
||||
|
|
@ -133,6 +142,23 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
vipAllPrice() {
|
||||
const item = this.item;
|
||||
const price =
|
||||
this.isShowVipPrice &&
|
||||
item.memberPrice != null &&
|
||||
item.memberPrice != undefined
|
||||
? (item.memberPrice<=0?item.salePrice:item.memberPrice)
|
||||
: item.salePrice;
|
||||
return (price * item.number + (item.packAmount || 0)).toFixed(2);
|
||||
},
|
||||
|
||||
allPrice() {
|
||||
const item = this.item;
|
||||
|
||||
const price = item.salePrice;
|
||||
return (price * item.number + (item.packAmount || 0)).toFixed(2);
|
||||
},
|
||||
isActive() {
|
||||
const isSel =
|
||||
this.selIndex === this.index && this.placeNum === this.selPlaceNum;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
:data="quans.fullReductionCoupon"
|
||||
@cell-click="fullReductionCouponClick"
|
||||
>
|
||||
<el-table-column type="index" width="80" label="">
|
||||
<el-table-column type="index" width="80" label="" v-if="quans.fullReductionCoupon.length>0">
|
||||
<template v-slot="scope">
|
||||
<el-checkbox
|
||||
@change="fullReductionCouponClick(scope.row)"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ export function returnPackFee(arr, isOld = true) {
|
|||
const bTotal = b.info
|
||||
.filter((v) => v.isGift !== "true" && v.status !== "return")
|
||||
.reduce((prve, cur) => {
|
||||
return prve + (cur.packFee || cur.packAmount||0);
|
||||
return prve + (cur.packFee || cur.packAmount || 0);
|
||||
}, 0);
|
||||
return a + bTotal;
|
||||
}, 0);
|
||||
} else {
|
||||
return arr.filter(v => v.status !== 'return' && v.isGift !== 'true').reduce((a, b) => {
|
||||
return a + (b.packFee || b.packAmount||0);
|
||||
return a + (b.packFee || b.packAmount || 0);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
|
@ -90,28 +90,35 @@ export function returnGiftArr(arr) {
|
|||
return result
|
||||
}
|
||||
|
||||
export function formatOrderGoodsList(arr){
|
||||
export function formatOrderGoodsList(arr) {
|
||||
const goodsMap = {}
|
||||
for (let i in arr) {
|
||||
const goods = arr[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum||1].push(goods)
|
||||
goodsMap[goods.placeNum || 1].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum||1] = [goods]
|
||||
goodsMap[goods.placeNum || 1] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key||1
|
||||
placeNum: key || 1
|
||||
}))
|
||||
}
|
||||
|
||||
export function returnIsSeatFee(item){
|
||||
if(!item){
|
||||
export function returnIsSeatFee(item) {
|
||||
if (!item) {
|
||||
return false
|
||||
}
|
||||
return item.productId=="-999"
|
||||
}
|
||||
return item.productId == "-999"
|
||||
}
|
||||
/**
|
||||
* 计算购物车会员优惠价格
|
||||
*/
|
||||
export function returnVipDiscountPrice() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue