liangjin
2021-04-01 006010711477c17f05de52f074a284e0184923b5
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
109
110
111
112
113
114
115
<!--
 * @Author: 小明丶
 * @Date: 2020-08-17 15:34:00
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-10-12 17:22:28
 * @Description: 通联提现结果页面
-->
<template>
  <div class="withdrawal-result-page">
    <v-navbar title="提现结果"></v-navbar>
    <div class="res-box">
      <img
        v-if="status == 2"
        src="../../../../../static/img/cg.png"
        alt="提现成功"
      />
      <img
        v-if="status == 0"
        src="../../../../../static/img/ing.png"
        alt="初始化"
      />
      <img
        v-if="status == 1"
        src="../../../../../static/img/ing.png"
        alt="提现中"
      />
      <img
        v-if="status == 3"
        src="../../../../../static/img/cs.png"
        alt="提现失败"
      />
      <p>{{ resultText }}</p>
    </div>
    <button class="btn-y" v-show="status != 0 && status != 1" @click="$router.go(-1)">返回</button>
  </div>
</template>
<script>
export default {
  data() {
    return {
      status: 0, //0 初始化  1提现中 2成功 3失败
      resultText: "提现中,请稍后",
      timer:"",
    };
  },
  created() {
      this.init()
  },
  methods: {
    init() {
      clearInterval(this.timer)
      this.$api
        .tltWalletWithdrawStatus({
          withdrawId: this.$route.query.withdrawId,
        })
        .then((res) => {
       
          this.status = res.body.status;
          if (res.body.status == 3) {
            this.resultText = "提现失败,请重试";
          } else if (res.body.status == 2) {
            this.resultText = "提现成功";
          } else {
            this.resultText = "提现中,请稍后";
            this.timer = setInterval(()=>{
                this.init()
            },5000)
          }
        });
    },
  },
  beforeRouteLeave (to, from, next) {
      clearInterval(this.timer)
      next()
  }
};
</script>
<style lang="less">
.withdrawal-result-page {
  & {
    min-height: 100vh;
    background: #f5f5f7;
  }
  .res-box {
    width: 96vw;
    margin-left: 2vw;
    box-sizing: border-box;
    padding: 33px;
    margin-top: 10px;
    background: #fff;
    text-align: center;
    img {
      width: 95px;
      height: 95px;
    }
    p {
      margin-top: 17px;
      font-size: 14px;
      color: #333;
      font-weight: 500;
    }
  }
  .btn-y{
    width: 94%;
    margin-left: 3%;
    margin-top: 20px;
    color:#fff ;
    height: 44px;
    background: #896edb;
    border: 0;
    outline: none;
    border-radius: 22px;
  }
}
</style>