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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<!--
 * @Author: 小明丶
 * @Date: 2019-10-24 15:13:33
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-11-20 17:26:19
 * @Description: 
 -->
<template>
  <div class="tonglian-withdrawals-page">
    <v-navbar title="提现">
      <div slot="right" @click="goHistory">提现纪录</div>
    </v-navbar>
    <!-- 账号 -->
    <div class="zfb-box">
      <div class="left">
        <p>提现至</p>
      </div>
      <div class="right">
        <span
          v-if="sta == '02'"
          style="color: #333333; font-size: 14px; margin-bottom: 5px"
          >支付宝账号</span
        >
        <span
          v-if="sta == '01'"
          style="color: #333333; font-size: 14px; margin-top: 9px"
          >银行卡账号</span
        >
        <span style="color: #333333; font-size: 14px">{{
          withdAccount.replace(/^(.{3})(?:\d+)(.{4})$/, "$1****$2")
        }}</span>
      </div>
    </div>
    <!-- 金额 -->
    <div class="money-box">
      <div class="tit">
        <p>提现金额</p>
      </div>
      <div class="input-box">
        <span>¥</span>
        <van-field
          v-model="amount"
          placeholder="请输入提现金额"
          style="
            width: 70%;
            display: inline-block;
            margin-left: 30px;
            font-size: 18px;
          "
          :border="false"
          maxlength="10"
        />
        <span @click="allWithd">全部提现</span>
      </div>
      <div class="yue">
        <p>
          <span>可提现金额:</span>
          <span>¥{{ this.balanceAmt }}</span>
        </p>
      </div>
    </div>
    <van-button
      round
      type="info"
      color="#896EDB"
      style="
        width: 86%;
        margin-top: 60px;
        margin-left: 7%;
        background: #896edb;
        color: #fff;
        border: 0.02rem solid rgb(137, 110, 219);
      "
      @click="getWidthrawals"
      >下一步</van-button
    >
    <!-- 短信弹窗 -->
    <van-popup
      v-model="showSendCode"
      style="width: 75%; text-align: center; padding: 34px 18px 20px 18px"
    >
      <van-icon
        name="cross"
        size="20px"
        style="position: absolute; right: 10px; top: 10px; color: #cccccc"
        @click="closePop"
        color="#CCCCCC"
      />
      <p style="font-size: 16px; font-weight: 500; color: rgba(0, 0, 0, 1)">
        请确认提现金额
      </p>
      <p
        style="
          font-size: 14px;
          font-weight: 500;
          color: rgba(153, 153, 153, 1);
          margin: 12px 0 20px 0;
        "
      >
        您当前发起提现金额为:
      </p>
      <p style="font-size: 18px;">{{amount}}元</p>
      <!-- <div class="withdrawal-code-box">
        <input
          type="text"
          v-model="authCode"
          placeholder="请输入验证码"
          maxlength="6"
        />
        <van-button size="small" color="#896EDB" plain type="info" @click="getCode">{{
          btnText
        }}</van-button>
      </div> -->
      <button class="withdrawal-btn" @click="goResrult">发起提现</button>
    </van-popup>
  </div>
</template>
<script>
import Vue from "vue";
import QRCode from "qrcode";
//import { setInterval } from 'timer';
import { Notify,Toast } from "vant";
import { Icon } from "vant";
 
Vue.use(Toast);
Vue.use(Icon);
Vue.use(Notify);
export default {
  data() {
    return {
      btnDis: false, //获取验证码按钮是否禁用
      btnText: "发送验证码",
      params: {}, //路由接收的参数
      showSendCode: false, //短信验证码弹窗
      showTip: false, //提示弹窗
      amount: "", //提现金额
      timer: "", //轮训定时器
      balanceAmt: "", //可提现余额
      branchName: "", //开户支行名称
      withdAccount: "", //提现账户
      legalMblNo: "", //提现手机号
      authCode: "", //验证码
      withdrawId: "", //提现id
      sta: 1,
      hasGetCode:true,
    };
  },
  created() {
    this.$api.tltWalletInit().then((res) => {
      this.balanceAmt = res.body.balanceAmt;
      this.sta = res.body.settType;
      this.branchName = res.body.branchName;
      this.withdAccount = res.body.withdAccount;
      this.legalMblNo = res.body.legalMblNo;
    });
  },
  mounted() {
    this.params = this.$route.params;
  },
  updated() {
    window.onresize;
  },
  beforeDestroy() {
    clearInterval(this.timer);
    this.timer = null;
  },
  methods: {
    /**
     * @description:获取验证码
     * @return void
     * **/
    getCode() {
      let _this = this;
      this.$api
        .tltWalletSendSmsCode({
          amount: this.amount,
        })
        .then((res) => {
          this.hasGetCode = true
          this.withdrawId = res.body.withdrawId;
          this.btnText = 60;
          this.btnDis = true;
          this.timer = setInterval(function () {
            if (_this.btnText == 1) {
              _this.btnText = "重新获取";
              _this.btnDis = false;
              clearInterval(_this.timer);
            } else {
              _this.btnText = --_this.btnText;
            }
          }, 1000);
        });
    },
    /**
     * @description:弹出层关闭
     * @return void
     * **/
    closePop() {
      this.showSendCode = false;
    },
    /**
     * @description:提现函数
     * @return void
     * **/
    getWidthrawals() {
      if (this.amount <= 0) {
        Notify({ type: "primary", message: "提现金额需大于0元" });
      }else if (this.amount > this.balanceAmt) {
        Notify({ type: "primary", message: "提现金额不得大于余额" });
      } else {
        this.showSendCode = true;
        this.getCode()
      }
    },
    /**
     * @description:全部提现
     * @return void
     * **/
    allWithd() {
      this.amount = this.balanceAmt;
    },
    /**
     * @description:提交提现,跳转提现结果
     * @return void
     * **/
    goResrult() {
      if(!this.hasGetCode){
         Toast.fail('请先获取验证码');
         return false
      }
      this.$api
        .tltWalletWithdraw({
          withdrawId: this.withdrawId,
          authCode: '888888',
          amount: this.amount,
        })
        .then((res) => {
          this.$router.push({
            path: "/tonglian/Withdrawal-result",
            query: {
              withdrawId: this.withdrawId,
            },
          });
        });
    },
    /**
     * @description:跳转提现记录
     * @return void
     * **/
 
    goHistory() {
      this.$router.push({
        path: "/tonglian/withdrawal-history",
      });
    },
  },
};
</script>
<style lang="less" scoped>
.tonglian-withdrawals-page {
  & {
    background-color: #f0f1f3;
    height: 100vh;
  }
  .clearfix {
    *zoom: 1;
  }
  .clearfix:after {
    clear: both;
    display: block;
    visibility: hidden;
    height: 0;
    content: ".";
  }
  .zfb-box {
    height: 60px;
    width: 94%;
    background-color: white;
    border-radius: 3px;
    margin-left: 3%;
    margin-top: 20px;
    display: flex;
    .left {
      width: 20%;
      box-sizing: border-box;
      padding-left: 13px;
      line-height: 60px;
      p {
        color: #333333;
        font-size: 18px;
        font-weight: Bold;
        text-align: left;
      }
    }
    .right {
      width: 84%;
      box-sizing: border-box;
      padding-left: 10px;
      line-height: 60px;
    }
  }
  .money-box {
    width: 94%;
    background-color: white;
    margin-left: 3%;
    height: 145px;
    margin-top: 20px;
    border-radius: 3px;
    .tit {
      height: 50px;
      box-sizing: border-box;
      padding: 18px 0 17px 13px;
      p {
        color: #333333;
        font-weight: bold;
        font-size: 16px;
      }
    }
    .input-box {
      border-bottom: 1px solid #eeeeee;
      box-sizing: border-box;
      padding-left: 13px;
      padding-right: 12px;
      vertical-align: middle;
      position: relative;
      span:nth-of-type(1) {
        font-size: 18px;
        display: inline-block;
        position: absolute;
        bottom: 15px;
        z-index: 1000;
      }
      span:nth-of-type(2) {
        font-size: 14px;
        color: #896edb;
        text-decoration: underline;
        position: absolute;
        bottom: 15px;
        z-index: 1000;
      }
    }
    .yue {
      box-sizing: border-box;
      padding-left: 13px;
      padding-top: 16px;
      p {
        span:nth-of-type(1),
        span:nth-of-type(3) {
          font-size: 12px;
          color: #999999;
        }
        span:nth-of-type(2) {
          font-size: 12px;
        }
      }
    }
  }
  .notes {
    font-size: 12px;
    color: #999999;
    text-align: center;
    margin-top: 12px;
  }
  .payCode {
    .myimg {
      position: absolute;
      top: 45px;
      left: 85px;
      z-index: 1000;
    }
  }
  .prod {
    p:nth-of-type(1) {
      font-size: 18px;
      color: #333333;
      margin-bottom: 20px;
      margin-top: 25px;
    }
    p:nth-of-type(2),
    p:nth-of-type(3) {
      font-size: 12px;
      color: #999999;
      margin-bottom: 5px;
    }
  }
  .withdrawal-btn {
    width: 70%;
    height: 36px;
    background: rgba(137, 110, 219, 1);
    border-radius: 18px;
    border: 0;
    outline: none;
    margin-top: 28px;
    color: #fff;
  }
  .withdrawal-code-box {
    text-align: center;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 5px;
    display: flex;
    input {
      border: 0;
      width: 66%;
      text-align: center;
    }
  }
}
</style>