member.vue 37.9 KB
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 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904
<template>
  <div>
    <div v-if="showDirectly&&directUnderFlag==0" class="box mb20">
      <el-row class="flexRow">
        <el-col :span="6">
          <h3 class="m0">团队会员认证</h3>
        </el-col>
        <el-col v-if="authenticationStatusa == 2" :span="6">
          <label> 有效日期至({{ parseTime(form?.validityDate, '{y}-{m}-{d}') }}) </label>
        </el-col>
        <el-col :span="6">
          <div class="fitem">
            <label>认证状态:</label>
            <span v-if="authenticationStatusa == 0 ||!authenticationStatusa" class="text-danger">未认证</span>
            <span v-if="authenticationStatusa == 1" class="text-success">认证中</span>
            <span v-if="authenticationStatusa == 2" class="text-success">已认证</span>
            <span v-if="authenticationStatusa == 3" class="text-danger">认证未通过</span>
            <span v-if="authenticationStatusa == 4" class="text-danger">即将过期</span>
            <span v-if="authenticationStatusa == 5" class="text-danger">已过期</span>
          </div>
        </el-col>
        <el-col :span="6">
          <el-button type="primary" :disabled="btn" @click="payTheFees">去缴费</el-button>
          <el-button v-if="form.deptType!=1" type="primary" @click="auditEditFN">审核详情</el-button>
        </el-col>
      </el-row>
    </div>

    <div class="box">
      <!--      &lt;!&ndash; 会员认证 &ndash;&gt;-->
      <!--      <el-col :span="6" class="ping">-->
      <!--        <div v-if="authenticationStatusa == 2" class="text-center ">-->
      <!--          <div class="textFather">-->
      <!--            <el-image style="width: 170px; height: 234px;display: block;" :src="image" fit="cover" />-->
      <!--            <div class="TextSon">-->
      <!--              <div class="tex1">-->
      <!--                {{ form.name }}-->
      <!--                <br>-->
      <!--                <span v-if="form.memCode" style="font-weight: 400;">-->
      <!--                  会员编号:{{ form.memCode }}-->
      <!--                </span>-->
      <!--              </div>-->
      <!--            </div>-->
      <!--          </div>-->
      <!--          &lt;!&ndash; <el-link type="primary" @click="downloadFN">-->
      <!--            <div style="margin-top: 10px;">-->
      <!--              <el-icon class="el-icon&#45;&#45;left"><Download /></el-icon>-->
      <!--              <span>下载证书</span>-->
      <!--            </div>-->
      <!--          </el-link> &ndash;&gt;-->
      <!--        </div>-->
      <!--      </el-col>-->

      <!--      <el-col :span="18">-->
      <!--      页面展示-->
      <el-form class="rightForm" :model="form" label-width="160px">
        <el-form-item v-if="form.aname" label="所属协会" prop="parentId">
          <div v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3" class="left">{{ form.aname }}</div>
        </el-form-item>
        <el-form-item v-if="form.memCode" label="会员编号" prop="menCode">
          <div class="left">{{ form.memCode }}</div>
        </el-form-item>
        <el-form-item label="机构名称" prop="name">
          <div class="left">{{ form.name }}</div>
        </el-form-item>
        <el-form-item label="所属省份" prop="belongProvinceId">
          <div v-for="item in options" v-show="item.value==form.belongProvinceId" :key="item.value" class="left">
            {{ item.text }}
          </div>
        </el-form-item>
        <el-form-item label="社会信用代码" prop="creditCode">
          <div v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3&&newResult||form.associateId&&form.associateId>0" class="left">{{ form.creditCode }}</div>
        </el-form-item>
        <el-form-item label="联系人" prop="legal">
          <div class="left">{{ form.certSiteContact }}</div>
        </el-form-item>
        <el-form-item label="联系方式" prop="legal">
          <div class="left">{{ form.certSiteTel }}</div>
        </el-form-item>
        <el-form-item label="认证地址" prop="coordinates1">
          <div class="left">{{ address }}</div>
        </el-form-item>
        <el-form-item label="认证详细地址" prop="adress">
          <div class="left">{{ form.certAddress }}</div>
        </el-form-item>

        <el-form-item label="法人姓名" prop="legal">
          <div class="left">{{ form.certLegal }}</div>
        </el-form-item>
        <el-form-item v-if="form.deptType==6" label="是否为考点" prop="isPoints">
          <el-radio-group v-model="form.isPoints" disabled class="left">
            <el-radio label="0"></el-radio>
            <el-radio label="1"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="法人身份证" prop="legal">
          <el-image
            class="left idCard" style="width: 360px; height: 225px"
            :src="fillImgUrl(form.legalIdcPhoto3)"
            :fit="fit"
          />
          <el-image
            class="left idCard" style="width: 360px; height: 225px"
            :src="fillImgUrl(form.legalIdcPhoto4)"
            :fit="fit"
          />


        </el-form-item>
        <el-form-item label="营业执照" prop="businessLicense">
          <el-image v-if="businessLicenseValue" class="left" style="width: 220px; height: 130px" :src="fillImgUrl(businessLicenseValue)" :fit="fit" />

          <a v-else :href="`${ download +form?.certBusinessLicense?.[0]?.url}`" :underline="false" target="_blank">
            <el-button class="left" type="primary" link>{{ form?.certBusinessLicense?.[0]?.name }}
            </el-button>
          </a>
        </el-form-item>
        <el-form-item label="机构照片" prop="pictures">
          <div class="left">
            <el-image
              v-for="item in imgList" :key="item" class="right" style="width: 220px; height: 130px" :src="fillImgUrl(item)"
              :fit="fit"
            />
          </div>
        </el-form-item>

        <!--          <el-form-item label="入会材料上传" class="FileUpload" prop="materials1" :disabled="!result">-->
        <!--            <a :href="`${ download +form?.materials1?.[0]?.url}`" :underline="false" target="_blank">-->
        <!--              <el-button class="left" type="primary" link>{{ form?.materials1?.[0]?.name }}</el-button>-->
        <!--            </a>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="入会申请书" class="FileUpload" prop="applicationForMembership1" :disabled="!result">-->
        <!--            <a :href="`${ download +form?.applicationForMembership1?.[0]?.url}`" :underline="false" target="_blank">-->
        <!--              <el-button class="left" type="primary" link>{{ form?.applicationForMembership1?.[0]?.name }}</el-button>-->
        <!--            </a>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="是否为自有场所" prop="ownFlag">-->
        <!--            <el-radio-group v-model="form.ownFlag" disabled class="left">-->
        <!--              <el-radio label="1"></el-radio>-->
        <!--              <el-radio label="0"></el-radio>-->
        <!--            </el-radio-group>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item v-if="form.ownFlag==1" label="合同" class="FileUpload" prop="applicationForMembership1" :disabled="!result">-->
        <!--            <a :href="`${ download +form?.leaseContract?.[0]?.url}`" :underline="false" target="_blank">-->
        <!--              <el-button class="left" type="primary" link>{{ form?.leaseContract?.[0]?.name }}</el-button>-->
        <!--            </a>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item v-if="form.ownFlag==0" label="租赁合同" class="FileUpload" prop="applicationForMembership1" :disabled="!result">-->
        <!--            <a :href="`${ download +form?.leaseContract?.[0]?.url}`" :underline="false" target="_blank">-->
        <!--              <el-button class="left" type="primary" link>{{ form?.leaseContract?.[0]?.name }}</el-button>-->
        <!--            </a>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item v-if="form.ownFlag==0" label="租赁合同有效期" class="FileUpload" prop="applicationForMembership1" :disabled="!result">-->
        <!--            <div v-if="leaseTimeS?.length>0" class="left">{{ leaseTimeS?.replaceAll(',','&#45;&#45;') }}</div>-->
        <!--          </el-form-item>-->
        <br>
        <br>
      </el-form>
      <!--      </el-col>-->
    </div>

    <!-- 编辑 -->
    <el-dialog
      v-if="showEdit" v-model="showEdit" destroy-on-close="true" align-center
      title="去缴费"
      width="1000px"
      append-to-body
      @close="close"
    >
      <el-form
        v-if="showEdit" ref="formData" class="rightForm" :model="form" label-width="160px"
        :rules="rules"
      >
        <el-form-item label="选择所属协会" prop="parentId" class="cas">
          <el-cascader
            v-model="form.parentId"
            :options="list"
            :props="props2"
            clearable
            style="width: 100%"
            :disabled="type&&parentId!=-1&&parentId!=0"
            filterable
            @change="changCase"
          />
        </el-form-item>
        <el-form-item v-if="form.memCode" label="会员编号" prop="menCode">
          <el-input v-model="form.memCode" :disabled="true" style="width: 100%" />
        </el-form-item>
        <el-form-item label="机构名称" prop="name">
          <el-input v-model="form.name" :disabled="type" style="width: 100%" />
        </el-form-item>
        <el-form-item label="所属省份" prop="belongProvinceId">
          <el-select
            v-model="form.belongProvinceId"
            placeholder="请选择"
            style="width: 100%"
            :disabled="type&&(belongProvinceId||belongProvinceId==0)"
          >
            <el-option label="全国" :value="0" />
            <el-option v-for=" item in options " :key="item.value" :label="item.text" :value="item.value" />
          </el-select>
        </el-form-item>
        <el-form-item label="社会信用代码" prop="creditCode">
          <el-input v-model="form.creditCode" :disabled="type&&!!creditCode&&newResult" style="width: 100%" />
        </el-form-item>
        <el-form-item label="联系人" prop="siteContact">
          <el-input v-model="form.siteContact" style="width: 100%" />
        </el-form-item>
        <el-form-item label="联系方式" prop="siteTel">
          <el-input v-model="form.siteTel" style="width: 100%" />
        </el-form-item>
        <el-form-item label="认证地址" prop="coordinates1">
          <el-cascader
            ref="cascaderA"
            v-model="form.coordinates1"
            placeholder="请选择"
            :options="options"
            :props="defaultProps"
            filterable
            style="width: 100%"
            @change="changeAddress"
          />
        </el-form-item>
        <el-form-item label="认证详细地址" prop="adress">
          <el-input v-model="form.adress" style="width: 100%" />
        </el-form-item>
        <el-form-item label="法人姓名" prop="legal">
          <el-input v-model="form.legal" style="width: 100%" />
        </el-form-item>

        <el-form-item v-if="form.deptType==6" label="是否申请考点" prop="applyPoints">
          <el-radio-group v-model="form.applyPoints">
            <el-radio label="1"></el-radio>
            <el-radio label="0"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="法人身份证" prop="legalIdcPhoto1" class="legalCard">
          <el-row style="width: 100%;">
            <el-col :span="12">
              <ImageUpload2
                v-model="form.legalIdcPhoto1" class="card1" :crop-width="440" :crop-height="260"
                :limit="1"
              />
            </el-col>
            <el-col :span="12">
              <ImageUpload2
                v-model="form.legalIdcPhoto2" class="card2" :crop-width="440" :crop-height="260"
                :limit="1"
              />
            </el-col>
          </el-row>
        </el-form-item>
        <!-- <el-form-item label="法人证件照" prop="legalPhoto">
          <ImageUpload2 v-model="form.legalPhoto" :disabled="!result&&authenticationStatusa!=0&&legalPhoto?.length>0" crop-width="440" crop-height="260" :limit="1" />
        </el-form-item> -->
        <el-form-item label="上传营业执照" prop="businessLicense" class="FileUpload">
          <!--          <ImageUpload2 v-model="form.businessLicense" :disabled="type" crop-width="440" crop-height="260" :limit="1" />-->
          <FileUpload
            v-if="!businessLicenseValue"
            v-model="form.businessLicense" :file-type="['pdf','png','jpg','jpeg','gif']" :limit="1" class="father" :file-size="100"
          />
          <a v-else :href="fillImgUrl(businessLicenseValue)" :underline="false" target="_blank">
            <el-button class="left" type="primary" link>营业执照</el-button>
          </a>
        </el-form-item>
        <el-form-item label="上传机构照片" prop="pictures">
          <ImageUpload2 v-model="form.pictures" crop-width="440" crop-height="260" :limit="3" />
        </el-form-item>

        <div>
          <!--        <el-form-item label="是否为考点" prop="isPoints">-->
          <!--          <el-radio-group v-model="form.isPoints" disabled class="left">-->
          <!--            <el-radio label="0"></el-radio>-->
          <!--            <el-radio label="1"></el-radio>-->
          <!--          </el-radio-group>-->
          <!--        </el-form-item>-->
          <!--        <el-form-item label="入会材料上传" class="FileUpload" prop="materials1">-->
          <!--          <FileUpload v-model="form.materials1" :limit="1" class="father" :file-size="100" :disabled="type" />-->
          <!--        </el-form-item>-->
          <!--        <el-form-item label="入会申请书" class="FileUpload" prop="applicationForMembership1">-->
          <!--          <FileUpload v-model="form.applicationForMembership1" :limit="1" class="father" :disabled="type" />-->
          <!--          <div>-->
          <!--            <a-->
          <!--              v-if="form.deptType==6||!form.deptType"-->
          <!--              href="/file/application.doc" target="_blank"-->
          <!--            >-->
          <!--              <el-button class="son1" type="primary" link>入会申请书模板(道馆)</el-button>-->
          <!--            </a>-->
          <!--            <a-->
          <!--              v-else-->
          <!--              href="/file/association.doc" :underline="false" target="_blank"-->
          <!--            >-->
          <!--              <el-button class="son1" type="primary" link>入会申请书模板(协会)</el-button>-->
          <!--            </a>-->
          <!--          </div>-->
          <!--        </el-form-item>-->
          <!--        <el-form-item label="是否为自有场所" prop="ownFlag">-->
          <!--          <el-radio-group v-model="form.ownFlag" :disabled="type" class="left">-->
          <!--            <el-radio label="1"></el-radio>-->
          <!--            <el-radio label="0"></el-radio>-->
          <!--          </el-radio-group>-->
          <!--        </el-form-item>-->
          <!--        <el-form-item v-if=" form.ownFlag==1" label="合同" class="FileUpload" prop="leaseContract">-->
          <!--          &lt;!&ndash; <FileUpload v-model="form.leaseContract" :limit="1" :file-size="100" /> &ndash;&gt;-->
          <!--          <FileUpload v-model="form.leaseContract" :limit="1" :file-size="100" :disabled="type" />-->
          <!--        </el-form-item>-->
          <!--        <el-form-item v-if=" form.ownFlag==0" label="租赁合同" class="FileUpload" prop="leaseContract">-->
          <!--          &lt;!&ndash; <FileUpload v-model="form.leaseContract" :limit="1" :file-size="100" /> &ndash;&gt;-->
          <!--          <FileUpload v-model="form.leaseContract" :limit="1" :file-size="100" :disabled="type" />-->
          <!--        </el-form-item>-->
          <!--        <el-form-item v-if=" form.ownFlag==0" label="租赁合同有效期" class="" prop="leaseTime">-->
          <!--          <el-date-picker-->
          <!--            v-model="form.leaseTime"-->
          <!--            :disabled="type"-->
          <!--            value-format="YYYY-MM-DD HH:mm:ss"-->
          <!--            type="datetimerange"-->
          <!--            start-placeholder="开始日期"-->
          <!--            end-placeholder="截止日期"-->
          <!--            placeholder="请选择租赁合同有效期"-->
          <!--            style="width: 100%;"-->
          <!--          />-->
          <!--        </el-form-item>-->
        </div>

        <br>
        <br>
      </el-form>
      <template #footer>
        <div style="text-align: center;">
          <el-button :loading="buttonLoading" type="primary" @click="submit"> </el-button>
          <el-button @click="showEdit=false"> </el-button>
        </div>
      </template>
    </el-dialog>
    <!-- 会员认证 -->
    <el-dialog
      v-model="showDialog" destroy-on-close="true" title="缴费年限" width="800px"
      append-to-body
    >
      <el-form ref="infoRef1" :model="forms" :rules="rules1" label-width="180px">
        <el-form-item label="缴费年限" prop="renewYear">
          <el-select v-model="form.renewYear" style="width: 100%;" :placeholder="请选择缴费年限">
            <el-option label="一年" value="1" />
            <el-option label="两年" value="2" />
            <el-option label="三年" value="3" />
            <el-option label="四年" value="4" />
            <el-option label="五年" value="5" />
          </el-select>
        </el-form-item>
        <!--        <el-form-item v-if="form.deptType==6" label="是否申请考点" prop="applyPoints">-->
        <!--          <el-radio-group v-model="forms.applyPoints">-->
        <!--            <el-radio label="1"></el-radio>-->
        <!--            <el-radio label="0"></el-radio>-->
        <!--          </el-radio-group>-->
        <!--        </el-form-item>-->
        <!--        <div v-if="forms.examPointFlag==1">-->
        <!--          <el-form-item label="教学场地人均面积" prop="examPointInfo.area">-->
        <!--            <el-input v-model="forms.examPointInfo.area" placeholder="">-->
        <!--              <template #append>平米/</template>-->
        <!--            </el-input>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="教练员数量" prop="examPointInfo.coach">-->
        <!--            <el-input v-model="forms.examPointInfo.coach" placeholder="">-->
        <!--              <template #append></template>-->
        <!--            </el-input>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="主教练最高级别证书编号" prop="examPointInfo.coachNumber">-->
        <!--            <el-input v-model="forms.examPointInfo.coachNumber" placeholder="" />-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="主教练最高级别证书" class="FileUpload" prop="examPointInfo.coachCertificate">-->
        <!--            &lt;!&ndash;          <el-input v-model="forms.examPointInfo.coachCertificate" placeholder="" />&ndash;&gt;-->
        <!--            <FileUpload v-model="forms.examPointInfo.coachCertificate" :limit="1" :file-size="100" />-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="主教练最高段位" prop="examPointInfo.coachDuan">-->
        <!--            <el-select v-model="forms.examPointInfo.coachDuan" style="width: 100%;" placeholder="请选择">-->
        <!--              <el-option v-for="item in duanList" :key="item.value" :label="item.label" :value="item.value" />-->
        <!--            </el-select>-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="主教练最高段位证书编号" prop="examPointInfo.coachDuanNumber">-->
        <!--            <el-input v-model="forms.examPointInfo.coachDuanNumber" placeholder="" />-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="主教练最高段位证书" class="FileUpload" prop="examPointInfo.coachDuanCertificate">-->
        <!--            &lt;!&ndash;          <el-input v-model="forms.examPointInfo.coachDuanCertificate" placeholder="" />&ndash;&gt;-->
        <!--            <FileUpload v-model="forms.examPointInfo.coachDuanCertificate" :limit="1" :file-size="100" />-->
        <!--          </el-form-item>-->
        <!--          <el-form-item label="是否具备级位考官资质 " prop="examPointInfo.examiner">-->
        <!--            <el-radio-group v-model="forms.examPointInfo.examiner">-->
        <!--              <el-radio label="1"></el-radio>-->
        <!--              <el-radio label="0"></el-radio>-->
        <!--            </el-radio-group>-->
        <!--          </el-form-item>-->
        <!--          <div v-if="forms.examPointInfo.examiner==1">-->
        <!--            <el-form-item label="考官姓名 " prop="examPointInfo.examinerName">-->
        <!--              <el-input v-model="forms.examPointInfo.examinerName" placeholder="" />-->
        <!--            </el-form-item>-->
        <!--            <el-form-item label="考官证号" prop="examPointInfo.examinerNumber">-->
        <!--              <el-input v-model="forms.examPointInfo.examinerNumber" placeholder="" />-->
        <!--            </el-form-item>-->
        <!--            <el-form-item label="考官证书" class="FileUpload" prop="examPointInfo.examinerCertificate">-->
        <!--              &lt;!&ndash;          <el-input v-model="forms.examPointInfo.examinerCertificate" placeholder="" />&ndash;&gt;-->
        <!--              <FileUpload v-model="forms.examPointInfo.examinerCertificate" :limit="1" :file-size="100" />-->
        <!--            </el-form-item>-->
        <!--          </div>-->
        <!--        </div>-->

      </el-form>
      <template #footer>
        <div style="text-align: center;">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
          <el-button @click="showDialog=false"> </el-button>
        </div>
      </template>
    </el-dialog>


    <auditEdit ref="auditEditRef" />
  </div>

</template>

<script setup>
import {
  editMyMemberCertifiedInfo,
  getMyOwnMemberInfo,
  commit, regionsList
} from '@/api/system/userInfo.js'
import { deptTreeSelect } from '@/api/system/user'
import { getCurrentInstance } from '@vue/runtime-core'
import { ref, reactive, toRefs } from 'vue'
import auditEdit from './auditEdit'
import { certifiedDeptTree } from '@/api/system/userInfo.js'
import { ElMessageBox } from 'element-plus'
// import type { Action } from 'element-plus'
const pr = ref([])
const baseUrl = import.meta.env.VITE_APP_BASE_API
const download = ref(baseUrl + '/upload/getFile?fileUrl=')
const { proxy } = getCurrentInstance()
const authenticationStatusa = ref()
const list = ref([])
const options = ref([])
const btn = ref(false)
const address = ref()
const defaultProps = {
  children: 'children',
  label: 'text',
  checkStrictly: true
}

const showDirectly = ref(true)
const showDialog = ref(false)
const showEdit = ref(false)
const type = ref(false) // 第一次选择认证认证类型
const flag = ref(false)
const result = ref(false)
const materials1 = ref()
const applicationForMembership1 = ref()
const pictures = ref()
const businessLicense = ref()
// const legalPhoto = ref()
const legal = ref()
const creditCode = ref()
const adress = ref()
const coordinates1 = ref()
const belongProvinceId = ref()
const parentId = ref()
const props2 = {
  checkStrictly: true,
  children: 'children',
  value: 'id',
  emitPath: false,
  disabled: 'disabled'
}

const data = reactive({
  form: {
    type: 1
  },
  forms: {
    examPointInfo: {}
  },
  rules: {
    parentId: [{ required: true, trigger: 'blur', message: '请选择所属协会' }],
    date1: [{ required: true, trigger: 'blur', message: '请选择有效期' }],
    creditCode: [
      { required: true, trigger: 'blur', message: '请输入社会信用代码' }
    ],
    businessLicense: [
      { required: true, trigger: 'blur', message: '请上传营业执照' }
    ],
    legal: [{ required: true, trigger: 'blur', message: '请输入法人姓名' }],
    siteContact: [{ required: true, trigger: 'blur', message: '请输入联系人' }],
    siteTel: [{ required: true, trigger: 'blur', message: '请输入联系方式' }],
    applyPoints: [{ required: true, trigger: 'blur', message: '请选择是否为考点' }],
    isPoints: [{ required: true, trigger: 'blur', message: '请选择是否为考点' }],
    pictures: [{ required: true, trigger: 'blur', message: '请上传机构照片' }],
    name: [{ required: true, trigger: 'blur', message: '请输入机构名称' }],
    materials1: [{ required: true, trigger: 'blur', message: '请上传入会材料' }],
    applicationForMembership1: [{ required: true, trigger: 'blur', message: '请上传入会申请书' }],
    renewYear: [{ required: true, trigger: 'blur', message: '请选择认证年限' }],
    deptType: [{ required: true, trigger: 'blur', message: '请选择认证类型' }],
    orgName: [{ required: true, trigger: 'blur', message: '请输入机构名称' }],
    check: [{ required: true, trigger: 'blur', message: '请勾选入会须知' }],
    adress: [{ required: true, trigger: 'blur', message: '请输入认证详细地址' }],
    coordinates1: [{ required: true, trigger: 'blur', message: '认证地址不能为空' }],
    leaseValidity: [{ required: true, trigger: 'blur', message: '请选择租赁有效期' }],
    legalIdcPhoto1: [
      { required: true, trigger: 'blur', message: '请上传身份证正反面' },
      { validator: validateID, trigger: 'blur' }
    ],
    belongProvinceId: [{ required: true, trigger: 'change', message: '请选着所属省份' }],
    ownFlag: [{ required: true, trigger: 'change', message: '请选择是否为自选考场' }],
    leaseTime: [{ required: true, trigger: 'change', message: '请选着租赁合同有效期' }],
    leaseContract: [{ required: true, trigger: 'blur', message: '请上传租赁合同' }]
  },
  rules1: {
    examPointFlag: [{ required: true, trigger: 'blur', message: '请选择是否为考点' }],
    renewYear: [{ required: true, trigger: 'blur', message: '请选择缴费年限' }],
    'examPointInfo.area': [
      { required: true, trigger: 'blur', message: '请输入人均面积' }
    ],
    'examPointInfo.coach': [
      { required: true, trigger: 'blur', message: '请输入教练数量' }
    ],
    'examPointInfo.coachNumber': [{ required: true, trigger: 'blur', message: '请输入主教练最高级别证书编号' }],
    'examPointInfo.coachCertificate': [{ required: true, trigger: 'blur', message: '请上传主教练最高级别证书' }],
    'examPointInfo.coachDuan': [{ required: true, trigger: 'blur', message: '请选择主教练最高段位' }],
    'examPointInfo.coachDuanNumber': [{ required: true, trigger: 'blur', message: '请输入主教练最高段位证书编号' }],
    'examPointInfo.coachDuanCertificate': [{ required: true, trigger: 'blur', message: '请上传主教练最高段位证书' }],
    'examPointInfo.examiner': [{ required: true, trigger: 'blur', message: '请选择是否具备级位考官资质' }],
    'examPointInfo.examinerName': [{ required: true, trigger: 'blur', message: '请输入考官姓名' }],
    'examPointInfo.examinerNumber': [{ required: true, trigger: 'blur', message: '请输入考官号' }],
    'examPointInfo.examinerCertificate': [{ required: true, trigger: 'blur', message: '请上传考官证书' }]
  }
})
const { form, rules, forms, rules1 } = toRefs(data)
const imgList = ref([])
const newResult = ref(false) // 认证流程至少通过一次
const leaseTime = ref()
const leaseTimeS = ref()
const directUnderFlag = ref(0)
const businessLicenseValue = ref()
addressFn()
async function addressFn() {
  const res = await regionsList()
  options.value = res.data
  initData()
}


// 身份证校验
function validateID(rule, value, callback) {
  if (!form.value.legalIdcPhoto1) {
    callback(new Error('请上传您的身份证国徽面'))
  }
  if (!form.value.legalIdcPhoto2) {
    callback(new Error('请上传您的身份证头像面'))
  }
  return callback()
}

async function initData() {
  const res = await getMyOwnMemberInfo()
  newResult.value = res.data.newResult//
  result.value = res.data.result// 认证缴费状态
  authenticationStatusa.value = res.data.authenticationStatus
  showDirectly.value = !res.data.memberInfo.associateId
  pr.value = res.data.pr
  directUnderFlag.value = res.data.memberInfo.directUnderFlag
  if (authenticationStatusa.value == 0) {
    btn.value = false
  } else if (authenticationStatusa.value == 1) {
    btn.value = true
  } else {
    btn.value = !result.value
  }

  // 认证地址
  const arr = []
  for (const item of options.value) {
    if (res.data.memberInfo.certProvinceId == item.value) {
      arr.push(item.text)
      for (const val of item.children) {
        if (res.data.memberInfo.certCityId == val.value) {
          arr.push(val.text)
          for (const inx of val.children) {
            if (res.data.memberInfo.certRegionId == inx.value) {
              arr.push(inx.text)
              break
            }
          }
          break
        }
      }
      break
    }
  }
  address.value = arr.join('/')

  // 认证信息
  if (authenticationStatusa.value == 0 || authenticationStatusa.value == 3) {
    type.value = false
  } else {
    type.value = true
  }
  // 至少审核通过一次
  if (authenticationStatusa.value != 0) {
    if (newResult.value) {
      // 至少认证过一次
      flag.value = true
    } else {
      // 没有认证
      flag.value = false
    }
  }

  form.value.isPoints == null ? form.value.isPoints = 1 : ''
  if (!res.data.memberInfo) res.data.memberInfo = {}
  if (!res.data.dept) res.data.dept = {}
  form.value = { ...res.data.dept, ...res.data.memberInfo }
  // 入会材料
  if (form.value.materials) {
    form.value.materials1 = JSON.parse(form.value.materials)
    // form.value.materials = JSON.parse(form.value.materials)
  }
  // 入会申请书
  if (form.value.applicationForMembership) {
    form.value.applicationForMembership1 = JSON.parse(form.value.applicationForMembership)
    // form.value.applicationForMembership = JSON.parse(form.value.applicationForMembership)
  }
  applicationForMembership1.value = form.value.applicationForMembership || []

  // 认证地址
  form.value.coordinates1 = []
  if (form.value.provinceId)form.value.coordinates1.push(form.value.provinceId)
  if (form.value.cityId) form.value.coordinates1.push(form.value.cityId) // 省份/市/区/州 选择框中的选择
  if (form.value.regionId) form.value.coordinates1.push(form.value.regionId) // 省份/市/区/州 选择框中的选择
  // 机构照片
  imgList.value = form?.value?.certPictures?.split(',')
  // 法人证件照
  form.value.legalIdcPhoto1 = form.value.legalIdcPhoto?.split(',')?.[0] || ''
  form.value.legalIdcPhoto3 = form.value.certLegalIdcPhoto?.split(',')?.[0] || ''
  form.value.legalIdcPhoto2 = form.value.legalIdcPhoto?.split(',')?.[1] || ''
  form.value.legalIdcPhoto4 = form.value.certLegalIdcPhoto?.split(',')?.[1] || ''
  // 合同/租赁合同
  if (form.value.leaseContract) form.value.leaseContract = JSON.parse(form.value.leaseContract)

  // 所属省份
  belongProvinceId.value = form.value.belongProvinceId

  // 租赁合同有效期
  leaseTime.value = form.value.leaseTime
  leaseTimeS.value = form.value.leaseTime

  // 是否为自有场所
  form.value.ownFlag ? form.value.ownFlag : form.value.ownFlag = '0'
  form.value.leaseTime = form.value.leaseTime?.split(',') || []
  let res1 = []
  if (authenticationStatusa.value == 0 || authenticationStatusa.value == 3 || authenticationStatusa.value == 1) {
    res1 = await certifiedDeptTree({ selfDeptId: '-1', webSiteShow: 1, showDisabled: 1 })
  } else {
    res1 = await deptTreeSelect({ selfDeptId: '-1', showDisabled: 1, showDirect: authenticationStatusa.value == 2 || authenticationStatusa.value == 5 || authenticationStatusa.value == 4 ? 1 : null })
  }
  form.value.deptType = res.data.dept.deptType
  list.value = res1.data
  // if (typeof list.value[0].id == 'number') {
  //   form.value.parentId = form.value.parentId * 1
  // } else {
  //   form.value.parentId = form.value.parentId.toString()
  // }
  form.value.parentId = form.value.parentId.toString()

  materials1.value = form.value.materials || []
  pictures.value = form.value.pictures
  try {
    businessLicense.value = form.value.certBusinessLicense = JSON.parse(form.value.certBusinessLicense)
    form.value.businessLicense = JSON.parse(form.value.businessLicense)
  } catch (e) {
    businessLicense.value = businessLicenseValue.value = form.value.certBusinessLicense
  }
  creditCode.value = form.value.creditCode
  legal.value = form.value.legal
  coordinates1.value = form.value.provinceId
  adress.value = form.value.adress
  parentId.value = form.value.parentId
}

function changeAddress(value) {
  form.value.provinceId = value?.[0]?.toString()
  form.value.cityId = value?.[1]?.toString()
  form.value.regionId = value?.[2]?.toString()
}

function submit() {
  proxy.$refs['formData'].validate(async(valid) => {
    if (valid) {
      form.value.duanPrice = undefined
      form.value.jiPrice = undefined
      if (form.value.parentId == -1 || form.value.parentId == 0) {
        return proxy.$modal.msgError('请选择所属协会')
      }
      let res = null
      res = await editMyMemberCertifiedInfo({
        parentId: form.value.parentId,
        creditCode: form.value.creditCode,
        legal: form.value.legal,
        // legalPhoto: form.value.legalPhoto,
        businessLicense: JSON.stringify(form.value.businessLicense),
        pictures: form.value.pictures,
        materials: JSON.stringify(form.value.materials1),
        applicationForMembership: JSON.stringify(form.value.applicationForMembership1),
        memId: form.value.memId,
        id: form.value.deptId,
        name: form.value.name,
        regionId: form.value.regionId,
        cityId: form.value.cityId,
        provinceId: form.value.provinceId,
        adress: form.value.adress,
        belongProvinceId: form.value.belongProvinceId,
        deptType: form.value.deptType,
        leaseValidity: form.value.leaseValidity,
        legalIdcPhoto: [form.value.legalIdcPhoto1, form.value.legalIdcPhoto2]?.join(','),
        leaseContract: JSON.stringify(form.value.leaseContract),
        leaseTime: form.value.leaseTime ? [...form.value.leaseTime].join() : '',
        applyPoints: form.value.applyPoints,
        siteContact: form.value.siteContact,
        siteTel: form.value.siteTel

        // isPoints: form.value.isPoints
      })
      if (res.code === 200) {
        // debugger
        await initData()
        showDialog.value = true
      } else {
        proxy.$modal.msgError('操作失败!')
      }
    } else {
      proxy.$modal.msgError('请完善信息')
    }
  })
}

// 确认认证
async function submitForm() {
  if (!form.value.renewYear) {
    proxy.$modal.msgError('请选择缴费年限!')
    return
  }
  const res = await commit({ renewYear: form.value.renewYear })
  if (res.code == 200) {
    showEdit.value = false
    showDialog.value = false
    initData()
    ElMessageBox.alert('缴费等待审核中!', '提示', {
      confirmButtonText: '确定'
    })
  } else {
    proxy.$modal.msgError('操作失败!')
  }
}

// 审核详情
function auditEditFN() {
  proxy.$refs['auditEditRef'].open(pr.value)
}
function close() {
  showEdit.value = false
  initData()
}

function payTheFees() {
  if (!form.value.name) {
    return proxy.$modal.msgError('请先完善团体信息!')
  }
  showEdit.value = true
}
</script>

<style scoped lang="scss">
.box {
  padding: 30px;
}
.ping {
  display: flex;
  justify-content: center;
}
.title-header {
  border: 1px solid black;
  padding: 10px;
}
.header {
  padding-left: 40px;
}
.header-1 {
  font-size: 20px;
}
.heder-right {
  padding-left: 20px;
  padding-top: 20px;
}
.quBtn {
  background-color: #920f20;
  color: #fff;
}

.idCard{
  margin-top: 5px;
  margin-bottom: 5px;
}
.m0{margin: 0}
.mb20{margin-bottom: 20px;}
.flexRow{display: flex;align-items: center;
  label{font-size: 16px;color: #7B7F83;}
}
:deep(.el-upload--picture-card){width: 220px;height: 130px;}
:deep(.el-upload-list__item){width: 220px;height: 130px;}
:deep( .FileUpload .el-upload-list__item){width: auto;height: 32px; .el-upload-list{margin:0 0 10px 0}}
:deep( .FileUpload ){.el-upload-list{margin:0 0 10px 0}}
:deep(.el-upload-list--picture-card .el-upload-list__item){width: 220px;height: 130px;}
:deep(.component-upload-image){
  display: flex;
  .el-upload__tip{width:200px;margin-left: 20px;}
}
.father{
  position: relative;
}
// .son1{
//   position: absolute;
//   top: 6px;
//   left: 100px ;
// }
.son2{
  position: absolute;
  top: 6px;
  left: 250px ;
}
.hint{
  text-align: left;
  font-size: 12px;
  color:#f56c6c;
  margin: 0;
  padding: 0;
}
.textFather{
  position: relative;
}

.TextSon{
  position: absolute;
  top: 125px;
  z-index: 2;
  padding: 0;
  margin: 0;
  width: 100%;
}
.tex1{
  z-index: 9;
  font-size: 10px;
  font-weight: 600;
  transform: scale(0.45);
  margin: 0;
  padding: 0;
  width: 100% !important;
}
.right{
  margin-right: 10px;
}


:deep(.legalCard){
  :deep(.el-form-item__label){color: #7B7F83}

  .el-upload__tip{
    display: none;
  }
  .card1{
    .el-upload--picture-card{
    background-image: url(@/assets/images/card2.png);
    background-size: 100%;
  }
  }

  .card2{
    .el-upload--picture-card{
    background-image: url(@/assets/images/card1.png);
    background-size: 100%;
  }
  }
  .el-upload-list--picture-card{
    width: 360px;
    height: 225px;
    .el-upload--picture-card{
      width: 100%;
      height: 100%;
    }
  }
  .el-upload-list__item{
    width: 360px;
    height: 225px;
    // border-radius: 10px;
    // border: 1px dashed #4e4c4c;
  }
}
</style>