|
|
|
|
@@ -77,20 +77,35 @@
|
|
|
|
|
<view>{{(shopTableInfo.seatNum*storeInfo.tableFee).toFixed(2)}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="favorable" v-for="(item,index) in favorable" :key="index">
|
|
|
|
|
<view class="favorable_left">
|
|
|
|
|
<image class="icon" :src="item.url" mode="aspectFill"/>
|
|
|
|
|
<text class="name"> {{ item.name }} </text>
|
|
|
|
|
<view v-for="(item,index) in favorable" :key="index" >
|
|
|
|
|
<view class="favorable" v-if="item.type!='points'" @click="goUrl(item)">
|
|
|
|
|
<view class="favorable_left">
|
|
|
|
|
<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>
|
|
|
|
|
<view class="favorable_right" v-if="item.type == 'points'" @click="isPointsChecked = !isPointsChecked">
|
|
|
|
|
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;">使用29积分抵扣¥29.00</text>
|
|
|
|
|
<u-checkbox-group iconPlacement="right">
|
|
|
|
|
<u-checkbox v-model="isPointsChecked" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
|
|
|
|
</u-checkbox>
|
|
|
|
|
</u-checkbox-group>
|
|
|
|
|
<view class="favorable" v-else-if="item.type=='points'">
|
|
|
|
|
<view class="favorable_left">
|
|
|
|
|
<image class="icon" :src="item.url" mode="aspectFill"/>
|
|
|
|
|
<text class="name"> {{ item.name }} </text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="favorable_right" @click.stop="pointsChange">
|
|
|
|
|
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;" v-if="calcUsablePointsData.usable">
|
|
|
|
|
使用 {{ calcUsablePointsData.pointsNum}} 积分抵扣¥{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
|
|
|
|
|
</text>
|
|
|
|
|
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
|
|
|
|
|
{{calcUsablePointsData.unusableReason}}
|
|
|
|
|
</text>
|
|
|
|
|
|
|
|
|
|
<u-checkbox-group iconPlacement="right" @change="pointsChange">
|
|
|
|
|
<u-checkbox v-model="isPointsChecked" :disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
|
|
|
|
</u-checkbox>
|
|
|
|
|
</u-checkbox-group>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="favorable_right" v-else ><text class="favorable_right_text">暂无可用优惠券</text> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon></view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="totalPrice">
|
|
|
|
|
<text style="margin-bottom: 5rpx;">小计¥</text>
|
|
|
|
|
<text class="totalPriceNum"> {{listinfo.payAmount}} </text>
|
|
|
|
|
@@ -107,12 +122,14 @@
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 充值免单 -->
|
|
|
|
|
<!-- <rechargeFree ref="rechargeFree" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree> -->
|
|
|
|
|
<rechargeFree v-if="freeDingConfig.enable == 1" ref="rechargeFree" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
|
|
|
|
|
<!-- 充值活动 -->
|
|
|
|
|
<!-- <topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity> -->
|
|
|
|
|
<topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
|
|
|
|
|
<!-- 支付方式 -->
|
|
|
|
|
<paymentMethod ref="paymentMethod" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
|
|
|
|
|
|
|
|
|
|
<view style="padding: 0 20rpx;">
|
|
|
|
|
<paymentMethod ref="paymentMethod" :freeCheck="freeCheck" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="width: 100%;height: 200rpx;"> </view>
|
|
|
|
|
<view class="bottom">
|
|
|
|
|
<view class="bottom_left">
|
|
|
|
|
<text style="margin-bottom: 5rpx;">实付金额</text>
|
|
|
|
|
@@ -178,29 +195,33 @@
|
|
|
|
|
sendType: "table",
|
|
|
|
|
eatModel: [],
|
|
|
|
|
favorable: [
|
|
|
|
|
// { name: "优惠券", type: "coupon", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
|
|
|
|
{ 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: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
|
|
|
|
|
],
|
|
|
|
|
isPointsChecked: false,
|
|
|
|
|
rechargeFreeChecked: false,
|
|
|
|
|
calcUsablePointsData: null,
|
|
|
|
|
order: {
|
|
|
|
|
phone: "",
|
|
|
|
|
},
|
|
|
|
|
shopTableInfo: null,
|
|
|
|
|
freeDingConfig: null,
|
|
|
|
|
cartLists: [],
|
|
|
|
|
listinfo: {
|
|
|
|
|
details: [],
|
|
|
|
|
payAmount: 0,
|
|
|
|
|
name: "",
|
|
|
|
|
},
|
|
|
|
|
freeCheck: false,
|
|
|
|
|
freeDisabled: false,
|
|
|
|
|
totalPrice: 0, // 小计金额
|
|
|
|
|
totalAmount: 20, // 支付金额
|
|
|
|
|
remark: "", // 备注
|
|
|
|
|
radiovalue: 1, // 支付方式
|
|
|
|
|
ispws: false, // 输入支付密码
|
|
|
|
|
payPasswordShow: false,
|
|
|
|
|
amountVIP: null, // 会员信息
|
|
|
|
|
amountVIP: uni.cache.get('shopUserInfo'), // 会员信息
|
|
|
|
|
listinfoid: null,
|
|
|
|
|
paymentBtnText: "余额支付",
|
|
|
|
|
isSocket: false,
|
|
|
|
|
@@ -229,15 +250,15 @@
|
|
|
|
|
uni.$off('message')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
if ( options.storeInfo ) {
|
|
|
|
|
this.storeInfo = JSON.parse(decodeURIComponent(options.storeInfo));
|
|
|
|
|
}
|
|
|
|
|
this.shopId = this.storeInfo.id;
|
|
|
|
|
this.listinfo.name = this.storeInfo.shopName;
|
|
|
|
|
this.listinfo.details = JSON.parse(e.cartLists).data;
|
|
|
|
|
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
|
|
|
|
|
if ( e.tableCode ) { this.tableCode = e.tableCode;}
|
|
|
|
|
|
|
|
|
|
this.listinfo.details = JSON.parse(options.cartLists).data;
|
|
|
|
|
this.cartLists = JSON.parse(options.cartLists);
|
|
|
|
|
if ( options.tableCode ) { this.tableCode = options.tableCode;}
|
|
|
|
|
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
|
|
|
|
|
this.eatModel = "dine-in";
|
|
|
|
|
this.is_type = 0;
|
|
|
|
|
@@ -255,8 +276,6 @@
|
|
|
|
|
} else {
|
|
|
|
|
this.handlemessage()
|
|
|
|
|
}
|
|
|
|
|
this.getAount()
|
|
|
|
|
|
|
|
|
|
this.is_typeList.map((item)=>{
|
|
|
|
|
console.log(this.storeInfo.eatModel.indexOf(item.val))
|
|
|
|
|
if ( this.storeInfo.eatModel.indexOf(item.val) != -1) {
|
|
|
|
|
@@ -265,14 +284,71 @@
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
changeFree ( val ) {
|
|
|
|
|
console.log(val)
|
|
|
|
|
if ( val ) {
|
|
|
|
|
this.listinfo.payAmount = this.listinfo.payAmount*2
|
|
|
|
|
setPayAmount ( cartLists ) {
|
|
|
|
|
console.log(cartLists)
|
|
|
|
|
if ( this.amountVIP.isVip == 1 && cartLists.memberAmount > 0 ) {
|
|
|
|
|
this.listinfo.payAmount = (cartLists.memberAmount+(this.shopTableInfo.seatNum*this.storeInfo.tableFee)).toFixed(2)
|
|
|
|
|
} else {
|
|
|
|
|
this.listinfo.payAmount = this.listinfo.payAmount/2
|
|
|
|
|
this.listinfo.payAmount = (cartLists.amount+(this.shopTableInfo.seatNum*this.storeInfo.tableFee)).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 免单状态监听
|
|
|
|
|
* @param {Object} val
|
|
|
|
|
*/
|
|
|
|
|
changeFree ( val ) {
|
|
|
|
|
this.freeCheck = val;
|
|
|
|
|
|
|
|
|
|
if ( val ) {
|
|
|
|
|
this.listinfo.payAmount = (this.listinfo.payAmount*this.freeDingConfig.rechargeTimes).toFixed(2)
|
|
|
|
|
} else {
|
|
|
|
|
this.listinfo.payAmount = (this.listinfo.payAmount/this.freeDingConfig.rechargeTimes).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 积分状态监听
|
|
|
|
|
*/
|
|
|
|
|
pointsChange (){
|
|
|
|
|
if ( this.freeCheck || !this.calcUsablePointsData.usable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.isPointsChecked = !this.isPointsChecked
|
|
|
|
|
if ( this.isPointsChecked ) {
|
|
|
|
|
this.freeDisabled = true
|
|
|
|
|
|
|
|
|
|
this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
|
|
|
|
} else {
|
|
|
|
|
this.freeDisabled = false
|
|
|
|
|
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
goUrl(item){
|
|
|
|
|
switch (item.type){
|
|
|
|
|
case 'coupon':
|
|
|
|
|
uni.pro.navigateTo('/pages/user/coupon', {
|
|
|
|
|
type: "confirm_order"
|
|
|
|
|
})
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取积分相关信息
|
|
|
|
|
*/
|
|
|
|
|
async getCalcUsablePoints() {
|
|
|
|
|
let params = {
|
|
|
|
|
memberId: this.amountVIP.id,
|
|
|
|
|
orderAmount: this.listinfo.payAmount,
|
|
|
|
|
}
|
|
|
|
|
let res = await this.api.calcUsablePoints(params)
|
|
|
|
|
this.calcUsablePointsData = res.data;
|
|
|
|
|
if ( this.calcUsablePointsData.usable && this.listinfo.payAmount >= this.calcUsablePointsData.minPaymentAmount) {
|
|
|
|
|
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
|
|
|
|
|
}
|
|
|
|
|
console.log(this.calcUsablePointsData)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取桌台码
|
|
|
|
|
@@ -306,8 +382,11 @@
|
|
|
|
|
if (this.tableCode) {params.code = this.tableCode}
|
|
|
|
|
if (this.shopId) {params.shopId = this.shopId}
|
|
|
|
|
let res = await this.api.productqueryShop(params)
|
|
|
|
|
this.freeDingConfig = res.data.freeDingConfig;
|
|
|
|
|
this.shopTableInfo = res.data.shopTableInfo;
|
|
|
|
|
this.storeInfo = res.data.storeInfo;
|
|
|
|
|
this.setPayAmount(this.cartLists)
|
|
|
|
|
this.getCalcUsablePoints()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -361,8 +440,7 @@
|
|
|
|
|
this.isSocket = true;
|
|
|
|
|
this.listinfoid = msg.data.id
|
|
|
|
|
this.listinfo.details = msg.data.detailList;
|
|
|
|
|
this.listinfo.payAmount = msg.data.amount;
|
|
|
|
|
|
|
|
|
|
this.setPayAmount(msg.data)
|
|
|
|
|
uni.$off('getMessage')
|
|
|
|
|
this.orderorderInfo(1)
|
|
|
|
|
}
|
|
|
|
|
@@ -374,7 +452,7 @@
|
|
|
|
|
this.orderorderInfo()
|
|
|
|
|
} else {
|
|
|
|
|
this.listinfo.details = msg.data;
|
|
|
|
|
this.listinfo.payAmount = msg.amount;
|
|
|
|
|
this.setPayAmount(msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -392,7 +470,7 @@
|
|
|
|
|
this.orderorderInfo()
|
|
|
|
|
} else {
|
|
|
|
|
this.listinfo.details = msg.data;
|
|
|
|
|
this.listinfo.payAmount = msg.amount;
|
|
|
|
|
this.setPayAmount(msg)
|
|
|
|
|
}
|
|
|
|
|
this.isSocket = true;
|
|
|
|
|
break;
|
|
|
|
|
@@ -426,7 +504,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.listinfo.payAmount = res.data.amount;
|
|
|
|
|
this.setPayAmount(res.data)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -532,14 +610,18 @@
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let res = await this.api.creatOrder({
|
|
|
|
|
|
|
|
|
|
let params = {
|
|
|
|
|
"tableId": this.tableCode , //桌台码
|
|
|
|
|
"shopId": uni.cache.get('shopId'),
|
|
|
|
|
"userId": uni.cache.get('userInfo').id,
|
|
|
|
|
"sendType": this.sendType,
|
|
|
|
|
"remark": this.remark,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if ( this.calcUsablePointsData.pointsNum && this.calcUsablePointsData.pointsNum > 0) {
|
|
|
|
|
params.pointsNum = this.calcUsablePointsData.pointsNum;
|
|
|
|
|
}
|
|
|
|
|
let res = await this.api.creatOrder(params)
|
|
|
|
|
console.log(res)
|
|
|
|
|
this.listinfoid = res.data.id;
|
|
|
|
|
if ( this.storeInfo.registerType == 'restaurant') {
|
|
|
|
|
@@ -598,17 +680,36 @@
|
|
|
|
|
* 微信/支付宝支付
|
|
|
|
|
*/
|
|
|
|
|
async showpopupclickdds() {
|
|
|
|
|
let res;
|
|
|
|
|
if ( !this.freeCheck ) {
|
|
|
|
|
res = await this.api.orderPay({
|
|
|
|
|
orderId: this.listinfoid,
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
payType: 'wechatPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-ALIPAY
|
|
|
|
|
payType: 'aliPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
|
|
|
|
|
}) //判断是否支付成功
|
|
|
|
|
} else {
|
|
|
|
|
res = await this.api.paymemeberIn({
|
|
|
|
|
shopId: uni.cache.get('shopId'),
|
|
|
|
|
amount: this.listinfo.payAmount,
|
|
|
|
|
orderld: this.listinfoid,
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
payType: 'wechatPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-ALIPAY
|
|
|
|
|
payType: 'aliPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
|
|
|
|
|
}) //判断是否支付成功
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let res = await this.api.orderPay({
|
|
|
|
|
orderId: this.listinfoid,
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
payType: 'wechatPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef MP-ALIPAY
|
|
|
|
|
payType: 'aliPay',
|
|
|
|
|
// #endif
|
|
|
|
|
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
|
|
|
|
|
}) //判断是否支付成功
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
|
|
|
|
// 微信支付还是余额支付
|
|
|
|
|
|