2022-10-09 14:29:13 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2022-11-02 15:07:29 +08:00
|
|
|
|
2022-10-09 14:29:13 +08:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8" />
|
2022-11-11 15:17:54 +08:00
|
|
|
<meta name="viewport"
|
|
|
|
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover" />
|
2022-10-09 14:29:13 +08:00
|
|
|
<title>支付成功</title>
|
2022-11-11 15:17:54 +08:00
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/vue.min.js?v=1367936144322" type="text/javascript"
|
|
|
|
charset="utf-8"></script>
|
|
|
|
<script type="text/javascript"
|
|
|
|
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322"></script>
|
2022-10-09 14:29:13 +08:00
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
|
2022-11-02 15:07:29 +08:00
|
|
|
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/modelPop.js?v=3"></script>
|
2022-10-21 17:56:10 +08:00
|
|
|
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
|
2022-11-11 15:17:54 +08:00
|
|
|
<link rel="stylesheet"
|
|
|
|
href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/paySuccess.css?v=12" />
|
2022-10-09 14:29:13 +08:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="app">
|
2022-10-21 17:56:10 +08:00
|
|
|
<div class="content" v-if="payResult">
|
2022-10-09 14:29:13 +08:00
|
|
|
<img class="img" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/paySuccess.png"
|
2022-10-11 09:43:31 +08:00
|
|
|
alt="" />
|
2022-10-09 14:29:13 +08:00
|
|
|
<p class="success">支付成功</p>
|
2022-11-04 10:38:19 +08:00
|
|
|
<!-- 直充商品 -->
|
2022-10-19 10:09:27 +08:00
|
|
|
<div v-if="orderInfo.type==1" class="dlexcenter operation-btn">
|
|
|
|
<p class="bottom" @click="orderPageFn">确认</p>
|
|
|
|
<p class="note">{{countdown}}s后 自动跳转【订单列表】</p>
|
|
|
|
</div>
|
|
|
|
<!-- 立减金商品 -->
|
|
|
|
<div v-if="orderInfo.type==2" class="dlexcenter operation-reduce-btn">
|
|
|
|
<p class="dlexcenter back" @click="orderPageFn">返回</p>
|
|
|
|
<p class="dlexcenter exchange" @click="receiveFn">去兑换</p>
|
|
|
|
</div>
|
|
|
|
<!-- 卡密商品 -->
|
|
|
|
<div v-if="orderInfo.type==3" class="dlexcenter operation-btn">
|
|
|
|
<p class="bottom" @click="cardPwdPageFn">确认</p>
|
|
|
|
<p class="note">{{countdown}}s后 自动跳转【卡密详情页面】</p>
|
|
|
|
</div>
|
2022-10-09 14:29:13 +08:00
|
|
|
</div>
|
2022-10-11 09:43:31 +08:00
|
|
|
<!-- 弹出提示 -->
|
2022-11-02 15:07:29 +08:00
|
|
|
<model-pop :show.sync="popAttr.show" :title="popAttr.title" :status="popAttr.status" :text="popAttr.text"
|
|
|
|
:bottom_text="popAttr.bottomText" @backFunction="backFunctionPop"></model-pop>
|
2022-10-09 14:29:13 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
new Vue({
|
|
|
|
el: "#app",
|
2022-11-02 15:07:29 +08:00
|
|
|
data () {
|
2022-10-11 09:43:31 +08:00
|
|
|
return {
|
|
|
|
orderNumber: '',
|
2022-10-19 10:09:27 +08:00
|
|
|
orderInfo: { type: 3 },
|
|
|
|
countdown: 3,
|
2022-10-11 09:43:31 +08:00
|
|
|
popAttr: {
|
|
|
|
show: false,
|
|
|
|
title: '温馨提示',
|
2022-10-21 17:56:10 +08:00
|
|
|
status: 3,/*1 成功 2提示 3失败 */
|
2022-11-01 16:42:06 +08:00
|
|
|
text: '错误信息',
|
2022-11-02 15:07:29 +08:00
|
|
|
bottomText: ''
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
2022-10-13 18:35:37 +08:00
|
|
|
plaflam: 1,
|
2022-11-02 15:07:29 +08:00
|
|
|
payResult: false,
|
|
|
|
copyLink: '',
|
2022-11-11 15:17:54 +08:00
|
|
|
orderId: '',
|
2022-10-13 18:35:37 +08:00
|
|
|
redirect_url: '' //微信小程序链接
|
2022-10-11 09:43:31 +08:00
|
|
|
};
|
2022-10-09 14:29:13 +08:00
|
|
|
},
|
|
|
|
|
2022-11-02 15:07:29 +08:00
|
|
|
components: { modelPop },
|
2022-10-09 14:29:13 +08:00
|
|
|
|
2022-11-02 15:07:29 +08:00
|
|
|
created () {
|
2022-10-11 09:43:31 +08:00
|
|
|
let orderNumber = this.getQueryString(
|
|
|
|
window.location.search,
|
|
|
|
"order_number"
|
|
|
|
);
|
|
|
|
this.orderNumber = orderNumber;
|
|
|
|
this.getOrderDetail(orderNumber);
|
2022-11-02 15:07:29 +08:00
|
|
|
localStorage.setItem('token', this.getQueryString(window.location.search, "token"));
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2022-11-02 15:07:29 +08:00
|
|
|
getQueryString (path, name) {
|
2022-10-11 09:43:31 +08:00
|
|
|
//获取浏览器地址栏的参数
|
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
|
var r = path.substr(1).match(reg);
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
|
|
return null;
|
|
|
|
},
|
2022-10-19 10:09:27 +08:00
|
|
|
//返回订单页面
|
2022-11-02 15:07:29 +08:00
|
|
|
orderPageFn () {
|
2022-10-19 10:09:27 +08:00
|
|
|
window.location.replace('./coupon/myOrder.html');
|
|
|
|
},
|
|
|
|
//卡密返回卡密详情页面
|
2022-11-02 15:07:29 +08:00
|
|
|
cardPwdPageFn () {
|
2022-10-19 10:09:27 +08:00
|
|
|
window.location.replace('./coupon/myOrder.html');
|
|
|
|
},
|
|
|
|
/* 倒计时 */
|
2022-11-02 15:07:29 +08:00
|
|
|
countdownFn () {
|
2022-10-19 10:09:27 +08:00
|
|
|
let time = 3;
|
|
|
|
let stopTimer = setInterval(() => {
|
|
|
|
time--;
|
|
|
|
if (time > 0) {
|
|
|
|
this.countdown = time;
|
|
|
|
} else {
|
|
|
|
this.orderPageFn();
|
|
|
|
clearInterval(stopTimer);
|
2022-11-02 15:07:29 +08:00
|
|
|
|
2022-10-19 10:09:27 +08:00
|
|
|
}
|
2022-11-02 15:07:29 +08:00
|
|
|
}, 1000);
|
2022-10-19 10:09:27 +08:00
|
|
|
},
|
2022-10-11 09:43:31 +08:00
|
|
|
//获取订单详情
|
2022-11-02 15:07:29 +08:00
|
|
|
getOrderDetail (id) {
|
2022-10-11 09:43:31 +08:00
|
|
|
req.axiosGet("/key/order/detail/" + id).then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
this.orderInfo = res.data;
|
2022-11-02 15:07:29 +08:00
|
|
|
this.payResult = true;
|
2022-10-13 18:35:37 +08:00
|
|
|
if (res.data.type == 2) { //1 商品 2立减金
|
2022-10-11 09:43:31 +08:00
|
|
|
//channel 1支付宝 2微信
|
2022-10-21 17:56:10 +08:00
|
|
|
this.plaflam = res.data.product.entity.channel;//只有立减金商品才有channel字段
|
|
|
|
this.redirect_url = res.data.wechat_redirect_url;
|
2022-11-02 15:07:29 +08:00
|
|
|
this.payStatus = res.data.pay_status;
|
2022-11-11 15:17:54 +08:00
|
|
|
this.orderId = res.data.alipay_order_number;
|
2022-11-02 15:07:29 +08:00
|
|
|
} else {
|
2022-10-26 10:06:14 +08:00
|
|
|
this.countdownFn();
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch();
|
|
|
|
},
|
2022-10-13 18:35:37 +08:00
|
|
|
|
2022-10-11 09:43:31 +08:00
|
|
|
//弹出框提示
|
2022-11-02 15:07:29 +08:00
|
|
|
openTipDialog (popUpAttr) {
|
2022-10-11 09:43:31 +08:00
|
|
|
this.popAttr = popUpAttr;
|
|
|
|
},
|
2022-11-02 15:07:29 +08:00
|
|
|
/* 弹窗回调 */
|
2022-11-01 16:42:06 +08:00
|
|
|
backFunctionPop (type) {
|
|
|
|
if (this.popAttr.bottomText === '点击复制' && type) {
|
|
|
|
var aux = document.createElement("input");
|
|
|
|
aux.setAttribute("value", this.copyLink);
|
|
|
|
document.body.appendChild(aux);
|
|
|
|
aux.select();
|
|
|
|
document.execCommand("copy");
|
|
|
|
document.body.removeChild(aux);
|
|
|
|
this.openTipDialog({
|
|
|
|
show: true,
|
|
|
|
title: '温馨提示',
|
|
|
|
status: 1,/*1 成功 2提示 3失败 */
|
|
|
|
text: '复制成功'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.isLogin) {
|
2022-11-14 14:38:05 +08:00
|
|
|
this.delayedOut();
|
2022-11-01 16:42:06 +08:00
|
|
|
}
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
2022-11-01 16:42:06 +08:00
|
|
|
toLinkAlipay () {
|
2022-10-11 09:43:31 +08:00
|
|
|
//支付宝H5跳转
|
|
|
|
let self = this;
|
|
|
|
let banklink = encodeURIComponent(
|
2022-11-02 15:07:29 +08:00
|
|
|
window.location.origin +
|
|
|
|
"/alipay.html?orderNumber=" + this.orderId
|
2022-10-11 09:43:31 +08:00
|
|
|
);
|
|
|
|
let link = "http://openapi.1688sup.com/alipay/oauth?jump=" + banklink;
|
|
|
|
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
|
2022-11-11 15:17:54 +08:00
|
|
|
/* 判断如果是微信浏览器或者百度浏览器 则无法拉起支付宝 */
|
2022-11-14 18:29:12 +08:00
|
|
|
if (ua.match(/MicroMessenger/i) == "micromessenger" || ua.indexOf("baiduboxapp") > -1 || ua.indexOf("firefox") > -1) {
|
2022-11-02 15:07:29 +08:00
|
|
|
//复制链接地址,提醒去浏览器打开
|
2022-11-01 16:42:06 +08:00
|
|
|
this.copyLink = link;
|
2022-11-14 14:38:05 +08:00
|
|
|
this.openErrorDialog(`请复制链接,在其他浏览器打开`, '点击复制');
|
2022-11-01 16:42:06 +08:00
|
|
|
} else {
|
|
|
|
//唤起支付宝
|
|
|
|
window.location.replace(link);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
openErrorDialog (tip, bottomText) {
|
2022-11-14 14:38:05 +08:00
|
|
|
this.popAttr.text = tip;
|
|
|
|
this.popAttr.show = true;
|
|
|
|
this.popAttr.bottomText = bottomText;
|
2022-10-11 09:43:31 +08:00
|
|
|
},
|
|
|
|
//领取立减金
|
2022-11-02 15:07:29 +08:00
|
|
|
receiveFn () {
|
|
|
|
if (this.payStatus != 2) {
|
2022-10-21 17:56:10 +08:00
|
|
|
this.openTipDialog({
|
|
|
|
show: true,
|
|
|
|
title: '温馨提示',
|
|
|
|
status: 2,/*1 成功 2提示 3失败 */
|
|
|
|
text: '支付结算中,请等待支付结果...'
|
|
|
|
});
|
2022-11-14 14:38:05 +08:00
|
|
|
return;
|
2022-10-21 17:56:10 +08:00
|
|
|
}
|
2022-10-11 09:43:31 +08:00
|
|
|
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
|
|
|
|
if (this.plaflam == 1) {
|
|
|
|
//支付宝-微信环境中不能唤起支付宝
|
|
|
|
this.toLinkAlipay();
|
|
|
|
}
|
|
|
|
if (this.plaflam == 2) {
|
|
|
|
//微信
|
2022-11-02 15:07:29 +08:00
|
|
|
//唤起微信福利官小程序
|
|
|
|
window.location.replace(this.redirect_url);
|
2022-10-11 09:43:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
2022-10-09 14:29:13 +08:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|