天使童装微信小程序支付

本文介绍了在微信小程序中实现支付功能的详细步骤,包括创建订单、检查用户余额、调用微信支付接口以及处理支付成功和失败的情况。通过示例代码展示了如何在天使童装小程序中使用余额支付或微信支付,并提供了支付失败后的错误处理和订单列表跳转逻辑。
摘要由CSDN通过智能技术生成

coupons,//优惠券

couponAmount: res.data.couponAmount //优惠金额

});

that.data.pageIsEnd = false

return;

}

//创建订单后的操作

that.processAfterCreateOrder(res)

})

//创建订单后的操作

async processAfterCreateOrder(res) {

// 直接弹出支付,取消支付的话,去订单列表

const balance = this.data.balance

if (balance || res.data.amountReal*1 == 0) {

// 有余额

const money = (res.data.amountReal * 1 - balance*1).toFixed(2)

if (money <= 0) {

// 余额足够

wx.showModal({

title: ‘请确认支付’,

content: 您当前可用余额¥${balance},使用余额支付¥${res.data.amountReal}?,

confirmText: “确认支付”,

cancelText: “暂不付款”,

success: res2 => {

if (res2.confirm) {

// 使用余额支付,传token,和订单id

WXAPI.orderPay(wx.getStorageSync(‘token’), res.data.id).then(res3 =&

  • 26
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值