提交 585b11ba authored 作者: lihuihui's avatar lihuihui

updata

上级 12a7b545
......@@ -97,6 +97,10 @@ export default class API {
window.G.$instance_vue.$router.replace({
path: '/pay'
})
// const routeData = window.G.$instance_vue.$router.resolve({
// name: 'pay'
// })
// window.open(routeData.href, '_blank')
}
}
err = new Error(JSON.stringify(res.response))
......
......@@ -3,10 +3,13 @@
<div class="pay-box"></div>
</template>
<script>
import { Toast } from 'vant'
import Pay from '../action'
export default {
name: 'PayH5',
components: {},
components: {
[Toast.name]: Toast
},
data () {
const _this = this
return {
......@@ -108,7 +111,6 @@ export default {
this.requestParam.nonceStr = res.data.options.nonceStr
this.requestParam.signType = res.data.options.signType
this.requestParam.paySign = res.data.options.paySign
this.wxWakeUpToPay(obj)
} else {
obj.code = 3003
......@@ -123,6 +125,14 @@ export default {
})
},
wxWakeUpToPay (obj) {
Toast(obj)
if (typeof WeixinJSBridge === 'undefined') {
obj.code = 4001
obj.msg = '缺少微信api'
this.VueEvent.$emit('pay-wx-h5-callback', obj)
return obj
}
const _this = this
/* 直接调用微信支付 */
// const timestamp = parseInt(new Date().getTime() / 1000)
// const noncestr = parseInt(Math.random() * 10000000000000000)
......@@ -144,7 +154,7 @@ export default {
// res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
obj.code = 200
}
this.VueEvent.$emit('pay-wx-h5-callback', obj)
_this.VueEvent.$emit('pay-wx-h5-callback', obj)
}
)
}
......
......@@ -52,8 +52,9 @@ export default {
this.VueEvent.$emit('pay-wx-h5', {})
this.VueEvent.$off('pay-wx-h5-callback').$on('pay-wx-h5-callback', obj => {
if (obj.code === 200) {
this.$router.go(-1)
this.$router.back()
} else {
// this.$router.go(-2)
Toast('支付失败!')
}
console.log(obj, '======')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论