liangjin
2021-04-01 ffcc13c38517386aee4f1b629b0be25a951cd2c2
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
<!--
 * @Author: 小明丶
 * @Date: 2019-08-19 16:20:48
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-06-13 16:44:11
 * @Description: 花呗间联——订单详情
 -->
<template>
    <div class="hbjl-detail-box h-100-g">
        <v-navbar title="订单详情" fixed></v-navbar>
        <div class="content">
            <div class="cell-group">
                <van-cell :value="form.userName" title='用户名称' readonly></van-cell>
                <van-cell :value="form.mblNo" title='联系方式' readonly></van-cell>
                <!-- <van-cell :value="form.aliAccount.replace(/(\d{3})\d*(\d{2})/,'$1xxxxxx$2')" title='用户支付宝账号' readonly></van-cell> -->
                <van-cell v-if="form.aliAccount" :value="form.aliAccount" title='银行卡账户' readonly></van-cell>
            </div>
 
            <div class="cell-group">
                <van-cell :value="form.userAmt" title='到账金额' readonly></van-cell>
                <van-cell :value="form.insAmt" title='还款金额' readonly></van-cell>
                <!-- <van-cell :value="form.insAmt" title='还款总额' readonly></van-cell> -->
                <van-cell v-if="form.dealTime" :value="form.dealTime | timeformat('yyyy-MM-dd')" title='交易日期' readonly></van-cell>
                <van-cell v-else title='交易时间' readonly></van-cell>
                <van-cell :value="form.insTermStr" title='期数' readonly></van-cell>
                <van-cell :value="form.statusStr" :value-class="statusColor" title='订单状态' readonly></van-cell>
                <van-cell :value="form.orderId" title='订单号' readonly></van-cell>
            </div>
 
            <div class="cell-group" >
                <van-cell :value="form.chanName || '无'" title='办理渠道' readonly></van-cell>
                <van-cell :value="form.merName || '无'" title='办理商户' readonly></van-cell>
                <van-cell :value="form.storeName || '无'" title='办理门店' readonly></van-cell>
                <van-cell :value="form.recordPerson || '无'" title='办单员' readonly></van-cell>
            </div>
        </div>
         <!-- 短信验证码弹窗 -->
        <van-popup v-model="yzmShow">
            <div class="yzmbox">
                <van-icon name="cross" class="yzmbox-close" @click="yzmShow = false" />
                <p style="font-size:16px;color:#000;">请输入短信验证码</p>
                <div class="yzmbox-contnet">
                    <div class="yzmbox-contnet-yzm">
                        <span>将发送到手机号:</span>
                        <span>{{userinfo.mblNo.replace(/(\d{3})\d*(\d{4})/, '$1****$2') }}</span>
                    </div>
                </div>
                <div class="yzmbox-contnet-get">
                    <input type="text" v-model="yzmVal" placeholder="请输入验证码">
                    <span class="yzmbox-contnet-get-yzm" @click="getYzm">{{ yzmText }}</span>
                </div>
                <van-button class="showbtn" round @click="yzmYes">确认</van-button>
            </div>
        </van-popup>
        <!-- 退单成功弹窗 -->
        <van-popup v-model="yzmOkShow">
            <div class="yzmOkbox">
                <van-icon name="cross" class="yzmbox-close" @click="yzmOkShow = false" />
                <div class="yzmOkbox-img">
                    <img src="../../assets/img/tkimg.png" alt="">
                </div>
                <p>退款成功</p>
            </div>
        </van-popup>
        <!-- <footer class="footer flex-center-g">
            <van-button class="btn" v-if="form.refundStatus==1" @click="refund">退款</van-button>
            <van-button class="btn" v-if="form.status==0" @click="showCode">显示支付二维码</van-button>
        </footer> -->
 
    </div>
</template>
 
<script>
    import {
        mapState,
        mapGetters
    } from 'vuex';
    import Vue from 'vue';
    import { Notify } from 'vant';
 
    Vue.use(Notify);
    export default {
        data() {
            return {
                // typeId: this.$route.query.typeId,
                Open: true, //倒计时开关
                yzmText:'获取验证码',
                yzmOkShow: false,
                yzmVal: '',
                yzmShow: false, //获取验证码弹窗
                form: {},
                statusColor:''
            }
        },
        computed: {
            ...mapState(['userinfo']),
            ...mapGetters(['orgType']),
            id() {
                return this.$route.query.id
            },
            typeId() {
                return this.$route.query.typeId
            },
        },
        created() {
            this.init()
            console.log(this.typeId)
        },
        methods: {
            //验证码弹窗确认事件
            yzmYes() {
                // console.log(this.yzmVal)
                if(this.yzmVal == '' || this.yzmVal == null){
                    Notify({ type: 'danger', message: '验证码为空!' });
                } else {
                    this.$api.hbOrderRefund({orderId:Number(this.id), verCode:this.yzmVal}).then(() => {
                        // this.$router.replace(`/product/dmf-detail?id=${this.orderId}`)
                        this.$notify('退款成功')
                        this.yzmShow = false;
                        this.yzmVal = '',
                        this.yzmOkShow = true;
                        setTimeout(() => {
                            location.reload()
                        }, 700);
                    })
                   
                }
            },
            //获取验证码
            getYzm() {
                let sendParams = {
                    // mblNo: this.userinfo.mblNo,
                    mblNo: this.userinfo.mblNo,
                    verCodeType: 11,
                };
                if(this.typeId != 200002) {
                    sendParams.verCodeType =11;
                }
                if(this.Open) {
                    this.$api.userSendMsg(sendParams).then(res => {
                        console.log(res.body)
                        this.Open = false
                        let num = 60;
                        this.yzmText = num + '秒后重发';
                        let _this = this
                        let timer = setInterval(() => {
                            num--;
                            // _this.$set(_this.yzmText = num + 's重发')                       
                            if(num === 0) {
                                clearInterval(timer);
                                _this.Open = true;
                                _this.yzmText = '重新发送';
                            } else {
                                _this.yzmText = num + '秒后重发';
                            }
                        },1000)
                    }).catch(()=>{
                        this.Open = true;
                    })
                }
            },
            init() {
                console.log(111)
                this.$api.hbjlOrderOrderDtl({
                    orderId:this.id
                }).then((res) => {
                    this.form = res.body || {};
                    if(this.form) {
                        if (this.form.status == 1) {
                            this.statusColor = 'status-val-done';
                        } else if (this.form.status == 2) {
                            this.statusColor = 'status-val-error';
                        } else if (this.form.status == 3) {
                            this.statusColor = 'status-val-refund';
                        } else if (this.form.status == 0) {
                            this.statusColor = 'status-val-wait';
                        } else {
                            this.statusColor = 'status-val-done';
                        }
                    }
                }).catch((err) => {
 
                });
            },
            //退款
            refund() {
                this.$dialog.confirm({
                    message: '是否确认退款'
                }).then(() => {
                     this.yzmShow = true
                    // this.$api.hbOrderRefund(this.id).then((res) => {
                    //     if (res.errorCode == 0) {
                    //         this.$notify('退款成功');
                    //         this.$router.back();
                    //     }
                    // }).catch((err) => {
 
                    // });
                }).catch(() => {
                    // on cancel
                });
                // this
 
            },
            //展示二维码
            showCode() {
                if (this.form.payCode) {
                    window.sessionStorage.setItem("hbpayQrCodeUrl", this.form.payCode);
                    let queryObj = {
                        payQrCodeUrl:this.form.payCode,
                        orderId: this.form.orderId,
                        totalAmount: this.form.insAmt,
                        term: this.form.insTerm,
                        typeId:this.typeId || ''
                    }
                    this.$router.push({
                        path: "/hb-getHBQRCode",
                        query: queryObj
                    })
                }
            }
        },
    }
</script>
<style lang="less" scoped>
    .showbtn{
        width: 60%;
        background: @c-default;
        color: #fff;
        position: absolute;
        bottom: 15px;
    }
    .yzmbox{
        box-sizing: border-box;
        width: 280px;
        height: 225px;
        position: relative;
        overflow: hidden;
        // background: #f5f5f5;
        .flex('', center, center, column);
        text-align: center;
        border-radius: 6px;
        background: #fff;
        padding-top: 34px;
        &-close{
            color: #999;
            font-size: 16px;
            position: absolute;
            right: 8px;
            top: 8px;
        }
        &-contnet{
            margin-top: 11px;
            color: #999;
            font-size: 14px;
            &-yzm{
                .flex(center, center);
                // font-size: 14px;
                span{
                    font-size: 14px;
                    // color: #999;
                }
                
            }
            &-get{
                width: 80%;
                margin: 0 10%;
                margin-top: 30px;
                .flex(space-between, center);
                 input{
                    border: none;
                    width: 45%;
                    background: #fff;
                    height: 30px;
                }
                &-yzm{
                    color: @c-default;
                }
            }
        }
    }
    .yzmOkbox{
        box-sizing: border-box;
        width: 280px;
        height: 225px;
        position: relative;
        overflow: hidden;
        .flex(center, center,'',column);
        &-img{
            width: 90px;
            height: 90px;
            img{
                width: 100%;
                height: 100%;
            }
        }
        p{
            font-size: 16px;
            color: #000;
            margin-top: 16px;
        }
    }
    .status-val-done {
        color:#19BE6B;
    }
    .status-val-refund {
        color:#FF9900;
    }
    .status-val-wait {
        color:#FF9900;
    }
    .status-val-error {
        color:#ED4014;
    }
    .hbjl-detail-box {
        padding-top: 44px;
        background-color: @c-bg-f5;
 
        .content {
            padding: 10px 8px;
        }
 
        .cell-group {
            margin-bottom: 10px;
        }
    }
 
    .footer {
        padding-bottom: 30px;
        margin: 0 8px;
        background-color: @c-bg-f5;
 
        .btn {
            width: 50%;
            color: @c-text-fff;
            background-color: @c-bg-default;
        }
    }
</style>