liangjin
2021-04-01 b3d69d1ed5d25ec57cf50e742100a5e4f61b2301
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
409
410
411
412
413
414
415
<!--
 * @Date: 2019-09-02 09:01:22
 * @LastEditors: 小明丶
 * @LastEditTime: 2019-09-02 09:20:18
 * @Description:
 -->
<template>
    <div class="open-heyd-index">
        <x-header :title="'开通公众租机'" :left-options="{backText: '', preventGoBack: true}" @on-click-back="goBackPage">
        </x-header>
        <!-- v-show="step === 1"  -->
        <mer-info
            v-show="step === 1"
            :merRefList="merRefList"
            :bankList="bankList"
            :address="address"
            :addressList="addressList"
            :merInfo="merInfo"
            @addr-change="setCitycode"
        >
        </mer-info>
        <store-info
                v-show="step === 2"
                :bizLicenseTypeList="bizLicenseTypeList"
                :storeInfo="storeInfo"
        >
        </store-info>
        <mgr-info
                v-show="step === 3"
                :mgrReqVo="mgrReqVo"
        >
        </mgr-info>
        <f-space type="large"></f-space>
        <f-button @on-click="handleNextStep" fixed>{{ (step!== 3) ? '下一步' : '提交开通' }}</f-button>
    </div>
</template>
 
<script>
    import MerInfo from './merBaseInfo.vue';
    import StoreInfo from './storeBaseInfo.vue';
    import MgrInfo from './storeBaseMgrInfo.vue';
    import formCheckAndComt from '@/utils/formCheckAndComb';
    import {calcArea} from '@/utils/index';
    import {
        dateFormat
    } from 'vux'
 
    export default {
        name: 'gzzjMerOpen',
        components: {
            MerInfo,
            StoreInfo,
            MgrInfo
        },
        data() {
            return {
                orgType: 0,
                step: 1,
                stepText: '下一步',
                bankList: [],
                cardTypeList: [],
                merRefList:[],
                addressList:[],
                address:[],
                bizLicenseTypeList: [{
                    code: 1,
                    name: "无",
                },
                {
                    code: 2,
                    name: "有",
                }],
                merInfo: {
                    acctOpenBankname:'',
                    merchantName: '',
                    licenseNo: '',
                    orgName:'',
                    actualCtl:'',
                    actualCtlIdCardNo:'',
                    actualCtlPhone:'',
                    addrText:'',
                    regDetailAddr:'',
                    acctName:'',
                    acctBankname:'',
                    acctNo:'',
                    acctCnaps:'',
                    addressList:'',
                    address:'',
                    regProvinceCode:'',
                    regCityCode:'',
                    regDistrictCode:'',
                    bankList:'',
                },
                storeInfo: {
                    bizLicenseType:'',
                    storeName:'',
                    licenseNo:'',
                    orgName:'',
                    storeDetailAddr:'',
                    legalName:'',
                    actualCtl:'',
                    actualCtlPhone:'',
                    actualCtlIdCardNo:'',
                    addrText:'',
                    storeProvinceCode:'',
                    storeCityCode:'',
                    storeDistrictCode:'',
                },
                mgrReqVo: {
                    staffName:'',
                    staffPhone:'',
                    staffIdcardNo:'',
                },
                // 商户开户信息字段
                merCheckInfo: [
                    {
                        key: 'merchantName',
                        tipType: 1,
                        message: '运营商内部名称'
                    },
                    {
                        key: 'orgName',
                        tipType: 1,
                        message: '营业执照名称'
                    },
                    {
                        key: 'licenseNo',
                        tipType: 1,
                        message: '营业执照编号'
                    },
                    {
                        key: 'legalName',
                        tipType: 1,
                        message: '法人名称'
                    },
                    {
                        key: 'actualCtl',
                        tipType: 1,
                        message: '实控人身份证地址'
                    },
                    {
                        key: 'actualCtlIdCardNo',
                        tipType: 1,
                        message: '实控人身份证号'
                    },
                    {
                        key: 'actualCtlPhone',
                        tipType: 1,
                        message: '实控人手机号'
                    },
                    {
                        key: 'regDetailAddr',
                        tipType: 1,
                        message: '详细地址'
                    },
                    {
                        key: 'acctName',
                        tipType: 1,
                        message: '商户账户名称'
                    },
                    {
                        key: 'acctBankname',
                        tipType: 2,
                        message: '商户银行名称'
                    },
                    {
                        key: 'acctNo',
                        tipType: 1,
                        message: '开户银行卡号'
                    },
                    {
                        key: 'acctOpenBankname',
                        tipType: 1,
                        message: '开户支行名称'
                    },
                    {
                        key: 'acctCnaps',
                        tipType: 1,
                        message: '开户行联行号'
                    },
                    {
                        key: 'regProvinceCode',
                        tipType: 1,
                        message: '省'
                    },
                    {
                        key: 'regCityCode',
                        tipType: 1,
                        message: '市'
                    },
                    {
                        key: 'regDistrictCode',
                        tipType: 1,
                        message: '区'
                    },
                ],
                // 门店验证信息
                storeCheckInfo: [
                    {
                        key: 'bizLicenseType',
                        tipType: 2,
                        message: '商户是否有独立营业执照'
                    },
                    {
                        key: 'storeName',
                        tipType: 1,
                        message: '门店名称'
                    },
                    {
                        key: 'actualCtl',
                        tipType: 1,
                        message: '门店管理员姓名'
                    },
                    {
                        key: 'actualCtlPhone',
                        tipType: 1,
                        message: '门店管理员手机号'
                    },
                    {
                        key: 'actualCtlIdCardNo',
                        tipType: 1,
                        message: '门店管理员身份证号'
                    },
                ],
                // 门店验证信息
                mgrCheckInfo: [
                    {
                        key: 'staffName',
                        tipType: 1,
                        message: '营业员姓名'
                    },
                    {
                        key: 'staffPhone',
                        tipType: 1,
                        message: '营业员电话'
                    },
                    {
                        key: 'staffIdcardNo',
                        tipType: 1,
                        message: '营业员身份证号'
                    },
                ],
            };
        },
        computed:{
            // 通过icon字段判断是智享云还是购机直降
        },
        created(){
            this.$api.getArea().then(res => {
                this.addressList = res.body.provList;
            });
            this.init();
            this.orgType = Number(this.$route.query.orgType);
        },
        methods: {
            // 获取地区列表
            getArea({commit}) {
                Vue.prototype.$api.getArea().then((res) => {
                    let { provList } = res.body;
                    let obj = calcArea(provList)
                    commit(SET_AREA_LIST,{
                        province_list:obj.province_list,
                        city_list:obj.city_list,
                        county_list:obj.county_list
                    })
                }).catch((err) => {
 
                });
            },
            // 设置地区code
            setCitycode(val){
                this.merInfo.provCode = val[0];
                this.merInfo.cityCode = val[1];
            },
            goBackPage() {
                if (this.step === 2 || this.step === 3) {
                    this.step -= 1;
                } else {
                    this.$router.push({
                        path: '/main/productManagement'
                    });
                }
            },
            // 初始化页面
            init() {
                let fn = this.$api.heydInitOpen;
                fn().then(res => {
                    let body = res.body;
                    this.bankList = body.bankList;
                    this.cardTypeList = body.acctTypeList;
                    this.merRefList = body.acctEnpRelList;
                    for (let i in this.merInfo) {
                        if(Array.isArray(this.merInfo[i])){
                            this.merInfo[i] = body[i] ? body[i] : [];
                            console.log(i+":"+this.merInfo[i]);
                        }else{
                            this.merInfo[i] = body[i] ? body[i] : '';
                        }
                    }
                    if(body.cityCode){
                        this.address.push(body.provCode+'')
                        this.address.push(body.cityCode+'')
                    }
                    this.merInfo.merAddrText = this.merInfo.bizProvinceName +'-'+ this.merInfo.bizCityName +'-'+ this.merInfo.bizDistrictName;
                    if(this.merInfo.regProvinceName) {
                        this.merInfo.addrText = this.merInfo.regProvinceName + '-' + this.merInfo.regCityName + '-' + this.merInfo.regDistrictName;
                    }
                });
            },
            // 处理点击下一步跳转处理
            handleNextStep() {
                console.log("step:"+this.step);
                // 判断表单字段必填性
                if (this.step === 1) {
                    if(!formCheckAndComt.checkRequiredField(this.merCheckInfo,this.merInfo,this)){
                        return false;
                    }
                    this.step += 1;
                }else if (this.step === 2) {
                    let rules = [
                    ]
                    // 对公时验证开户行行号
                    if(this.storeInfo.bizLicenseType ===2){
                        rules.push({
                            key: 'licenseNo',
                            tipType: 1,
                            message: '营业执照号'
                        });
                        rules.push({
                            key: 'orgName',
                            tipType: 1,
                            message: '营业执照名称'
                        });
                        rules.push({
                            key: 'storeProvinceCode',
                            tipType: 1,
                            message: '省份'
                        });
                        rules.push({
                            key: 'storeCityCode',
                            tipType: 1,
                            message: '市区'
                        });
                        rules.push({
                            key: 'storeDistrictCode',
                            tipType: 1,
                            message: '区域'
                        });
                        rules.push({
                            key: 'storeDetailAddr',
                            tipType: 1,
                            message: '门店详细地址'
                        });
                        rules.push({
                            key: 'legalName',
                            tipType: 1,
                            message: '法人姓名'
                        });
                        rules.push({
                            key: 'addrText',
                            tipType: 2,
                            message: '省市区选择'
                        });
                    }
                    this.storeCheckInfo.push(...rules)
                    if(!formCheckAndComt.checkRequiredField(this.storeCheckInfo,this.storeInfo,this)){
                        return false;
                    }
                    this.step += 1;
                }else if (this.step === 3) {
                    if(!formCheckAndComt.checkRequiredField(this.mgrCheckInfo,this.mgrReqVo,this)){
                        return false;
                    }
                    // 判断表单是否必填
                    this.handleSubmitOpen();
                }
            },
            // 处理提交
            handleSubmitOpen() {
 
                let submitInfo = {
                    ...this.merInfo,
                    openStoreInfo:{
                        ...this.storeInfo,
                        mgrReqVo:{...this.mgrReqVo}
                    },
 
                };
 
                let fn;
                fn = this.$api.gzzjOpen; //海尔云贷接口
                fn(submitInfo).then((res) => {
                    this.$router.push({
                        path: '/gzzj/open-result',
                        // 提交后,默认跳转审核结果页面,状态为开通中
                        query: {
                            orgType: this.orgType,
                            openStatus: 1,
                            icon:this.$route.query.icon
                        }
                    })
                });
            }
        }
    };
 
</script>
 
<style lang="less" scoped>
.open-heyd-index{
        padding-top: 54px;
        height:100%;
        background-color: #f1f1f1;
}
</style>