Files
BlockChainH5/public/cashierPay.js
2021-10-28 14:19:52 +08:00

55 lines
1.0 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) => {
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();