提交 feb447a9 authored 作者: lihuihui's avatar lihuihui
...@@ -51,22 +51,45 @@ export default { ...@@ -51,22 +51,45 @@ export default {
// 微信支付 // 微信支付
wxPay() { wxPay() {
const options = this.order.options const options = this.order.options
wx.chooseWXPay({ WeixinJSBridge.invoke(
timestamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符 'getBrandWCPayRequest',
nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位 {
package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*) appId: options.appId, // 公众号名称,由商户传入
signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5' timeStamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
paySign: options.paySign, // 支付签名 nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位
success: res => { package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
this.$toast('支付成功') signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// 支付成功后的回调函数 paySign: options.paySign // 支付签名
this.$emit('success', res)
}, },
fail: error => { function (res) {
this.$toast('支付失败') if (res.err_msg === 'get_brand_wcpay_request:ok') {
this.$emti('fail', error) // 使用以上方式判断前端返回,微信团队郑重提示:
// res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
this.$toast('支付成功')
// 支付成功后的回调函数
this.$emit('success', res)
} else {
this.$toast('支付失败')
this.$emti('fail', res)
}
} }
}) )
// wx.chooseWXPay({
// timestamp: options.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
// nonceStr: options.nonceStr, // 支付签名随机串,不长于 32 位
// package: `prepay_id=${this.order.prepay_id}`, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
// signType: options.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
// paySign: options.paySign, // 支付签名
// success: res => {
// this.$toast('支付成功')
// // 支付成功后的回调函数
// this.$emit('success', res)
// },
// fail: error => {
// this.$toast('支付失败')
// this.$emti('fail', error)
// }
// })
}, },
pay() { pay() {
this.getOpenId() this.getOpenId()
......
<template> <template>
<div class="main-container" v-show="loaded"> <div class="main-container" v-show="loaded">
<ul v-if="list.length"> <ul v-if="dataList.length">
<li class="order-item" v-for="(item, index) in list" :key="index"> <li class="order-item" v-for="(item, index) in dataList" :key="index">
<div class="order-info"> <div class="order-info">
<div class="no-c"></div> <div class="no-c"></div>
<img :src="item.product_image" /> <img :src="item.product_image" />
...@@ -28,8 +28,10 @@ ...@@ -28,8 +28,10 @@
<div class="close" @click="isPopShow = false">×</div> <div class="close" @click="isPopShow = false">×</div>
<div class="tit">恭喜您,课程已购买成功!</div> <div class="tit">恭喜您,课程已购买成功!</div>
<div class="txt">请添加客服微信,有任何问题可随时沟通客服。</div> <div class="txt">请添加客服微信,有任何问题可随时沟通客服。</div>
<img src="../../assets/images/pay/pay-izq.png" alt=""> <img src="../../assets/images/pay/pay-izq.png" alt />
<a href="https://mp.weixin.qq.com/s/fwDqI1SFrk_bAyUrbLOvhg"><div class="btns">添加客服微信</div></a> <a href="https://mp.weixin.qq.com/s/fwDqI1SFrk_bAyUrbLOvhg">
<div class="btns">添加客服微信</div>
</a>
<!-- <img @click="imagePreview" src="https://zws-imgs-pub.ezijing.com/static/public/dcef7bc62237a077b10d7e49c44a1e51.jpg" alt=""> --> <!-- <img @click="imagePreview" src="https://zws-imgs-pub.ezijing.com/static/public/dcef7bc62237a077b10d7e49c44a1e51.jpg" alt=""> -->
</div> </div>
</div> </div>
...@@ -50,14 +52,24 @@ export default { ...@@ -50,14 +52,24 @@ export default {
goFlag: true goFlag: true
} }
}, },
mounted() {
this.getMyOrder()
},
computed: { computed: {
isIos() {
return this.$store.state.isIos
},
isWeapp() { isWeapp() {
return this.$store.state.isWeapp return this.$store.state.isWeapp
},
// ios小程序里过滤未支付的订单
dataList() {
if (this.isIos && this.isWeapp) {
return this.list.filter(item => item.status !== '-1')
}
return this.list
} }
}, },
mounted() {
this.getMyOrder()
},
filters: { filters: {
courseStatusText(status) { courseStatusText(status) {
return status === '1' ? '已付款' : '未付款' return status === '1' ? '已付款' : '未付款'
...@@ -181,33 +193,33 @@ export default { ...@@ -181,33 +193,33 @@ export default {
} }
} }
} }
.succ-pop{ .succ-pop {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: rgba(0,0,0,0.5); background: rgba(0, 0, 0, 0.5);
.pop{ .pop {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
-webkit-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%);
width:5.9rem; width: 5.9rem;
height:6.98rem; height: 6.98rem;
background:rgba(255,255,255,1); background: rgba(255, 255, 255, 1);
border-radius:.12rem; border-radius: 0.12rem;
.tit{ .tit {
line-height: 1.1rem; line-height: 1.1rem;
text-align: center; text-align: center;
font-size: .3rem; font-size: 0.3rem;
color: #222; color: #222;
font-weight: bold; font-weight: bold;
} }
.txt{ .txt {
width:5.1rem; width: 5.1rem;
font-size: .3rem; font-size: 0.3rem;
color:rgba(34,34,34,1); color: rgba(34, 34, 34, 1);
margin: 0 auto; margin: 0 auto;
} }
// img{ // img{
...@@ -216,28 +228,28 @@ export default { ...@@ -216,28 +228,28 @@ export default {
// margin: 0.4rem auto; // margin: 0.4rem auto;
// display: block; // display: block;
// } // }
img{ img {
width: 3.16rem; width: 3.16rem;
height: 3rem; height: 3rem;
margin: 0.6rem auto 0.45rem auto; margin: 0.6rem auto 0.45rem auto;
display: block; display: block;
} }
.btns{ .btns {
width: 4.5rem; width: 4.5rem;
height: 0.7rem; height: 0.7rem;
background: #C62245; background: #c62245;
border-radius: .12rem; border-radius: 0.12rem;
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
line-height: 0.7rem; line-height: 0.7rem;
font-size: .3rem; font-size: 0.3rem;
color: #fff; color: #fff;
} }
.close{ .close {
position: absolute; position: absolute;
top: -.8rem; top: -0.8rem;
right: 0; right: 0;
font-size: .6rem; font-size: 0.6rem;
color: #fff; color: #fff;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论