liiistem-miniapp/pages/pay/pay.js

39 lines
900 B
JavaScript
Raw Normal View History

2025-09-16 13:41:49 +08:00
import R from '../../utils/request';
import C from '../../utils/constant';
import * as F from '../../utils/func';
Page({
data: {
},
onLoad(options) {
const { order_no, redirect_url } = options;
R.post('/index.php/api/v1/pay_order_shop', { order_no }).then(({ model }) => {
wx.requestPayment({
...model,
success(res) {
wx.showToast({
title: '支付成功',
icon: 'success',
duration: 2000,
success() {
wx.redirectTo({
url: '/pages/shop/shop?path=user',
});
}
})
},
fail(res) {
wx.showToast({
title: '支付失败',
icon: 'none',
duration: 2000
})
wx.redirectTo({
url: '/pages/shop/shop?path=user',
});
}
})
})
},
})