Commit d15b7930 authored by malin's avatar malin

t

parent 37fb11e5
...@@ -67,7 +67,11 @@ ...@@ -67,7 +67,11 @@
class="row-center-center fc-f fs-36 ff-pp fw-5" class="row-center-center fc-f fs-36 ff-pp fw-5"
style="margin-top: 0.66rem; position: relative" style="margin-top: 0.66rem; position: relative"
> >
<div ref="payBtn" class="pay-btn row-center-center" @click="_payment"> <div
ref="payBtn"
class="pay-btn row-center-center"
@click.once="_payment"
>
<div>立即支付</div> <div>立即支付</div>
<div v-if="loading" class="loading"></div> <div v-if="loading" class="loading"></div>
...@@ -140,61 +144,56 @@ export default { ...@@ -140,61 +144,56 @@ export default {
async _payment() { async _payment() {
this.$refs.payBtn.style.opacity = "0.5"; this.$refs.payBtn.style.opacity = "0.5";
this.loading = true; this.loading = true;
setTimeout(() => {
const h5LogsObj = JSON.parse(decodeURI(utils.getCookie("h5LogsObj")));
let link = decodeURI(utils.getCookie("link"));
let params_createorder = {
zygt: "hzwz",
tgtk: 1,
uid: 122193,
pkg: "com.h5game.peidui",
source: h5LogsObj.source ? h5LogsObj.source : "toutiao",
};
// 获取订单号
let res_order = await API.API_createorder(
params_createorder,
this.baseInfo
);
const orderId = res_order.result.data.orderId;
utils.setCookie("orderId", orderId, 0); // 将orderId放入cookie中
// 上报-- > 信息收集;
API.API_h5Logs({
outTradeNo: orderId,
link: link,
clickId: h5LogsObj.clickid,
source: h5LogsObj.source,
pkg: h5LogsObj.pkg,
}).then((res) => {
console.log("收集数据===", res);
});
// 支付
API.API_gatewayCreateorder({
payPlatform: 1,
payType: 2,
wxType: "H5Page",
orderType: 5,
// pkg: h5LogsObj.pkg,
pkg: h5LogsObj.pkg ? h5LogsObj.pkg : "com.h5game.peidui",
outTradeNo: orderId,
totalFee: 1,
}).then((res) => {
this.$refs.payBtn.style.opacity = "1"; this.$refs.payBtn.style.opacity = "1";
this.loading = false; this.loading = false;
}, 4000); let mwebUrl = res.result.data.wakeup.mwebUrl;
if (this.loading) { let tempUrl = window.location.href;
const h5LogsObj = JSON.parse(decodeURI(utils.getCookie("h5LogsObj"))); tempUrl = tempUrl.replace("pay", "result");
let link = decodeURI(utils.getCookie("link")); window.location.href = `${mwebUrl}&redirect_url=${tempUrl}?pay_cb=1`;
});
let params_createorder = {
zygt: "hzwz",
tgtk: 1,
uid: 122193,
pkg: "com.h5game.peidui",
source: h5LogsObj.source ? h5LogsObj.source : "toutiao",
};
// 获取订单号
let res_order = await API.API_createorder(
params_createorder,
this.baseInfo
);
const orderId = res_order.result.data.orderId;
utils.setCookie("orderId", orderId, 0); // 将orderId放入cookie中
// 上报-- > 信息收集;
API.API_h5Logs({
outTradeNo: orderId,
link: link,
clickId: h5LogsObj.clickid,
source: h5LogsObj.source,
pkg: h5LogsObj.pkg,
}).then((res) => {
console.log("收集数据===", res);
});
// 支付
API.API_gatewayCreateorder({
payPlatform: 1,
payType: 2,
wxType: "H5Page",
orderType: 5,
// pkg: h5LogsObj.pkg,
pkg: h5LogsObj.pkg ? h5LogsObj.pkg : "com.h5game.peidui",
outTradeNo: orderId,
totalFee: 1,
}).then((res) => {
this.$refs.payBtn.style.opacity = "1";
this.loading = false;
let mwebUrl = res.result.data.wakeup.mwebUrl;
let tempUrl = window.location.href;
tempUrl = tempUrl.replace("pay", "result");
window.location.href = `${mwebUrl}&redirect_url=${tempUrl}?pay_cb=1`;
});
}
}, },
// 倒计时 // 倒计时
......
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
} else { } else {
return this._fetchInfo(); return this._fetchInfo();
} }
}, 2000); }, 1000);
return; return;
} }
}); });
...@@ -169,12 +169,13 @@ export default { ...@@ -169,12 +169,13 @@ export default {
} else { } else {
// 支付不成功 // 支付不成功
setTimeout(() => { setTimeout(() => {
if (this.countdown == 1) { if (this.countdown > 1) {
return this.$router.push({ path: "/pay", query: this.baseInfo }); return this.$router.push({ path: "/pay", query: this.baseInfo });
} else {
this.countdown += 1;
this._queryOrder();
} }
this.countdown += 1; }, 1000);
this._queryOrder();
}, 2000);
} }
}); });
}, },
......
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