memberDetails.vue 40.7 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 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027
<template>
  <div style="padding: 20px">
    <header style="display: flex; justify-content: space-between; align-items: center">
      <h1 style="font-weight: 600; font-size: 20px">{{ $t("会员详情") }}</h1>
      <div>
        <el-button type="primary" v-has-permi="['member:certificate']" @click="guarantee(details)">{{ $t("保函证书") }}</el-button>
        <el-button type="primary" v-has-permi="['member:log']" @click="operationLogFn(details)">{{ $t("操作日志") }}</el-button>
        <el-button type="primary" v-has-permi="['member:id-card']" @click="identityFn(details, '1')">{{ $t("身份证") }}</el-button>
        <el-button type="primary" v-has-permi="['member:business-license']" @click="identityFn(details, '2')">{{ $t("营业执照") }}</el-button>
        <el-button type="danger" v-has-permi="['member:delete']" @click="deleteFn(details)">{{ $t("删除") }}</el-button>
      </div>
    </header>
    <!--lanbm 2024-05-15 修改信息显示BUG-->
    <el-descriptions :title="$t('基础信息')" :labelStyle="{ width: '146px' }" :contentStyle="{ width: '278px' }" :column="4" border>
      <el-descriptions-item :label="$t('会员编号')">{{ details.memberCode }}</el-descriptions-item>
      <el-descriptions-item :label="$t('会员昵称')">{{ details.nickname }}</el-descriptions-item>
      <el-descriptions-item :label="$t('英文名称')">{{ details.englishName }}</el-descriptions-item>
      <el-descriptions-item :label="$t('真实姓名')">{{ details.identityName || "-" }}</el-descriptions-item>
      <el-descriptions-item :label="$t('联系方式')"
        ><span style="margin-right: 10px">+{{ details.areaCode }}</span
        ><span>{{ details.mobile }}</span>
      </el-descriptions-item>
      <el-descriptions-item :label="$t('绑定邮箱')">{{ details.email }}</el-descriptions-item>
      <el-descriptions-item :label="$t('生日')">{{ details.birthday }}</el-descriptions-item>
      <el-descriptions-item :label="$t('性别')">{{ details.gender === 0 ? "" : details.gender === 1 ? "" : "保密" }} </el-descriptions-item>
      <el-descriptions-item :label="$t('地址')">{{ details.address }}</el-descriptions-item>
      <el-descriptions-item :label="$t('部门')">{{ details.department }}</el-descriptions-item>
      <el-descriptions-item :label="$t('职位')">{{ details.jobPosition }}</el-descriptions-item>
      <el-descriptions-item :label="$t('创建时间')">{{ details.createTime }}</el-descriptions-item>
      <el-descriptions-item :label="$t('绑定客户')">{{ details.customerCode }}</el-descriptions-item>
      <el-descriptions-item :label="$t('国家')">{{ isChinese ? details.countryTitleZh : details.countryTitleEn }}</el-descriptions-item>
      <el-descriptions-item :label="$t('城市')">{{ isChinese ? details.cityTitleZh : cityTitleEn }}</el-descriptions-item>
      <el-descriptions-item :label="$t('上次登录')">{{ details.loginDate }}</el-descriptions-item>
    </el-descriptions>

    <!--lanbm 2024-05-15 修改信息显示BUG-->
    <el-descriptions style="margin-top: 20px" :title="$t('公司信息')" :labelStyle="{ width: '146px' }" :contentStyle="{ width: '278px' }" :column="4" border>
      <el-descriptions-item :label="$t('公司名称')">{{ details.enterpriseName }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司英文名称')">{{ details.enterpriseNameEn }}</el-descriptions-item>
      <el-descriptions-item :label="$t('档口')">{{ details.enterpriseStall }}</el-descriptions-item>
      <el-descriptions-item :label="$t('品牌')">{{ details.enterpriseBrand }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司地址')">{{ details.enterpriseAddress }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司简介')">{{ details.enterpriseDesc }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions style="margin-top: 20px" :title="$t('认证信息')" :labelStyle="{ width: '146px' }" :contentStyle="{ width: '278px' }" :column="4" border>
      <el-descriptions-item :label="$t('成交')">{{ details.customerStatus === 3 ? "成交" : "未成交" }}</el-descriptions-item>
      <el-descriptions-item :label="$t('认证')">
        <span v-if="details.identityAuditStatus === 2 && details.enterpriseAuditStatus === 2">{{ $t("双认证") }}</span>
        <span v-else-if="details.identityAuditStatus === 2 && details.enterpriseAuditStatus !== 2">{{ $t("身份证") }}</span>
        <span v-else-if="details.identityAuditStatus !== 2 && details.enterpriseAuditStatus === 2">{{ $t("企业") }}</span>
        <span v-else-if="details.identityAuditStatus !== 2 && details.enterpriseAuditStatus !== 2">{{ $t("") }}</span>
      </el-descriptions-item>
      <el-descriptions-item :label="$t('身份证认证状态')">{{
        details.identityAuditStatus !== null
          ? $l(
              getDictDatas(this.DICT_TYPE.AUDIT_STATUS).find((i) => i.value == details.identityAuditStatus),
              "label"
            )
          : ""
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('营业执照认证状态')">{{
        details.enterpriseAuditStatus !== null
          ? $l(
              getDictDatas(this.DICT_TYPE.AUDIT_STATUS).find((i) => i.value == details.enterpriseAuditStatus),
              "label"
            )
          : ""
      }}</el-descriptions-item>
    </el-descriptions>
    <!-- 积分信息 -->

    <el-descriptions style="margin-top: 20px" :title="$t('积分信息')" :column="6" direction="vertical" border>
      <!-- <el-descriptions-item :label="$t('会员图标')">
        
        </el-descriptions-item
      > -->
      <el-descriptions-item :label="$t('会员等级')">
        <el-image :src="details.userScoreLevelInfo.levelIcon" style="width: 20px; height: 20px">{{ $t("") }}</el-image>
        {{ details.userScoreLevelInfo.levelName }}
      </el-descriptions-item>
      <el-descriptions-item :label="$t('当前积分')">{{ details.userScoreLevelInfo.holdScore }}</el-descriptions-item>
      <el-descriptions-item :label="$t('已兑换积分')">{{ details.userScoreLevelInfo.usedScore }}</el-descriptions-item>
      <el-descriptions-item :label="$t('推荐码')">{{ details.userScoreLevelInfo.memberCode }}</el-descriptions-item>
      <el-descriptions-item :label="$t('操作')">
        <el-button type="text" class="copy-btn" :data-clipboard-text="details.memberCode">
          {{ $t("复制推荐码") }}
        </el-button>
        <el-button type="text" @click="handleExchangeRewards(details)">
          {{ $t("兑换礼品") }}
        </el-button>
      </el-descriptions-item>
    </el-descriptions>

    <!-- table Tab -->
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="reward">{{ $t("积分记录") }}</el-menu-item>
      <el-menu-item index="exchange">{{ $t("兑换记录") }}</el-menu-item>
    </el-menu>
    <div class="table-container">
      <div class="reward" v-show="activeIndex == 'reward'">
        <!-- 积分记录 -->

        <IntegralRecord :memberCode="$route.params.id"></IntegralRecord>
        <!-- <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          label-width="120px"
        >
          <el-form-item :label="$t('积分规则')">
            <dict-selector
              clearable
              :type="DICT_TYPE.SCORE_RULE_TYPE"
              v-model="queryParams.sourceType"
              @change="handleQuery"
            >
            </dict-selector>
          </el-form-item>
          <el-form-item :label="$t('规则说明')">
            <el-input
              style="width: 300px"
              v-model.trim="queryParams.ruleDesc"
              :placeholder="$t('请输入关键词查找')"
              clearable
              @keyup.enter.native="handleQuery"
              onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')"
            />
          </el-form-item>
          <el-form-item :label="$t('兑换时间')">
            <el-date-picker
              type="datetimerange"
              clearable
              placement="bottom-start"
              v-model="dateRangeCreateTime"
              style="width: 240px"
              value-format="yyyy-MM-dd HH:mm:ss"
              range-separator="-"
              :start-placeholder="$t('开始日期')"
              :end-placeholder="$t('结束日期')"
            />
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              @click="handleQuery"
              >{{ $t("搜索") }}</el-button
            >
            <el-button icon="el-icon-refresh" @click="resetQuery">{{
              $t("重置")
            }}</el-button>
          </el-form-item>
        </el-form>
        <el-table ref="multipleTable" v-loading="loading" :data="memberList">
          <el-table-column
            width="140"
            :label="$t('积分记录ID')"
            align="center"
            prop="id"
          ></el-table-column>

          <el-table-column :label="$t('积分来源')" align="center">
            <template slot-scope="scope">
              {{
                isChinese
                  ? handleSourceType(scope.row.sourceType).label
                  : handleSourceType(scope.row.sourceType).labelEn
              }}
            </template>
          </el-table-column>
          <el-table-column
            :label="$t('规则标题')"
            align="center"
            :prop="isChinese ? 'ruleTitleZh' : 'ruleTitleEn'"
          >
          </el-table-column>
          <el-table-column
            :label="$t('规则说明')"
            align="center"
            :prop="isChinese ? 'ruleDescZh' : 'ruleDescEn'"
          >
          </el-table-column>
          <el-table-column
            align="center"
            :label="$t('分值')"
            prop="scoreCount"
          ></el-table-column>
          <el-table-column :label="$t('操作积分时间')" align="center">
            <template v-slot="{ row }">
              {{ parseTime(row.createTime) || "/" }}</template
            >
          </el-table-column>
        </el-table>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNo"
          :limit.sync="queryParams.pageSize"
          @pagination="handleQueryPagination"
        /> -->
      </div>
      <div class="exchange" v-show="activeIndex != 'reward'">
        <el-form :model="queryParamsRecord" ref="queryForm" size="small" :inline="true" label-width="120px">
          <el-form-item :label="$t('礼品')">
            <el-input style="width: 300px" v-model.trim="queryParamsRecord.rewardTitle" :placeholder="$t('请输入礼品名称')" clearable @keyup.enter.native="handleQuery" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')" />
          </el-form-item>
          <el-form-item :label="$t('领取方式')">
            <dict-selector clearable :type="DICT_TYPE.WAY_OF_RECEIVING" v-model="queryParamsRecord.redeemType"> </dict-selector>
          </el-form-item>

          <el-form-item :label="$t('兑换时间')">
            <el-date-picker type="datetimerange" clearable placement="bottom-start" v-model="dateRangeCreateTimeRecord" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" @click="handleQueryRecord">{{ $t("搜索") }}</el-button>
            <el-button icon="el-icon-refresh" @click="resetQueryRecord">{{ $t("重置") }}</el-button>
          </el-form-item>
        </el-form>

        <el-table ref="multipleTable" v-loading="loading" :data="memberRecordList">
          <el-table-column :label="$t('记录ID')" width="160" align="center">
            <template #default="{ row }">
              <el-button type="text" @click="handleViewRecord(row)">{{ row.redemptionNumber }}</el-button>
            </template>
          </el-table-column>
          <el-table-column width="140" :label="$t('礼品ID')" align="center">
            <template #default="{ row }">
              <el-button type="text" @click="handleShowRewardsDetail(row)">{{ row.rewardCode }}</el-button>
            </template>
          </el-table-column>
          <el-table-column width="180" :label="$t('礼品')" align="center" :prop="isChinese ? 'rewardTitleZh' : 'rewardTitleEn'"></el-table-column>
          <el-table-column :label="$t('会员')" align="center" :prop="isChinese ? 'memberNameZh' : 'memberNameEn'"></el-table-column>
          <el-table-column width="180" :label="$t('时间')" align="center">
            <template v-slot="{ row }">
              {{ parseTime(row.redemptionTime) || "/" }}
            </template>
          </el-table-column>
          <el-table-column width="140" :label="$t('数量')" align="center" prop="rewardCount"></el-table-column>
          <el-table-column :label="$t('积分')" align="center" prop="totalCount"></el-table-column>
          <el-table-column width="140" :label="$t('入口')" align="center">
            <template v-slot="{ row }">
              {{ isChinese ? handleExchangeEntrance(row.entrance).label : handleExchangeEntrance(row.entrance).labelEn }}
            </template>
          </el-table-column>
          <el-table-column width="140" :label="$t('网点')" align="center" :prop="isChinese ? 'nodeTitleZh' : 'nodeTitleEn'"> </el-table-column>
          <el-table-column width="140" :label="$t('领取方式')" align="center">
            <template v-slot="{ row }">
              {{ isChinese ? handleExchangeRedeemType(row.redeemType).label : handleExchangeRedeemType(row.redeemType).labelEn }}
            </template>
          </el-table-column>
          <el-table-column width="140" :label="$t('状态')" align="center">
            <template v-slot="{ row }">
              {{ isChinese ? handleExchangeStatus(row.status).label : handleExchangeStatus(row.status).labelEn }}
            </template>
          </el-table-column>
          <el-table-column width="140" :label="$t('备注')" align="center" prop="remark"></el-table-column>

          <el-table-column width="140" :label="$t('创建人')" align="center" prop="creatorName"></el-table-column>
          <el-table-column width="140" :label="$t('更新人')" align="center" prop="updaterName"></el-table-column>
        </el-table>
        <!-- //分页列表 -->
        <pagination v-show="totalRecord > 0" :total="totalRecord" :page.sync="queryParamsRecord.pageNo" :limit.sync="queryParamsRecord.pageSize" @pagination="handleQueryPaginationRecord" />
      </div>
    </div>

    <el-dialog
      title="保函/证书"
      :visible.sync="guaranteeShow"
      :before-close="
        () => {
          guaranteeUrl = ''
          guaranteeShow = false
        }
      "
      width="50%"
    >
      <el-form>
        <el-form-item :label="$t('保函/证书')">
          <el-row :gutter="20" type="flex" justify="center">
            <el-col :span="12">
              <el-input v-model="guaranteeUrl"></el-input>
            </el-col>
            <el-col :span="4">
              <div style="height: 45px; overflow: hidden">
                <file-upload v-model="guaranteeUrl" :fileType="['png', 'jpg', 'jpeg', 'pdf']" :limit="1" :isShowTip="false"></file-upload>
              </div>
            </el-col>
            <el-col :span="6">
              <div>{{ $t("可上传图片,pdf文档") }}</div>
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
      <div style="text-align: center">
        <el-button @click="setGuarantee">{{ $t("保 存") }}</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="$t('操作日志')" :visible.sync="operationLogShow" width="50%">
      <el-table :data="operationLogList">
        <el-table-column :label="$t('标题')" prop="title"></el-table-column>
        <el-table-column :label="$t('操作内容')" prop="content"></el-table-column>
        <el-table-column :label="$t('操作人')" prop="userId">
          <template v-slot="{ row }">
            {{ details.identityName }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作时间')">
          <template v-slot:default="scope">
            {{ parseTime(scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作ip')" prop="ip"></el-table-column>
      </el-table>
      <pagination v-show="totalLog > 0" :total="totalLog" :page.sync="operationLogFrom.page" :limit.sync="operationLogFrom.row" @pagination="getOperationLogList" />
    </el-dialog>
    <el-dialog :title="$t('认证')" :visible.sync="attestationShow" width="80%">
      <div class="details">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane :label="$t('身份证')" name="1">
            <div style="padding: 0 40px; box-sizing: border-box">
              <el-form :disabled="[2, 3].includes(IdDetails.status) && modifyIdCard" ref="formId" label-position="left" label-width="100px" :rules="rulesId" :model="IdDetails">
                <el-form-item :label="$t('姓名')" prop="name">
                  <el-input v-model="IdDetails.name"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件类型')" prop="cardType">
                  <dict-selector v-model="IdDetails.cardType" :type="DICT_TYPE.CERTIFICATE_TYPE"></dict-selector>
                </el-form-item>
                <el-form-item :label="$t('证件号码')" prop="cardNumber">
                  <el-input v-model="IdDetails.cardNumber"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件正面照')" prop="img1">
                  <div>
                    <el-input readonly style="margin-bottom: 20px" v-model="IdDetails.img1"></el-input>
                    <ImageUpload :isShowTip="false" v-model="IdDetails.img1" :limit="1"></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item :label="$t('证件背面照')" prop="img2">
                  <div>
                    <el-input readonly style="margin-bottom: 20px" v-model="IdDetails.img2"></el-input>
                    <ImageUpload :isShowTip="false" :limit="1" v-model="IdDetails.img2"></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item :label="$t('审核状态')" v-if="modifyIdCard && IdDetails.status !== 0">
                  {{ getDictDatas(DICT_TYPE.AUDIT_STATUS)[IdDetails.status] ? getDictDatas(DICT_TYPE.AUDIT_STATUS)[IdDetails.status].label : "" }}
                </el-form-item>
                <el-form-item :label="$t('审核时间')" v-if="[2, 3].includes(IdDetails.status) && modifyIdCard">
                  {{ parseTime(IdDetails.auditTime) }}
                </el-form-item>
                <el-form-item v-if="modifyIdCard && IdDetails.status !== 0" :label="$t('审核备注')">
                  <el-input v-model="IdDetails.auditRemark" :disabled="IdDetails.status === 3" type="textarea"></el-input>
                </el-form-item>
              </el-form>
              <div v-if="IdDetails.status === 1" style="text-align: center; margin-top: 20px">
                <el-button type="primary" @click="idCardAuditFn(2)">{{ $t("审核通过") }}</el-button>
                <el-button type="primary" @click="idCardAuditFn(3)">{{ $t("审核不通过") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
              <div v-if="IdDetails.status === 2 || IdDetails.status === 3" style="text-align: center; margin-top: 20px">
                <el-button type="primary" v-if="modifyIdCard" @click="modifyIdCard = false">{{ $t("修 改") }} </el-button>
                <el-button type="primary" v-else @click="setMemberUserUpdateIdCard">{{ $t("提交审核") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
              <div v-if="IdDetails.status === 0" style="text-align: center; margin-top: 20px">
                <el-button type="primary" @click="submitId">{{ $t("上 传") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane :label="$t('营业执照')" name="2">
            <div style="width: 500px; padding: 0 40px; box-sizing: border-box">
              <el-form :disabled="modifyLicense && [2, 3].includes(enterpriseFrom.status)" :rules="rulesEnterprise" :model="enterpriseFrom" label-position="left" ref="formEnter" label-width="100px">
                <el-form-item :label="$t('企业名称')" prop="name">
                  <el-input v-model="enterpriseFrom.name"></el-input>
                </el-form-item>
                <el-form-item :label="$t('企业法人')" prop="legalName">
                  <el-input v-model="enterpriseFrom.legalName"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件号码')" prop="cardNumber">
                  <el-input v-model="enterpriseFrom.cardNumber"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件照')" prop="img1">
                  <div>
                    <el-input readonly style="margin-bottom: 20px" v-model="enterpriseFrom.img1"></el-input>
                    <ImageUpload :isShowTip="false" :limit="1" v-model="enterpriseFrom.img1"></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item :label="$t('附件')">
                  <el-input readonly v-model="enterpriseFrom.img2"></el-input>
                  <ImageUpload :isShowTip="false" :limit="1" v-model="enterpriseFrom.img2"></ImageUpload>
                </el-form-item>
                <el-form-item v-if="modifyLicense && enterpriseFrom.status !== 0" :label="$t('审核状态')">
                  {{ getDictDatas(DICT_TYPE.AUDIT_STATUS)[enterpriseFrom.status].label }}
                </el-form-item>
                <el-form-item v-if="[2, 3].includes(enterpriseFrom.status) && modifyLicense" :label="$t('审核时间')">
                  {{ parseTime(enterpriseFrom.auditTime) }}
                </el-form-item>
                <el-form-item v-if="modifyLicense && enterpriseFrom.status !== 0" :label="$t('审核备注')">
                  <el-input v-model="enterpriseFrom.auditRemark" :disabled="enterpriseFrom.status === 3" type="textarea"></el-input>
                </el-form-item>
              </el-form>
              <div v-if="enterpriseFrom.status === 1" style="text-align: center; margin-top: 20px">
                <el-button type="primary" @click="certificateVerificationFn(2)">{{ $t("审核通过") }}</el-button>
                <el-button type="primary" @click="certificateVerificationFn(3)">{{ $t("审核不通过") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
              <div v-if="enterpriseFrom.status === 2 || enterpriseFrom.status === 3" style="text-align: center; margin-top: 20px">
                <el-button type="primary" v-if="modifyLicense" @click="modifyLicense = false">{{ $t("修 改") }} </el-button>
                <el-button type="primary" v-else @click="setMemberUserUpdateEnterprise">{{ $t("提交审核") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
              <div v-if="enterpriseFrom.status === 0" style="text-align: center; margin-top: 20px">
                <el-button type="primary" @click="submit">{{ $t("上 传") }}</el-button>
                <el-button @click="attestationShow = false">{{ $t("取 消") }}</el-button>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-dialog>
    <!-- 查看 礼品 -->
    <operating-gift ref="operatingGift" :title="operatingPagetitle" :rewards-details="rewardsItem" :show.sync="dialogVisible" :node-list="nodeList" />
  </div>
</template>
<script>
import { createAuditIdCard, deleteUser, memberGetAuthEnterpriseInfo, memberGetAuthIdcardInfo, memberUserAuditEnterprise, memberUserAuditIdCard, memberUserGet, memberUserUpdateEnterprise, memberUserUpdateIdCard, operationLogApi, seTupdateBackletter, userCreateAuditEnterprise } from "@/api/member/user"
import FileUpload from "@/components/FileUpload/index.vue"
import ImageUpload from "@/components/ImageUpload/index.vue"
import { DICT_TYPE, getDictDatas } from "@/utils/dict"
import ClipboardJS from "clipboard"
import { queryMemberScoreRecord, queryMemberExchangeRecord } from "@/api/ecw/memberManagement"
import { getNodeList, getRewardsDetails } from "@/api/ecw/giftManagement"
import OperatingGift from "@/views/ecw/giftManagement/components/operatingGift.vue"
import IntegralRecord from "@/views/ecw/memberManagement/integralRecord"
export default {
  name: "memberDetails",
  components: { ImageUpload, FileUpload, OperatingGift, IntegralRecord },
  data() {
    return {
      // 网点
      nodeList: [],
      //兑换记录:
      dateRangeCreateTimeRecord: [],
      memberRecordList: [],
      queryParamsRecord: {
        rewardTitle: "",
        memberId: this.$route.params.id,
        memberName: "", //会员昵称
        redeemType: "", //兑换方式
        status: "",
        rewardCount: "",
        rewardCountOperate: "",
        rewardCode: "",
        entrance: "", //兑换入口
        startTime: "",
        endTime: "",
        nodeId: "",
        pageNo: 1,
        pageSize: 10
      },
      queryParams: {
        ruleTitle: "",
        ruleDesc: "",
        key: "",
        sourceType: "",
        scoreCount: "",
        memberId: this.$route.params.id,
        scoreCountOperate: "",
        endTime: "",
        pageNo: 1,
        pageSize: 10,
        startTime: ""
      },
      dateRangeCreateTime: [],
      total: 0,
      totalRecord: 0,
      loading: true,
      activeIndex: "reward",
      // 表单校验
      rulesId: {
        name: [
          {
            required: true,
            message: this.$t("用户昵称不能为空"),
            trigger: "blur"
          }
        ],
        cardType: [
          {
            required: true,
            message: this.$t("证件类型不能为空"),
            trigger: "blur"
          }
        ],
        cardNumber: [
          {
            required: true,
            message: this.$t("证件号码不能为空"),
            trigger: "blur"
          }
        ],
        img1: [
          {
            required: true,
            message: this.$t("身份正面照不能为空"),
            trigger: ["blur", "change"]
          }
        ],
        img2: [
          {
            required: true,
            message: this.$t("身份正面照不能为空"),
            trigger: ["blur", "change"]
          }
        ]
      },
      rulesEnterprise: {
        name: [
          {
            required: true,
            message: this.$t("企业名称不能为空"),
            trigger: "blur"
          }
        ],
        legalName: [
          {
            required: true,
            message: this.$t("企业法人不能为空"),
            trigger: "blur"
          }
        ],
        cardNumber: [
          {
            required: true,
            message: this.$t("证件号码不能为空"),
            trigger: "blur"
          }
        ],
        img1: [
          {
            required: true,
            message: this.$t("证件照不能为空"),
            trigger: ["blur", "change"]
          }
        ]
      },
      getDictDatas,
      DICT_TYPE,
      details: {
        address: "",
        areaCode: "",
        avatar: "",
        backLetterImg: "",
        birthday: "",
        createTime: "",
        customerStatus: "",
        department: "",
        email: "",
        englishName: "",
        enterpriseAddress: "",
        enterpriseAuditCreateTime: "",
        enterpriseAuditRemark: "",
        enterpriseAuditStatus: "",
        enterpriseAuditTime: "",
        enterpriseBrand: "",
        enterpriseDesc: "",
        enterpriseName: "",
        enterpriseNameEn: "",
        enterpriseStall: "",
        enterpriseWebsite: "",
        gender: "",
        groupCount: "",
        id: "",
        identityAuditCreateTime: "",
        identityAuditRemark: "",
        identityAuditStatus: "",
        identityAuditTime: "",
        identityName: "",
        isDeal: "",
        isSimplePassword: "",
        jobPosition: "",
        loginDate: "",
        loginIp: "",
        mobile: "",
        nickname: "",
        password: "",
        registDate: "",
        registerIp: "",
        status: ""
      },
      publicObj: {},
      guaranteeShow: false,
      guaranteeUrl: "",
      operationLogFrom: {
        page: 1,
        row: 10,
        userId: undefined
      },
      loading: true,
      dialogVisible: false,
      operatingPagetitle: "",
      rewardsItem: {},
      attestationShow: false,
      modifyLicense: false,
      modifyIdCard: true, //修改身份证
      IdDetails: {},
      enterpriseFrom: {},
      operationLogShow: false,
      activeName: "1",
      operationLogList: [],
      totalLog: 0
    }
  },
  created() {
    this.getDetails()
    this.handleQuery()
    this.handleQueryRecord()
    this.getNodeListAPI()
  },
  computed: {
    isChinese() {
      return this.$i18n.locale === "zh_CN"
    }
  },
  mounted() {
    let clipboard = new ClipboardJS(".copy-btn")
    clipboard.on("success", () => {
      this.$message.success(this.$t("复制成功"))
    })
    clipboard.on("error", () => {
      this.$message.error(this.$t("复制失败"))
    })
  },
  methods: {
    handleViewRecord(row) {
      this.$router.push({
        path: "/member/memberManagement/exchangeRecordOperation",
        query: { exchangeRewardID: row.id, pageStatus: "view" }
      })
    },
    getNodeListAPI() {
      getNodeList().then((res) => {
        this.nodeList = res.data
      })
    },
    handleShowRewardsDetail(row) {
      let params = {
        id: row.rewardId
      }
      getRewardsDetails(params).then((res) => {
        this.dialogVisible = true
        this.operatingPagetitle = "1"
        this.rewardsItem = res.data
      })
    },
    handleExchangeRedeemType(id) {
      return this.getDictDatas(DICT_TYPE.WAY_OF_RECEIVING).filter((item) => item.value == id)[0]
    },
    //兑换入口
    handleExchangeEntrance(id) {
      return this.getDictDatas(DICT_TYPE.PLATFORM_TYPE).filter((item) => item.value == id)[0]
    },
    //兑换状态
    handleExchangeStatus(id) {
      return this.getDictDatas(DICT_TYPE.REWARD_REDEEM_STATUS).filter((item) => item.value == id)[0]
    },
    handleQueryRecord() {
      this.queryParamsRecord.pageNo = 1
      let params = { ...this.queryParamsRecord }
      if (this.dateRangeCreateTimeRecord) {
        params.startTime = this.dateRangeCreateTimeRecord[0]
        params.endTime = this.dateRangeCreateTimeRecord[1]
      }
      queryMemberExchangeRecord(params).then((res) => {
        this.loading = false
        this.memberRecordList = res.data.list
        this.totalRecord = res.data.total
      })
    },

    resetQueryRecord() {
      this.loading = true
      this.dateRangeCreateTimeRecord = []
      this.queryParamsRecord = {
        country: null,
        city: null,
        endTime: null,
        holdScore: null,
        memberId: this.$route.params.id,
        holdScoreOperate: null,
        key: null,
        pageNo: 1,
        pageSize: 10,
        startTime: null,
        usedScore: null,
        usedScoreOperate: null
      }
      this.handleQueryRecord()
    },

    handleQueryPaginationRecord() {
      let params = { ...this.queryParamsRecord }
      if (this.dateRangeCreateTimeRecord) {
        params.startTime = this.dateRangeCreateTimeRecord[0]
        params.endTime = this.dateRangeCreateTimeRecord[1]
      }
      queryMemberExchangeRecord(params).then((res) => {
        this.loading = false
        this.memberRecordList = res.data.list
        this.totalRecord = res.data.total
      })
    },

    handleSourceType(id) {
      return this.getDictDatas(DICT_TYPE.MEMBER_SCORE_SOURCE).filter((item) => item.value == id)[0]
    },
    handleholdScoreStatus(id) {
      return this.getDictDatas(DICT_TYPE.MEMBER_SCORE_OPERATE_TYPE).filter((item) => item.value == id)[0]
    },
    handleQuery() {
      this.queryParams.pageNo = 1
      let params = { ...this.queryParams }

      if (this.dateRangeCreateTime) {
        params.startTime = this.dateRangeCreateTime[0]
        params.endTime = this.dateRangeCreateTime[1]
      }
      queryMemberScoreRecord(params).then((res) => {
        this.loading = false
        this.memberList = res.data.list
        this.total = res.data.total
      })
    },
    handleQueryPagination() {
      let params = { ...this.queryParams }
      if (this.dateRangeCreateTime) {
        params.startTime = this.dateRangeCreateTime[0]
        params.endTime = this.dateRangeCreateTime[1]
      }
      queryMemberScoreRecord(params).then((res) => {
        this.loading = false
        this.memberList = res.data.list
        this.total = res.data.total
      })
    },
    resetQuery() {
      this.loading = true
      this.dateRangeCreateTime = []
      this.queryParams = {
        ruleTitle: "",
        ruleDesc: "",
        key: "",
        sourceType: "",
        scoreCount: "",
        memberId: this.$route.params.id,
        scoreCountOperate: "",
        endTime: "",
        pageNo: 1,
        pageSize: 100,
        startTime: ""
      }
      this.handleQuery()
    },
    handleCopyReferralCode(details) {},
    handleSelect(key, keyPath) {
      console.log(key, keyPath)
      this.activeIndex = key
    },
    handleExchangeRewards(details) {
      this.$router.push({
        path: "/member/memberManagement/exchangeRecordOperation",
        query: {
          memberId: details.userScoreLevelInfo.memberId,
          pageStatus: "add"
        }
      })
    },
    deleteFn(row) {
      const nickname = row.nickname
      this.$modal
        .confirm(`${this.$t("是否确认删除昵称为{nickname}的会员?", { nickname })}`)
        .then(function () {
          return deleteUser(row.id)
        })
        .then((res) => {
          this.$message.success(this.$t("删除成功"))
          this.$router.back()
        })
        .catch(() => {
          // this.$message.success(this.$t('删除失败'))
        })
    },
    getDetails() {
      memberUserGet({ id: this.$route.params.id }).then((r) => {
        this.details = r.data
      })
    },
    // 保函证书
    guarantee(row) {
      this.publicObj = row
      this.guaranteeShow = true
      this.guaranteeUrl = row.backLetterImg
    },
    // 操作日志
    operationLogFn(row) {
      this.publicObj = row
      this.operationLogFrom.page = 1
      this.operationLogFrom.userId = row.id
      this.operationLogShow = true
      this.operationLogList = []
      this.getOperationLogList()
    },
    getOperationLogList() {
      operationLogApi(this.operationLogFrom).then((r) => {
        if (r.code === 0) {
          this.operationLogList = r.data.list
          this.totalLog = r.data.total
        }
      })
    },
    identityFn(row, val) {
      this.attestationShow = true
      this.activeName = val
      this.publicObj = row
      if (val == 1) {
        this.getIdentityDetails()
      } else {
        this.getEnterpriseFn()
      }
    },
    handleClick(val) {
      if (val.name == 1) {
        this.getIdentityDetails()
      } else {
        this.getEnterpriseFn()
      }
    },
    getIdentityDetails() {
      this.resetId()
      memberGetAuthIdcardInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.IdDetails = r.data
        }
      })
    },
    getEnterpriseFn() {
      this.resetEnterprise()
      memberGetAuthEnterpriseInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.enterpriseFrom = r.data
        }
      })
    },
    //身份证审核
    idCardAuditFn(val) {
      let p = {
        auditStatus: val,
        userCardAuthId: this.IdDetails.id,
        auditRemark: this.IdDetails.auditRemark
      }
      memberUserAuditIdCard(p).then((r) => {
        if (r.code === 0) {
          this.$message.success(this.$t("修改成功"))
          this.getList()
          this.getIdentityDetails()
        }
      })
    },
    //  企业证书审核
    certificateVerificationFn(val) {
      let p = {
        auditStatus: val,
        userEnterpriseAuthId: this.enterpriseFrom.id,
        auditRemark: this.enterpriseFrom.auditRemark
      }
      memberUserAuditEnterprise(p).then((r) => {
        if (r.code === 0) {
          this.getList()
          this.getEnterpriseFn()
        }
      })
    },
    setMemberUserUpdateIdCard() {
      this.$refs.formId.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.IdDetails.cardNumber,
            cardType: this.IdDetails.cardType,
            img1: this.IdDetails.img1,
            img2: this.IdDetails.img2,
            name: this.IdDetails.name,
            userCardAuthId: this.IdDetails.id,
            auditPass: true
          }
          memberUserUpdateIdCard(p).then((r) => {
            if (r.code === 0) {
              this.$message.success(this.$t("修改成功"))
              if (p.auditPass === true) {
                this.getIdentityDetails()
              }
              this.getList()
              this.modifyIdCard = true
            }
          })
        }
      })
    },
    setMemberUserUpdateEnterprise() {
      this.$refs.formEnter.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.enterpriseFrom.cardNumber,
            img1: this.enterpriseFrom.img1,
            img2: this.enterpriseFrom.img2,
            legalName: this.enterpriseFrom.legalName,
            name: this.enterpriseFrom.name,
            userEnterpriseAuthId: this.enterpriseFrom.id,
            auditPass: true
          }
          memberUserUpdateEnterprise(p).then((r) => {
            if (r.code === 0) {
              if (p.auditPass === true) {
                this.getEnterpriseFn()
              }
              this.getList()
              this.modifyLicense = true
              this.$message.success(this.$t("修改成功"))
            }
          })
        }
      })
    },
    submit() {
      let p = {
        cardNumber: this.enterpriseFrom.cardNumber,
        img1: this.enterpriseFrom.img1,
        img2: this.enterpriseFrom.img2,
        legalName: this.enterpriseFrom.legalName,
        name: this.enterpriseFrom.name,
        userEnterpriseAuthId: this.enterpriseFrom.id,
        userId: this.publicObj.id
      }
      userCreateAuditEnterprise(p).then((r) => {
        if (r.code === 0) {
          this.$message.success(this.$t("添加成功!"))
          this.enterpriseFrom.status = 2
          this.enterpriseFrom.auditTime = new Date().getTime()
          this.getEnterpriseFn()
          this.getList()
        }
      })
    },
    submitId() {
      this.$refs.formId.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.IdDetails.cardNumber,
            cardType: this.IdDetails.cardType,
            img1: this.IdDetails.img1,
            img2: this.IdDetails.img2,
            name: this.IdDetails.name,
            status: 2,
            userId: this.publicObj.id
          }
          createAuditIdCard(p).then((r) => {
            if (r.code === 0) {
              this.$message.success(this.$t("添加成功!"))
              this.IdDetails.status = 2
              this.IdDetails.auditTime = new Date().getTime()
              this.getIdentityDetails()
              this.getList()
            }
          })
        }
      })
    },
    /** 表单重置 */
    resetId() {
      this.IdDetails = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        cardType: undefined,
        createTime: undefined,
        id: 0,
        img1: undefined,
        img2: undefined,
        name: "",
        status: 0,
        userId: 0
      }
    }, //清空身份证
    resetEnterprise() {
      this.enterpriseFrom = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        createTime: undefined,
        id: undefined,
        img1: undefined,
        img2: undefined,
        legalName: undefined,
        name: undefined,
        status: 0,
        userId: undefined
      }
    }, //清空企业
    setGuarantee() {
      seTupdateBackletter({
        userId: this.publicObj.id,
        backLetter: this.guaranteeUrl
      }).then((r) => {
        if (r.code === 0) {
          this.publicObj.backLetterImg = this.guaranteeUrl
          this.guaranteeShow = false
          this.$message.success(this.$t("保存成功"))
        }
      })
    }
  }
}
</script>
<style scoped lang="scss">
.table-container {
  padding-top: 20px;
}
</style>