Commit 94519171 authored by 罗超's avatar 罗超

1

parent 43ed46a2
...@@ -838,7 +838,9 @@ export default { ...@@ -838,7 +838,9 @@ export default {
data.CoverImg = this.currentPriceInfo.CoverImg; data.CoverImg = this.currentPriceInfo.CoverImg;
let myData = JSON.stringify(data); let myData = JSON.stringify(data);
this.orderData = encodeURIComponent(myData); this.orderData = encodeURIComponent(myData);
this.querenAli(data.OrderId); console.log(841, data);
this.querenAli(data);
OrderId;
} else { } else {
} }
this.submit = false; this.submit = false;
...@@ -849,14 +851,15 @@ export default { ...@@ -849,14 +851,15 @@ export default {
); );
} }
}, },
querenAli(OrderId) { querenAli(data) {
let that = this;
let url = "/api/WeChatPay/GetTravlePayInfo"; let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = this.currentPriceInfo.title; let GoodsName = this.currentPriceInfo.title;
this.request2( this.request2(
{ {
url: url, url: url,
data: { data: {
OrderId: OrderId, OrderId: data.OrderId,
GoodsName: GoodsName, GoodsName: GoodsName,
OrderPayType: 2, OrderPayType: 2,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId, OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
...@@ -865,7 +868,15 @@ export default { ...@@ -865,7 +868,15 @@ export default {
(res) => { (res) => {
this.orderInfo = JSON.parse(res.data); this.orderInfo = JSON.parse(res.data);
if (res.data) { if (res.data) {
this.PayAli(res.data); let cbObj = {
tradeNO: res.data,
OrderNo: data.OrderNo,
OrderId: data.OrderId,
preferPrice: data.PreferPrice,
};
console.log(891, cbObj);
that.payAliCallback(cbObj);
// this.PayAli(res.data, data);
} else { } else {
uni.showToast({ uni.showToast({
title: "获取交易号失败", title: "获取交易号失败",
...@@ -875,18 +886,21 @@ export default { ...@@ -875,18 +886,21 @@ export default {
} }
); );
}, },
PayAli(tradeNO) { PayAli(tradeNO, data) {
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") { if (res.resultCode == "9000") {
setTimeout(() => { let cbObj = {
uni.redirectTo({ tradeNO: tradeNO,
url: "/pages/jiuzhai/jz_MyOrder", OrderNo: data.OrderNo,
}); OrderId: data.OrderId,
}, 1000); preferPrice: data.PreferPrice,
};
console.log(893, cbObj);
that.payAliCallback(cbObj);
} else if (res.resultCode == "6001") { } else if (res.resultCode == "6001") {
uni.showToast({ uni.showToast({
title: "支付取消", title: "支付取消",
...@@ -902,6 +916,39 @@ export default { ...@@ -902,6 +916,39 @@ export default {
}, },
}); });
}, },
payAliCallback(obj) {
console.log("919", 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({
url: "/pages/jiuzhai/paysuccess",
});
// setTimeout(() => {
// uni.redirectTo({
// url: "/pages/jiuzhai/jz_MyOrder",
// });
// }, 1000);
},
() => {
console.log("2", res);
uni.redirectTo({
url: "/pages/jiuzhai/paysuccess",
});
}
);
},
// #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