Commit c2790a9e authored by malin's avatar malin

t

parent aacc56d3
...@@ -67,11 +67,7 @@ ...@@ -67,11 +67,7 @@
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 <div ref="payBtn" class="pay-btn row-center-center" @click="_payment">
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>
...@@ -144,55 +140,61 @@ export default { ...@@ -144,55 +140,61 @@ 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;
const h5LogsObj = JSON.parse(decodeURI(utils.getCookie("h5LogsObj"))); setTimeout(() => {
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;
let mwebUrl = res.result.data.wakeup.mwebUrl; }, 5000);
let tempUrl = window.location.href; if (this.loading) {
tempUrl = tempUrl.replace("pay", "result"); const h5LogsObj = JSON.parse(decodeURI(utils.getCookie("h5LogsObj")));
window.location.href = `${mwebUrl}&redirect_url=${tempUrl}?pay_cb=1`; 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.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`;
});
}
}, },
// 倒计时 // 倒计时
......
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