From f894b1b6eb127655b2113197ab565791ed4340ed Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Sun, 17 Oct 2021 01:42:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/user/userApi.js | 24 ++++++++++++++++++++ pages/tempCarFee/tempCarFee.vue | 30 ++++++++++++++++++++++--- pages/tempParkingFee/tempParkingFee.vue | 7 +++--- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/api/user/userApi.js b/api/user/userApi.js index a1cd9da..2727635 100644 --- a/api/user/userApi.js +++ b/api/user/userApi.js @@ -219,3 +219,27 @@ export function queryOwnerAccountDetail(_objData) { }); }) } + +/** + * 刷新用户 + * @param {Object} _objData + */ +export function refreshUserOpenId(_objData){ + return new Promise((resolve, reject) => { + requestNoAuth({ + url: url.queryOwnerAccountDetail, + method: "POST", + data: JSON.stringify(_obj), //动态数据 + success: function(res) { + if (res.statusCode == 200) { + resolve(res); + return; + } + reject(); + }, + fail: function(e) { + reject(); + } + }); + }) +} diff --git a/pages/tempCarFee/tempCarFee.vue b/pages/tempCarFee/tempCarFee.vue index 0d74819..e040023 100644 --- a/pages/tempCarFee/tempCarFee.vue +++ b/pages/tempCarFee/tempCarFee.vue @@ -44,7 +44,8 @@ - + @@ -62,6 +63,12 @@ import { getTempCarFeeOrder } from '../../api/fee/feeApi.js' + import { + isNotNull + } from '../../utils/StringUtil.js' + import { + refreshUserOpenId + } from '../../api/user/userApi.js' export default { data() { return { @@ -70,16 +77,24 @@ stopTimeTotal: 0, inTime: '', amount: 0.0, - queryTime:'' + queryTime: '', + appId: '', + openId: '', }; }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { + this.openId = options.openId; this.paId = options.paId; this.carNum = options.carNum; - this.appId = uni.getStorageSync(constant.mapping.W_APP_ID); + this.appId = options.appId; + if (!isNotNull(this.openId)) { + //刷新 openId + this._refreshWechatOpenId(); + return; + } this._loadTempCarFee(); }, methods: { @@ -156,6 +171,15 @@ }); } }); + }, + _refreshWechatOpenId: function() { + let _redirectUrl = window.location.href; + refreshUserOpenId({ + redirectUrl: _redirectUrl, + wAppId: this.appId + }).then(_data => { + + }); } } }; diff --git a/pages/tempParkingFee/tempParkingFee.vue b/pages/tempParkingFee/tempParkingFee.vue index 67c909b..0a9847a 100644 --- a/pages/tempParkingFee/tempParkingFee.vue +++ b/pages/tempParkingFee/tempParkingFee.vue @@ -79,7 +79,8 @@ index7: "" }, carNum: '', - paId:'' + paId:'', + appId:'' } }, components: { @@ -87,6 +88,7 @@ }, onLoad(options) { this.paId = options.paId; + this.appId = options.appId; }, methods: { showCarNumberKeyboard() { @@ -152,9 +154,8 @@ }) return ; } - uni.navigateTo({ - url:'/pages/tempCarFee/tempCarFee?paId='+_that.paId+'&carNum='+_that.carNum + url:'/pages/tempCarFee/tempCarFee?paId='+_that.paId+'&carNum='+_that.carNum+"&appId="+_that.appId }) }) }