From 3f48b10e59384a8e05e5c46aeae88d6141967ad2 Mon Sep 17 00:00:00 2001 From: Wik-T <812952667@qq.com> Date: Tue, 24 May 2022 09:17:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=85=AC=E4=BC=97=E5=8F=B7?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=8A=A0=E6=B2=B9=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 20 ++-- Utils/Api.js | 4 + pages/goods/refuel-details/refuel-details.vue | 112 ++++++++++++++---- pages/tabBar/home/home.vue | 22 +++- 4 files changed, 124 insertions(+), 34 deletions(-) diff --git a/App.vue b/App.vue index 751aaba..1fbcc6f 100644 --- a/App.vue +++ b/App.vue @@ -5,15 +5,15 @@ // brestUrl: 'http://192.168.3.4:9302/brest', // imgUrl: 'https://192.168.3.4:9301/filesystem/', //正式 - url: 'https://hsg.dctpay.com/crest', - imgUrl: 'https://hsg.dctpay.com/filesystem/', - brestUrl : 'https://hsg.dctpay.com/brest', - imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', + // url: 'https://hsg.dctpay.com/crest', + // imgUrl: 'https://hsg.dctpay.com/filesystem/', + // brestUrl : 'https://hsg.dctpay.com/brest', + // imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', //测试 - // url: 'https://hsgcs.dctpay.com/crest', - // brestUrl : 'https://hsgcs.dctpay.com/brest', - // imgUrl: 'https://hsgcs.dctpay.com/filesystem/', - // imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', + url: 'https://hsgcs.dctpay.com/crest', + brestUrl : 'https://hsgcs.dctpay.com/brest', + imgUrl: 'https://hsgcs.dctpay.com/filesystem/', + imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', userInfo: "", brestUserInfo : '', openId: '', @@ -34,7 +34,9 @@ //门店名字 storename:'', //公众号进入值 - accountId:'' + accountId:'', + //公众号菜单区分 + accountType:'' }, onLaunch: function() { }, diff --git a/Utils/Api.js b/Utils/Api.js index 7d3a91a..aef1d22 100644 --- a/Utils/Api.js +++ b/Utils/Api.js @@ -185,6 +185,10 @@ export const getGasStoreList = params => { export const getGasDetailByStoreKey = params => { return POST('GET', `${base}/highGas/getGasDetailByStoreKey`, params).then(res => res.data); } +//团油一键加油查询详情 +export const recentGasStation = params => { + return POST('GET', `${base}/highGas/recentGasStation`, params).then(res => res.data); +} //团油距离限制 export const getDictionaryByCodeTypeOl = params => { return POST('GET', `${base}/common/getDictionaryByCodeTypeOl`, params).then(res => res.data); diff --git a/pages/goods/refuel-details/refuel-details.vue b/pages/goods/refuel-details/refuel-details.vue index f7f3863..19a758e 100644 --- a/pages/goods/refuel-details/refuel-details.vue +++ b/pages/goods/refuel-details/refuel-details.vue @@ -145,7 +145,8 @@ getGasDetailByStoreKey, addOrder, getDictionaryByCodeTypeOl, - oilPriceDiscountCompute + oilPriceDiscountCompute, + recentGasStation } from '../../../Utils/Api.js'; import wybPopup from '../../../components/wyb-popup/wyb-popup.vue'; let app = getApp(); @@ -215,13 +216,30 @@ if (app.globalData.accountId) { this.isTyAgent = true; } + // #ifdef H5 + if (app.globalData.accountType && app.globalData.accountType == '000000#/') { + this.recentGasStation(); + } else { + this.getGasDetailByStoreKey(); + } + // #endif + // #ifdef MP this.getGasDetailByStoreKey(); + // #endif this.getDictionaryByCodeTypeOl(); this.getDictionaryByCodeTypeMoney(); }, onShow() { this.user = app.globalData.userInfo; }, + onUnload() { + if (app.globalData.accountType && app.globalData.accountType == '000000#/') { + uni.removeStorage({ + key: 'accountType' + }) + app.globalData.accountType = ''; + } + }, methods: { //前往导航 seeloaction() { @@ -237,8 +255,47 @@ this.typeId = item; this.$refs.popup.show(); }, + //一键加油 + recentGasStation() { + uni.showLoading({ + title: '加载中...' + }) + let params = { + latitude: app.globalData.latitude, + longitude: app.globalData.longitude, + isTyAgent: this.isTyAgent + } + recentGasStation(params).then(res => { + uni.hideLoading(); + if (res.return_code == '000000') { + this.storeList = res.return_data; + if (!this.oilNo) { + this.oilNo = res.return_data.oilPriceList[0].oilNoName; + this.priceVip = res.return_data.oilPriceList[0].priceVip; + this.priceGun = res.return_data.oilPriceList[0].priceGun; + this.priceOfficial = res.return_data.oilPriceList[0].priceOfficial; + this.detailList = res.return_data.oilPriceList; + this.oilType = res.return_data.oilPriceList[0].oilType; + this.gasGunList = res.return_data.gasGunList; + for (var i = 0; i < res.return_data.gasGunList.length; i++) { + if (this.oilNo == res.return_data.gasGunList[i].oilNoName) { + this.gunnumber.push(res.return_data.gasGunList[i]) + this.gunNo = res.return_data.gasGunList[i].gunNo; + this.gasOilNo = res.return_data.gasGunList[i].oilNo; + } + } + } + } else { + uni.showToast({ + title: res.return_msg, + icon: "none", + duration: 2000 + }); + } + }) + }, //查询详情 - getGasDetailByStoreKey() { + getGasDetailByStoreKey() { uni.showLoading({ title: '加载中...' }) @@ -322,26 +379,26 @@ this.priceGun = item.priceGun; this.totalPrice = '0.00'; this.discountPrice = '0.00'; - this.inputMoney = ''; - this.oilLiters = '0'; - this.discount = '0'; - this.oilSubsidy = '0'; - this.litersPreferences = '0'; - this.pricePreferences = '0'; + this.inputMoney = ''; + this.oilLiters = '0'; + this.discount = '0'; + this.oilSubsidy = '0'; + this.litersPreferences = '0'; + this.pricePreferences = '0'; this.totalPreferences = '0'; this.$refs.popup.hide(); }, //选择油枪 changeValue2(item) { - this.gunNo = item.gunNo; - this.totalPrice = '0.00'; - this.discountPrice = '0.00'; - this.inputMoney = ''; - this.oilLiters = '0'; - this.discount = '0'; - this.oilSubsidy = '0'; - this.litersPreferences = '0'; - this.pricePreferences = '0'; + this.gunNo = item.gunNo; + this.totalPrice = '0.00'; + this.discountPrice = '0.00'; + this.inputMoney = ''; + this.oilLiters = '0'; + this.discount = '0'; + this.oilSubsidy = '0'; + this.litersPreferences = '0'; + this.pricePreferences = '0'; this.totalPreferences = '0'; this.$refs.popup.hide(); }, @@ -374,12 +431,12 @@ this.totalPrice = '0.00'; this.discountPrice = '0.00'; this.litre = ''; - this.inputMoney = ''; - this.oilLiters = '0'; - this.discount = '0'; - this.oilSubsidy = '0'; - this.litersPreferences = '0'; - this.pricePreferences = '0'; + this.inputMoney = ''; + this.oilLiters = '0'; + this.discount = '0'; + this.oilSubsidy = '0'; + this.litersPreferences = '0'; + this.pricePreferences = '0'; this.totalPreferences = '0'; return; } @@ -480,7 +537,16 @@ success: function(res) { app.globalData.latitude = res.latitude; app.globalData.longitude = res.longitude; + // #ifdef H5 + if (app.globalData.accountType && app.globalData.accountType == '000000#/') { + that.recentGasStation(); + } else { + that.getGasDetailByStoreKey(); + } + // #endif + // #ifdef MP that.getGasDetailByStoreKey(); + // #endif setTimeout(() => { that.toPay(); }, 500); diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue index 8b9134c..4864c21 100644 --- a/pages/tabBar/home/home.vue +++ b/pages/tabBar/home/home.vue @@ -187,6 +187,20 @@ } } }) + uni.getStorage({ + key: 'accountType', + success(e) { + if (e.data) { + app.globalData.accountType = e.data; + if (e.data == '000000#/' && app.globalData.h5code) { + uni.navigateTo({ + url: '../../goods/refuel-details/refuel-details' + }) + } + + } + } + }) // #endif }, onLoad(options) { @@ -203,6 +217,10 @@ key: "accountId", data: arr2[1] }) + uni.setStorage({ + key: "accountType", + data: arr2[1] + }) } if (app.globalData.h5code) { @@ -261,7 +279,7 @@ methods: { jumpcdx() { location.href = - 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsg.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; + 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FhsgH5%2Findex.html%23%2F&response_type=code&scope=snsapi_base&state=1#wechat_redirect'; }, //获取首页功能 getCmsContentcmsContent() { @@ -381,7 +399,7 @@ that.city = res.data.result.address_component.province; app.globalData.cityName = res.data.result.address_component .province; - app.globalData.cityId = res.data.result.ad_info.adcode; + app.globalData.cityId = res.data.result.ad_info.adcode; uni.hideLoading(); if (res.data.result.ad_info.adcode) { that.getCouponListArea();