订单逻辑修改

This commit is contained in:
GaoHao
2024-09-26 09:20:08 +08:00
parent 5f03e44701
commit 1de598f1b1
16 changed files with 856 additions and 135 deletions

View File

@@ -7,11 +7,12 @@
<view class="title_text">请选择就餐人数</view>
<view class="title_tabNum">桌号A2</view>
</view>
<view class="num">
<view class="num" :class="{'active':numIndex==-1}">
<view class="num_item" :class="{'active':numIndex==index }" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">{{item+1}}</view>
<view class="num_item" :class="{'active':numIndex==-1 }" @click="tabCut(-1)">其他</view>
<!-- <view class="num_item" v-else :class="{'active':numIndex==-1 }"></view> -->
<u--input custom-class="num_item" v-model="otherNum" :class="{'active':numIndex==-1 }" @focus="tabCut(-1)" @blur="blur()" border="none" type="number" maxlength="3"></u--input>
</view>
<view class="startBtn">
<view class="startBtn" @click="start">
开始点餐
</view>
</view>
@@ -32,12 +33,12 @@
tableCode: null,
shopId: null,
numIndex: 0,
num: 1,
otherNum: '其他',
dinersNum: 1,
};
},
onLoad(options) {
this.tableCode = uni.cache.get('tableCode');
},
onShow() {
},
@@ -48,11 +49,38 @@
* 切换桌型
*/
tabCut(index) {
console.log(index)
this.numIndex = index;
if ( index != -1) {
this.num = index+1;
this.dinersNum = index+1;
} else {
this.otherNum = this.otherNum == "其他" ? "" : this.otherNum;
}
},
blur ( index ) {
this.otherNum = this.otherNum == "" ? "其他" : this.otherNum;
},
/**
* 开始点餐
*/
start () {
if ( this.numIndex == -1 && (this.otherNum == "其他"||this.otherNum <= 0)) {
uni.showToast({
title: '请选择就餐人数',
icon: 'none',
})
return;
}
if ( this.numIndex == -1 && this.otherNum != "其他") {
this.dinersNum = this.otherNum
}
uni.pro.navigateTo('order_food/order_food', {
tableCode: this.tableCode,
dinersNum: this.dinersNum,
})
}
}
};
@@ -110,7 +138,7 @@
text-align: center;
margin-right: 28rpx;
margin-bottom: 32rpx;
background: #FEF4EB;
background-color: #FEF4EB;
border-radius: 12rpx;
font-weight: 400;
font-size: 28rpx;
@@ -119,10 +147,39 @@
.num_item:nth-child(5n){
margin-right: 0;
}
::v-deep .u-input{
width: 104rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
margin-bottom: 32rpx;
background-color: #FEF4EB;
border-radius: 12rpx;
}
::v-deep input{
font-weight: 400;
font-size: 28rpx!important;
color: #333333!important;
text-align: center!important;
}
.active{
color: #fff;
background-color: #E8AD7B;
}
}
::v-deep .num.active .u-input{
width: 104rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
margin-bottom: 32rpx;
background-color: #E8AD7B!important;
border-radius: 12rpx;
}
::v-deep .num.active input{
color: #fff!important;
}
}