58 lines
1.1 KiB
JavaScript
58 lines
1.1 KiB
JavaScript
|
|
/**
|
|
* Web唐明明
|
|
* 匆匆数载恍如梦,岁月迢迢华发增。
|
|
* 碌碌无为枉半生,一朝惊醒万事空。
|
|
* moduleName: 收银
|
|
*/
|
|
|
|
class cashierPay{
|
|
constructor() {
|
|
|
|
}
|
|
pay(platform, orderInfo){
|
|
if(!platform){
|
|
uni.showToast({
|
|
title: '缺少必要参数:支付平台类型',
|
|
icon : 'none'
|
|
})
|
|
return
|
|
}
|
|
if(!orderInfo){
|
|
uni.showToast({
|
|
title: '缺少必要参数:支付参数不能为空',
|
|
icon : 'none'
|
|
})
|
|
return
|
|
}
|
|
return new Promise((resolve, reject) => {
|
|
|
|
console.log(platform)
|
|
console.log(orderInfo)
|
|
uni.requestPayment({
|
|
provider : platform,
|
|
orderInfo : orderInfo,
|
|
success : payRes => {
|
|
uni.showModal({
|
|
title : "开通提示",
|
|
content : "支付成功,已成功开通/升级节点身份",
|
|
showCancel : false,
|
|
success : ()=> {
|
|
resolve(payRes)
|
|
}
|
|
})
|
|
},
|
|
fail : payErr => {
|
|
reject(payErr)
|
|
uni.showToast({
|
|
title: '支付被取消',
|
|
icon : 'none'
|
|
})
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
export default new cashierPay();
|