liangjin
2021-03-23 eb9443b959ad490ac735f2c04e4dee743d7365c7
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
<!--
 * @Author: 小明丶
 * @Date: 2019-08-19 16:20:48
 * @LastEditors: 小明丶
 * @LastEditTime: 2019-10-22 08:56:10
 * @Description: 花呗分期——订单详情
 -->
<template>
    <div class="hb-detail-box h-100-g">
        <v-navbar title="订单详情" fixed></v-navbar>
        <div class="content">
            <div class="cell-group">
                <van-cell :value="form.usrName" title='姓名' readonly></van-cell>
                <van-cell :value="form.usrNo" title='手机号' readonly></van-cell>
            </div>
 
            <div class="cell-group">
                <van-cell v-if="form.creTime" :value="form.creTime | timeformat('yyyy-MM-dd')" title='交易时间' readonly></van-cell>
                <van-cell v-else title='交易时间' readonly></van-cell>
                <van-cell :value="form.status" :value-class="statusColor" title='订单状态' readonly>{{ form.status == 0 ? '待确认' : form.status == 1? '拉新' : form.status == 2? '拉新+绑卡' : '无效' }}</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.mgrName || '无'" title='办单员' readonly></van-cell>
            </div>
 
            <!-- <div class="cell-group">
                <van-cell :value="form.rate + '%'" title='费率' readonly></van-cell>
            </div> -->
        </div>
 
        <!-- <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
    } from 'vuex';
    export default {
        data() {
            return {
                form: {},
                statusColor:'',
                id: this.$route.query.id, //lx订单详情id
            }
        },
        computed: {
            id() {
                return this.$route.query.id
            },
            typeId() {
                return this.$route.query.typeId
            },
            ...mapState(['userinfo'])
        },
        created() {
            this.init()
        },
        methods: {
            init() {
                // this.$api.getHBDetail(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) => {
 
                // });
                //拉新列表初始化
                this.$api.zfbLxList().then(res => {
                    res.body.filter( item => {
                        if(item.id == this.id) this.form = item
                    })
                    // console.log(this.form)
                    switch (this.form.status) {
                        case 0: 
                            this.statusColor = 'status-val-wait'
                            break;
                        case 1: 
                            this.statusColor = 'status-val-done'
                        case 2: 
                            this.statusColor = 'status-val-done'
                            break;
                        case 2: 
                            this.statusColor = 'status-val-error'
                            break;
                    
                        default:
                            break;
                    }
                }).catch((err) => {
 
                });
            },
            //退款
            refund() {
                this.$dialog.confirm({
                    message: '是否确认退款'
                }).then(() => {
                    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.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>
    .status-val-done {
        color:#19BE6B;
    }
    .status-val-refund {
        color:#FF9900;
    }
    .status-val-wait {
        color:#333333;
    }
    .status-val-error {
        color:#ED4014;
    }
    .hb-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>