下单选择人数条件修改

This commit is contained in:
GaoHao
2024-09-29 13:35:51 +08:00
parent e2881ebd7b
commit 19b6e2fa09
4 changed files with 26 additions and 13 deletions

View File

@@ -61,7 +61,7 @@
let data = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
})
if ( !data.data.shopTableInfo.choseCount ) {
if ( data.data.shopTableInfo && !data.data.shopTableInfo.choseCount ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
shopId: data.data.storeInfo.id,

View File

@@ -73,7 +73,7 @@
})
console.log()
if ( !data.data.shopTableInfo.choseCount ) {
if ( data.data.shopTableInfo && !data.data.shopTableInfo.choseCount ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
shopId: data.data.storeInfo.id,

View File

@@ -534,7 +534,7 @@
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
if (res.code == 0) {
if ( !res.data.shopTableInfo.choseCount && this.tableCode && !this.dinersNum ) {
if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: this.tableCode,
shopId: res.data.storeInfo.id,
@@ -687,8 +687,8 @@
"shopId": this.shopId,
"note": item.note,
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
if (this.shopInfo.storeInfo.eatModel.indexOf('dine-in') != -1) { params.tableId = this.tableCode;}
this.addCart(params);
},
@@ -951,8 +951,8 @@
"note": item.note,
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
if (this.shopInfo.storeInfo.eatModel.indexOf('dine-in') != -1) { params.tableId = this.tableCode;}
//添加到购物车
this.addCart(params);
} else {

View File

@@ -16,7 +16,7 @@
<view class="tabBox" v-if="storeInfo.registerType == 'munchies'">
<view class="tab">
<view :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1,item)">
<view v-if="item.show" :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1,item)">
<view></view>
<image class="icon" :src="is_type==(index+1)?item.url_active:item.url" mode="aspectFill"/>
<text class="title" :class="{active:is_type==(index+1)}">{{item.title}}</text>
@@ -187,8 +187,8 @@
},
is_type: 1,
is_typeList: [
{ title: "送餐到桌", type: "table", val: "dine-in", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"},
{ title: "打包外带", type: "takeself", val: "take-out", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"},
{ title: "送餐到桌", show: false, type: "table", val: "dine-in", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"},
{ title: "打包外带", show: false, type: "takeself", val: "take-out", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"},
],
sendType: "table",
eatModel: [],
@@ -249,10 +249,8 @@
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; }
if ( e.dinersNum ) {
this.dinersNum = e.dinersNum;
}
if ( e.tableCode ) { this.tableCode = e.tableCode;}
if ( e.dinersNum ) { this.dinersNum = e.dinersNum;}
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
this.eatModel = ["dine-in"]
@@ -271,6 +269,13 @@
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) {
item.show = true;
}
})
},
methods: {
@@ -306,6 +311,7 @@
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
this.shopTableInfo = res.data.shopTableInfo;
this.storeInfo = res.data.storeInfo;
},
/**
@@ -491,6 +497,13 @@
})
return;
}
if ( this.sendType == 'table' && !this.tableCode) {
uni.showToast({
title: "请选择桌台",
icon: "none",
})
return;
}
if ( this.listinfo.details.length == 0) {
uni.showToast({
title: "购物车为空,请添加商品",
@@ -767,7 +780,7 @@
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 22rpx;
border-radius: 22rpx 22rpx 0 0;
background-color: $uni-bg-color;
.tab_item{
width: 50%;