From 2096b812d2fb86bfaf6b93cbb97b4c713b094b7a Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Fri, 3 Jan 2020 14:13:44 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=81=9C=E8=BD=A6][=E6=95=B4=E7=90=86]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ext.json | 9 ++-- index/passCar.js | 114 ++++++++++++++++++++++++++++++++++----------- index/passCar.wxml | 14 ++++-- 3 files changed, 103 insertions(+), 34 deletions(-) diff --git a/ext.json b/ext.json index de86e65..15f463a 100644 --- a/ext.json +++ b/ext.json @@ -18,13 +18,16 @@ "car": { "etcp": { "etcpAppId": "wxc07f9d67923d676d", - "etcpCallbackUrl": "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback" + "etcpCallbackUrl": "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback", + "payPath": "pages/pay/order-pay-open/main" }, "tjd": { - "tjdAppId": "wx6945d1bda68d7993" + "tjdAppId": "wx6945d1bda68d7993", + "payPath": "" }, "bolink": { - "bolinkAppId": "wxbd08b4baa10fcc1d" + "bolinkAppId": "wxbd08b4baa10fcc1d", + "payPath": "pages/park/park" }, "version": "release" }, diff --git a/index/passCar.js b/index/passCar.js index c356f47..a390935 100644 --- a/index/passCar.js +++ b/index/passCar.js @@ -207,21 +207,22 @@ Page({ console.log(res) }, gotoCarMini: function (e) { + var that = this // etcp parkVendor1 // 泊链停车 parkVendor5 if (e.target.dataset.flag == 'parkVendor1'){ wx.navigateToMiniProgram({ - appId: this.data.etcpAppId, - extraData: this.data.extraData, - envVersion: 'release', - path: "pages/pay/order-pay-open/main", + appId: that.data.etcpAppId, + extraData: that.data.extraData, + envVersion: that.data.carMiniVersion, + path: that.data.payPath }) } else if (e.target.dataset.flag == 'parkVendor5'){ wx.navigateToMiniProgram({ - appId: 'wxbd08b4baa10fcc1d', - extraData: this.data.extraData, - envVersion: 'release', - path: "pages/park/park", + appId: that.data.bolinkAppId, + extraData: that.data.extraData, + envVersion: that.data.carMiniVersion, + path: that.data.payPath }) } }, @@ -246,9 +247,10 @@ Page({ } var that = this; that.setData({ - etcpAppId: extConfig.attr.etcpAppId, - etcpVersion: extConfig.attr.etcpVersion, - etcpCallbackUrl: extConfig.attr.etcpCallbackUrl, + etcpAppId: extConfig.attr.car.etcp.etcpAppId, + carMiniVersion: extConfig.attr.car.version, + etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, + payPath: extConfig.attr.car.etcp.payPath, ifHaveCarModular: extConfig.attr.ifHaveCarModular }) if (app.globalData.token) { @@ -447,25 +449,33 @@ Page({ var that = this; /** * etcp - */ - var etcpData = { + */ + var postCouponData = { etcpToken: app.globalData.etcpToken, carNumber: that.data.listCardNum, couponOrderId: quanid }; - /** - * 停简单 - */ - var tjdData = { - carNumber: that.data.listCardNum - }; - var postCouponData = app.globalData.parkVendor == 1 ? etcpData : tjdData; + if (app.globalData.parkVendor == 2) { + // 停简单 + postCouponData = { + carNumber: that.data.listCardNum + } + } if (app.globalData.parkVendor == 4){ + // 尚安 postCouponData = { carNumber: that.data.listCardNum, couponOrderId: quanid } } + if (app.globalData.parkVendor == 5) { + // 泊链 + postCouponData = { + carNumber: that.data.listCardNum, + orderId: that.data.bolinkOrderId, + couponOrderId: quanid + } + } Http.post({ url: config.api.getCarCoupon, data: postCouponData @@ -618,10 +628,10 @@ Page({ etcpToken: app.globalData.etcpToken, carNumber: carNum }; - var tjdData = { + var otherData = { carNumber: carNum }; - var postData = app.globalData.parkVendor == 1 ? etcpData : tjdData; + var postData = app.globalData.parkVendor == 1 ? etcpData : otherData; Http.post({ url: config.api.bindCar, data: postData @@ -662,6 +672,38 @@ Page({ }) if (res.data){ app.globalData.parkVendor = res.data.vendorType; + if (app.globalData.parkVendor == 1) { + console.log("payPath: " + extConfig.attr.car.etcp.payPath) + // etcp + that.setData({ + parkVendor: app.globalData.parkVendor, + etcpAppId: extConfig.attr.car.etcp.etcpAppId, + carMiniVersion: extConfig.attr.car.version, + etcpCallbackUrl: extConfig.attr.car.etcp.etcpCallbackUrl, + payPath: extConfig.attr.car.etcp.payPath + }) + } else if (app.globalData.parkVendor == 2) { + // TJD + var vendorObj = JSON.parse(res.data.vendorParams) + that.setData({ + parkVendor: app.globalData.parkVendor, + tjdAppId: extConfig.attr.car.tjd.tjdAppId, + carMiniVersion: extConfig.attr.car.version, + payPath: extConfig.attr.car.tjd.payPath + }) + } else if (app.globalData.parkVendor == 5) { + // 泊链 + var vendorObj = JSON.parse(res.data.vendorParams) + console.log("payPath: " + extConfig.attr.car.bolink.payPath) + that.setData({ + parkVendor: app.globalData.parkVendor, + bolinkAppId: extConfig.attr.car.bolink.bolinkAppId, + carMiniVersion: extConfig.attr.car.version, + payPath: extConfig.attr.car.bolink.payPath, + bolinkComId: vendorObj.comid, + bolinkUnionId: vendorObj.union_id + }) + } } }) .catch(err => { @@ -751,7 +793,7 @@ Page({ }) .then(res => { console.log(res) - if(app.globalData.parkVendor == 1){ + if(app.globalData.parkVendor == 1){ // ETCP var extraDataStr = { params: { token: app.globalData.etcpToken, @@ -769,17 +811,35 @@ Page({ stopFees: res.data, timecha: Util.timecha(res.data.exitTime, res.data.entranceTime) }); - } else if (app.globalData.parkVendor == 5) { + } else if (app.globalData.parkVendor == 2) { // TJD // TODO + var extraDataStr = { + prePayType: that.data.prePayType, + channel: res.data.channel, + isShowDetail: true, + orderId: res.data.orderId + } + that.setData({ + parkVendor: app.globalData.parkVendor, + extraData: extraDataStr, + stopFees: { + orderId: res.data.orderId, + entranceTime: res.data.start_time, + remainingFee: res.data.money + }, + timecha: res.data.duration + }); + } else if (app.globalData.parkVendor == 5) { // BoLink var extraDataStr = { - union_id: '200389', + union_id: that.data.bolinkUnionId, order_id: res.data.order_id, - park_id: "30536", + park_id: that.data.bolinkComId, plate_number: res.data.plate_number, money: res.data.money, park_name: res.data.park_name } that.setData({ parkVendor: app.globalData.parkVendor, + bolinkOrderId: res.data.order_id, extraData: extraDataStr, stopFees: { orderId: res.data.order_id, @@ -789,8 +849,6 @@ Page({ timecha: res.data.duration }); } - - that.setData({ scroll: true diff --git a/index/passCar.wxml b/index/passCar.wxml index 85ba03b..289a105 100644 --- a/index/passCar.wxml +++ b/index/passCar.wxml @@ -45,15 +45,23 @@ 待缴费用: {{stopFees.remainingFee}}元 - + - + 立即支付 立即支付 + + + + 立即支付 + + 立即支付 + + - + 立即支付 立即支付