订单逻辑修改
This commit is contained in:
@@ -54,13 +54,27 @@
|
||||
}
|
||||
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
success: async(res) => {
|
||||
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
|
||||
uni.cache.set('tableCode', tableCode)
|
||||
if (tableCode) {
|
||||
uni.pro.navigateTo('order_food/order_food', {
|
||||
tableCode: tableCode,
|
||||
let data = await this.api.productqueryShop({
|
||||
code: uni.cache.get('tableCode'),
|
||||
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
|
||||
'',
|
||||
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
|
||||
'',
|
||||
})
|
||||
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
|
||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||
tableCode: tableCode,
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('order_food/order_food', {
|
||||
tableCode: tableCode,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
fail:( res) =>{
|
||||
|
||||
@@ -64,14 +64,28 @@
|
||||
uni.cache.set('forceUpdate',2)
|
||||
},200)
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
success: async (res) => {
|
||||
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
|
||||
uni.cache.set('tableCode', tableCode)
|
||||
if (tableCode) {
|
||||
uni.pro.navigateTo('order_food/order_food', {
|
||||
tableCode: tableCode,
|
||||
let data = await this.api.productqueryShop({
|
||||
code: uni.cache.get('tableCode'),
|
||||
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
|
||||
'',
|
||||
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
|
||||
'',
|
||||
})
|
||||
// uni.pro.navigateTo('/pagesOrder/orderAMeal/index')
|
||||
console.log()
|
||||
if ( !data.data.shopTableInfo.orderId && data.data.storeInfo.isTableFee == 1) {
|
||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||
tableCode: tableCode,
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('order_food/order_food', {
|
||||
tableCode: tableCode,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
|
||||
@@ -207,6 +207,7 @@
|
||||
code: data.code,
|
||||
encryptedData: d.detail.encryptedData,
|
||||
iv: d.detail.iv,
|
||||
source: "wechar"
|
||||
})
|
||||
this.telephone = res.data
|
||||
}
|
||||
@@ -223,9 +224,30 @@
|
||||
success: async (data) => {
|
||||
console.log(data)
|
||||
let res = await this.api.userwxlogins({
|
||||
code: res.authCode,
|
||||
encryptedData: d.response,
|
||||
iv: d.detail.iv,
|
||||
encryptedData: JSON.parse(data.response).response,
|
||||
source: "alipay"
|
||||
})
|
||||
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
|
||||
this.mobile = res.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
// 支付宝小程序环境
|
||||
my.getAuthCode({
|
||||
scopes: 'auth_user',
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let authCode = res.authCode;
|
||||
my.getPhoneNumber({
|
||||
success: async (data) => {
|
||||
let res = await this.api.userwxlogins({
|
||||
// code: authCode,
|
||||
encryptedData: JSON.parse(data.response).response,
|
||||
source: "alipay"
|
||||
})
|
||||
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
|
||||
this.mobile = res.data;
|
||||
|
||||
@@ -109,8 +109,11 @@
|
||||
type: 'index',
|
||||
})
|
||||
} else {
|
||||
uni.pro.navigateTo('member/memberdetails', {
|
||||
shopId_id: item.shopId
|
||||
// uni.pro.navigateTo('member/memberdetails', {
|
||||
// shopId: item.shopId
|
||||
// })
|
||||
uni.pro.navigateTo('/pages/order_food/order_food', {
|
||||
shopId: item.shopId
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
itemClick ( type ) {
|
||||
if ( type == 1) {
|
||||
uni.pro.navigateTo('member/index', {
|
||||
shopId: this.shopUserInfo.id,
|
||||
shopId: this.shopId,
|
||||
type: 'index',
|
||||
})
|
||||
} else if ( type == 3 ) {
|
||||
|
||||
@@ -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||''}`
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
@@ -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 :
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
* 获取手机号
|
||||
* @param {Object} d
|
||||
*/
|
||||
getPhone(d) {
|
||||
async getPhone(d) {
|
||||
console.log(d)
|
||||
// #ifdef MP-WEIXIN
|
||||
if (d.detail.iv) {
|
||||
@@ -194,6 +194,7 @@
|
||||
code: data.code,
|
||||
encryptedData: d.detail.encryptedData,
|
||||
iv: d.detail.iv,
|
||||
source: "wechar"
|
||||
})
|
||||
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
|
||||
this.mobile = res.data;
|
||||
@@ -207,13 +208,13 @@
|
||||
scopes: 'auth_user',
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
let authCode = res.authCode;
|
||||
my.getPhoneNumber({
|
||||
success: async (data) => {
|
||||
console.log(data)
|
||||
let res = await this.api.userwxlogins({
|
||||
code: res.authCode,
|
||||
encryptedData: d.response,
|
||||
iv: d.detail.iv,
|
||||
// code: authCode,
|
||||
encryptedData: JSON.parse(data.response).response,
|
||||
source: "alipay"
|
||||
})
|
||||
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
|
||||
this.mobile = res.data;
|
||||
@@ -221,9 +222,6 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// #endif
|
||||
},
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
if (uni.cache.get('shopId') && uni.cache.get('token')) {
|
||||
if ( this.shopInfo.isVip == 0 ) {
|
||||
uni.pro.navigateTo('member/memberdetails', {
|
||||
shopId_id: uni.cache.get('shopId')
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
|
||||
Reference in New Issue
Block a user