优化缴费 功能

This commit is contained in:
wuxw 2022-11-11 13:17:59 +08:00
parent 87171c7a2f
commit d43d26c230
2 changed files with 8 additions and 148 deletions

View File

@ -128,6 +128,8 @@
// #endif // #endif
import {payFeeApp,payFeeWechat} from '@/api/fee/feeApi.js';
export default { export default {
components: { components: {
vcDiscount, vcDiscount,
@ -271,11 +273,8 @@
}, },
_payWxApp: function(_data) { _payWxApp: function(_data) {
let _receivedAmount = this.receivableAmount; let _receivedAmount = this.receivableAmount;
wx.showLoading({
title: '支付中'
});
let _tradeType = 'APP'; let _tradeType = 'APP';
let _objData = { payFeeApp(this,{
cycles: this.feeMonth, cycles: this.feeMonth,
communityId: this.communityId, communityId: this.communityId,
feeId: this.feeId, feeId: this.feeId,
@ -287,85 +286,14 @@
selectUserAccount: this.selectUserAccount, // selectUserAccount: this.selectUserAccount, //
accountAmount: this.accountAmount, // accountAmount: this.accountAmount, //
deductionAmount: this.deductionAmount, // 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() { onPayFee: function() {
let _receivedAmount = this.receivableAmount; let _receivedAmount = this.receivableAmount;
wx.showLoading({
title: '支付中',
});
let _tradeType = 'JSAPI'; let _tradeType = 'JSAPI';
let _objData = {
payFeeWechat(this,{
business: "payFee",
cycles: this.feeMonth, cycles: this.feeMonth,
communityId: this.communityId, communityId: this.communityId,
feeId: this.feeId, feeId: this.feeId,
@ -380,75 +308,7 @@
payerObjId: this.payerObjId, payerObjId: this.payerObjId,
payerObjType: this.payerObjType, payerObjType: this.payerObjType,
userId: this.userId, 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
})
}
});
} }
} }
}; };

View File

@ -166,7 +166,7 @@
dateSubOneDay dateSubOneDay
} from '../../lib/java110/utils/DateUtil.js'; } from '../../lib/java110/utils/DateUtil.js';
import {payFeeApp} from '@/api/fee/feeApi.js'; import {payFeeApp,payFeeWechat} from '@/api/fee/feeApi.js';
export default { export default {
components: { components: {