test:支付回调,测试领取支付宝立减金
This commit is contained in:
parent
c38be0f76c
commit
1b54d9a269
103
paysuccess.html
103
paysuccess.html
|
@ -8,9 +8,10 @@
|
|||
<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 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"></script>
|
||||
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/paySuccess.css" />
|
||||
</head>
|
||||
|
||||
|
@ -18,26 +19,108 @@
|
|||
<div id="app">
|
||||
<div class="content">
|
||||
<img class="img" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/paySuccess.png"
|
||||
alt="">
|
||||
alt="" />
|
||||
<p class="success">支付成功</p>
|
||||
<p class="bottom">立即兑换</p>
|
||||
<p class="note">也可在【订单列表】中查看并兑换</p>
|
||||
<p class="bottom" v-if="orderInfo.type==2" @click="receiveFn">立即兑换</p>
|
||||
<p class="note" v-if="orderInfo.type==2">也可在【订单列表】中查看并兑换</p>
|
||||
</div>
|
||||
<!-- 弹出提示 -->
|
||||
<model-pop :show.sync="popAttr.show" :title="popAttr.title" :status="popAttr.status" :text="popAttr.text"
|
||||
@backFunction="backFunctionPop"></model-pop>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
data () {
|
||||
return {}
|
||||
data() {
|
||||
return {
|
||||
orderNumber: '',
|
||||
orderInfo: {},
|
||||
popAttr: {
|
||||
show: false,
|
||||
title: '温馨提示',
|
||||
status: 2,/*1 成功 2提示 3失败 */
|
||||
text: '错误信息'
|
||||
},
|
||||
plaflam:1,
|
||||
redirect_url:'' //微信小程序链接
|
||||
};
|
||||
},
|
||||
|
||||
components: {},
|
||||
|
||||
created () { },
|
||||
created() {
|
||||
let orderNumber = this.getQueryString(
|
||||
window.location.search,
|
||||
"order_number"
|
||||
);
|
||||
this.orderNumber = orderNumber;
|
||||
this.getOrderDetail(orderNumber);
|
||||
},
|
||||
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;
|
||||
},
|
||||
//获取订单详情
|
||||
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.goods.entity.channel;//只有立减金商品才有channel字段
|
||||
}
|
||||
}
|
||||
}).catch();
|
||||
},
|
||||
//弹出框提示
|
||||
openTipDialog(popUpAttr) {
|
||||
this.popAttr = popUpAttr;
|
||||
},
|
||||
/* 弹框回调,点击按钮触发 */
|
||||
backFunctionPop() {
|
||||
|
||||
methods: {}
|
||||
})
|
||||
},
|
||||
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(){
|
||||
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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue