mobileclient/paysuccess.html

179 lines
7.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover" />
<title>支付成功</title>
<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>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/modelPop.js?v=3"></script>
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/paySuccess.css?v=12" />
</head>
<body>
<div id="app">
<div class="content" v-if="payResult">
<img class="img" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/paySuccess.png"
alt="" />
<p class="success">支付成功</p>
<!-- zhi chong商品 -->
<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>
</div>
<!-- 弹出提示 -->
<model-pop :show="popAttr.show" :title="popAttr.title" :status="popAttr.status" :text="popAttr.text"
@backFunction="backFunctionPop"></model-pop>
</div>
<script>
new Vue({
el: "#app",
data() {
return {
orderNumber: '',
orderInfo: { type: 3 },
countdown: 3,
popAttr: {
show: false,
title: '温馨提示',
status: 3,/*1 成功 2提示 3失败 */
text: '错误信息'
},
plaflam: 1,
payResult:false,
redirect_url: '' //微信小程序链接
};
},
components: {modelPop},
created() {
let orderNumber = this.getQueryString(
window.location.search,
"order_number"
);
this.orderNumber = orderNumber;
this.getOrderDetail(orderNumber);
this.countdownFn();
},
methods: {
getQueryString(path, name) {
//获取浏览器地址栏的参数
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = path.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},
//返回订单页面
orderPageFn(){
window.location.replace('./coupon/myOrder.html');
},
//卡密返回卡密详情页面
cardPwdPageFn(){
window.location.replace('./coupon/myOrder.html');
},
/* 倒计时 */
countdownFn() {
let time = 3;
let stopTimer = setInterval(() => {
time--;
if (time > 0) {
this.countdown = time;
} else {
this.orderPageFn();
clearInterval(stopTimer);
}
},1000);
},
//获取订单详情
getOrderDetail(id) {
req.axiosGet("/key/order/detail/" + id).then((res) => {
if (res.code == 200) {
this.orderInfo = res.data;
if (res.data.type == 2) { //1 商品 2立减金
//channel 1支付宝 2微信
this.plaflam = res.data.product.entity.channel;//只有立减金商品才有channel字段
this.redirect_url = res.data.wechat_redirect_url;
this.payStatus=res.data.pay_status;
this.payResult=true;
}
}
}).catch();
},
//弹出框提示
openTipDialog(popUpAttr) {
this.popAttr = popUpAttr;
},
/* 弹框回调,点击按钮触发 */
backFunctionPop() {
this.popAttr.show=false;
},
toLinkAlipay() {
//支付宝H5跳转
let self = this;
let banklink = encodeURIComponent(
window.location.origin +
"/alipay.html?orderNumber=" + this.orderNumber
);
let link = "http://openapi.1688sup.com/alipay/oauth?jump=" + banklink;
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
window.location.replace(link);
},
//领取立减金
receiveFn() {
if(this.payStatus!=2){
this.openTipDialog({
show: true,
title: '温馨提示',
status: 2,/*1 成功 2提示 3失败 */
text: '支付结算中,请等待支付结果...'
});
return
}
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
if (this.plaflam == 1) {
//支付宝-微信环境中不能唤起支付宝
this.toLinkAlipay();
}
if (this.plaflam == 2) {
//微信
if (ua.indexOf("dingtalk") > -1) {
//在钉钉内置环境打开,不能唤起微信小程序
this.openTipDialog({
show: true,
title: '温馨提示',
status: 2,/*1 成功 2提示 3失败 */
text: '请在其他浏览器打开'
});
} else {
//唤起微信福利官小程序
window.location.replace(this.redirect_url);
}
}
}
},
});
</script>
</body>
</html>