From 61cbc5c846e72ca1cb6b14ab7518dfd76282e492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Thu, 8 Aug 2024 17:42:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=99=BB=E5=BD=95=20=20=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 41 ++++++-- framework/0-conf.js | 8 +- framework/11-api.js | 21 ++--- pages/order_food/order_food.vue | 162 +++++++++++++++----------------- 4 files changed, 120 insertions(+), 112 deletions(-) diff --git a/App.vue b/App.vue index 6b41c6c..1cdc5c0 100644 --- a/App.vue +++ b/App.vue @@ -1,5 +1,4 @@ diff --git a/framework/0-conf.js b/framework/0-conf.js index ab5aecc..a9b4c7d 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -16,11 +16,11 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService' // #endif // #ifdef APP || MP-WEIXIN -// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上 -// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上 +const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上 +const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上 -const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上 -const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/ +// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上 +// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/ // #endif // import VConsole from "./vConsole.js" diff --git a/framework/11-api.js b/framework/11-api.js index 489545c..9e21419 100644 --- a/framework/11-api.js +++ b/framework/11-api.js @@ -104,19 +104,14 @@ async function request(options) { if (res.code != 0) { console.log(options) if (res.code == -4) { - // uni.showToast({ - // title: '', - // // title: res.message || res.msg, - // icon: "none", - // success: () => { - // setTimeout(res => { - // store.dispatch("loginEvent"); //获取shapid - // }, 1000) - // } - // }) - setTimeout(res => { - store.dispatch("loginEvent"); //获取shapid - }, 1000) + uni.showToast({ + title: res.message || res.msg, + icon: "none", + success: () => { + + } + }) + } else if (res.code == 482) { let nowTime = new Date() / 1000 | 0 let offset = parseInt(res.data.message) - parseInt(nowTime); diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index d294b50..c6f99cc 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -110,10 +110,11 @@ - - TOP{{index1+1}} @@ -277,7 +278,7 @@ {{item.name}} - + @@ -389,22 +390,11 @@ this.$store.getters.is_BarHeight.customBar) } }, - onReady() { - // setTimeout(() => { - // uni.getSystemInfo({ - // success: (data) => { - // this.scrollHeight = data.windowHeight - // } - // }) - // }, 100); - }, onLoad(e) { if (e.q) { this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') uni.cache.set('tableCode', this.tableCode) } - uni.cache.set('types', 'types'); - }, onUnload() { if (this.socketTicket) { @@ -427,28 +417,26 @@ uni.login({ provider: 'weixin', success: async (data) => { - try { - uni.getUserInfo({ - provider: 'weixin', - success: async (infoRes) => { - uni.cache.set('weixincode', data.code); - let res = await this.api.userwxlogin({ - code: uni.cache.get('weixincode'), //临时登录凭证 - rawData: infoRes.rawData - }) - 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); - uni.$on('message', this.getMessage) - - _this.getLocation() - } - }, - fail: (err) => {} - }); - } catch (e) {} + uni.getUserInfo({ + provider: 'weixin', + success: async (infoRes) => { + uni.cache.set('weixincode', data.code); + let res = await this.api.userwxlogin({ + code: uni.cache.get('weixincode'), //临时登录凭证 + rawData: infoRes.rawData + }) + 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); + uni.$on('message', this.getMessage) + + _this.getLocation() + } + }, + fail: (err) => {} + }); } }); }, @@ -476,36 +464,39 @@ "type": "connect", }) }, - + /** * 获取定位 */ - getLocation () { - uni.getLocation({ - type: 'wgs84', - success: async (res) => { - let successres = await this.api.geocodelocation({ - lng: res.longitude, - lat: res.latitude, - }) - if (successres.code == 0) { - let datastorage = { - country: successres.data.addressComponent.country, // "中国" - province: successres.data.addressComponent.province, //province: "陕西省" - address: successres.data.addressComponent.city, //district: "西安市" - district: successres.data.addressComponent.district, //district: "未央区" + getLocation() { + try { + uni.getLocation({ + type: 'wgs84', + success: async (res) => { + let successres = await this.api.geocodelocation({ lng: res.longitude, lat: res.latitude, + }) + if (successres.code == 0) { + let datastorage = { + country: successres.data.addressComponent.country, // "中国" + province: successres.data.addressComponent.province, //province: "陕西省" + address: successres.data.addressComponent.city, //district: "西安市" + district: successres.data.addressComponent.district, //district: "未央区" + lng: res.longitude, + lat: res.latitude, + } + uni.cache.set('getLocationstorage', datastorage); + this.productqueryShop(); } - uni.cache.set('getLocationstorage', datastorage); + }, + fail: async (err) => { this.productqueryShop(); } - }, - fail: async (err) => { - console.log(err, '获取错误') //测试用于app - this.productqueryShop(); - } - }); + }); + } catch (e) { + this.productqueryShop(); + } }, /** @@ -514,8 +505,8 @@ async productqueryShop() { let res = 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:'', + lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng : '', + lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat : '', }) if (res.code == 0) { uni.cache.set('shopUser', res.data.storeInfo.id) @@ -529,18 +520,18 @@ } }, - + /** * 图片加载 */ - imageLoaded (item,index,index1) { + imageLoaded(item, index, index1) { console.log(index) console.log(index1) console.log(this.shopProductList.productInfo[index]) this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true; // e.currentTarget.src }, - + /** * 商品数量增加/减少 * @param {Object} item @@ -735,7 +726,7 @@ start: -1, children: [] } - item.value.split(",").forEach((v,e)=>{ + item.value.split(",").forEach((v, e) => { res.children.push({ name: v, isGrounding: false @@ -743,7 +734,7 @@ }) return res }) - + //初始化第一列规格可编辑 let filteredJson; let isSkuidname = []; @@ -756,14 +747,14 @@ console.log(filteredJson); for (let i = 0; i < filteredJson.length; i++) { console.log(filteredJson[i].isGrounding) - if ( filteredJson[i].isGrounding ) { + if (filteredJson[i].isGrounding) { this.specifications.tagSnap[0].children[o].isGrounding = true break; // 终止循环 } } - + } - + this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}哦` // this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个 @@ -787,7 +778,7 @@ * @param {Object} item */ async morloe(e, index, index1, item) { - if ( !e.isGrounding ) { + if (!e.isGrounding) { return; } @@ -801,18 +792,18 @@ } this.skuidname = []; this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个 - if ( i > index ) { - val.children.forEach(( v1,e1)=>{ + if (i > index) { + val.children.forEach((v1, e1) => { v1.isGrounding = false; }) val.start = -1; } - if ( val.start >= 0 ) { + if (val.start >= 0) { this.skuidname.push(val.children[val.start].name) } }) // this.skuidname.splice(index, 1, e.info); //替换skuidname的数据 - + for (let i = 0; i < this.specifications.tagSnap.length; i++) { if (this.specifications.tagSnap[i].start < 0) { this.isSpec = false; @@ -820,36 +811,36 @@ break; // 终止循环 } } - - + + let filteredJson; let isSkuidname = []; //提前下一列规格循环,查看是否有下架规格 - if ( this.specifications.tagSnap[index+1] ) { - for (let o = 0; o < this.specifications.tagSnap[index+1].children.length; o++) { + if (this.specifications.tagSnap[index + 1]) { + for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) { isSkuidname = JSON.parse(JSON.stringify(this.skuidname)); - isSkuidname.push(this.specifications.tagSnap[index+1].children[o].name) + isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name) //筛选符合条件的规格列表 console.log(isSkuidname); filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0); console.log(filteredJson); for (let i = 0; i < filteredJson.length; i++) { console.log(filteredJson[i].isGrounding) - if ( filteredJson[i].isGrounding ) { - this.specifications.tagSnap[index+1].children[o].isGrounding = true + if (filteredJson[i].isGrounding) { + this.specifications.tagSnap[index + 1].children[o].isGrounding = true break; // 终止循环 } } - + } } - - + + // res.data.forEach((v,e)=>{ // // this.$set(this.specifications.tagSnap[e], 'children', v.value) // }) console.log(this.specifications.tagSnap) - + this.$forceUpdate(); this.hodgepodge(item, 2) }, @@ -1035,7 +1026,6 @@ /* 获取最后一项的高度,设置填充高度。判断和填充时做了 +-20 的操作,是为了滚动时更好的定位 */ let last = res[res.length - 1].height; if (last - 20 < this.scrollHeight) { - // this.fillHeight = this.scrollHeight - last + 20; //这是吸到顶部的距离 this.fillHeight = 200; } }); From 192b9ab9de4eab1637f358e6cc847c607c7e0afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Wed, 14 Aug 2024 09:54:56 +0800 Subject: [PATCH 2/3] 1 --- components/navseat.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/navseat.vue b/components/navseat.vue index d218c4b..fde21df 100644 --- a/components/navseat.vue +++ b/components/navseat.vue @@ -17,7 +17,7 @@ - + From 907321d3d33ffedf346b10a743dbce4007daa5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Wed, 14 Aug 2024 09:58:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/navseat.vue | 20 +++++++++++++++++-- ...information - 副本.vue => information.vue} | 0 2 files changed, 18 insertions(+), 2 deletions(-) rename pages/user/{information - 副本.vue => information.vue} (100%) diff --git a/components/navseat.vue b/components/navseat.vue index fde21df..348f43f 100644 --- a/components/navseat.vue +++ b/components/navseat.vue @@ -15,7 +15,18 @@ :style="{'height':HeighT.customBar+'px','marginTop':HeighT.heightBar+'px','padding-right':HeighT.custwidth + 'px'}"> - + + + + + + + 搜索 + + + + @@ -42,7 +53,8 @@ export default { data() { return { - Topdistance: '' + Topdistance: '', + keyword }; }, props: { @@ -77,6 +89,10 @@ navigateBacknavtitle: { type: Boolean, default: false + }, + inputshow:{ + type: Boolean, + default: false } }, computed: { diff --git a/pages/user/information - 副本.vue b/pages/user/information.vue similarity index 100% rename from pages/user/information - 副本.vue rename to pages/user/information.vue