From ddf5a75413f6adde17292b8aa1523e72108494da Mon Sep 17 00:00:00 2001
From: Wik-T <812952667@qq.com>
Date: Tue, 30 Aug 2022 09:30:27 +0800
Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=9C=A8=E7=BA=BF=E5=8A=A0?=
=?UTF-8?q?=E6=B2=B9=E4=BB=B7=E6=A0=BC=E9=80=89=E6=8B=A9=202.=E4=B8=8A?=
=?UTF-8?q?=E7=BA=BFh5=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 44 ++-
Utils/Api.js | 12 +-
pages/goods/refuel-confirm/refuel-confirm.vue | 26 +-
pages/goods/refuel-details/refuel-details.vue | 342 +++++++++++++++---
pages/login/register.vue | 6 +-
pages/tabBar/category/category.vue | 10 +-
pages/tabBar/home/home.vue | 19 +-
pages/user/positioning/positioning.vue | 268 +++++++++-----
pages/welcome/welcome.vue | 32 +-
9 files changed, 586 insertions(+), 173 deletions(-)
diff --git a/App.vue b/App.vue
index 6cada43..f8a2e7f 100644
--- a/App.vue
+++ b/App.vue
@@ -11,9 +11,9 @@
// imageWxImg: 'https://hsg.dctpay.com/filesystem/wxApplets/',
//测试
url: 'https://hsgcs.dctpay.com/crest',
- brestUrl : 'https://hsgcs.dctpay.com/brest',
+ brestUrl: 'https://hsgcs.dctpay.com/brest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
- imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
+ imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
userInfo: "",
brestUserInfo: '',
bresthighAgent: '',
@@ -51,13 +51,41 @@
//第三方嵌入id
mchId: '',
//千猪名称
- qianzhuCityName: '重庆市',
- //团油数据
- pelletoilList:''
-
+ qianzhuCityName: '重庆市',
+ //团油数据
+ pelletoilList: ''
+
+ },
+ onLaunch: function() {
+ },
+ onShow: function() {
+ let that = this;
+ uni.getStorage({
+ key: 'openId',
+ success(e) {
+ if (e.data) {
+ that.globalData.openId = e.data;
+ }
+ }
+ })
+ uni.getStorage({
+ key: 'user',
+ success(e) {
+ if (e.data) {
+ that.globalData.userInfo = e.data;
+ }
+ }
+ })
+
+ uni.getStorage({
+ key: 'token',
+ success(e) {
+ if (e.data) {
+ that.globalData.token = e.data;
+ }
+ }
+ })
},
- onLaunch: function() {},
- onShow: function() {},
onHide: function() {}
}
diff --git a/Utils/Api.js b/Utils/Api.js
index 5906773..5e6e2b0 100644
--- a/Utils/Api.js
+++ b/Utils/Api.js
@@ -353,7 +353,12 @@ export const getTPigKFCToken = params => {
//查询城市列表
export const getAllCity = params => {
return POST('GET', `${base}/highThirdParty/getAllCity`, params).then(res => res.data);
-}
+}
+//首页城市选择
+export const findCompanyByCityName = params => {
+ return POST('GET', `${base}/common/findCompanyByCityName`, params).then(res => res.data);
+}
+
//查询肯德基门店列表
export const getKfcStoresList = params => {
return POST('GET', `${base}/highThirdParty/getKfcStoresList`, params).then(res => res.data);
@@ -437,6 +442,11 @@ export const cancelOrderByOrderNo = params => {
* H5 获取用户信息
*/
+//判断是否有手机号
+export const getH5AccessByOpenId = params => {
+ return POST('GET', `${base}/wechat/getH5AccessByOpenId`, params).then(res => res.data);
+}
+
//h5静默登陆
export const loginBySilence = params => {
return POST('GET', `${base}/wechat/loginBySilence`, params).then(res => res.data);
diff --git a/pages/goods/refuel-confirm/refuel-confirm.vue b/pages/goods/refuel-confirm/refuel-confirm.vue
index ad7d419..a78e6b3 100644
--- a/pages/goods/refuel-confirm/refuel-confirm.vue
+++ b/pages/goods/refuel-confirm/refuel-confirm.vue
@@ -266,7 +266,10 @@
onShow() {
let that = this;
// that.paytype = '';
- that.findUser();
+ that.findUser();
+ this.priceValue[1] = 0;
+ this.reload();
+ this.calculatepayPrice();
},
methods: {
findUser() {
@@ -382,7 +385,7 @@
} else {
this.availIntegal = payprice;
this.priceValue[1] = 0;
- }
+ }
this.reload();
this.calculatepayPrice();
},
@@ -486,13 +489,20 @@
url: '/pages/goods/refuel-succes/refuel-succes?id=' +
this.orderNo
});
- } else {
- uni.showToast({
- title: res.return_msg,
- icon: 'none',
- duration: 2000
- });
+ return;
+ }
+ if (res.return_code == '102130') {
+ uni.navigateTo({
+ url: '../../login/updatePas/updatePas'
+ })
+ return;
}
+ uni.showToast({
+ title: res.return_msg,
+ icon: 'none',
+ duration: 2000
+ });
+
})
return;
}
diff --git a/pages/goods/refuel-details/refuel-details.vue b/pages/goods/refuel-details/refuel-details.vue
index c16bace..b083c97 100644
--- a/pages/goods/refuel-details/refuel-details.vue
+++ b/pages/goods/refuel-details/refuel-details.vue
@@ -73,12 +73,13 @@
-
+
@@ -119,8 +120,8 @@
-
-
+
+
@@ -144,6 +145,25 @@
+
+
+
+
+
+
+ {{getCodeText}}
+
+
+
+
+
+ 提示: {{showtoastdes}}
+ 立即登录
+
+
+
+
+
@@ -153,7 +173,10 @@
addOrder,
getDictionaryByCodeTypeOl,
oilPriceDiscountCompute,
- recentGasStation
+ recentGasStation,
+ sendSmsCodeByHw,
+ H5login,
+ getDictionaryByCodeType
} from '../../../Utils/Api.js';
import wybPopup from '../../../components/wyb-popup/wyb-popup.vue';
let app = getApp();
@@ -171,24 +194,24 @@
detailList: [],
gunnumber: [],
user: '',
- amountList: [{
- id: '1',
- price: '200'
- },
- {
- id: '2',
- price: '300'
- },
- {
- id: '3',
- price: '400'
- },
- {
- id: '4',
- price: '500'
- }
+ amountList: [
+ // {
+ // id: '1',
+ // price: '200'
+ // },
+ // {
+ // id: '2',
+ // price: '300'
+ // },
+ // {
+ // id: '3',
+ // price: '400'
+ // },
+ // {
+ // id: '4',
+ // price: '500'
+ // }
],
- inputAmount: '',
store_key: '',
storeList: '',
oilNo: '',
@@ -215,6 +238,14 @@
pricePreferences: '0', //优惠价格
totalPreferences: '0', //本次优惠
locationRef: null, // 用于接收定位对象
+
+ //一键登陆
+ phoneNumber: "",
+ code: '',
+ getCodeText: '获取验证码',
+ getCodeBtnColor: "#ffffff",
+ getCodeisWaiting: false,
+ showtoastdes:'' // 未登陆错误
}
},
onLoad(options) {
@@ -241,10 +272,11 @@
this.getGasDetailByStoreKey();
// #endif
this.getDictionaryByCodeTypeOl();
- this.getDictionaryByCodeTypeMoney();
+ this.getDictionaryByCodeTypeMoney();
+ this.getDictionaryByCodeType();
},
onShow() {
- this.user = app.globalData.userInfo;
+ this.user = app.globalData.userInfo;
},
onUnload() {
if (app.globalData.accountType && app.globalData.accountType == '000000#/') {
@@ -254,7 +286,142 @@
app.globalData.accountType = '';
}
},
- methods: {
+ methods: {
+ //价格
+ //查询油品
+ getDictionaryByCodeType() {
+ let datas = {
+ codeType: 'REFUEL_PRICE'
+ }
+ getDictionaryByCodeType(datas).then(res => {
+ if (res.return_code == '000000') {
+ this.amountList = res.return_data;
+ }
+ })
+ },
+ //一键加油登陆
+ //跳转协议
+ getDocument(item) {
+ uni.navigateTo({
+ url: '../userLogin/agreement/agreement?id=' + item
+ })
+ },
+ Timer() {},
+ getCode() {
+ uni.hideKeyboard()
+
+ if (this.getCodeisWaiting) {
+ return;
+ }
+ if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) {
+ uni.showToast({
+ title: '请填写正确手机号码',
+ icon: "none"
+ });
+ return false;
+ }
+ uni.showLoading({
+ title: '发送中...'
+ })
+ let params = {
+ phone: this.phoneNumber,
+ HWMSG: 3
+ }
+ sendSmsCodeByHw(params).then(res => {
+ uni.hideLoading();
+ if (res.return_code == '000000') {
+ this.getCodeisWaiting = true;
+ this.getCodeBtnColor = "rgba(255,255,255,0.5)"
+ uni.showToast({
+ title: '验证码已发送',
+ icon: "none"
+ });
+ this.setTimer();
+ }
+ })
+ },
+ setTimer() {
+ let holdTime = 60;
+ this.getCodeText = "重新获取(60)"
+ this.Timer = setInterval(() => {
+ if (holdTime <= 0) {
+ this.getCodeisWaiting = false;
+ this.getCodeBtnColor = "#ffffff";
+ this.getCodeText = "获取验证码"
+ clearInterval(this.Timer);
+ return;
+ }
+ this.getCodeText = "重新获取(" + holdTime + ")"
+ holdTime--;
+
+ }, 1000)
+ },
+ doReg() {
+ uni.hideKeyboard();
+ //模板示例部分验证规则
+ if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.phoneNumber))) {
+ uni.showToast({
+ title: '请填写正确手机号码',
+ icon: "none"
+ });
+ return false;
+ }
+ if (!this.code) {
+ uni.showToast({
+ title: '请填写验证码',
+ icon: "none"
+ });
+ return false;
+ }
+ uni.showLoading({
+ title: '提交中...'
+ })
+ let userid = '';
+ if (app.globalData.accountId == '000009&key' || app.globalData.accountId == '0000010&key') {
+ userid = app.globalData.staffCode;
+ }
+ let params = {
+ phone: this.phoneNumber,
+ code: this.code,
+ openId: app.globalData.openId,
+ popularizeUserId: userid,
+ regionId: app.globalData.cityId
+ }
+ H5login(params).then(res => {
+ uni.hideLoading();
+ if (res.return_code == '000000') {
+ app.globalData.userInfo = res.return_data
+ .object
+ .highUser;
+ app.globalData.token = res.return_data.uniqueCode;
+ this.user = res.return_data
+ .object
+ .highUser;
+ uni.setStorage({
+ key: "user",
+ data: res.return_data
+ .object
+ .highUser
+ })
+ uni.setStorage({
+ key: "token",
+ data: res.return_data.uniqueCode
+ })
+ this.$refs.popups.hide();
+ this.postionIng();
+ } else {
+ this.showtoastdes = res.return_msg;
+ uni.showToast({
+ title: res.return_msg,
+ icon: "none",
+ duration:2000
+ });
+ }
+ })
+ },
+ //一件加油
+
+
//前往导航
seeloaction() {
// #ifdef MP
@@ -271,8 +438,12 @@
this.typeId = item;
this.$refs.popup.show();
},
+ showPopuplogin() {
+ this.$refs.popups.show();
+ },
//一键加油
- recentGasStation() {
+ recentGasStation() {
+ this.gunnumber = [];
uni.showLoading({
title: '加载中...'
})
@@ -312,7 +483,8 @@
})
},
//查询详情
- getGasDetailByStoreKey() {
+ getGasDetailByStoreKey() {
+ this.gunnumber = [];
uni.showLoading({
title: '加载中...'
})
@@ -422,19 +594,10 @@
//选择油枪
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.totalPreferences = '0';
this.$refs.popup.hide();
},
select(amount) {
- this.inputMoney = amount.price;
+ this.inputMoney = amount.codeValue;
this.oilPriceDiscountCompute();
},
// H5获取手机号
@@ -537,6 +700,14 @@
*/
postionIng() {
let that = this;
+
+ // #ifdef H5
+ if (app.globalData.accountType && app.globalData.accountType == '000000#/' && !that.user.phone) {
+ that.showPopuplogin();
+ return;
+ }
+ // #endif
+
var c = /^([1-9][0-9]*)+(\.[0-9]{1,2})?$/;
if (that.inputMoney == '' || that.inputMoney < 10 || !(c.test(this.inputMoney))) {
uni.showToast({
@@ -732,7 +903,91 @@
}
-
diff --git a/pages/welcome/welcome.vue b/pages/welcome/welcome.vue
index c79ca7c..ef8084f 100644
--- a/pages/welcome/welcome.vue
+++ b/pages/welcome/welcome.vue
@@ -6,8 +6,9 @@