zhaoxiaoqiang
2021-07-28 9e6e98a8c6541354619f15e81009082db8d3ad14
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
<!--
 * @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"  -->
        <store-info
                v-show="step === 1"
                :bizLicenseTypeList="bizLicenseTypeList"
                :storeInfo="storeInfo"
        >
        </store-info>
        <mgr-info
                v-show="step === 2"
                :mgrReqVo="mgrReqVo"
        >
        </mgr-info>
        <!-- <store-pictures  :storeInfo="storeInfo" :filetype="6" ></store-pictures> -->
        <f-space type="large"></f-space>
        <!-- <f-button @on-click="handleNextStep" fixed>{{ step !== 3 ? '下一步' : '提交开通' }}</f-button> -->
        <van-button class="btn" round @click="handleNextStep" fixed>{{ step !== 3 ? '下一步' : '提交开通' }}</van-button>
    </div>
</template>
 
<script>
    import StoreInfo from './storeBaseInfo.vue';
    import MgrInfo from './storeBaseMgrInfo.vue';
    import formCheckAndComt from '@/utils/formCheckAndComb';
 
    import {
        dateFormat
    } from 'vux'
 
    export default {
        name: 'gzzjStoreOpen',
        components: {
            StoreInfo,
            MgrInfo
        },
        data() {
            return {
                orgType:0,
                step: 1,
                stepText: '下一步',
                bizLicenseTypeList: [{
                    code: 1,
                    name: "无",
                },
                    {
                        code: 2,
                        name: "有",
                    }
                ],
                storeInfo: {
                    bizLicenseType:'',
                    storeName:'',
                    licenseNo:'',
                    orgName:'',
                    storeDetailAddr:'',
                    legalName:'',
                    actualCtl:'',
                    actualCtlPhone:'',
                    actualCtlIdCardNo:'',
                    addrText:'',
                    storeProvinceCode:'',
                    storeCityCode:'',
                    storeDistrictCode:'',
                },
                mgrReqVo: {
                    staffName:'',
                    staffPhone:'',
                    staffIdcardNo:'',
                },
                // 门店验证信息
                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.init();
            this.orgType = Number(this.$route.query.orgType);
        },
        methods: {
            goBackPage() {
                if (this.step === 3 || this.step === 2) {
                    this.step -= 1;
                } else {
                    this.$router.replace({
                        path: '/store/productManage'
                    });
                    this.$router.go(-1)
                }
            },
            // 初始化页面
            init() {
                let fn = this.$api.gzzjInitStore;
                fn().then(res => {
                    let body = res.body;
                    if(body.mgrReqVo && body.mgrReqVo.staffName){
                        this.mgrReqVo = body.mgrReqVo;
                    }
                    for (let i in this.storeInfo) {
                        if(Array.isArray(this.storeInfo[i])){
                            this.storeInfo[i] = body[i] ? body[i] : [];
                        }else{
                            this.storeInfo[i] = body[i] ? body[i] : '';
                        }
                    }
                    if(this.storeInfo.storeProvinceCode) {
                        if(this.storeInfo.regProvinceName && this.storeInfo.regCityName && this.storeInfo.regDistrictName){
                            this.storeInfo.addrText = this.storeInfo.regProvinceName + '-' + this.storeInfo.regCityName + '-' + this.storeInfo.regDistrictName;
                        }
                    }
                });
            },
            // 处理点击下一步跳转处理
            handleNextStep() {
                // 判断表单字段必填性
                if (this.step === 1) {
                    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;
                    }
                    // 判断表单是否必填
                    if (!formCheckAndComt.checkRequiredField(this.storeCheckInfo, this.storeInfo, this)) {
                        return false;
                    }
 
                    this.step += 1;
                } else if(this.step === 2){
                    if (!formCheckAndComt.checkRequiredField(this.mgrCheckInfo, this.mgrReqVo, this)) {
                        return false;
                    }
                    this.handleSubmitOpen();
                }
            },
            // 处理提交
            handleSubmitOpen() {
                // 处理提交
                let submitInfo = {
                    ...this.merInfo,
                    ...this.storeInfo,
                    mgrReqVo:{...this.mgrReqVo}
                };
 
                let fn;
                fn = this.$api.gzzjOpenStore; //海尔云贷接口
                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;
    }
    .btn {
        position: fixed;
        bottom: 15px;
        width: 84%;
        margin: 0 8%;
        background: @c-default;
        color: @c-text-fff;
        display: block;
        margin-top: 15px;
        }
</style>