会员价,优惠券,打包费相关更新

This commit is contained in:
GaoHao
2024-11-11 17:22:28 +08:00
parent 7167c2604f
commit 2caee2bd1a
7 changed files with 116 additions and 43 deletions

View File

@@ -46,10 +46,13 @@
<view class="tabBox_t " v-if="storeInfo.registerType == 'restaurant'">
<view class="shopName">{{ listinfo.name }}</view>
<view class="tableName">
<view>桌号</view>
<view class="name">{{ shopTableInfo.name }} </view>
<view class="num" v-if="shopTableInfo&&shopTableInfo.seatNum">{{ shopTableInfo.seatNum }}</view>
<view class="tableName" style="display: flex;align-items: center;justify-content: space-between;">
<view style="display: flex;">
<view>桌号</view>
<view class="name" v-if="shopTableInfo.name">{{ shopTableInfo.name || '' }} </view>
<view class="num" v-if="shopTableInfo&&shopTableInfo.seatNum">{{ shopTableInfo.seatNum }}</view>
</view>
<u-icon v-if="!shopTableInfo.name" @click="scan" name="scan" size="60"></u-icon>
</view>
</view>
</view>
@@ -64,10 +67,18 @@
<view class="center" >
<text class="center_title"> {{item.name || item.productName || "" }} </text>
<text class="type"> {{ item.skuName || item.productSkuName || ""}} </text>
<text class="num" > X{{ item.totalNumber || item.num}} </text>
<text class="num" > X{{ item.totalNumber || ""}} </text>
</view>
</view>
<view class="price"> {{ item.totalAmount || item.priceAmount || 0}} </view>
<view class="price"> {{ item.memberPrice*item.totalNumber || item.salePrice*item.totalNumber || 0}} </view>
</view>
<view class="cell-item" v-if="packFee && packFee > 0">
<view class="label">打包费</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;"></view>
<view>{{packFee.toFixed(2)}}</view>
</view>
</view>
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'">
<view class="label">餐位费</view>
@@ -83,7 +94,7 @@
<image class="icon" :src="item.url" mode="aspectFill"/>
<text class="name"> {{ item.name }} </text>
</view>
<view class="favorable_right" ><text class="favorable_right_text"></text> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon></view>
<view class="favorable_right" ><text class="favorable_right_text">{{item.value}}</text> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon></view>
</view>
<view class="favorable" v-else-if="item.type=='points'&&calcUsablePointsData.usable">
<view class="favorable_left">
@@ -122,9 +133,9 @@
</view>
<!-- 充值免单 -->
<rechargeFree v-if="freeDingConfig.enable == 1" ref="rechargeFree" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
<rechargeFree v-if="freeDingConfig.enable == 1&&storeInfo.registerType == 'munchies'" ref="rechargeFree" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
<!-- 充值活动 -->
<topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
<topUpActivity v-if="storeInfo.registerType == 'munchies'" ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
<!-- 支付方式 -->
<view style="padding: 0 20rpx;">
<paymentMethod ref="paymentMethod" :freeCheck="freeCheck" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
@@ -195,9 +206,9 @@
sendType: "table",
eatModel: [],
favorable: [
{ name: "优惠券", type: "coupon", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
{ name: "积分抵扣", type: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
{ name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
{ name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
],
isPointsChecked: false,
rechargeFreeChecked: false,
@@ -205,6 +216,7 @@
order: {
phone: "",
},
userCouponInfos: null,
shopTableInfo: null,
freeDingConfig: null,
cartLists: [],
@@ -226,10 +238,11 @@
paymentBtnText: "余额支付",
isSocket: false,
socketTicket: null,
orderAMeal: true,
shopId: null,
storeInfo: {},
tableCode: null,
packFee: null,
}
},
computed: {
@@ -270,6 +283,7 @@
this.getchoseEatModel();
},
onShow() {
let _this = this;
if (this.listinfoid) {
uni.$on('message', this.getMessage)
this.orderorderInfo()
@@ -277,11 +291,32 @@
this.handlemessage()
}
this.is_typeList.map((item)=>{
console.log(this.storeInfo.eatModel.indexOf(item.val))
if ( this.storeInfo.eatModel.indexOf(item.val) != -1) {
item.show = true;
}
})
uni.$on('couponItem',function(data){
let couponData = JSON.parse(data)
console.log('监听到事件来自返回的参数:' , couponData);
_this.userCouponInfos = {
userCouponId: couponData.id,
discountAmount: couponData.discountAmount,
num: 1,
}
console.log('监听到事件来自返回的参数:' , _this.favorable);
if ( couponData.discountAmount < _this.listinfo.payAmount) {
_this.listinfo.payAmount = _this.listinfo.payAmount - _this.userCouponInfos.discountAmount
_this.favorable[0].value = ('-¥'+couponData.discountAmount)
if ( _this.isPointsChecked) {
_this.pointsChange()
_this.getCalcUsablePoints()
}
} else {
}
// TODO 下面执行刷新的方法
})
},
methods: {
setPayAmount ( cartLists ) {
@@ -291,6 +326,8 @@
} else {
this.listinfo.payAmount = (cartLists.amount+(this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0)).toFixed(2)
}
this.isPointsChecked = false;
this.getCalcUsablePoints()
},
/**
* 免单状态监听
@@ -387,14 +424,13 @@
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: this.tableCode,
shopId: res.data.storeInfo.id,
type: 'confirm'
})
return;
}
this.freeDingConfig = res.data.freeDingConfig;
this.shopTableInfo = res.data.shopTableInfo;
this.storeInfo = res.data.storeInfo;
this.setPayAmount(this.cartLists)
this.getCalcUsablePoints()
},
/**
@@ -446,26 +482,22 @@
return;
}
this.isSocket = true;
this.isPointsChecked = false;
this.listinfoid = msg.data.id
this.listinfo.details = msg.data.detailList;
this.setPayAmount(msg.data)
uni.$off('getMessage')
this.orderorderInfo(1)
this.getCalcUsablePoints()
}
break;
case 'addCart':
this.isSocket = true;
if ( this.eatModel == "dine-in" && this.tableCode ) {
this.isPointsChecked = false;
if (this.listinfoid) {
this.orderorderInfo()
} else {
this.listinfo.details = msg.data;
this.setPayAmount(msg)
}
this.getCalcUsablePoints()
}
break;
@@ -478,14 +510,12 @@
}, 1000)
break;
case 'addcart':
this.isPointsChecked = false;
if (this.listinfoid) {
this.orderorderInfo()
} else {
this.listinfo.details = msg.data;
this.setPayAmount(msg)
}
this.getCalcUsablePoints()
this.isSocket = true;
break;
}
@@ -504,6 +534,7 @@
this.eatModel = [];
this.eatModel.push(item.val);
this.getchoseEatModel();
},
/**
@@ -518,6 +549,7 @@
if ( this.shopTableInfo && this.shopTableInfo.seatNum ) { params.num = this.shopTableInfo.seatNum; }
let res = await this.api.choseEatModel(params)
this.listinfo.details = res.data.info;
this.packFee = res.data.packFee;
this.setPayAmount(res.data)
},
@@ -634,6 +666,9 @@
}
if ( this.isPointsChecked && this.calcUsablePointsData.pointsNum && this.calcUsablePointsData.pointsNum > 0) {
params.pointsNum = this.calcUsablePointsData.pointsNum;
}
if ( this.userCouponInfos ) {
params.userCouponInfos = this.userCouponInfos
}
let res = await this.api.creatOrder(params)
console.log(res)