小五哥
发布于

uni-app App端拉起微信H5支付

直接上代码

// #ifdef APP-PLUS
uni.showLoading({title:"加载中..."})
const res = await Api.toPay(this.gd.appId,this.contractId,"h5");
uni.hideLoading();
if(res.errcode === 0){
  const path = res.data + '&redirect_url=https://www.xxx.cn/h5/#/';
  const platform = uni.getSystemInfoSync().platform;
  const webview = plus.webview.create('','https://www.xxx.cn');
  switch(platform){
    case 'android':
     webview.loadURL(path,{'Referer':'https://www.xxx.cn'});
     break;
   case 'ios':
     //解决ios支付完成后,打开safari浏览器的bug
     webview.loadURL(path,{'Referer':'www.xxx.cn'});
     break;
   default:
     webview.loadURL(path,{'Referer':'https://www.xxx.cn'});
    break;
  }
}
// #endif
浏览 (17)
点赞
收藏
评论