This commit is contained in:
liuyuan
2025-05-19 15:59:34 +08:00
parent 0bbcd61bde
commit cbc3465c57
7 changed files with 38 additions and 32 deletions

View File

@@ -116,7 +116,7 @@ export default {
iosPaylist: [{
title: "IAP 支付",
id: 3,
imgUrl: require("@/static/icon/pay_2.png"),
imgUrl: require("@/static/icon/icon_IAP.png"),
}, ],
transaction: {
// 成功回调
@@ -280,7 +280,7 @@ export default {
});
const that = this;
let IAPOrders = [];
IAPOrders.push('s' + that.stepsCj.priceTypeId);
IAPOrders.push('x' + that.stepsCj.priceTypeId);
// 新建订单
uni.showLoading({
title: "正在创建订单",
@@ -325,7 +325,7 @@ export default {
orderId: result.payment.username, // 系统订单号
receiptData: result.transactionReceipt, // 苹果返回收据
// sandBox: true, //测试数据
// body: that.stepsCj.priceTypeId // 充值类型id
// body: that.stepsCj.priceTypeId //充值类型id
};
$http
.request({
@@ -345,11 +345,17 @@ export default {
icon: 'success'
})
// 服务器验证票据有效后在客户端关闭订单 (iapChannel.finishTransaction)
//that.finishTransaction(result);
that.finishTransaction(result);
setTimeout(() => {
uni.switchTab({
url: '/pages/my/index'
})
}, 2000);
}
})
.catch((e) => {
uni.hideLoading()
that.finishTransaction(result);
uni.showModal({
title: "提示",
showCancel: false,
@@ -360,7 +366,6 @@ export default {
}
},
});
//that.finishTransaction(result);
}, )
},
getDevName() {
@@ -428,14 +433,6 @@ export default {
let that = this;
that.payType = e;
},
//ios充值
iosPay() {
// 苹果内购实现思路:
// 1.先确认支付通道是否包含苹果内购
// 2.检查一下是否存在上次未处理完的订单(主要是支付成功没有走回调的订单),异常订单直接关闭掉,成功没有走回调的提交给后台进行验证
// 3.请求并创建新的订单
this.iphonepay();
},
// 充值
goToPay() {
this.kaiChar();
@@ -540,8 +537,7 @@ export default {
}
});
} else if (that.payType == 3) {
console.log("苹果支付");
that.iosPay();
that.iphonepay();
}
}
});