From d43d26c230b06f68df0af9e2544155b641271196 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Fri, 11 Nov 2022 13:17:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=B4=E8=B4=B9=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/payParkingFee/payParkingFee.vue | 154 ++------------------------ pages/roomFee/roomFee.vue | 2 +- 2 files changed, 8 insertions(+), 148 deletions(-) diff --git a/pages/payParkingFee/payParkingFee.vue b/pages/payParkingFee/payParkingFee.vue index c09742b..339c298 100755 --- a/pages/payParkingFee/payParkingFee.vue +++ b/pages/payParkingFee/payParkingFee.vue @@ -127,6 +127,8 @@ const WexinPayFactory = require('../../factory/WexinPayFactory.js'); // #endif + + import {payFeeApp,payFeeWechat} from '@/api/fee/feeApi.js'; export default { components: { @@ -271,11 +273,8 @@ }, _payWxApp: function(_data) { let _receivedAmount = this.receivableAmount; - wx.showLoading({ - title: '支付中' - }); let _tradeType = 'APP'; - let _objData = { + payFeeApp(this,{ cycles: this.feeMonth, communityId: this.communityId, feeId: this.feeId, @@ -287,85 +286,14 @@ selectUserAccount: this.selectUserAccount, // 选中的账户 accountAmount: this.accountAmount, // 账户金额 deductionAmount: this.deductionAmount, // 抵扣金额 - }; - context.request({ - url: constant.url.preOrder, - header: context.getHeaders(), - method: "POST", - data: _objData, - //动态数据 - success: function(res) { - - if (res.statusCode == 200 && res.data.code == '0') { - let data = res.data; //成功情况下跳转 - let obj = { - appid: data.appId, - noncestr: data.nonceStr, - package: 'Sign=WXPay', // 固定值,以微信支付文档为主 - partnerid: data.partnerid, - prepayid: data.prepayid, - timestamp: data.timeStamp, - sign: data.sign // 根据签名算法生成签名 - } - // 第二种写法,传对象字符串 - let orderInfo = JSON.stringify(obj) - uni.requestPayment({ - provider: 'wxpay', - orderInfo: orderInfo, //微信、支付宝订单数据 - success: function(res) { - // uni.showToast({ - // title: "支付成功", - // duration: 2000 - // }); - // uni.navigateBack({}); - uni.navigateTo({ - url:"/pages/successPage/successPage?msg=支付成功&objType=3003" - }) - }, - fail: function(err) { - console.log('fail:' + JSON.stringify(err)); - } - }); - wx.hideLoading(); - return; - } - if (res.statusCode == 200 && res.data.code == '100') { - let data = res.data; //成功情况下跳转 - uni.showToast({ - title: "支付成功", - duration: 2000 - }); - setTimeout(function(){ - uni.navigateBack({}); - },2000) - - return; - } - - wx.hideLoading(); - wx.showToast({ - title: "缴费失败", - icon: 'none', - duration: 2000 - }); - }, - fail: function(e) { - wx.hideLoading(); - wx.showToast({ - title: "服务器异常了", - icon: 'none', - duration: 2000 - }); - } }); }, onPayFee: function() { let _receivedAmount = this.receivableAmount; - wx.showLoading({ - title: '支付中', - }); let _tradeType = 'JSAPI'; - let _objData = { + + payFeeWechat(this,{ + business: "payFee", cycles: this.feeMonth, communityId: this.communityId, feeId: this.feeId, @@ -380,75 +308,7 @@ payerObjId: this.payerObjId, payerObjType: this.payerObjType, userId: this.userId, - } - - context.request({ - url: constant.url.preOrder, - header: context.getHeaders(), - method: "POST", - data: _objData, //动态数据 - success: function(res) { - if (res.statusCode == 200 && res.data.code == '0') { - let data = res.data; - // #ifdef MP-WEIXIN - uni.requestPayment({ - 'timeStamp': data.timeStamp, - 'nonceStr': data.nonceStr, - 'package': data.package, - 'signType': data.signType, - 'paySign': data.sign, - 'success': function(res) { - uni.showToast({ - title: "支付成功", - duration: 2000 - }); - uni.navigateBack({}); - }, - 'fail': function(res) { - console.log('fail:' + JSON.stringify(res)); - } - }); - // #endif - // #ifdef H5 - WexinPayFactory.wexinPay(data, function() { - uni.showToast({ - title: "支付成功", - duration: 2000 - }); - uni.navigateBack({}); - }); - // #endif - wx.hideLoading(); - return; - } - if (res.statusCode == 200 && res.data.code == '100') { - let data = res.data; //成功情况下跳转 - uni.showToast({ - title: "支付成功", - duration: 2000 - }); - setTimeout(function(){ - uni.navigateBack({}); - },2000) - - return; - } - uni.hideLoading(); - uni.showToast({ - title: "缴费失败", - icon: 'none', - duration: 2000 - }) - }, - fail: function(e) { - uni.hideLoading(); - uni.showToast({ - title: "服务器异常了", - icon: 'none', - duration: 2000 - }) - } - }); + }) } } }; diff --git a/pages/roomFee/roomFee.vue b/pages/roomFee/roomFee.vue index 3a13976..52a3299 100755 --- a/pages/roomFee/roomFee.vue +++ b/pages/roomFee/roomFee.vue @@ -166,7 +166,7 @@ dateSubOneDay } from '../../lib/java110/utils/DateUtil.js'; - import {payFeeApp} from '@/api/fee/feeApi.js'; + import {payFeeApp,payFeeWechat} from '@/api/fee/feeApi.js'; export default { components: {