订单逻辑修改

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

@@ -1,5 +1,5 @@
<template>
<view>
<view class="container">
<!-- 占位符导航栏 -->
<!-- <navseat class="navbar" :opacity='opacitys' :backColor="'#E8AD7B'" :title='toplist.name' :titleshow='true'></navseat> -->
<!-- #ifdef MP-WEIXIN -->
@@ -9,14 +9,14 @@
<!-- 头部内容 -->
<view class="head">
<view class="head_bg"></view>
<view class="tips">
<view class="tips" v-if="storeInfo.registerType == 'munchies'">
<image class="informIcon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png" mode="aspectFill"/>
<text class="informText">温馨提示请适量点餐避免浪费</text>
</view>
<view class="tabBox">
<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)">
<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.val)">
<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>
@@ -48,13 +48,15 @@
</view>
</view>
<view class="addDish" @click="addDish">加菜下单</view>
<view class="addDish" @click="addDish" v-if="storeInfo.registerType == 'restaurant'">加菜下单</view>
<view class="tabBox_t ">
<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></view></view>
<view class="name">{{ shopTableInfo.name }} </view>
<view class="num" v-if="dinersNum">{{ dinersNum }}</view>
</view>
</view>
</view>
<!-- 订单内容区域 -->
@@ -95,7 +97,7 @@
</view>
<!-- 支付方式 -->
<view class="paymentMethod">
<view class="paymentMethod" v-if="storeInfo.registerType == 'munchies'">
<view class="paymentMethod_content">
<view class="paymentMethod_title">支付方式</view>
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
@@ -128,9 +130,13 @@
<text style="margin-bottom: 5rpx;">实付金额</text>
<text class="totalAmount">{{ listinfo.payAmount }} </text>
</view>
<view class="paymentBtnText" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo"> {{ paymentBtnText }} </view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else> {{ paymentBtnText }} </view>
<!-- <view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" > 提交订单 </view> -->
<block v-if="storeInfo.registerType == 'munchies'">
<view class="paymentBtnText" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo"> {{ paymentBtnText }} </view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else> {{ paymentBtnText }} </view>
</block>
<block v-if="storeInfo.registerType == 'restaurant'">
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" > 提交订单 </view>
</block>
</view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
@@ -174,9 +180,10 @@
},
is_type: 1,
is_typeList: [
{ title: "送餐到桌", 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: "打包外带", 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: "送餐到桌", 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: "打包外带", 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"},
],
eatModel: [],
favorable: [
{ name: "优惠券", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
{ name: "团购优惠", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
@@ -213,8 +220,9 @@
socketTicket: null,
shopId: null,
storeInfo: null,
storeInfo: {},
tableCode: null,
dinersNum: null,
}
},
computed: {
@@ -238,12 +246,19 @@
},
onLoad(e) {
console.log(e)
this.shopId = JSON.parse(decodeURIComponent(e.storeInfo)).shopId;
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
this.listinfo.name = JSON.parse(decodeURIComponent(e.storeInfo)).shopName;
this.tableCode = e.tableCode;
console.log(this.storeInfo)
this.shopId =this.storeInfo.shopId;
this.listinfo.name = this.storeInfo.shopName;
if ( e.tableCode ) { this.tableCode = e.tableCode; }
if ( e.dinersNum ) { this.dinersNum = e.dinersNum; }
this.listinfo.details = JSON.parse(e.cartLists).data;
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
this.eatModel = ["dine-in"]
} else {
this.eatModel = ["take-out"]
}
if ( e.tableCode ) {
this.getProductqueryShop()
}
@@ -333,8 +348,13 @@
} else {
switch (msg.type) {
case 'createOrder':
if ( this.storeInfo.registerType == 'restaurant') {
uni.switchTab({
url: '/pages/order/order'
});
return;
}
this.isSocket = true;
console.log(msg)
this.listinfoid = msg.data.id
this.listinfo.details = msg.data.detailList;
this.listinfo.payAmount = msg.data.amount;
@@ -378,8 +398,9 @@
* 监听送餐/打包切换
* @param {Object} val
*/
tabClick ( val ) {
this.is_type = val;
tabClick ( index,val ) {
this.is_type = index;
this.eatModel.push(val);
},
/**
@@ -487,6 +508,8 @@
"isYhq": 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"dinersNum": this.dinersNum, //就餐人数
"eatModel": this.eatModel, //就餐模式
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
}
@@ -692,6 +715,9 @@
</script>
<style lang="scss">
.container{
padding-bottom: 246rpx;
}
.head{
width: 100%;
padding: $uni-spacing-row-base;
@@ -930,10 +956,12 @@
.tableName{
display: flex;
.name{
border-right: 2rpx solid #d6d6d6;
padding-right: 16rpx;
margin-right: 16rpx;
}
.num{
border-left: 2rpx solid #d6d6d6;
padding-left: 16rpx;
}
}
@@ -1082,7 +1110,7 @@
padding: 0 30rpx;
box-sizing: border-box;
margin-top: 30rpx;
padding-bottom: 246rpx;
.paymentMethod_content{
background-color: $uni-bg-color;
border-radius: 22rpx;