payResult.vue
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<template>
<div style="padding-top: 50px">
<div class="pay-result">
<div :style="{'background-image': 'url('+resultBG+')'}" class="result-bg"></div>
<div>{{payMsg}}</div>
</div>
<div class="close" @click="closePage" v-show="isShow">关闭</div>
</div>
</template>
<script>
import oKBg from '../assets/images/ok.png'
import noBg from '../assets/images/no.png'
import { queryBankOrderState } from '@/api/payResult/payResult'
export default {
name: 'payResult',
data() {
return {
resultBG: '',
payMsg: '支付成功',
orderId:'',
isShow:false
}
},
created(){
// console.log(this.$route.query.ID)
this.resultBG = oKBg
if(window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) {
// alert('当前页面在新容器');
this.isShow = true
} else {
// alert('当前页面在旧容器');
}
// this.orderId = localStorage.getItem("OrderNum")
// this.queryBankOrderState()
// alert(window.location.href)
// alert(this.$router.query.ID)
},
mounted(){
// alert(window.location.href)
},
methods:{
queryBankOrderState:function () {
let me = this
let params = {
payOrderId : me.orderId
}
queryBankOrderState(params).then(response => {
console.log(response)
if(response.data.payResultEnum == 'PAY_SUCCESS'){
me.resultBG = oKBg
me.payMsg = '支付成功'
}else{
me.resultBG = noBg
me.payMsg = '支付失败'
}
})
},
closePage:function () {
if(window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) {
// alert('当前页面在新容器');
AlipayJSBridge.call('abcExitWebAndBackToHome');
} else {
// alert('当前页面在旧容器');
// 旧支付方式
}
}
}
}
</script>
<style scoped lang="scss">
.pay-result {
/*width: 150px;*/
margin: 0 auto;
text-align: center;
}
.result-bg {
display: inline-block;
width: 70px;
height: 70px;
background-position: center 0;
background-size: 100% 100%;
}
.close{
width: 80%;
margin: 20px auto;
height: 40px;
line-height: 40px;
color: #fff;
text-align: center;
background: #0564cc;
border-radius: 5px;
cursor: pointer;
}
</style>