zhaoxiaoqiang
2022-08-05 0ca0d582346846c8d6db95cb89d6683001a9b389
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
<!--
 * @Author: 小明丶
 * @Date: 2020-05-25 09:59:53
 * @LastEditors: zxq
 * @LastEditTime: 2022-07-20 09:47:46
 * @Description: 信息填写页面
--> 
<template>
  <div class="upload-userinfo-page">
    <v-navbar title="订单申请"></v-navbar>
    <div class="steps-box">
      <div class="steps">
        <p></p>
        <div class="step-1">1</div>
        <div class="step-2">2</div>
        <div class="step-3">3</div>
        <div class="step-4">4</div>
        <div class="step-5">5</div>
      </div>
    </div>
    <div class="mation-box">
      <p>个人信息填写</p>
      <p>请确保资料填写的准确性,以便顺利申请</p>
    </div>
    <div class="user-info-box">
      <h-cell
        v-model="degree"
        placeholder="请选择"
        label="最高学历"
        readonly
        isLink
        isMust
        @click.native="getSelect(1)"
      ></h-cell>
      <h-cell
        v-model="socialIdentity"
        placeholder="请选择"
        label="社会身份"
        readonly
        isLink
        isMust
        @click.native="getSelect(2)"
      ></h-cell>
      <h-cell
        v-model="areListHome"
        placeholder="请选择"
        label="现居住地址"
        readonly
        isLink
        isMust
        @click.native="getSelect(3)"
      ></h-cell>
      <h-cell max="30" v-model="userMation.homeAddr" isMust placeholder="请输入居住详细地址" label="居住详细地址"></h-cell>
      <h-cell max="20" v-model="userMation.email" isMust placeholder="请输入电子邮箱" label="电子邮箱" @blur="changeEmail"></h-cell>
      <h-cell
        v-if="userMation.socialIdentity != 2&&userMation.socialIdentity != 3"
        max="20"
        isMust
        v-model="userMation.companyName"
        placeholder="请输入公司名称"
        label="公司名称"
      ></h-cell>
      <h-cell
        v-if="userMation.socialIdentity != 2&&userMation.socialIdentity != 3"
        v-model="userMation.companyPhone"
        isMust
        placeholder="请输入公司电话"
        label="公司电话"
        max="11"
      ></h-cell>
      <h-cell
        v-if="userMation.socialIdentity != 2&&userMation.socialIdentity != 3"
        v-model="areListMer"
        placeholder="请选择"
        label="公司地址"
        readonly
        isLink
        isMust
        @click.native="getSelect(4)"
      ></h-cell>
      <h-cell
        v-if="userMation.socialIdentity != 2&&userMation.socialIdentity != 3"
        max="30"
        isMust
        v-model="userMation.companyAddr"
        placeholder="请输入公司详细地址"
        label="公司详细地址"
      ></h-cell>
      <h-cell v-model="userMation.contactName1" isMust placeholder="请输入第一联系人姓名" label="第一联系人姓名"></h-cell>
      <h-cell
        v-model="contactRelation1"
        placeholder="请选择"
        label="第一联系人关系"
        readonly
        isLink
        isMust
        @click.native="getSelect(5)"
      ></h-cell>
      <h-cell
        v-model="userMation.contactMblNo1"
        placeholder="请输入第一联系人手机号"
        label="第一联系人手机号"
        isMust
        max="11"
      ></h-cell>
      <h-cell  v-model="userMation.contactName2" :isMust='isMustReq' placeholder="请输入第二联系人姓名" label="第二联系人姓名"></h-cell>
      <h-cell
        v-model="contactRelation2"
        placeholder="请选择"
        label="第二联系人关系"
        :isMust='isMustReq'
        readonly
        isLink
        @click.native="getSelect(6)"
      ></h-cell>
      <h-cell
        v-model="userMation.contactMblNo2"
        :isMust='isMustReq'
        placeholder="请输入第二联系人手机号"
        label="第二联系人手机号"
        max="11"
      ></h-cell>
      <h-cell
        v-if=" projId == 100001"
        v-model="contactRelation3"
        placeholder="请选择"
        label="第三联系人关系"
        readonly
        isLink
        @click.native="getSelect(7)"
      ></h-cell>
      <h-cell  v-if=" projId == 100001" v-model="userMation.contactName3"  placeholder="请输入第三联系人姓名" label="第三联系人姓名"></h-cell>
      <h-cell
        v-if=" projId == 100001"
        v-model="userMation.contactMblNo3"
        placeholder="请输入第三联系人手机号"
        label="第三联系人手机号"
        max="11"
      ></h-cell>
    </div>
    <div class="btn-box">
      <button @click="goNext">下一步</button>
    </div>
    <van-popup v-model="showPickerOne" round position="bottom">
      <van-picker
        value-key="name"
        show-toolbar
        :columns="columnsOne"
        @cancel="showPickerOne = false"
        @confirm="onConfirmOne"
      />
    </van-popup>
    <van-popup v-model="showPickerTwo" round position="bottom">
      <van-picker
        value-key="text"
        show-toolbar
        item-height="50"
        visible-item-count="5"
        :columns="columnsTwo"
        @cancel="showPickerTwo = false"
        @confirm="onConfirmTwo"
      />
    </van-popup>
    <van-popup v-model="showPickerThree" round position="bottom">
      <van-picker
        value-key="name"
        show-toolbar
        item-height="50"
        visible-item-count="5"
        :columns="columnsThree"
        @cancel="showPickerThree = false"
        @confirm="onConfirmThree"
      />
    </van-popup>
  </div>
</template>
<script>
import Vue from "vue";
import { Picker } from "vant";
import { Popup } from "vant";
 
Vue.use(Popup);
Vue.use(Picker);
export default {
  data() {
    return {
      showPickerOne: false,
      showPickerTwo: false,
      showPickerThree:false,
      columnsOne: [], //其他选择
      columnsTwo: [], //地区选择
      columnsThree:[],
      userMation: {}, //个人信息对象
      areListHome: "", //显示的居中地址
      areListMer: "", //显示的公司地址
      homeOrMer: "", //用于判断弹出层附值
      degree: "",
      socialIdentity: "",
      contactRelation1: "",
      contactRelation2: "",
      contactRelation3:"",
      isMustReq:false
    };
  },
  computed: {
    projId() {
      return localStorage.getItem("projId");
    },
  },
  created() {
    this.columnsTwo = this.$store.state.areaList;
    this.$api.initUserInfo().then(res => {
      this.userMation = res.body;
      this.isMustReq =  res.body.projId == 100001;
      //返显最高学历
      res.body.degreeList.forEach(e => {
        if (e.code == res.body.degree) {
          this.degree = e.name;
        }
      });
      //返显社会角色
      res.body.socialIdentityList.forEach(e => {
        if (e.code == res.body.socialIdentity) {
          this.socialIdentity = e.name;
        }
      });
      //返显联系一关系
      res.body.contactRelation1List.forEach(e => {
        if (e.code == res.body.contactRelation1) {
          this.contactRelation1 = e.name;
        }
      });
      //返显联系二关系
      res.body.contactRelation2List.forEach(e => {
        if (e.code == res.body.contactRelation2) {
          this.contactRelation2 = e.name;
        }
      });
      res.body.contactRelation3List.forEach(e => {
        if (e.code == res.body.contactRelation3) {
          this.contactRelation3 = e.name;
        }
      });
      // 返显居住地区
      var pr = "",
        ci = "",
        ar = "";
      this.$store.state.areaList.forEach(e => {
        if (e.code == res.body.homeProv) {
          pr = e.text;
          e.children.forEach(i => {
            if (i.code == res.body.homeCity) {
              ci = i.text;
              i.children.forEach(c => {
                if (c.code == res.body.homeArea) {
                  ar = c.text;
                }
              });
            }
          });
        }
      });
      if (pr && ci && ar) {
        this.areListHome = pr + "/" + ci + "/" + ar;
      }
 
      //返显公司地址
      var pr2 = "",
        ci2 = "",
        ar2 = "";
      this.$store.state.areaList.forEach(e => {
        if (e.code == res.body.companyProv) {
          pr2 = e.text;
          e.children.forEach(i => {
            if (i.code == res.body.companyCity) {
              ci2 = i.text;
              i.children.forEach(c => {
                if (c.code == res.body.companyArea) {
                  ar2 = c.text;
                }
              });
            }
          });
        }
      });
      if (pr2 && ci2 && ar2) {
        this.areListHome = pr2 + "/" + ci2 + "/" + ar2;
      }
    });
  },
  methods: {
    changeEmail(){
       let isHave = this.userMation.email.indexOf("@");
       let email = this.userMation.email;
       if(isHave>-1&&email){
          let beforeStr = email.substring(0,isHave);
          let afterStr = email.substring(isHave+1,email.length);
          this.userMation.email = beforeStr+"@"+afterStr;
       }
    },
    // 下一步
    goNext() {
      let v = this.$tool;
      if (v.checkValEmpty(this.degree)) {
        v.toast("请选择最高学历");
        return;
      }
      if (v.checkValEmpty(this.socialIdentity)) {
        v.toast("请选择社会身份");
        return;
      }
      if (v.checkValEmpty(this.areListHome)) {
        v.toast("请选择居住地址");
        return;
      }
      if (v.checkValEmpty(this.userMation.homeAddr)) {
        v.toast("请输入居住详细地址");
        return;
      }
      // if (!v.checkAddress(this.userMation.homeAddr)) {
      //   v.toast("请输入正确的居住详细地址");
      //   return;
      // }
      if (v.checkValEmpty(this.userMation.email)) {
        v.toast("请输入电子邮箱");
        return;
      }
      if (!v.checkEmail(this.userMation.email)) {
        v.toast("请输入正确的电子邮箱");
        return;
      }
      if (this.userMation.socialIdentity != 2 && this.userMation.socialIdentity != 3) {
        if (v.checkValEmpty(this.userMation.companyName)) {
          v.toast("请输入公司名称");
          return;
        }
        if (!v.checkCompany(this.userMation.companyName)) {
          v.toast("请输入正确的公司名称");
          return;
        }
        if (v.checkValEmpty(this.userMation.companyPhone)) {
          v.toast("请输入公司电话");
          return;
        }
        // if (!v.checkCompanyPhone(this.userMation.companyPhone)) {
        //   v.toast("请输入正确的公司电话");
        //   return;
        // }
        if (v.checkValEmpty(this.areListMer)) {
          v.toast("请选择公司地址");
          return;
        }
        if (v.checkValEmpty(this.userMation.companyAddr)) {
          v.toast("请输入公司详细地址");
          return;
        }
        // if (!v.checkAddress(this.userMation.companyAddr)) {
        //   v.toast("请输入正确的公司详细地址");
        //   return;
        // }
      }
      if (v.checkValEmpty(this.userMation.contactName1)) {
        v.toast("请输入第一联系人姓名");
        return;
      }
      // if (!v.checkRealName(this.userMation.contactName1)) {
      //   v.toast("请输入正确的第一联系人姓名");
      //   return;
      // }
      if (v.checkValEmpty(this.contactRelation1)) {
        v.toast("请选择第一联系人关系");
        return;
      }
      if (v.checkValEmpty(this.userMation.contactMblNo1)) {
        v.toast("请输入第一联系人手机号");
        return;
      }
      if (!v.checkPhone(this.userMation.contactMblNo1)) {
        v.toast("请输入正确的第一联系人手机号");
        return;
      }
   
      // F1项目添加第二联系人必填
      if(this.isMustReq){
        if (v.checkValEmpty(this.userMation.contactName2)) {
          v.toast("请输入第二联系人姓名");
          return;
        }
        // if (!v.checkRealName(this.userMation.contactName2)) {
        //   v.toast("请输入正确的第二联系人姓名");
        //   return;
        // }
        if (v.checkValEmpty(this.contactRelation2)) {
          v.toast("请选择第二联系人关系");
          return;
        }
        if (v.checkValEmpty(this.userMation.contactMblNo2)) {
          v.toast("请输入第二联系人手机号");
          return;
        }
        if (!v.checkPhone(this.userMation.contactMblNo2)) {
          v.toast("请输入正确的第二联系人手机号");
          return;
        }
        // 第三联系人
        if (v.checkValEmpty(this.userMation.contactName2)) {
          v.toast("请输入第二联系人姓名");
          return;
        }
        // if (!v.checkRealName(this.userMation.contactName2)) {
        //   v.toast("请输入正确的第二联系人姓名");
        //   return;
        // }
        // if (v.checkValEmpty(this.contactRelation3)) {
        //   v.toast("请选择第二联系人关系");
        //   return;
        // }
        // if (v.checkValEmpty(this.userMation.contactMblNo3)) {
        //   v.toast("请输入第二联系人手机号");
        //   return;
        // }
        // if (!v.checkPhone(this.userMation.contactMblNo3)) {
        //   v.toast("请输入正确的第二联系人手机号");
        //   return;
        // }
      }
      this.$api.saveUserInfo({...this.userMation}).then(res => {
          this.$router.push({
            path: "/order-handling/contract-signing",
          });
          window.sessionStorage.backUrl = "/order-handling/upload-userInfo"
        });
    },
    // 弹出层选择
    getSelect(i) {
      this.homeOrMer = i;
      if (i == 1) {
        this.showPickerOne = true;
        this.columnsOne = this.userMation.degreeList;
      }
      if (i == 2) {
        this.showPickerOne = true;
        this.columnsOne = this.userMation.socialIdentityList;
      }
      if (i == 3) {
        this.showPickerTwo = true;
        // this.columnsTwo = this.$store.state.areaList;
      }
      if (i == 4) {
        this.showPickerTwo = true;
        // this.columnsTwo = this.$store.state.areaList;
      }
      if (i == 5) {
        this.showPickerOne = true;
        this.columnsOne = this.userMation.contactRelation1List;
 
      }
      if (i == 6) {
        this.showPickerOne = true;
        this.columnsOne = this.userMation.contactRelation2List;
        console.log(this.userMation.contactRelation2List);
      }
      if (i == 7) {
        this.showPickerThree = true;
        this.columnsThree = this.userMation.contactRelation3List;
        console.log(this.userMation.contactRelation3List);
      }
    },
    // 其他选择确定
    onConfirmOne(picker, value, index) {
      if (this.homeOrMer == 1) {
        this.userMation.degree = picker.code;
        this.degree = picker.name;
      }
      if (this.homeOrMer == 2) {
        this.userMation.socialIdentity = picker.code;
        this.socialIdentity = picker.name;
      }
      if (this.homeOrMer == 5) {
        this.userMation.contactRelation1 = picker.code;
        this.contactRelation1 = picker.name;
      }
      if (this.homeOrMer == 6) {
        this.userMation.contactRelation2 = picker.code;
        this.contactRelation2 = picker.name;
      }
      this.showPickerOne = false;
    },
    // 地区选择确定
    onConfirmTwo(picker, value, index) {
      if (this.homeOrMer == 3) {
        this.userMation.homeProv = this.columnsTwo[value[0]].code;
        this.userMation.homeCity = this.columnsTwo[value[0]].children[
          value[1]
        ].code;
        this.userMation.homeArea = this.columnsTwo[value[0]].children[
          value[1]
        ].children[value[2]].code;
        this.areListHome = picker[0] + "/" + picker[1] + "/" + picker[2];
      }
      if (this.homeOrMer == 4) {
        this.userMation.companyProv = this.columnsTwo[value[0]].code;
        this.userMation.companyCity = this.columnsTwo[value[0]].children[
          value[1]
        ].code;
        this.userMation.companyArea = this.columnsTwo[value[0]].children[
          value[1]
        ].children[value[2]].code;
        this.areListMer = picker[0] + "/" + picker[1] + "/" + picker[2];
      }
      this.showPickerTwo = false;
    },
    onConfirmThree(picker, value, index){
      this.userMation.contactRelation3 = picker.code;
      this.contactRelation3 = picker.name;
      this.showPickerThree = false;
    }
  }
};
</script>
<style lang="less" scoped>
.upload-userinfo-page {
  & {
    min-height: 100vh;
  }
  .steps-box {
    .steps {
      width: 100%;
      height: 65px;
      position: relative;
      padding: 0 18px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      -webkit-align-items: center;
      p {
        border-bottom: 1px dashed #b3b3b3;
        width: 90%;
        position: absolute;
        z-index: -1;
      }
      .step-1 {
        text-align: center;
        line-height: 30px;
        color: #fff;
        width: 30px;
        height: 30px;
        background: rgba(113, 123, 133, 1);
        border-radius: 50%;
        // position: absolute;
        // left: 18px;
        // top: 19px;
      }
      .step-2 {
        text-align: center;
        line-height: 28px;
        width: 28px;
        height: 28px;
        background: rgba(113, 123, 133, 1);
        border: 0;
        border-radius: 50%;
        color: #fff;
        // position: absolute;
        // left: 90px;
        // top: 19px;
      }
      .step-3 {
        text-align: center;
        line-height: 28px;
        width: 28px;
        height: 28px;
        background: rgba(81, 148, 254, 1);
        box-shadow: 0px 0px 8px 0px rgba(81, 148, 254, 0.64);
        border-radius: 50%;
        // position: absolute;
        // left: 170px;
        // top: 19px;
        color: #fff;
      }
      .step-4 {
        text-align: center;
        line-height: 28px;
        width: 28px;
        height: 28px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(113, 123, 133, 1);
        border-radius: 50%;
        // position: absolute;
        // left: 250px;
        // top: 19px;
      }
      .step-5 {
        text-align: center;
        line-height: 28px;
        width: 28px;
        height: 28px;
        background: rgba(255, 255, 255, 1);
        border: 1px solid rgba(113, 123, 133, 1);
        border-radius: 50%;
        // position: absolute;
        // right: 18px;
        // top: 19px;
      }
    }
  }
  .mation-box {
    width: 343px;
    height: 79px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 0px 10px 0px rgba(47, 103, 192, 0.1);
    border-radius: 5px;
    margin: auto;
    box-sizing: border-box;
    padding: 16px 17px;
    p:nth-of-type(1) {
      font-size: 16px;
      font-family: PingFang SC;
      font-weight: 500;
      color: rgba(51, 51, 51, 1);
      margin-bottom: 10px;
    }
    p:nth-of-type(2) {
      font-size: 12px;
      font-family: PingFang SC;
      font-weight: 500;
      color: rgba(153, 153, 153, 1);
    }
  }
  .user-info-box {
    & {
      box-sizing: border-box;
      padding: 0 16px;
      margin-top: 15px;
    }
  }
  .btn-box {
    & {
      text-align: center;
      margin-top: 32px;
      padding-bottom: 46px;
    }
    button {
      width: 320px;
      height: 44px;
      background: rgba(81, 148, 254, 1);
      border-radius: 22px;
      outline: none;
      border: 0;
      color: #fff;
    }
  }
}
</style>