mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
优化缴费 功能
This commit is contained in:
parent
87171c7a2f
commit
d43d26c230
@ -128,6 +128,8 @@
|
||||
|
||||
// #endif
|
||||
|
||||
import {payFeeApp,payFeeWechat} from '@/api/fee/feeApi.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
vcDiscount,
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user