payResult.vue
1.51 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
<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>
</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:''
}
},
created(){
// console.log(this.$route.query.ID)
this.resultBG = oKBg
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 = '支付失败'
}
})
}
}
}
</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%;
}
</style>