topay() {
let that = this;
// 这里写H5支付
// #ifdef H5
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') != -1;
if (isWeixin) {
this.type = 1;
this.H5WeChat = true;
} else {
var u = navigator.userAgent,
app = navigator.appVersion;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
console.log(isAndroid, "s===安卓")
console.log(isiOS, "-----ios")
console.log(this.urls)
//this.urls是个这样的地址https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=1234567&package=34567
if(isiOS){
console.log('ios')
window.location.href = this.urls
}else{
console.log('android')
window.open(this.urls
}
}
// #endif
// #ifdef APP-PLUS
//App支付
that.$request.api.activeSignUp({
mweb: 'APP',
join_amount: that.money,
uuid: uni.getStorageSync('uuid'),
activityId: this.activeDeta.id,
}).then(res => {
this.bankData = res.data;
console.log(this.bankData)
this.enrollPopup = false
this.actForm.join_number = null;
this.actForm.location = null;
this.actForm.posts = null;
if (res.code === 0) {
uni.requestPayment({
"provider": "wxpay",
"orderInfo": {
"appid": res.data.appid, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": res.data.noncestr, // 随机字符串
"package": res.data.package, // 固定值
"partnerid": res.data.partnerid, // 微信支付商户号
"prepayid": res.data.prepayid, // 统一下单订单号
"timestamp": res.data.timestamp, // 时间戳(单位:秒)
"sign": res.data.signCode.slice(0, 30) // 签名,这里用的 MD5 签名
},
success: function(res) {
// console.log('success:' + JSON.stringify(res));
uni.showToast({
title: JSON.stringify(‘成功’)
})
},
fail: function(err) {
uni.showToast({
title: JSON.stringify(‘失败’)
})
}
});
}
})
// #endif
},