- 提交订单,后端返回 重要数据 包含 appid ,时间戳 一些 (把数据 JSON.parse处理一下)
- 调起内置支付
后端返回的数据格式 是string 先转换为 对象
orderString: "{"result":1,"error_msg":"success","order_info":{"order_no":"123032010886493080435","order_info_token":"ChJrc01wUGF5Lm9yZGVyVG9rZW4SUAN0H69V8zDxXRhbi4197tnTwpnqsL5CP5AW9o0G3awDas76smk8MbrpNsjfsKcdsnjOpgumRTSGNvyLP4jPYMJTxbSuRXziT8xzRZPGQEceGhJWpWd9TLPYWCbXad2vn_QSiXkiIC79ZTRuXo7hvdcBjt_-3vX1WGtbZ0JXv8_ztO_g6KOYKAUwAQ"}}"
调用内置支付 具体写法
// #ifdef MP-KUAISHOU
that.kspay(JSON.parse(res.orderString));
// #endif
kspay(orderString){
let _this = this;
ks.pay({
serviceId: '1',
orderInfo: orderString.order_info,
success:function success(res) {
uni.showToast({
title: '支付成功',
icon: 'none'
});
_this.showPay = false;
},
fail:function fail(res) {
console.log(res)
_this.showPay = false;
uni.showToast({
title: '支付失败',
icon: 'none'
})
},
complete:function complete(res) {
console.log(res)
}
});
},