订单逻辑修改

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

@@ -227,7 +227,7 @@
</view>
</view>
<view class="placedOrderTip"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<view class="placedOrderTip" @click="placedOrder" v-if="tableCode&&shopInfo.shopTableInfo.orderId&&shopInfo.storeInfo.registerType == 'restaurant'"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<!-- 购物车 -->
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@@ -441,6 +441,7 @@
shopExtend: null,
shopId: null,
tableCode: null,
dinersNum: null,
}
},
onPageScroll(e) {
@@ -475,9 +476,15 @@
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
}
if ( e.shopId ) {
this.shopId = e.shopId
}
if ( e.tableCode ) {
this.tableCode = e.tableCode
}
if ( e.dinersNum ) {
this.dinersNum = e.dinersNum;
}
},
onUnload() {
if (this.socketTicket) {
@@ -534,7 +541,7 @@
handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils(`${uni.conf.baseUrlwws}`, 5000, {
tableId: uni.cache.get('tableCode'),
tableId: this.tableCode,
shopId: this.shopId,
userId: uni.cache.get('userInfo').id,
"type": "connect",
@@ -587,7 +594,8 @@
*/
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
code: this.tableCode,
shopId: this.shopId,
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
@@ -639,11 +647,19 @@
searchStatus (e) {
if ( e == "searchClick" ) {
uni.navigateTo({
url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode')
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&shopId=${this.shopId}`
});
}
},
/**
* 查看已下单菜品
*/
placedOrder () {
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: this.shopInfo.shopTableInfo.orderId,
})
},
/**
* 商品数量增加/减少
* @param {Object} item
@@ -731,7 +747,7 @@
"productId": item.id, //商品id
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params)
},
@@ -755,7 +771,7 @@
"productId": item.productId, //商品id
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params);
} catch (e) {
@@ -782,7 +798,7 @@
async cartclear() {
let res = await this.api.cleanCart({
"shopId": this.shopId,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
})
},
@@ -1001,7 +1017,7 @@
try {
// console.log(this.skuidname.join(","))
let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'),
code: this.tableCode,
shopId: this.shopId,
productId: item.id, //商品id
isVip: item.isVip, //商品id
@@ -1018,7 +1034,7 @@
"isVip": item.isVip,
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'),
"tableId": this.tableCode,
}
this.addCart(params);
} else {
@@ -1055,9 +1071,8 @@
})
return false
}
console.log(JSON.stringify(this.shopInfo.storeInfo))
uni.navigateTo({
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode}`
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode||''}&dinersNum=${this.dinersNum||''}`
});
},

View File

@@ -279,6 +279,8 @@
searchList: [],
systemInfo: getApp().globalData.systemInfo,
shopId: null,
}
},
onPageScroll(e) {
@@ -292,7 +294,9 @@
},
onLoad(e) {
if ( e.shopId ) {
this.shopId = e.shopId
}
},
onUnload() {
if (this.socketTicket) {
@@ -337,6 +341,7 @@
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
shopId: this.shopId,
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :