liangjin
2021-04-04 6ab8cacad8580c7d297609d6583b46b89310ff6f
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/*
 * @Author: c.y
 * @Date: 2018-12-24 15:25:57
 * @Last Modified by: c.y
 * @Last Modified time: 2019-06-06 15:22:27
 * @文件说明:开通花呗--审核结果
 */
<template>
  <div class="huabei-result-page">
    <x-header
      :title="'开通' + this.$route.query.title"
      :left-options="{backText:'',preventGoBack:true}"
      @on-click-back="pageGoBack()"
    ></x-header>
    <div class="status-icon">
      <i v-if="openStatus == 1" class="iconfont scene_Staging-shenhezhong1"></i>
      <i v-if="openStatus == 2" class="iconfont scene_Staging-danxuan"></i>
      <i v-if="openStatus == 3" class="iconfont scene_Staging-shibai1"></i>
      <i v-if="openStatus == 4" class="iconfont scene_Staging-shenhezhong1"></i>
    </div>
    <div class="tips">
      <p v-if="openStatus == 1">审核中</p>
      <p v-if="openStatus == 2">审核通过</p>
      <p v-if="openStatus == 3">审核未通过</p>
      <p v-if="openStatus == 4">人工审核中,请联系客服</p>
    </div>
    <div style="padding:0 15px;margin-top:20px;color:#999;" v-if="openStatus != 4">
      <x-input title="花呗审核备注" v-model="hbAuditRemark" :readonly="true" text-align="right"></x-input>
    </div>
    <f-button @on-click="handleBack">{{ buttonText }}</f-button>
    <f-button v-if="signUrl" @on-click="goSign">去签约</f-button>
  </div>
</template>
 
<script>
export default {
  name: "add-account",
  data() {
    return {
      openStatus: 0, // 开通状态
      buttonText: "", // 底部按钮文字
      signUrl: null, //签约地址
      hbAuditRemark: "无", //花呗审核备注
      timer:"",//定时器
    };
  },
  computed:{
    isApp(){
      return Number(this.$route.query.isApp)
    }
  },
  methods: {
    goSign() {
      window.location.href = this.signUrl;
    },
    pageGoBack() {
      if(this.isApp==1){
        this.$router.push({
          path: "/app/home"
        });
      }else{
        this.$router.push({
          path: "/main/productManagement"
        });
      }
      
    },
    // 1.商户提交开通花呗分期申请后状态:审核中,审核不通过,开通成功。
    // 2.如果是审核中,点击返回按钮回到“我”的界面;
    // 3.如果审核失败,底部按钮改为“重新开通”,点击进入产品管理页并可以重新开通花呗分期;
    // 4.如果开通成功,按钮改为“查看详情”,点击进入花呗详情页面;
    // 5.如果是审核中,点击返回按钮回到“我”的界面;
    handleBack() {
      let jumpUrl = "";
      switch (this.openStatus) {
        case 1:
          if(this.isApp==1){
            jumpUrl = "/app/home";
          }else{
            jumpUrl = "/main/mine";
          }
          break;
        case 2:
          if(this.isApp==1){
            if(this.$route.query.prodId == 30000003){
              jumpUrl = "/app/zfbVersionDetail";
            }else{
              jumpUrl = "/app/shskVersionDetail";
            }
          }else{
            if (this.$route.query.title == "花呗分期") {
              jumpUrl = "/huabei/staging";
            } else {
              jumpUrl = "/huabei/staging_dmf";
            }
          }
          break;
        case 3:
          if(this.isApp==1){
            jumpUrl = "/app/home";
          }else{
            jumpUrl = "/main/productManagement";
          }
          break;
        case 4:
          if(this.isApp==1){
            jumpUrl = "/app/home";
          }else{
            jumpUrl = "/main/mine";
          } 
      }
      // 审核未通过3---需要调用--重新开通接口
      if (this.openStatus === 3) {
        this.$api.hbOpenReOpen({}).then(res => {
          this.$router.push({
            path: jumpUrl,
            query:{
              ...this.$route.query
            }
          });
        });
      } else {
        this.$router.push({
          path: jumpUrl,
          query:{
            ...this.$route.query
          }
        });
      }
    },
    // * 开通状态 mOpenStatus 0-待开户,1-审核中,2-审核通过,3-审核未通过 4-人工审核
    init() {
      if (this.$route.query.prodId == "30000011") {
        this.$api.findXygOpenSts().then(res => {
          console.log(res);
          try {
            this.signUrl = res.body.signUrl || null;
            this.hbAuditRemark = res.body.hbAuditRemark || "无";
          } catch (err) {}
          this.openStatus = res.body.openStatus;
          console.log("aaa" + this.openStatus);
          switch (res.body.openStatus) {
            case 1:
              this.buttonText = "返回";
              
              break;
            case 2:
              this.buttonText = "查看详情";
              clearInterval(this.timer)
              break;
            case 3:
              this.buttonText = "重新开通";
              clearInterval(this.timer)
              break;
            case 4:
              this.buttonText = "返回";
              clearInterval(this.timer)
          }
          console.log("bbb" + this.buttonText);
        });
      } else {
        this.$api
          .findOpenSts({
            zfbVersion: this.$route.query.zfbVersion
          })
          .then(res => {
            console.log(res);
            try {
              this.signUrl = res.body.signUrl || null;
              this.hbAuditRemark = res.body.hbAuditRemark || "无";
            } catch (err) {}
            this.openStatus = res.body.openStatus;
            console.log("aaa" + this.openStatus);
            switch (res.body.openStatus) {
              case 1:
                this.buttonText = "返回";
               
                break;
              case 2:
                this.buttonText = "查看详情";
                clearInterval(this.timer)
                break;
              case 3:
                this.buttonText = "重新开通";
                clearInterval(this.timer)
                break;
              case 4:
                this.buttonText = "返回";
                clearInterval(this.timer)
            }
            console.log("bbb" + this.buttonText);
          });
      }
    }
  },
  created() {
    console.log(this.$route.query.title);
    this.buttonText = "";
    this.openStatus = 0;
    this.init();
  },
  mounted(){
    let _this = this
    this.timer = setInterval(()=>{
      _this.init();
    },5000)
  },
  beforeRouteLeave (to, from, next) {
    // 清除定时器
    clearInterval(this.timer)
    next()
  }
};
</script>
 
<style lang="less">
.huabei-result-page {
  padding-top: 45px;
  .status-icon {
    padding-top: 20px;
    text-align: center;
  }
  .iconfont {
    font-size: 64px;
    color: #bfa073;
  }
  .scene_Staging-shibai1 {
    color: #f76260;
  }
  .tips {
    color: #999;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
  }
}
</style>