From 42d99196469776abbf8bd43490a12ccaf46019c4 Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Thu, 22 Apr 2021 10:27:05 +0800 Subject: [PATCH] 赤峰小票码 -- 微信支付完成后的跳转 --- src/components/orderPay.vue | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------- src/components/parkRecord.vue | 54 ++++++++++++++++++++++++++++++------------------------ src/components/plateNumber.vue | 58 +++++++++++++++++++++++++++++----------------------------- 3 files changed, 203 insertions(+), 177 deletions(-) diff --git a/src/components/orderPay.vue b/src/components/orderPay.vue index a96aa88..e3d9f35 100644 --- a/src/components/orderPay.vue +++ b/src/components/orderPay.vue @@ -208,22 +208,27 @@ export default { if (this.clientBrowser == '微信') { // 微信支付 - //第一步获取openid - var codeParams = { - code: this.webAppCode, - appId: this.$utils.myVxAppId - }; - getOpenId(codeParams).then(res => { - if (res.code == 0) { - me.vxPay(res.data, this.orderId) - } else if (res.code == 40163) { //code been used, hints[重复code问题] - alert('请重新扫码') - console.log(res.message); - } else { - alert('请重新扫码') - } - }) - + let _openId = sessionStorage.getItem('openIdData') + if(_openId){ + me.vxPay(_openId, this.orderId) + }else { + //第一步获取openid + var codeParams = { + code: this.webAppCode, + appId: this.$utils.myVxAppId + }; + getOpenId(codeParams).then(res => { + if (res.code == 0) { + me.vxPay(res.data, this.orderId) + sessionStorage.setItem('openIdData', res.data) + } else if (res.code == 40163) { //code been used, hints[重复code问题] + alert('请重新扫码重复code问题') + console.log(res.message); + } else { + alert('请重新扫码') + } + }) + } } }, @@ -265,125 +270,140 @@ export default { } }) }, - onBridgeReady(params) { - let me = this - console.log('调用微信支付WeixinJSBridge') - WeixinJSBridge.invoke( - 'getBrandWCPayRequest', params, - // - // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 - // 'appId': data.appId, // 公众号名称,由商户传入 - // 'timeStamp': data.timeStamp, // 时间戳 - // 'nonceStr': data.nonceStr, // 随机串 - // 'package': data.package, // 预支付id - // 'signType': data.signType, // 微信签名方式 - // 'paySign': data.paySign // 微信签名 - // }, - function (res) { - // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 - if (res.err_msg === 'get_brand_wcpay_request:ok') { - console.log('成功') - var salt = me.$utils.myCommonSalt(32); - let wxparams = { - pageNum: 1, - pageSize: 10000, - parkState: 10, - terminalSource: 7, - carNumber: me.carNumber, - app_id: me.$utils.myVarAppid, - deviceInfo: me.$utils.myDeviceInfo, - salt: salt, - sign_type: "md5", - token:'', - } - wxparams.sign = me.$utils.signObject(wxparams) - queryParkingRecordPageByCarNumbers(wxparams).then(response => { - console.log(response) - me.parkList = response.data.dataList - - if(me.parkList.length == 0){ - me.$router.push({ - path:'parkRecord', - query:{ - carNumber: me.carNumber, - carNumberColor: me.carWrapBG, - parkFlag: 0 // 0表示在停 1表示历史 - } - }) + onBridgeReady(params) { + let me = this + console.log('调用微信支付WeixinJSBridge') + WeixinJSBridge.invoke( + 'getBrandWCPayRequest', params, + // + // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 + // 'appId': data.appId, // 公众号名称,由商户传入 + // 'timeStamp': data.timeStamp, // 时间戳 + // 'nonceStr': data.nonceStr, // 随机串 + // 'package': data.package, // 预支付id + // 'signType': data.signType, // 微信签名方式 + // 'paySign': data.paySign // 微信签名 + // }, + function (res) { + // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 + if (res.err_msg === 'get_brand_wcpay_request:ok') { + console.log('成功') + var salt = me.$utils.myCommonSalt(32); + let wxparams = { + pageNum: 1, + pageSize: 10000, + parkState: 10, + terminalSource: 7, + carNumber: me.carNumber, + app_id: me.$utils.myVarAppid, + deviceInfo: me.$utils.myDeviceInfo, + salt: salt, + sign_type: "md5", + token:'', } - - me.parkingData = me.parkList.filter(item => { - return item.parkState == '10' - }) - console.log(me.parkingData) - me.historyList = me.parkList.filter(item => { - return item.parkState == '20' - }) - console.log(me.historyList) - if(me.parkingData.length>0){ - MessageBox.confirm('', { - message: '您当前有在停订单 是否立即支付?', - title: '温馨提示', - confirmButtonText: '去支付', - cancelButtonText: '取消' - }).then(action => { - if (action == 'confirm') { //确认的回调 - console.log('确定'); - me.$router.push({ - path:'parkRecord', - query:{ - carNumber: me.carNumber, - carNumberColor: me.carWrapBG, - parkFlag: 0 // 0表示在停 1表示历史 + wxparams.sign = me.$utils.signObject(wxparams) + queryParkingRecordPageByCarNumbers(wxparams).then(response => { + console.log(response) + me.parkList = response.data.dataList + + // alert(JSON.stringify(me.parkList)) + // alert(me.parkList.length) + if(me.parkList.length == 0){ + me.$router.push({ + path:'parkRecord', + query:{ + carNumber: me.carNumber, + carNumberColor: me.carWrapBG, + parkFlag: 0 // 0表示在停 1表示历史 + } + }) + + }else{ + me.parkingData = me.parkList.filter(item => { + return item.parkState == '10' + }) + console.log(me.parkingData) + me.historyList = me.parkList.filter(item => { + return item.parkState == '20' + }) + console.log(me.historyList) + + if(me.historyList.length>0){ + MessageBox.confirm('', { + message: '您当前有历史欠费 是否立即补缴?', + title: '温馨提示', + confirmButtonText: '去补缴', + cancelButtonText: '取消' + }).then(action => { + if (action == 'confirm') { //确认的回调 + console.log('确定'); + me.$router.push({ + path:'parkRecord', + query:{ + carNumber: me.carNumber, + carNumberColor: me.carWrapBG, + parkFlag: 1 // 0表示在停 1表示历史 + } + }) } - }) - } - }).catch(err => { - if (err == 'cancel') { //取消的回调 - console.log('取消'); - } - }); - } - - if(me.parkingData.length==0&&me.historyList.length>0){ - MessageBox.confirm('', { - message: '您当前有历史欠费 是否立即补缴?', - title: '温馨提示', - confirmButtonText: '去补缴', - cancelButtonText: '取消' - }).then(action => { - if (action == 'confirm') { //确认的回调 - console.log('确定'); - me.$router.push({ - path:'parkRecord', - query:{ - carNumber: me.carNumber, - carNumberColor: me.carWrapBG, - parkFlag: 1 // 0表示在停 1表示历史 + }).catch(err => { + if (err == 'cancel') { //取消的回调 + console.log('取消'); } - }) - } - }).catch(err => { - if (err == 'cancel') { //取消的回调 - console.log('取消'); + }); + }else{ + + if(me.paySrcType==101){ //缴费了本次 + me.$router.push({ + path:'parkRecord', + query:{ + carNumber: me.carNumber, + carNumberColor: me.carWrapBG, + parkFlag: 0 // 0表示在停 1表示历史 + } + }) + }else{ + MessageBox.confirm('', { + message: '您当前有在停订单 是否立即支付?', + title: '温馨提示', + confirmButtonText: '去支付', + cancelButtonText: '取消' + }).then(action => { + if (action == 'confirm') { //确认的回调 + console.log('确定'); + me.$router.push({ + path:'parkRecord', + query:{ + carNumber: me.carNumber, + carNumberColor: me.carWrapBG, + parkFlag: 0 // 0表示在停 1表示历史 + } + }) + } + }).catch(err => { + if (err == 'cancel') { //取消的回调 + console.log('取消'); + } + }); + } + } - }); - } + } - }) + }) - } else { - console.log('失败') - alert('支付失败') - me.$router.go(-2); + } else { + console.log('失败') + alert('支付失败') + me.$router.go(-2); + } } - } - ) - }, + ) + }, }, filters: { } diff --git a/src/components/parkRecord.vue b/src/components/parkRecord.vue index dc54ee4..db2dd58 100644 --- a/src/components/parkRecord.vue +++ b/src/components/parkRecord.vue @@ -113,24 +113,24 @@ 暂无记录 - -
-
-

请至少选择一笔记录

-
-
- 知道了 -
- - - -
-
-

停车15分钟内无需缴费,申请成功。

-
-
- 知道了 -
+ + + + + + + + + + + + + + + + + + @@ -207,13 +207,18 @@ export default { this.historyList = this.parkList.filter(item => { return item.parkState == '20' }) - if(this.parkingData.length==0&&this.historyList.length>0){ - this.currentTabActive = 1 - } - this.historyList.forEach(i => { + this.historyList.forEach( i => { this.allMoney += Number(i.unPayFee) }) + if(this.parkingData.length==0 && this.historyList.length>0){ + this.currentTabActive = 1 + } + + if(this.$route.query.parkFlag == 1){ + this.currentTabActive = 1 + this.checkedAll() + } console.log(this.historyList) }) }, @@ -317,7 +322,7 @@ export default { } else { //$('.dialog-out').show() - this.$refs.zeroAlert.open() + this.$msgbox('提示', '停车15分钟内无需缴费,申请成功。') } }) @@ -325,7 +330,8 @@ export default { }, toPayHisroryPage() { // 缴纳历史费用 if (this.historyCheckedLen == 0) { - this.$refs.alert.open() + this.$msgbox('提示', '请至少选择一条记录') + return } var salt = this.$utils.myCommonSalt(32); diff --git a/src/components/plateNumber.vue b/src/components/plateNumber.vue index 677f85d..c72f892 100644 --- a/src/components/plateNumber.vue +++ b/src/components/plateNumber.vue @@ -165,41 +165,41 @@ -
- -
- - + + +
+ +
-
-
- -
-
- -
-
- -
+ + + + + + + + + + + -
- -
+ + + -
-
-
-
-
-
-
-
-
+ + + + + + + + +
@@ -315,7 +315,7 @@ export default { _4: ['H', 'J', 'K', 'L', 'M', 'N', 'O'], _5: ['P', 'Q', 'R', 'S', 'T', 'U', 'V'], _6: ['W', 'X', 'Y', 'Z'], - // _7: ['港', '澳', '学', '领', '警'] + _7: ['港', '澳', '学', '领', '警'] }, activeKeyWordIndex: 1, // 当前车牌号 keyBoardStatus: false, -- libgit2 0.21.4