From 5478746ae1870c552e363b6735eaa121fa9d8f96 Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Mon, 22 Mar 2021 14:34:07 +0800 Subject: [PATCH] 赤峰动态码 --- src/components/dynCodePay.vue | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- src/router/index.js | 14 +++++++------- 2 files changed, 69 insertions(+), 60 deletions(-) diff --git a/src/components/dynCodePay.vue b/src/components/dynCodePay.vue index 51d217d..2119a25 100644 --- a/src/components/dynCodePay.vue +++ b/src/components/dynCodePay.vue @@ -3,23 +3,33 @@

{{carNumber}}

-

{{(arrearageActFee/100).toFixed(2)}}元

+

{{(orderFee/100).toFixed(2)}}元

{{clientBrowser}}支付
@@ -43,19 +53,24 @@ let Base64 = require('js-base64').Base64 -import { aliPay, getOpenId, vxPayQuery, bankH5Pay } from '@/api/orderPay/orderPay' +import {aliPay, getOpenId, vxPayQuery, bankH5Pay} from '@/api/orderPay/orderPay' export default { name: 'dynCodePay', data() { return { carWrapBG: 0, - carNumber: '', + carNumber: '', // 车牌 + parkName: '', // 停车场名称 + inparktime: '', // 入场时间 + outtime: '', // 出场时间 + staytime: '', // 停车时长 + orderFee: '', // 需要支付的费用 arrearageActFee: 0, arrearageDiscFee: 0, arrearageActFee: 0, clientBrowser: '', // 客户端 - paySrcType: '', //支付的类型 101 是本次 103是历史欠费 + paySrcType: 101, //支付的类型 101 是本次 103是历史欠费 orderId: '', //支付的订单 webAppCode: '', // 微信code appOrderTimeout: '', // 超时描述 @@ -63,13 +78,18 @@ export default { }, created() { // this.carWrapBG = this.$route.query.carColor //车牌颜色 - // this.carNumber = this.$route.query.carNumber + this.carNumber = this.$route.query.plateno + this.parkName = this.$route.query.parkName + this.inparktime = this.$route.query.inparktime + this.outtime = this.$route.query.outtime + this.staytime = this.$route.query.staytime + this.orderFee = this.$route.query.orderFee // this.arrearageTotalFee = this.$route.query.arrearageTotalFee // 应收 // this.arrearageDiscFee = this.$route.query.arrearageDiscFee // 优惠 // this.arrearageActFee = this.$route.query.arrearageActFee // 实收 - // this.clientBrowser = this.$utils.clientBrowser() //支付方式 - // this.paySrcType = this.$route.query.paySrcType // 实收 - // this.orderId = this.$route.query.ordeID + this.clientBrowser = this.$utils.clientBrowser() //支付方式 + // this.paySrcType = this.$route.query.codeType // 实收 + this.orderId = this.$route.query.orderId // console.log(this.orderId) // this.appOrderTimeout = this.$route.query.appOrderTimeout // if (this.clientBrowser == "微信") { @@ -80,7 +100,7 @@ export default { methods: { getCode() { var appID = this.$utils.myVxAppId; - alert(appID) + // alert(appID) var code = this.getUrlParam('code'); var local = window.location.href; if (code == null || code === '') { @@ -114,13 +134,13 @@ export default { if (this.clientBrowser == '支付宝') { // 支付宝支付 var aliParams = {}; aliParams.orderId = this.orderId; - aliParams.carNumber = this.carNumber; + // aliParams.carNumber = this.carNumber; aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 aliParams.paySrcType = this.paySrcType;//101停车支付 - aliParams.orgId = this.$utils.myOrgId, - aliParams.backType = 2, - aliParams.recordArreaInfos = JSON.stringify(this.orderId); + // aliParams.orgId = this.$utils.myOrgId, + // aliParams.backType = 2, + // aliParams.recordArreaInfos = JSON.stringify(this.orderId); console.log(aliParams) aliPay(aliParams).then(response => { console.log(response) @@ -133,7 +153,6 @@ export default { }) } - console.log(this.clientBrowser) if (this.clientBrowser == '农行') { // 农行支付 var bankabcParams = {}; bankabcParams.orderId = this.orderId; @@ -149,41 +168,39 @@ export default { bankH5Pay(bankabcParams).then(response => { console.log(response) - if(response.code=='0'){ + if (response.code == '0') { let res = response.data.PaymentURL let _token = res.split('TOKEN=')[1] let OrderNo = response.data.OrderNo - localStorage.setItem('OrderNum',OrderNo) - + localStorage.setItem('OrderNum', OrderNo) - if(window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) { + if (window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) { // alert('当前页面在新容器'); - AlipayJSBridge.call('startApp',{ - appId:'30603024', // 固定值 - param:{ - type:"3", // 3: 掌银内H5页面, - tokenId:_token, //商户传过来的tokenId - paySystem:"", //商户传过来的paySystem, 没有则传空字符串 - payType:"1111", //商户传过来的payType,没有则传'1111' - webviewURL:"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult", //商户传过来的回跳地址 - remark:"其他参数", //扩展备用 - showProgress:'NO', - backBehavior:'back' + AlipayJSBridge.call('startApp', { + appId: '30603024', // 固定值 + param: { + type: "3", // 3: 掌银内H5页面, + tokenId: _token, //商户传过来的tokenId + paySystem: "", //商户传过来的paySystem, 没有则传空字符串 + payType: "1111", //商户传过来的payType,没有则传'1111' + webviewURL: "https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult", //商户传过来的回跳地址 + remark: "其他参数", //扩展备用 + showProgress: 'NO', + backBehavior: 'back' }, - },function(result){ + }, function (result) { }); } else { // alert('当前页面在旧容器'); // 旧支付方式 - window.location.href = 'https://www.abchina.com/luascript/mobilePayLua/'+ encodeURI('{"return":{"tokenID":"'+_token+'","backURL":"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult","payType":""}}'); + window.location.href = 'https://www.abchina.com/luascript/mobilePayLua/' + encodeURI('{"return":{"tokenID":"' + _token + '","backURL":"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult","payType":""}}'); } - }else{ + } else { alert('支付失败') } - // console.log(_token) // let _data = 'method=invokePayFromBrowser&tokenID='+_token // let cryData = CryptoJS.encrypt(_data, 'G9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvM3', 'EkpTEA3FbZFGGq8Y') @@ -196,12 +213,6 @@ export default { }) } - - - - - - if (this.clientBrowser == '微信') { // 微信支付 //第一步获取openid var codeParams = { @@ -226,13 +237,13 @@ export default { let vm = this var wxParams = {}; wxParams.orderId = orderIdData; - wxParams.backType = 2, - wxParams.orgId = this.$utils.myOrgId, + // wxParams.backType = 2, + // wxParams.orgId = this.$utils.myOrgId, wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 - wxParams.carNumber = this.carNumber; - wxParams.paySrcType = this.paySrcType;//101停车支付 - wxParams.recordArreaInfos = JSON.stringify(orderIdData); + // wxParams.carNumber = this.carNumber; + // wxParams.paySrcType = this.paySrcType;//101停车支付 + // wxParams.recordArreaInfos = JSON.stringify(orderIdData); wxParams.openId = openIdData; wxParams.appId = this.$utils.myVxAppId; vxPayQuery(wxParams).then(res => { @@ -288,8 +299,7 @@ export default { ) }, }, - filters: { - } + filters: {} } @@ -332,7 +342,6 @@ export default { .carNumber { padding: 20px 0 10px; font-size: 30px; - color: #fff; text-align: center; } diff --git a/src/router/index.js b/src/router/index.js index 656d34d..91e757a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,7 @@ import Vue from 'vue' import Router from 'vue-router' import plateNumber from '@/components/plateNumber' import parkRecord from '@/components/parkRecord' -import navigation from '@/components/navigation' +import dynCodePay from '@/components/dynCodePay' Vue.use(Router) @@ -11,14 +11,14 @@ export default new Router({ { path: '/', redirect: { - name: 'navigation' + name: 'dynCodePay' } }, - { - path: '/navigation', - name: 'navigation', - component: navigation - }, + // { + // path: '/navigation', + // name: 'navigation', + // component: navigation + // }, { path: '/plateNumber', name: 'plateNumber', -- libgit2 0.21.4