页面完善
This commit is contained in:
@@ -106,11 +106,13 @@ import {
|
||||
iapChannel:{},
|
||||
checking:false, // 正在检测
|
||||
ComplateRequestArr:null,
|
||||
isAndorid:true
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getOrderList()
|
||||
this.checkIapOrders() //检查未完成的苹果支付订单
|
||||
this.getOS()
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
@@ -122,6 +124,17 @@ import {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
// 获得操作系统
|
||||
getOS(){
|
||||
let oprateOs = ''
|
||||
oprateOs = uni.getSystemInfoSync().platform
|
||||
console.log(oprateOs)
|
||||
if(oprateOs == 'android'){
|
||||
this.isAndorid = true
|
||||
}else{
|
||||
this.isAndorid = false
|
||||
}
|
||||
},
|
||||
checkIapOrders() {
|
||||
const that = this
|
||||
// 如果ios已经绑定支付信息,就直接支付,如果没有绑定,就需要先绑定
|
||||
@@ -196,8 +209,7 @@ import {
|
||||
|
||||
// 支付
|
||||
goPay(payItem) {
|
||||
console.log(payItem,'payItem')
|
||||
|
||||
console.log(payItem,'payItem')
|
||||
if(payItem.paymentMethod == 2){
|
||||
console.log('阿里支付')
|
||||
setPay({
|
||||
@@ -223,38 +235,56 @@ import {
|
||||
})
|
||||
} else if(payItem.paymentMethod == 1){
|
||||
console.log('微信支付')
|
||||
let data1={
|
||||
orderSn:payItem.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: payItem.realMoney
|
||||
}
|
||||
console.log(data1,'data1')
|
||||
setWXPay(data1,res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
if(res.data.errMsg.indexOf('User canceled') != -1){
|
||||
// console.log(this.isAndorid)
|
||||
if(this.isAndorid == false){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '很抱歉,苹果系统暂不支持微信支付',
|
||||
showCancel:false
|
||||
})
|
||||
return false
|
||||
}else{
|
||||
let data1={
|
||||
orderSn:payItem.orderSn,
|
||||
buyOrderId: null,
|
||||
totalAmount: payItem.realMoney
|
||||
}
|
||||
console.log(data1,'data1')
|
||||
setWXPay(data1,res => {
|
||||
if (res.success) {
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
title: "支付成功"
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
if(res.data.errMsg.indexOf('User canceled') != -1){
|
||||
uni.showToast({
|
||||
title: "用户取消支付",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
image: '../../static/icon/ic_close.png'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}else if(payItem.paymentMethod == 3){
|
||||
// 苹果充值
|
||||
console.log('苹果二次支付')
|
||||
this.iphonepay(payItem)
|
||||
if(this.isAndorid){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
showCancel:false,
|
||||
content:'很抱歉,当前订单属于苹果系统内购订单,安卓系统无法完成支付操作,您可切换到苹果系统进行支付,也可以取消该订单,并重新下单'
|
||||
})
|
||||
}else{
|
||||
this.iphonepay(payItem)
|
||||
}
|
||||
}
|
||||
},
|
||||
iphonepay(payItem) {
|
||||
|
||||
Reference in New Issue
Block a user