From e36341f1ec89a315b577eebed5d7705ffaace622 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Mon, 27 Jan 2020 22:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=8C=E6=88=90=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E8=BD=A6=E7=BC=B4=E8=B4=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constant/UrlConstant.js | 10 ++- pages/tempParkingFeePay/tempParkingFeePay.js | 84 +++++++++++++++++--- 2 files changed, 80 insertions(+), 14 deletions(-) diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index fe46ba0..fbe5276 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -71,9 +71,15 @@ const queryFeeByParkingSpace = baseUrl+"app/fee.queryFeeByParkingSpace"; //查询物业费用 const queryFeeByOwner = baseUrl + "app/fee.queryFee"; +//查询车辆进场费用 +const queryFeeByCarInout = baseUrl + "app/fee.queryFeeByCarInout"; + //预下单 const preOrder = baseUrl +"/app/payment/toPay"; +//临时车缴费 +const preOrderTempCarInout = baseUrl + "/app/payment/toPayTempCarInout"; + //查询小区 const listCommunitys = baseUrl + "/app/community.listCommunitys"; @@ -125,5 +131,7 @@ module.exports = { listAdvertPhoto: listAdvertPhoto, listMyRepair: listMyRepair, listCarIn: listCarIn, - queryConfigFee: queryConfigFee + queryConfigFee: queryConfigFee, + queryFeeByCarInout: queryFeeByCarInout, + preOrderTempCarInout: preOrderTempCarInout }; \ No newline at end of file diff --git a/pages/tempParkingFeePay/tempParkingFeePay.js b/pages/tempParkingFeePay/tempParkingFeePay.js index 134a473..d6dae8b 100644 --- a/pages/tempParkingFeePay/tempParkingFeePay.js +++ b/pages/tempParkingFeePay/tempParkingFeePay.js @@ -17,7 +17,8 @@ Page({ squarePrice:'', money:0.00, ingTime:'', - inoutId:'' + inoutId:'', + feeId:'' }, /** @@ -38,7 +39,7 @@ Page({ ingTime: _ingTime }); - this._loadTempParkingFeeConfig(); + this._loadTempParkingFee(); }, /** @@ -92,15 +93,15 @@ Page({ onPayFee:function(){ }, - _loadTempParkingFeeConfig:function(){ + _loadTempParkingFee:function(){ let _that = this; let _objData = { communityId: this.data.communityId, - feeTypeCd: '888800010007' + state: '2008001', + inoutId: this.data.inoutId } - context.request({ - url: constant.url.queryConfigFee, + url: constant.url.queryFeeByCarInout, header: context.getHeaders(), method: "GET", data: _objData, //动态数据 @@ -108,15 +109,14 @@ Page({ console.log("请求返回信息:", res); if (res.statusCode == 200) { //let _carInouts = res.data.carInouts; - let tempParkingSpaceFeeConfig = res.data[0]; - + let tempParkingSpaceFeeConfig = res.data; _that.setData({ additionalAmount: tempParkingSpaceFeeConfig.additionalAmount, - squarePrice: tempParkingSpaceFeeConfig.squarePrice - + squarePrice: tempParkingSpaceFeeConfig.squarePrice, + feeId: tempParkingSpaceFeeConfig.feeId, }); - - return ; + + return; } wx.showToast({ title: "服务器异常了", @@ -132,6 +132,64 @@ Page({ }) } }) - + }, + onPayFee: function () { + let _receivedAmount = this.data.money / 100; + wx.showLoading({ + title: '支付中', + }); + let _objData = { + communityId: this.data.communityId, + feeId: this.data.feeId, + feeName: this.data.carNum+'临时停车费', + receivedAmount: _receivedAmount + } + + context.request({ + url: constant.url.preOrderTempCarInout, + header: context.getHeaders(), + method: "POST", + data: _objData, //动态数据 + success: function (res) { + console.log(res); + if (res.statusCode == 200 && res.data.code == '0') { + let data = res.data; + //成功情况下跳转 + wx.requestPayment({ + 'timeStamp': data.timeStamp, + 'nonceStr': data.nonceStr, + 'package': data.package, + 'signType': data.signType, + 'paySign': data.sign, + 'success': function (res) { + wx.showToast({ + title: "支付成功", + duration: 2000 + }); + wx.navigateBack({}); + }, + 'fail': function (res) { + console.log('fail:' + JSON.stringify(res)); + } + }); + wx.hideLoading(); + return; + } + wx.hideLoading(); + wx.showToast({ + title: "缴费失败", + icon: 'none', + duration: 2000 + }) + }, + fail: function (e) { + wx.hideLoading(); + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + } + }); } }) \ No newline at end of file