index.vue 34.6 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
4 5 6 7 8 9 10 11
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
lanbaoming's avatar
lanbaoming committed
12
      <el-form-item :label="$t('关键字')" prop="nickname">
13 14 15 16 17 18
        <el-input
          v-model="queryParams.searchKey"
          :placeholder="$t('搜索昵称、姓名、手机、Email')"
          clearable
          @keyup.enter.native="handleQuery"
        />
lanbaoming's avatar
lanbaoming committed
19 20 21
      </el-form-item>
      <el-form-item :label="$t('成交')" prop="mobile">
        <el-select v-model="queryParams.isDeal">
22 23 24 25 26 27 28 29 30 31 32
          <el-option
            v-for="item in [
              { label: $t('全部'), value: '' },
              { label: $t('是'), value: true },
              { label: $t('否'), value: false },
            ]"
            :value="item.value"
            :label="item.label"
            :key="item.value"
          ></el-option>
        </el-select>
lanbaoming's avatar
lanbaoming committed
33 34 35
      </el-form-item>
      <el-form-item :label="$t('认证')" prop="password">
        <el-select v-model="queryParams.authType">
36 37 38 39 40 41 42 43 44 45 46
          <el-option
            v-for="item in [
              { label: $t('全部'), value: '' },
              { label: $t('营业执照认证'), value: 1 },
              { label: $t('身份证认证'), value: 2 },
              { label: $t('双认证'), value: 3 },
            ]"
            :key="item.value"
            :value="item.value"
            :label="item.label"
          ></el-option>
lanbaoming's avatar
lanbaoming committed
47 48 49
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('审核状态')" prop="registerIp">
50 51 52 53
        <dict-selector
          v-model="queryParams.auditStatus"
          :type="DICT_TYPE.AUDIT_STATUS"
        ></dict-selector>
lanbaoming's avatar
lanbaoming committed
54 55 56 57 58 59
      </el-form-item>
      <el-form-item :label="$t('创建时间')">
        <el-date-picker
          v-model="dateRangeCreateTime"
          type="datetimerange"
          :start-placeholder="$t('开始日期')"
60 61 62
          value-format="yyyy-MM-dd HH:mm:ss"
          :end-placeholder="$t('结束日期')"
        >
lanbaoming's avatar
lanbaoming committed
63 64
        </el-date-picker>
      </el-form-item>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
      <el-form-item :label="$t('客户编号')" prop="customerCode">
        <el-input
          v-model="queryParams.customerCode"
          :placeholder="$t('请输入客户编号')"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('会员编号')" prop="memberCode">
        <el-input
          v-model="queryParams.memberCode"
          :placeholder="$t('请输入会员编号')"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
81
      <el-form-item>
82 83 84 85 86 87 88 89 90 91 92 93 94
        <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-button
          v-has-permi="['member:export']"
          :loading="exportLoading"
          type="primary"
          @click="exportFn"
          >{{ $t("导 出") }}</el-button
        >
lanbaoming's avatar
lanbaoming committed
95 96 97 98 99
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
100 101 102 103
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
lanbaoming's avatar
lanbaoming committed
104 105 106 107
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
108 109 110
      <el-table-column
        :label="$t('会员编号')"
        align="center"
chenwei's avatar
chenwei committed
111 112 113 114 115 116 117 118 119
        width="120px"
      >
        <template #default="{ row }">
          <el-button
            type="text"
            @click="$router.push('/member/member/member-details/' + row.id)"
          >{{row.memberCode}}</el-button>
        </template>
      </el-table-column>
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
      <el-table-column
        :label="$t('公司名称')"
        align="center"
        prop="enterpriseName"
      />
      <el-table-column :label="$t('客户编号')" align="center">
        <template v-slot="{ row }">
          <el-button @click="handleGoDetail(row.customerId)" type="text">{{
            row.customerCode
          }}</el-button>
        </template>
      </el-table-column>
      <el-table-column
        :label="$t('用户昵称')"
        align="center"
        prop="nickname"
        width="150"
      />
      <el-table-column
        :label="$t('真实姓名')"
        align="center"
        prop="identityName"
      />
lanbaoming's avatar
lanbaoming committed
143
      <el-table-column :label="$t('区号')">
144 145
        <template v-slot:default="scope">
          +{{ scope.row.areaCode ? `${scope.row.areaCode}` : "" }}
lanbaoming's avatar
lanbaoming committed
146 147
        </template>
      </el-table-column>
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
      <el-table-column
        :label="$t('手机号')"
        show-overflow-tooltip
        align="center"
        prop="mobile"
        width="150"
      >
      </el-table-column>
      <el-table-column
        :label="$t('成交')"
        align="center"
        prop="customerStatus"
        show-overflow-tooltip
      >
        <template v-slot="{ row }">
          {{ row.customerStatus === 3 ? $t("成交") : $t("非成交") }}
lanbaoming's avatar
lanbaoming committed
164 165
        </template>
      </el-table-column>
166 167 168 169 170 171
      <el-table-column
        :label="$t('认证')"
        align="center"
        :formatter="authentication"
      />
      <el-table-column :label="$t('状态')" align="center" prop="status">
lanbaoming's avatar
lanbaoming committed
172
        <template slot-scope="scope">
173 174 175 176 177 178
          <el-switch
            v-model="scope.row.status"
            :active-value="0"
            :inactive-value="1"
            @change="handleStatusChange(scope.row)"
          />
lanbaoming's avatar
lanbaoming committed
179 180
        </template>
      </el-table-column>
181 182 183 184 185
      <el-table-column
        :label="$t('身份证审核状态')"
        align="center"
        prop="createTime"
      >
lanbaoming's avatar
lanbaoming committed
186
        <template slot-scope="scope">
187 188 189 190 191 192 193 194 195 196 197 198 199
          <div v-if="!scope.row.identityAuditStatus">{{ $t("未提交") }}</div>
          <dict-tag
            v-else
            :type="DICT_TYPE.AUDIT_STATUS"
            :value="scope.row.identityAuditStatus"
          ></dict-tag>
          <el-tooltip
            v-if="scope.row.identityAuditStatus === 3"
            class="item"
            effect="dark"
            :content="scope.row.identityAuditRemark"
            placement="bottom"
          >
lanbaoming's avatar
lanbaoming committed
200 201 202 203
            <i class="el-icon-question"></i>
          </el-tooltip>
        </template>
      </el-table-column>
204 205 206 207 208
      <el-table-column
        :label="$t('营业执照审核状态')"
        align="center"
        prop="createTime"
      >
lanbaoming's avatar
lanbaoming committed
209
        <template slot-scope="scope">
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
          <div v-if="!scope.row.enterpriseAuditStatus">{{ $t("未提交") }}</div>
          <dict-tag
            v-else
            :type="DICT_TYPE.AUDIT_STATUS"
            :value="scope.row.enterpriseAuditStatus"
          ></dict-tag>
          <el-tooltip
            v-if="scope.row.enterpriseAuditStatus === 3"
            class="item"
            effect="dark"
            :content="scope.row.rowenterpriseAuditRemark"
            placement="bottom"
          >
            <i class="el-icon-question"></i>
          </el-tooltip>
lanbaoming's avatar
lanbaoming committed
225 226
        </template>
      </el-table-column>
227 228 229 230 231 232
      <el-table-column
        :label="$t('创建时间')"
        align="center"
        prop="createTime"
        width="180"
      >
lanbaoming's avatar
lanbaoming committed
233 234 235 236
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
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
      <el-table-column
        :label="$t('操作')"
        align="center"
        class-name="small-padding fixed-width"
        width="200px"
      >
        <template slot-scope="scope">
          <el-button
            v-has-permi="['member:certificate']"
            size="mini"
            type="text"
            @click="guarantee(scope.row)"
            >{{ $t("保函/证书") }}</el-button
          >
          <el-button
            v-has-permi="['member:log']"
            size="mini"
            type="text"
            @click="operationLogFn(scope.row)"
            >{{ $t("操作日志") }}</el-button
          >
          <el-button
            v-has-permi="['member:id-card']"
            size="mini"
            type="text"
            @click="identityFn(scope.row, '1')"
            >{{ $t("身份证") }}</el-button
          >
          <el-button
            v-has-permi="['member:business-license']"
            size="mini"
            type="text"
            @click="identityFn(scope.row, '2')"
            >{{ $t("营业执照") }}</el-button
          >
          <el-button
            v-has-permi="['member:delete']"
            size="mini"
            type="text"
            @click="deleteFn(scope.row)"
            >{{ $t("删 除") }}</el-button
          >
chenwei's avatar
chenwei committed
279
          <!-- <el-button
280 281 282 283 284
            type="text"
            v-has-permi="['member:user:info']"
            size="mini"
            @click="$router.push('member/member-details/' + scope.row.id)"
            >{{ $t("查看") }}</el-button
chenwei's avatar
chenwei committed
285
          > -->
lanbaoming's avatar
lanbaoming committed
286 287 288 289
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
290 291 292 293 294 295 296
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.rows"
      @pagination="getList"
    />
lanbaoming's avatar
lanbaoming committed
297 298 299
    <el-dialog
      title="保函/证书"
      :visible.sync="guaranteeShow"
300 301 302 303 304 305 306 307
      :before-close="
        () => {
          guaranteeUrl = '';
          guaranteeShow = false;
        }
      "
      width="50%"
    >
lanbaoming's avatar
lanbaoming committed
308 309
      <el-form>
        <el-form-item :label="$t('保函/证书')">
310 311 312 313 314 315 316 317 318 319 320 321 322
          <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>
lanbaoming's avatar
lanbaoming committed
323
            <el-col :span="6">
324
              <div>{{ $t("可上传图片,pdf文档") }}</div>
lanbaoming's avatar
lanbaoming committed
325 326 327 328
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
329 330 331
      <div style="text-align: center">
        <el-button @click="setGuarantee">{{ $t("保 存") }}</el-button>
      </div>
lanbaoming's avatar
lanbaoming committed
332 333 334 335
    </el-dialog>
    <el-dialog
      :title="$t('操作日志')"
      :visible.sync="operationLogShow"
336 337
      width="50%"
    >
lanbaoming's avatar
lanbaoming committed
338 339
      <el-table :data="operationLogList">
        <el-table-column :label="$t('标题')" prop="title"></el-table-column>
340 341 342 343
        <el-table-column
          :label="$t('操作内容')"
          prop="content"
        ></el-table-column>
lanbaoming's avatar
lanbaoming committed
344
        <el-table-column :label="$t('操作人')" prop="userId">
345 346
          <template v-slot="{ row }">
            {{ list.find((i) => i.id == row.userId).identityName }}
lanbaoming's avatar
lanbaoming committed
347 348 349
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作时间')">
350 351
          <template v-slot:default="scope">
            {{ parseTime(scope.row.createTime) }}
lanbaoming's avatar
lanbaoming committed
352 353 354 355
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作ip')" prop="ip"></el-table-column>
      </el-table>
356 357 358 359 360 361 362
      <pagination
        v-show="totalLog > 0"
        :total="totalLog"
        :page.sync="operationLogFrom.page"
        :limit.sync="operationLogFrom.row"
        @pagination="getOperationLogList"
      />
lanbaoming's avatar
lanbaoming committed
363
    </el-dialog>
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
    <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>
lanbaoming's avatar
lanbaoming committed
401
                  </div>
402 403 404 405 406 407 408 409 410 411 412 413 414
                </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>
lanbaoming's avatar
lanbaoming committed
415
                  </div>
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
                </el-form-item>
                <el-form-item
                  :label="$t('审核状态')"
                  v-if="modifyIdCard && IdDetails.status !== 0"
                >
                  {{
                    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>
lanbaoming's avatar
lanbaoming committed
522
                  </div>
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
                </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>
lanbaoming's avatar
lanbaoming committed
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
  </div>
</template>

<script>
import {
  createUser,
  updateUser,
  deleteUser,
  getUserPage,
  exportUserExcel,
  operationLogApi,
  seTupdateBackletter,
  memberGetAuthIdcardInfo,
  memberGetAuthEnterpriseInfo,
  memberUserAuditIdCard,
  memberUserUpdateIdCard,
  memberUserUpdateEnterprise,
  setUserUpdateStatus,
  userCreateAuditEnterprise,
  memberUserAuditEnterprise,
632
  createAuditIdCard,
lanbaoming's avatar
lanbaoming committed
633
} from "@/api/member/user";
634 635
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
import FileUpload from "@/components/FileUpload";
lanbaoming's avatar
lanbaoming committed
636 637
import ImageUpload from "@/components/ImageUpload";
import uploadImage from "@/components/UploadImage";
638 639 640 641 642 643
import { CommonStatusEnum } from "@/utils/constants";
import {
  changeUserStatus,
  listServiceUser,
  listSimpleUsers,
} from "@/api/system/user";
lanbaoming's avatar
lanbaoming committed
644 645 646 647
export default {
  name: "User",
  components: {
    FileUpload,
648 649
    ImageUpload,
    uploadImage,
lanbaoming's avatar
lanbaoming committed
650 651 652
  },
  data() {
    return {
653 654 655 656
      totalLog: 0,
      IdDetails: {},
      enterpriseFrom: {},
      guaranteeUrl: undefined,
lanbaoming's avatar
lanbaoming committed
657 658 659
      DICT_TYPE,
      getDictDatas,
      // audit_status
660
      activeName: "1",
lanbaoming's avatar
lanbaoming committed
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeLoginDate: [],
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
681 682 683 684 685 686
        isDeal: undefined, //	是否成交
        searchKey: undefined, //关键字
        auditStatus: undefined, //审核状态
        authType: undefined, //关键字
        customerCode: null,
        memberCode: null,
lanbaoming's avatar
lanbaoming committed
687 688 689 690 691
      },
      // 表单参数
      form: {},
      // 表单校验
      rulesId: {
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
        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"],
          },
        ],
lanbaoming's avatar
lanbaoming committed
727 728
      },
      rulesEnterprise: {
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
        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"],
          },
        ],
lanbaoming's avatar
lanbaoming committed
757
      },
758 759 760 761 762 763 764
      publicObj: undefined,
      operationLogShow: false,
      guaranteeShow: false,
      operationLogFrom: {
        page: 1,
        row: 10,
        userId: undefined,
lanbaoming's avatar
lanbaoming committed
765
      },
766 767 768 769
      operationLogList: [],
      attestationShow: false,
      modifyIdCard: true, //修改身份证
      modifyLicense: true, //修改营业执照
lanbaoming's avatar
lanbaoming committed
770 771 772 773
    };
  },
  created() {
    this.resetId();
774
    this.resetEnterprise();
lanbaoming's avatar
lanbaoming committed
775 776 777
    this.getList();
  },
  methods: {
778 779 780 781
    handleGoDetail(customerId) {
      this.$router.push("/customer/query/" + customerId);
    },
    deleteFn(row) {
lanbaoming's avatar
lanbaoming committed
782
      const nickname = row.nickname;
783 784 785 786 787 788 789 790 791 792 793 794 795 796
      this.$modal
        .confirm(
          `${this.$t("是否确认删除昵称为{nickname}的会员?", { nickname })}`
        )
        .then(function () {
          return deleteUser(row.id);
        })
        .then((res) => {
          if (res.code === 0) this.getList();
          this.$message.success(this.$t("删除成功"));
        })
        .catch(() => {
          // this.$message.success(this.$t('删除失败'))
        });
lanbaoming's avatar
lanbaoming committed
797 798
    },
    //导出
799 800 801 802 803 804 805 806 807 808 809 810
    exportFn() {
      this.$modal
        .confirm(this.$t("是否确认导出所有用户数据项?"))
        .then(() => {
          this.exportLoading = true;
          return exportUserExcel(this.queryParams);
        })
        .then((response) => {
          this.$download.excel(response, `${this.$t("注册会员")}.xls`);
          this.exportLoading = false;
        })
        .catch(() => {});
lanbaoming's avatar
lanbaoming committed
811 812 813
    },
    // 用户状态修改
    handleStatusChange(row) {
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
      let text =
        row.status === CommonStatusEnum.ENABLE
          ? this.$t("启用")
          : this.$t("停用");
      this.$modal
        .confirm(
          this.$t('确认要"') + text + '""' + row.nickname + this.$t('"用户吗?')
        )
        .then(function () {
          return setUserUpdateStatus({ id: row.id, status: row.status });
        })
        .then(() => {
          this.$modal.msgSuccess(text + this.$t("成功"));
        })
        .catch(function () {
          row.status =
            row.status === CommonStatusEnum.ENABLE
              ? CommonStatusEnum.DISABLE
              : CommonStatusEnum.ENABLE;
        });
lanbaoming's avatar
lanbaoming committed
834 835 836 837 838
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
839
      let params = { ...this.queryParams };
lanbaoming's avatar
lanbaoming committed
840
      // this.addBeginAndEndTime(params, this.dateRangeLoginDate, 'loginDate');
841 842 843 844 845 846
      this.addBeginAndEndTime(
        params,
        this.dateRangeCreateTime,
        "createTime",
        false
      );
lanbaoming's avatar
lanbaoming committed
847
      // 执行查询
848
      getUserPage(params).then((response) => {
lanbaoming's avatar
lanbaoming committed
849 850 851 852 853 854
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 表单重置 */
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
    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() {
lanbaoming's avatar
lanbaoming committed
871 872 873 874 875 876 877 878 879 880 881
      this.enterpriseFrom = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        createTime: undefined,
        id: undefined,
        img1: undefined,
        img2: undefined,
        legalName: undefined,
        name: undefined,
        status: 0,
882 883 884
        userId: undefined,
      };
    }, //清空企业
lanbaoming's avatar
lanbaoming committed
885 886 887 888 889 890 891 892 893 894 895 896
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeLoginDate = [];
      this.dateRangeCreateTime = [];
      this.queryParams = {
        page: 1,
        rows: 10,
897 898 899 900 901
        isDeal: undefined, //	是否成交
        searchKey: undefined, //关键字
        auditStatus: undefined, //审核状态
        authType: undefined, //关键字
      };
lanbaoming's avatar
lanbaoming committed
902 903 904 905 906
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 保函证书
    guarantee(row) {
907 908 909
      this.publicObj = row;
      this.guaranteeShow = true;
      this.guaranteeUrl = row.backLetterImg;
lanbaoming's avatar
lanbaoming committed
910 911
    },
    // 操作日志
912
    operationLogFn(row) {
lanbaoming's avatar
lanbaoming committed
913 914
      this.publicObj = row;
      this.operationLogFrom.page = 1;
915
      this.operationLogFrom.userId = row.id;
lanbaoming's avatar
lanbaoming committed
916 917 918 919
      this.operationLogShow = true;
      this.operationLogList = [];
      this.getOperationLogList();
    },
920 921 922 923 924
    getOperationLogList() {
      operationLogApi(this.operationLogFrom).then((r) => {
        if (r.code === 0) {
          this.operationLogList = r.data.list;
          this.totalLog = r.data.total;
lanbaoming's avatar
lanbaoming committed
925
        }
926
      });
lanbaoming's avatar
lanbaoming committed
927
    },
928 929 930 931 932 933
    setGuarantee() {
      seTupdateBackletter({
        userId: this.publicObj.id,
        backLetter: this.guaranteeUrl,
      }).then((r) => {
        if (r.code === 0) {
lanbaoming's avatar
lanbaoming committed
934 935
          this.publicObj.backLetterImg = this.guaranteeUrl;
          this.guaranteeShow = false;
936
          this.$message.success(this.$t("保存成功"));
lanbaoming's avatar
lanbaoming committed
937
        }
938
      });
lanbaoming's avatar
lanbaoming committed
939
    },
940
    identityFn(row, val) {
lanbaoming's avatar
lanbaoming committed
941 942 943
      this.attestationShow = true;
      this.activeName = val;
      this.publicObj = row;
944
      if (val == 1) {
lanbaoming's avatar
lanbaoming committed
945
        this.getIdentityDetails();
946
      } else {
lanbaoming's avatar
lanbaoming committed
947 948 949
        this.getEnterpriseFn();
      }
    },
950 951
    handleClick(val) {
      if (val.name == 1) {
lanbaoming's avatar
lanbaoming committed
952
        this.getIdentityDetails();
953
      } else {
lanbaoming's avatar
lanbaoming committed
954 955 956
        this.getEnterpriseFn();
      }
    },
957
    getIdentityDetails() {
lanbaoming's avatar
lanbaoming committed
958
      this.resetId();
959 960 961
      memberGetAuthIdcardInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.IdDetails = r.data;
lanbaoming's avatar
lanbaoming committed
962
        }
963
      });
lanbaoming's avatar
lanbaoming committed
964
    },
965
    getEnterpriseFn() {
lanbaoming's avatar
lanbaoming committed
966
      this.resetEnterprise();
967 968 969 970 971
      memberGetAuthEnterpriseInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.enterpriseFrom = r.data;
        }
      });
lanbaoming's avatar
lanbaoming committed
972 973
    },
    //身份证审核
974
    idCardAuditFn(val) {
lanbaoming's avatar
lanbaoming committed
975
      let p = {
976 977 978 979 980 981 982 983 984
        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();
lanbaoming's avatar
lanbaoming committed
985
        }
986
      });
lanbaoming's avatar
lanbaoming committed
987
    },
988 989
    //  企业证书审核
    certificateVerificationFn(val) {
lanbaoming's avatar
lanbaoming committed
990
      let p = {
991 992 993 994 995 996 997
        auditStatus: val,
        userEnterpriseAuthId: this.enterpriseFrom.id,
        auditRemark: this.enterpriseFrom.auditRemark,
      };
      memberUserAuditEnterprise(p).then((r) => {
        if (r.code === 0) {
          this.getList();
lanbaoming's avatar
lanbaoming committed
998 999
          this.getEnterpriseFn();
        }
1000
      });
lanbaoming's avatar
lanbaoming committed
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
    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;
            }
          });
        }
      });
lanbaoming's avatar
lanbaoming committed
1026
    },
1027 1028 1029
    setMemberUserUpdateEnterprise() {
      this.$refs.formEnter.validate(async (valid) => {
        if (valid) {
lanbaoming's avatar
lanbaoming committed
1030
          let p = {
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
            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) {
lanbaoming's avatar
lanbaoming committed
1042 1043
                this.getEnterpriseFn();
              }
1044
              this.getList();
lanbaoming's avatar
lanbaoming committed
1045
              this.modifyLicense = true;
1046
              this.$message.success(this.$t("修改成功"));
lanbaoming's avatar
lanbaoming committed
1047
            }
1048
          });
lanbaoming's avatar
lanbaoming committed
1049
        }
1050
      });
lanbaoming's avatar
lanbaoming committed
1051
    },
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
    authentication(row) {
      if (!row.identityAuditStatus && !row.enterpriseAuditStatus) {
        return this.$t("");
      } else if (!!row.identityAuditStatus && !!row.enterpriseAuditStatus) {
        return this.$t("双认证");
      } else if (row.identityAuditStatus >= 0) {
        return this.$t("身份");
      } else if (row.enterpriseAuditStatus >= 0) {
        return this.$t("营业");
      }
lanbaoming's avatar
lanbaoming committed
1062
    },
1063
    submit() {
lanbaoming's avatar
lanbaoming committed
1064
      let p = {
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
        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();
lanbaoming's avatar
lanbaoming committed
1078
          this.getEnterpriseFn();
1079
          this.getList();
lanbaoming's avatar
lanbaoming committed
1080
        }
1081
      });
lanbaoming's avatar
lanbaoming committed
1082
    },
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093
    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,
lanbaoming's avatar
lanbaoming committed
1094
          };
1095 1096 1097 1098 1099
          createAuditIdCard(p).then((r) => {
            if (r.code === 0) {
              this.$message.success(this.$t("添加成功!"));
              this.IdDetails.status = 2;
              this.IdDetails.auditTime = new Date().getTime();
lanbaoming's avatar
lanbaoming committed
1100
              this.getIdentityDetails();
1101
              this.getList();
lanbaoming's avatar
lanbaoming committed
1102
            }
1103
          });
lanbaoming's avatar
lanbaoming committed
1104
        }
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118
      });
    },
  },
  watch: {
    attestationShow(newVal) {
      if (!newVal) {
        this.resetId();
        this.resetEnterprise();
        this.publicObj = undefined;
      } else {
        this.modifyIdCard = true;
        this.modifyLicense = true;
      }
    },
lanbaoming's avatar
lanbaoming committed
1119 1120 1121 1122
  },
};
</script>
<style lang="scss" scoped>
1123
.details {
lanbaoming's avatar
lanbaoming committed
1124 1125 1126
  .el-input {
    width: 300px;
  }
1127
  .el-textarea {
lanbaoming's avatar
lanbaoming committed
1128 1129 1130 1131
    width: 300px;
  }
}
</style>