bc3b464349
微信小程序 host-bridge 与 shell 文件改为职责命名 移动壳 host-bridge 与 shell 文件改为职责命名 更新原生壳结构门禁、微信 smoke 和宿主壳文档
43 lines
937 B
JavaScript
43 lines
937 B
JavaScript
/* global wx */
|
|
|
|
const {
|
|
notifyPreviousWebView,
|
|
parsePayParams,
|
|
requestWechatPayment,
|
|
} = require('../host-bridge/payment');
|
|
|
|
function createWechatPayPage(pageContext) {
|
|
return {
|
|
data: {
|
|
title: '正在拉起支付',
|
|
errorMessage: '',
|
|
},
|
|
|
|
async onLoad(query) {
|
|
const requestId = String(query.requestId || '');
|
|
const orderId = String(query.orderId || '');
|
|
const payParams = parsePayParams(query.payParams);
|
|
if (!requestId || !payParams) {
|
|
const page = pageContext ?? this;
|
|
page.setData({
|
|
title: '支付失败',
|
|
errorMessage: '缺少支付参数。',
|
|
});
|
|
return;
|
|
}
|
|
|
|
const payResult = await requestWechatPayment(payParams);
|
|
notifyPreviousWebView(requestId, orderId, payResult);
|
|
wx.navigateBack();
|
|
},
|
|
|
|
handleBack() {
|
|
wx.navigateBack();
|
|
},
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
createWechatPayPage,
|
|
};
|