<view class="pushBtn">
<u-button
@click="submitPay"
shape="circle"
:custom-style="customStyle"
:ripple="true"
ripple-bg-color="#909399"
>确定缴费</u-button
>
</view>
submitPay() {
if (this.checked == false) {
this.$u.toast("请选择支付方式");
return;
}
let that = this;
that.form.tradeType = "JSAPI";
that.form.body = "物业缴费";
that.form.outTradeNo = that.paymentDetailsList.outTradeNo; // 微信交易编号
that.form.totalFee = that.paymentDetailsList.waitPayAmount * 100; // 金额
that.$u.api.updateCreateOrder(that.form).then((res) => {
uni.requestPayment({
provider: "wxpay", // 服务提供商
appid: res.data.appid,
timeStamp: res.data.timeStamp, // 时间戳
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.packageValue, // 返回prepay_id 参数值
signType: res.data.signType, // 签名算法
paySign: res.data.paySign, // 签名
success: function (res) {
console.log("success:" + JSON.stringify(res));
uni.showToast({
title: "支付成功",
icon: "none",
mask: true,
duration: 1000,
});
that.goBack();
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
uni.showToast({
title: "支付失败",
icon: "none",
mask: true,
duration: 1000,
});
return;
},
});
});
},