From 1de598f1b16de95307e89791ce9dcdf4abb8f768 Mon Sep 17 00:00:00 2001
From: GaoHao <1210693421@qq.com>
Date: Thu, 26 Sep 2024 09:20:08 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 49 +-
common/js/api.js | 1 +
framework/1-utils.js | 26 +-
pages/index/components/diamond.vue | 20 +-
pages/index/indexs.vue | 22 +-
pages/member/components/registermember.vue | 28 +-
pages/member/list.vue | 7 +-
pages/member/memberdetails.vue | 2 +-
pages/order_food/order_food.vue | 37 +-
pages/order_food/order_food_search.vue | 7 +-
pages/user/my_info.vue | 14 +-
pages/user/user.vue | 2 +-
pagesOrder/confirm_order/index.vue | 74 ++-
pagesOrder/orderAMeal/index.vue | 71 ++-
pagesOrder/order_detail/index - 副本.vue | 559 +++++++++++++++++++++
pagesOrder/order_detail/index.vue | 72 ++-
16 files changed, 856 insertions(+), 135 deletions(-)
create mode 100644 pagesOrder/order_detail/index - 副本.vue
diff --git a/App.vue b/App.vue
index 3026991..8434f37 100644
--- a/App.vue
+++ b/App.vue
@@ -14,7 +14,9 @@
uni.cache.set('menuInfo', uni.getMenuButtonBoundingClientRect());
// #endif
uni.cache.set('NAME', '零点八零');
- // this.$store.dispatch("loginEvent")
+ if (!uni.cache.get('token')) {
+ this.$store.dispatch("loginEvent")
+ }
},
onLoad() {
@@ -66,50 +68,7 @@
// console.log('App Hide');
},
methods: {
- userlogin() {
- if (!uni.cache.get('token')) {
- // this.$store.dispatch("loginEvent"); //获取shapid
- uni.login({
- // #ifndef MP-WEIXIN
- provider: 'weixin',
- // #endif
- // #ifndef MP-ALIPAY
- provider: 'alipay',
- // #endif
- success: (data) => {
- uni.getUserInfo({
- // #ifndef MP-WEIXIN
- provider: 'weixin',
- // #endif
- // #ifndef MP-ALIPAY
- provider: 'alipay',
- // #endif
- success: async (infoRes) => {
- console.log(infoRes)
- let res = await Api.userwxlogin({
- code: data.code, //临时登录凭证
- rawData: infoRes.rawData,
- // #ifdef MP-WEIXIN
- source: 'wechat',
- // #endif
- // #ifdef MP-ALIPAY
- source: 'alipay',
- // #endif
- })
- if (res.code == 0) {
- uni.cache.set('token', res.data.token);
- uni.cache.set('miniAppOpenId', res.data.userInfo
- .miniAppOpenId)
- uni.cache.set('userInfo', res.data.userInfo);
- this.$isResolve()
- }
- },
- fail: (err) => {}
- });
- },
- })
- }
- }
+
}
};
diff --git a/common/js/api.js b/common/js/api.js
index 2ec864c..f3894d4 100644
--- a/common/js/api.js
+++ b/common/js/api.js
@@ -6,6 +6,7 @@ export default {
return uni.api.get("/login/userInfo", data,false);
},
userwxlogins(data) { // 获取手机号
+ console.log(data)
return uni.api.post("/login/getPhoneNumber", data);
},
getShopExtend(data) { //获取图片 通过shopId和autokey
diff --git a/framework/1-utils.js b/framework/1-utils.js
index 14deaf2..401a726 100644
--- a/framework/1-utils.js
+++ b/framework/1-utils.js
@@ -273,19 +273,19 @@ const getUserInfo = function (successCallback, failCallback) {
success: (data) => {
console.log(data)
// 支付宝小程序环境
- // my.getAuthUserInfo({
- // success: async (infoRes) => {
- // let res = await Api.userwxlogin({
- // code: data.authCode, //临时登录凭证
- // rawData: JSON.stringify(infoRes),
- // source: 'alipay'
- // })
- // if (res.code == 0) {
- // resolve(res)
- // }
- // },
- // fail: (err) => {}
- // });
+ my.getAuthUserInfo({
+ success: async (infoRes) => {
+ let res = await Api.userwxlogin({
+ code: data.authCode, //临时登录凭证
+ rawData: JSON.stringify(infoRes),
+ source: 'alipay'
+ })
+ if (res.code == 0) {
+ resolve(res)
+ }
+ },
+ fail: (err) => {}
+ });
}
});
})
diff --git a/pages/index/components/diamond.vue b/pages/index/components/diamond.vue
index e925770..7f1ce3c 100644
--- a/pages/index/components/diamond.vue
+++ b/pages/index/components/diamond.vue
@@ -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) =>{
diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue
index b99b2e7..88a42f1 100644
--- a/pages/index/indexs.vue
+++ b/pages/index/indexs.vue
@@ -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: () => {
diff --git a/pages/member/components/registermember.vue b/pages/member/components/registermember.vue
index 39aac19..2f0909b 100644
--- a/pages/member/components/registermember.vue
+++ b/pages/member/components/registermember.vue
@@ -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;
diff --git a/pages/member/list.vue b/pages/member/list.vue
index 15d3e28..6005a9c 100644
--- a/pages/member/list.vue
+++ b/pages/member/list.vue
@@ -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
})
}
}
diff --git a/pages/member/memberdetails.vue b/pages/member/memberdetails.vue
index 447cc4f..9a52242 100644
--- a/pages/member/memberdetails.vue
+++ b/pages/member/memberdetails.vue
@@ -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 ) {
diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue
index 07e1642..0b32bbf 100644
--- a/pages/order_food/order_food.vue
+++ b/pages/order_food/order_food.vue
@@ -227,7 +227,7 @@
- 已下单菜品
+ 已下单菜品
{
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
},
diff --git a/pages/user/user.vue b/pages/user/user.vue
index 8fa63d0..c42f75a 100644
--- a/pages/user/user.vue
+++ b/pages/user/user.vue
@@ -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({
diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue
index 9f1f03e..0eab4d8 100644
--- a/pagesOrder/confirm_order/index.vue
+++ b/pagesOrder/confirm_order/index.vue
@@ -1,5 +1,5 @@
-
+
@@ -9,14 +9,14 @@
-
+
温馨提示:请适量点餐,避免浪费
-
+
-
+
{{item.title}}
@@ -48,13 +48,15 @@
- 加菜下单
+ 加菜下单
-
+
{{ listinfo.name }}
桌号:
- {{ shopTableInfo.name }} 人
+ {{ shopTableInfo.name }}
+ {{ dinersNum }}人
+
@@ -95,7 +97,7 @@
-
+
支付方式
实付金额
¥{{ listinfo.payAmount }}
- {{ paymentBtnText }}
- {{ paymentBtnText }}
-
+
+ {{ paymentBtnText }}
+ {{ paymentBtnText }}
+
+
+ 提交订单
+
@@ -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 @@
\ No newline at end of file
diff --git a/pagesOrder/order_detail/index.vue b/pagesOrder/order_detail/index.vue
index 2ea09ad..d120f1e 100644
--- a/pagesOrder/order_detail/index.vue
+++ b/pagesOrder/order_detail/index.vue
@@ -102,19 +102,36 @@
订单信息
-
-
- 订单信息:
- {{listinfo.orderNo}}(点击复制)
-
-
- 创建时间:
- {{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}
-
-
+
+
+
+ 订单编号:
+ {{listinfo.orderNo}}(点击复制)
+
+
+ 下单时间:
+ {{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}
+
+
+ 下单门店:
+ {{listinfo.name}}
+
+
+ 订单类型:
+ {{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}
+
+
+ 备注:
+ {{listinfo.orderNo}}(点击复制)
+
+
+ 就餐人数:
+ {{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}
+
+
@@ -139,6 +156,7 @@
pay_type: 1,
orderId: '',
listinfo: {},
+ status: [],
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
@@ -164,6 +182,9 @@
})
if (res.code == 0) {
this.listinfo = res.data;
+ if (this.listinfo.useType == "dine-in-before") {
+ //堂食先付费
+ }
}
},
@@ -248,7 +269,7 @@