Commit fd5dce1f authored by 罗超's avatar 罗超

1

parent 59232b8f
...@@ -461,40 +461,64 @@ export default { ...@@ -461,40 +461,64 @@ export default {
}, },
}, },
(res) => { (res) => {
this.goPayAli(res.data); this.goPayAli(res.data, item);
} }
); );
}, },
goPayAli(tradeNO) { goPayAli(tradeNO, item) {
let that = this; let that = this;
my.tradePay({ my.tradePay({
tradeNO: tradeNO, tradeNO: tradeNO,
success: function (res) { success: function (res) {
console.log("success", res); console.log("success", res);
if (res.resultCode == "9000") { let obj = {
TradeNo: tradeNO,
OrderNo: item.orderNo,
OrderId: item.orderId,
preferPrice: item.preferPrice,
};
that.payAliCallback(obj);
},
fail: function (err) {
console.log("fail:", err);
uni.showToast({ uni.showToast({
title: "支付成功", title: "支付失败",
icon: "none",
});
},
}); });
},
payAliCallback(obj) {
console.log(893), Obj;
this.request2(
{
url: "/api/AliPay/ALiPayCallBackDmcNotify",
data: {
OrderNo: obj.OrderNo,
OrderId: obj.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
TradeNo: obj.TradeNo,
ProjectType: 2,
PreferPrice: obj.preferPrice,
},
},
(res) => {
console.log("cb", res);
uni.redirectTo({ uni.redirectTo({
url: url:
"/pages/jiuzhai/paysuccess?PreferPrice=" + "/pages/jiuzhai/paysuccess?PreferPrice=" +
that.price + obj.PreferPrice +
"&isFrom=1", "&isFrom=1",
}); });
} else if (res.resultCode == "6001") {
uni.showToast({
title: "支付取消",
});
}
}, },
fail: function (err) { (err) => {
console.log("fail:", err); console.log("cb2", err);
uni.showToast({ uni.showToast({
title: "支付失败", title: "支付失败",
icon: "none", icon: "none",
}); });
}, }
}); );
}, },
// #endif // #endif
}, },
......
...@@ -874,9 +874,7 @@ export default { ...@@ -874,9 +874,7 @@ export default {
OrderId: data.OrderId, OrderId: data.OrderId,
preferPrice: data.PreferPrice, preferPrice: data.PreferPrice,
}; };
console.log(883, cbObj);
this.payAliCallback(cbObj); this.payAliCallback(cbObj);
console.log(884);
} else { } else {
uni.showToast({ uni.showToast({
title: "获取交易号失败", title: "获取交易号失败",
...@@ -892,7 +890,6 @@ export default { ...@@ -892,7 +890,6 @@ export default {
tradeNO: tradeNO, tradeNO: tradeNO,
success: function (res) { success: function (res) {
console.log("success", res); console.log("success", res);
if (res.resultCode == "9000") {
let cbObj = { let cbObj = {
TradeNo: tradeNO, TradeNo: tradeNO,
OrderNo: data.OrderNo, OrderNo: data.OrderNo,
...@@ -900,11 +897,6 @@ export default { ...@@ -900,11 +897,6 @@ export default {
preferPrice: data.PreferPrice, preferPrice: data.PreferPrice,
}; };
that.payAliCallback(cbObj); that.payAliCallback(cbObj);
} else if (res.resultCode == "6001") {
uni.showToast({
title: "支付取消",
});
}
}, },
fail: function (err) { fail: function (err) {
console.log("fail:", err); console.log("fail:", err);
...@@ -916,7 +908,6 @@ export default { ...@@ -916,7 +908,6 @@ export default {
}); });
}, },
payAliCallback(obj) { payAliCallback(obj) {
console.log(893, obj);
this.request2( this.request2(
{ {
url: "/api/AliPay/ALiPayCallBackDmcNotify", url: "/api/AliPay/ALiPayCallBackDmcNotify",
...@@ -931,19 +922,23 @@ export default { ...@@ -931,19 +922,23 @@ export default {
}, },
(res) => { (res) => {
console.log("cb", res); console.log("cb", res);
this.submit = false;
uni.redirectTo({ uni.redirectTo({
url: "/pages/jiuzhai/paysuccess?PreferPrice=" + obj.PreferPrice, url: "/pages/jiuzhai/paysuccess?PreferPrice=" + obj.PreferPrice,
}); });
}, },
(err) => { (err) => {
this.submit = false;
console.log("cb2", err); console.log("cb2", err);
uni.showToast({ uni.showToast({
title: "支付失败", title: "支付失败",
icon: "none", icon: "none",
}); });
// uni.redirectTo({ setTimeout(() => {
// url: "/pages/jiuzhai/paysuccess?PreferPrice=" + obj.PreferPrice, uni.redirectTo({
// }); url: "/pages/jiuzhai/jz_MyOrder",
});
}, 1000);
} }
); );
}, },
......
...@@ -726,15 +726,23 @@ export default { ...@@ -726,15 +726,23 @@ export default {
if (loss == 1 || status == 4) { if (loss == 1 || status == 4) {
this.orderStatus.code = -1; this.orderStatus.code = -1;
this.orderStatus.text = "已取消"; this.orderStatus.text = "已取消";
this.submit = false;
this.submitCancel = false;
} else if (status == 2 && isCancel != 1) { } else if (status == 2 && isCancel != 1) {
this.orderStatus.code = 0; this.orderStatus.code = 0;
this.orderStatus.text = "待付款"; this.orderStatus.text = "待付款";
this.submit = true;
this.submitCancel = true;
} else if (status == 2 && isCancel == 1) { } else if (status == 2 && isCancel == 1) {
this.orderStatus.code = -2; this.orderStatus.code = -2;
this.orderStatus.text = "审核中"; this.orderStatus.text = "审核中";
this.submit = false;
this.submitCancel = false;
} else if (status == 1) { } else if (status == 1) {
this.orderStatus.code = 1; this.orderStatus.code = 1;
this.orderStatus.text = "正常"; this.orderStatus.text = "正常";
this.submit = false;
this.submitCancel = false;
} }
}, },
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
...@@ -844,14 +852,13 @@ export default { ...@@ -844,14 +852,13 @@ export default {
tradeNO: tradeNO, tradeNO: tradeNO,
success: function (res) { success: function (res) {
console.log("success", res); console.log("success", res);
if (res.resultCode == "9000") { let obj = {
that.submit = false; TradeNo: tradeNO,
that.initOrderInfo(that.orderData.model.OrderId); OrderNo: item.orderNo,
} else if (res.resultCode == "6001") { OrderId: item.orderId,
uni.showToast({ preferPrice: item.preferPrice,
title: "支付取消", };
}); that.payAliCallback(obj);
}
}, },
fail: function (err) { fail: function (err) {
console.log("fail:", err); console.log("fail:", err);
...@@ -864,6 +871,41 @@ export default { ...@@ -864,6 +871,41 @@ export default {
}, },
}); });
}, },
payAliCallback(obj) {
console.log(893), Obj;
let that = this;
this.request2(
{
url: "/api/AliPay/ALiPayCallBackDmcNotify",
data: {
OrderNo: obj.OrderNo,
OrderId: obj.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
TradeNo: obj.TradeNo,
ProjectType: 2,
PreferPrice: obj.preferPrice,
},
},
(res) => {
console.log("cb", res);
// uni.redirectTo({
// url:
// "/pages/jiuzhai/paysuccess?PreferPrice=" +
// obj.PreferPrice +
// "&isFrom=1",
// });
that.submit = false;
that.initOrderInfo(that.orderData.model.OrderId);
},
(err) => {
console.log("cb2", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
}
);
},
// #endif // #endif
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment