|
@@ -63,11 +63,18 @@
|
|
|
payLimitTime:null,
|
|
|
order:null,
|
|
|
user:null,
|
|
|
+ checkTimer: null, // 轮询定时器 ID
|
|
|
+ maxRetryCount: 10, // 最大轮询次数(可选)
|
|
|
+ retryCount: 0 // 当前轮询次数(可选)
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
this.orderId=JSON.parse(option.orderId);
|
|
|
this.getStoreOrderById();
|
|
|
+ if (this.checkTimer) {
|
|
|
+ clearInterval(this.checkTimer);
|
|
|
+ this.checkTimer = null;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
copyOrderSn(text) {
|
|
@@ -120,29 +127,76 @@
|
|
|
otherPayment(data).then(
|
|
|
res => {
|
|
|
if(res.code==200){
|
|
|
+ console.log('json;;;;;',res.result)
|
|
|
var result=JSON.parse(res.result);
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'wxpay',
|
|
|
- timeStamp: result.timeStamp,
|
|
|
- nonceStr: result.nonceStr,
|
|
|
- package: result.package,
|
|
|
- signType: result.signType,
|
|
|
- paySign: result.paySign,
|
|
|
- success: function(res) {
|
|
|
- uni.hideLoading();
|
|
|
- uni.redirectTo({
|
|
|
- url:"otherPaySuccess"
|
|
|
- })
|
|
|
- },
|
|
|
- fail: function(err) {
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title:'fail:' + JSON.stringify(err),
|
|
|
- });
|
|
|
- console.log('fail:' + JSON.stringify(err));
|
|
|
- uni.hideLoading();
|
|
|
- }
|
|
|
- });
|
|
|
+ wx.navigateToMiniProgram({
|
|
|
+ appId: 'wx1b63de1096c46cde', // 收银台小程序 AppId 固定值
|
|
|
+ path: '/pages/pay/pay', // 收银台小程序 固定路径
|
|
|
+ extraData: {
|
|
|
+ orderNo: result.orderNo,
|
|
|
+ orderAmt: result.orderAmt,
|
|
|
+ platMerCstNo: result.platMerCstNo,
|
|
|
+ platMerCstName: result.platMerCstName,
|
|
|
+ businessCstNo: result.businessCstNo,
|
|
|
+ licenseCode: result.licenseCode,
|
|
|
+ },
|
|
|
+ envVersion: 'release', // 开发版 develop,体验版 trial,正式环境传 release
|
|
|
+ success(res) {
|
|
|
+ uni.showLoading({
|
|
|
+ title:"查询支付结果中..."
|
|
|
+ })
|
|
|
+ // 启动定时器并保存 ID
|
|
|
+ that.checkTimer = setInterval(() => {
|
|
|
+ const data = { orderId: that.order.id };
|
|
|
+ getMyStoreOrderById(data).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.order.status == 3) {
|
|
|
+ // 跳转前清除定时器
|
|
|
+ clearInterval(that.checkTimer);
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages_user/user/storeOrderDetail?id=' + that.order.id
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ clearInterval(that.checkTimer);
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages_user/user/storeOrderDetail?id=' + that.order.id
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 4000);
|
|
|
+ console.log(res)
|
|
|
+ // 接口调用成功的回调函数
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ // 接口调用失败的回调函数
|
|
|
+ console.log(res)
|
|
|
+ if (that.checkTimer) clearInterval(that.checkTimer);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // uni.requestPayment({
|
|
|
+ // provider: 'wxpay',
|
|
|
+ // timeStamp: result.timeStamp,
|
|
|
+ // nonceStr: result.nonceStr,
|
|
|
+ // package: result.package,
|
|
|
+ // signType: result.signType,
|
|
|
+ // paySign: result.paySign,
|
|
|
+ // success: function(res) {
|
|
|
+ // uni.hideLoading();
|
|
|
+ // uni.redirectTo({
|
|
|
+ // url:"otherPaySuccess"
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // fail: function(err) {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon:'none',
|
|
|
+ // title:'fail:' + JSON.stringify(err),
|
|
|
+ // });
|
|
|
+ // console.log('fail:' + JSON.stringify(err));
|
|
|
+ // uni.hideLoading();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
// uni.requestPayment({
|
|
|
// provider: 'wxpay',
|
|
|
// timeStamp: res.result.timeStamp,
|