From d330091b19bc4b5a025654bb4a6646312833da3b Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Tue, 13 Aug 2024 09:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/components/price-select-tab.vue | 13 ++-- BagStation/pages/makeOrder/makeOrder.vue | 4 +- components/three-sites.vue | 7 ++- pages/tabbar/home/home.vue | 33 +++++----- pages/tabbar/station/stationList.vue | 60 +++++++++++++++---- 5 files changed, 83 insertions(+), 34 deletions(-) diff --git a/BagStation/pages/components/price-select-tab.vue b/BagStation/pages/components/price-select-tab.vue index 8904bb1..bf6440b 100644 --- a/BagStation/pages/components/price-select-tab.vue +++ b/BagStation/pages/components/price-select-tab.vue @@ -365,6 +365,10 @@ activeCur: { type: Number, default: 0 + }, + siteId: { + type: String, + default: "" } }, data() { @@ -672,10 +676,9 @@ }) }, checkInfo() { - // console.log(this.radio) this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) - if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056'] - .includes(this.oilItem.siteId)) { + if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056','1762304610449412096'] + .includes(this.siteId || this.oilItem.siteId)) { // this.plateNumber='' uni.showToast({ title: '车牌号不可为空或格式错误,请重新输入', @@ -836,8 +839,8 @@ beforeMake() { // console.log(this.radio, 'beforeMake') this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) - if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056'] - .includes(this.oilItem.siteId)) { + if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056','1762304610449412096'] + .includes(this.siteId || this.oilItem.siteId)) { // this.plateNumber='' uni.showToast({ title: '车牌号不可为空或格式错误,请重新输入', diff --git a/BagStation/pages/makeOrder/makeOrder.vue b/BagStation/pages/makeOrder/makeOrder.vue index 2b66c1e..45b16d5 100644 --- a/BagStation/pages/makeOrder/makeOrder.vue +++ b/BagStation/pages/makeOrder/makeOrder.vue @@ -63,7 +63,7 @@ + :channelJuli="siteInfo.juli" :siteId="siteId"> @@ -79,6 +79,7 @@ data() { return { isBackPrev: true, + siteId:'', otherImgURL: this.global.otherImgURL, radio: 'B', mainURL: this.global.mainURL, @@ -109,6 +110,7 @@ if (authorization && target.siteId) { // 扫码进入 返回按钮点击回到首页 this.isBackPrev = false + this.siteId = target.siteId this.getSiteInfo(target.siteId) } } catch (e) {} diff --git a/components/three-sites.vue b/components/three-sites.vue index dfe771d..159b84b 100644 --- a/components/three-sites.vue +++ b/components/three-sites.vue @@ -50,7 +50,7 @@ } }, created() { - this.getSiteList() + this.refreshLocation() }, methods: { toSitePage(){ @@ -62,13 +62,14 @@ refreshLocation(){ uni.getLocation({ type: 'wgs84', - success: function (res) { + success: (res) => { uni.setStorageSync('location',res) + this.getSiteList() } }); }, getSiteList() { - this.refreshLocation() + // this.refreshLocation() let data1 = { currentPage: 1, pageSize: 3, diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index 089249a..68e6d0c 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -83,7 +83,8 @@ - + @@ -237,7 +238,8 @@ }, onPullDownRefresh() { - // this.refreshLocation() + this.refreshLocation() + setTimeout(function() { uni.stopPullDownRefresh() }, 800); @@ -306,6 +308,7 @@ type: 'wgs84', success: (res) => { uni.setStorageSync('location', res) + this.getSiteList() }, fail: () => { uni.getSetting({ @@ -318,25 +321,23 @@ success: (resSec) => { if (resSec.confirm) { uni.openSetting({ - success: (resThird) => { - if (resThird - .authSetting[ - 'scope.userLocation' - ]) { - this.refreshLocation() - } - } + }) } } }) + } else { + uni.showToast({ + title: '获取定位失败,请稍后再试!', + icon: 'none' + }) } } }) }, - complete: () => { - this.getSiteList() - }, + // complete: () => { + // this.getSiteList() + // }, }); }, @@ -443,14 +444,16 @@ currentPage: 1, pageSize: 10, params: { - longitude: 117.157817, - latitude: 31.802472, + // longitude: 117.157817, + // latitude: 31.802472, clientBelong: 'ZHONGPIN', comprehensiveSort: 1, zpDisable: 'ENABLE', sort: "juli", ...uni.getStorageSync('location'), ...this.filterData, + // latitude: '37.38808', + // longitude: '112.40546' } }; diff --git a/pages/tabbar/station/stationList.vue b/pages/tabbar/station/stationList.vue index d274464..aff1468 100644 --- a/pages/tabbar/station/stationList.vue +++ b/pages/tabbar/station/stationList.vue @@ -256,14 +256,14 @@ } }, }, - onShow() { - this.tools.userLocationChenk().then(res => { - this.refreshLocation(); - }).catch(err => {}); - this.getSiteList() - }, + // onShow() { + // this.tools.userLocationChenk().then(res => { + // this.refreshLocation(); + // }).catch(err => {}); + // this.getSiteList() + // }, onLoad() { - // this.refreshLocation() + this.refreshLocation() if (!uni.getStorageSync('filterData')) { this.getFilterData() } else { @@ -369,15 +369,55 @@ onSelected(e) { // console.log(e) }, + // refreshLocation() { + // uni.getLocation({ + // type: 'wgs84', + // success: function(res) { + // uni.setStorageSync('location', res) + // } + // }); + // }, refreshLocation() { uni.getLocation({ type: 'wgs84', - success: function(res) { + success: (res) => { uni.setStorageSync('location', res) - } + this.getSiteList() + }, + fail: () => { + uni.getSetting({ + success: (res) => { + if (!res.authSetting['scope.userLocation']) { + uni.showModal({ + title: '请您打开定位权限', + content: '用于获取您当前位置附近的油站', + confirmText: '去设置', + success: (resSec) => { + if (resSec.confirm) { + uni.openSetting({ + complete:() => { + // this.getSiteList() + // this.realPosition() + this.refreshLocation() + } + }) + } + } + }) + }else { + uni.showToast({ + title:'获取定位失败,请稍后再试!', + icon:'none' + }) + } + } + }) + }, + // complete: () => { + // this.getSiteList() + // }, }); }, - getSiteList() { let parameter = { currentPage: this.currentPage,