underReview.vue 12.6 KB
Newer Older
dcy's avatar
dcy committed
1 2 3 4 5 6

<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
dcy's avatar
dcy committed
7 8
      <el-form-item :label="$t('关键字')" prop="nickname">
        <el-input v-model="queryParams.searchKey" :placeholder="$t('搜索昵称、姓名、手机、Email')" clearable @keyup.enter.native="handleQuery"/>
dcy's avatar
dcy committed
9 10
      </el-form-item>
      <el-form-item>
dcy's avatar
dcy committed
11
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
dcy's avatar
dcy committed
12 13 14 15 16 17 18 19 20 21
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
dcy's avatar
dcy committed
22 23
      <el-table-column :label="$t('用户昵称')" align="center" prop="nickname" />
      <el-table-column :label="$t('真实姓名')" align="center" prop="identityName" />
dcy's avatar
dcy committed
24
      <el-table-column  align="center" :label="$t('区号')">
dcy's avatar
dcy committed
25
        <template v-slot:default = 'scope'>
dcy's avatar
dcy committed
26
          +{{scope.row.areaCode ? `${scope.row.areaCode}`:''}}
dcy's avatar
dcy committed
27 28
        </template>
      </el-table-column>
dcy's avatar
dcy committed
29
      <el-table-column :label="$t('手机号')" show-overflow-tooltip align="center" prop="mobile" >
dcy's avatar
dcy committed
30
      </el-table-column>
dcy's avatar
dcy committed
31
      <el-table-column :label="$t('提交审核时间')" align="center" prop="createTime">
dcy's avatar
dcy committed
32
        <template slot-scope="scope">
33
          <span>{{ parseTime(scope.row.identityAuditCreateTime) }}</span>
dcy's avatar
dcy committed
34 35
        </template>
      </el-table-column>
dcy's avatar
dcy committed
36
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
dcy's avatar
dcy committed
37
        <template slot-scope="scope" >
dcy's avatar
dcy committed
38
          <el-button v-if="scope.row.identityAuditStatus !== 0 && scope.row.identityAuditStatus !== undefined" size="mini" type="text"  @click="identityFn(scope.row , '1')">{{$t('身份证审核')}}</el-button>
dcy's avatar
dcy committed
39 40 41 42 43 44 45
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows"
                @pagination="getList"/>
    <el-dialog
dcy's avatar
dcy committed
46
      :title="$t('认证')"
dcy's avatar
dcy committed
47 48 49
      :visible.sync="attestationShow"
      width="80%">
      <div class="details">
dcy's avatar
dcy committed
50
        <el-tabs v-model="activeName" >
dcy's avatar
dcy committed
51
          <el-tab-pane :label="$t('身份证')" name="1">
dcy's avatar
dcy committed
52 53
            <div style="padding:0 40px;box-sizing: border-box;">
              <el-form ref="formId" label-position="left" label-width="100px" :rules="rulesId"  :model="IdDetails" >
dcy's avatar
dcy committed
54
                <el-form-item :label="$t('姓名')" prop="name">
dcy's avatar
dcy committed
55 56
                  <el-input v-model="IdDetails.name"></el-input>
                </el-form-item>
dcy's avatar
dcy committed
57
                <el-form-item :label="$t('证件类型')" prop="cardType">
dcy's avatar
dcy committed
58 59
                  <dict-selector v-model="IdDetails.cardType"  :type="DICT_TYPE.CERTIFICATE_TYPE" ></dict-selector>
                </el-form-item>
dcy's avatar
dcy committed
60
                <el-form-item :label="$t('证件号码')" prop="cardNumber">
dcy's avatar
dcy committed
61 62
                  <el-input v-model="IdDetails.cardNumber"></el-input>
                </el-form-item>
dcy's avatar
dcy committed
63
                <el-form-item :label="$t('证件正面照')" prop="img1">
dcy's avatar
dcy committed
64 65 66 67 68
                  <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>
dcy's avatar
dcy committed
69
                <el-form-item :label="$t('证件背面照')" prop="img2">
dcy's avatar
dcy committed
70 71 72 73 74
                  <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>
dcy's avatar
dcy committed
75
                <el-form-item :label="$t('审核状态')">
dcy's avatar
dcy committed
76 77
                  {{getDictDatas(DICT_TYPE.AUDIT_STATUS)[IdDetails.status].label}}
                </el-form-item>
dcy's avatar
dcy committed
78
                <el-form-item :label="$t('审核时间')" v-if="IdDetails.status === 2 || IdDetails.status === 3">
dcy's avatar
dcy committed
79 80
                  {{parseTime(IdDetails.auditTime)}}
                </el-form-item>
dcy's avatar
dcy committed
81
                <el-form-item v-if="IdDetails.status === 1 || IdDetails.status === 3" :label="$t('审核备注')">
dcy's avatar
dcy committed
82 83 84 85
                  <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;">
dcy's avatar
dcy committed
86 87 88
                <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>
dcy's avatar
dcy committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  deleteUser,
  exportUserExcel,
  operationLogApi,
  seTupdateBackletter,
  memberGetAuthIdcardInfo,
  memberGetAuthEnterpriseInfo,
  memberUserAuditIdCard,
dcy's avatar
dcy committed
107
  setUserUpdateStatus, userCreateAuditEnterprise, getWaitApprovePage
dcy's avatar
dcy committed
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
} from "@/api/member/user";
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import FileUpload  from "@/components/FileUpload"
import ImageUpload from "@/components/ImageUpload";
import uploadImage from "@/components/UploadImage";
import {CommonStatusEnum} from "@/utils/constants";

export default {
  name: "underReview",
  components: {
    FileUpload,
    ImageUpload,uploadImage
  },
  data() {
    return {
      totalLog:0,
      IdDetails:{},
      enterpriseFrom:{},
      guaranteeUrl:undefined,
      DICT_TYPE,
      getDictDatas,
      // audit_status
      activeName:"1",
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
        isDeal:undefined,//	是否成交
        searchKey:undefined,//关键字
        auditStatus:1,//审核状态
dcy's avatar
dcy committed
152
        authType:2,//关键字
dcy's avatar
dcy committed
153 154 155 156 157
      },
      // 表单参数
      form: {},
      // 表单校验
      rulesId: {
dcy's avatar
dcy committed
158 159 160 161 162
        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'] }],
dcy's avatar
dcy committed
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
      },
      publicObj:undefined,
      operationLogShow:false,
      guaranteeShow:false,
      operationLogFrom:{
        page:1,
        row:10,
        userId:undefined
      },
      operationLogList:[],
      attestationShow:false
    };
  },
  created() {
    this.resetId();
    this.resetEnterprise()
    this.getList();
  },
  methods: {
    deleteFn(row){
dcy's avatar
dcy committed
183
      this.$modal.confirm(`${this.$t('是否要删除昵称为')}${row.nickname}${this.$t('的会员')}`).then(function (){
dcy's avatar
dcy committed
184 185
        return deleteUser(row.id)
      }).then( res => {
dcy's avatar
dcy committed
186
        if(res.code === 0) this.getList(); this.$message.success(this.$t('删除成功'))
dcy's avatar
dcy committed
187
      }).catch(() =>{
dcy's avatar
dcy committed
188
          this.$message.success(this.$t('删除失败'))
dcy's avatar
dcy committed
189 190 191 192 193 194
        }

      )
    },
    //导出
    exportFn(){
dcy's avatar
dcy committed
195
      this.$modal.confirm(this.$t('是否确认导出所有用户数据项?')).then(() => {
dcy's avatar
dcy committed
196 197 198
        this.exportLoading = true;
        return exportUserExcel(this.queryParams);
      }).then(response => {
dcy's avatar
dcy committed
199
        this.$download.excel(response, `${this.$t('待审核会员')}.xls`);
dcy's avatar
dcy committed
200 201 202 203 204
        this.exportLoading = false;
      }).catch(() => {});
    },
    // 用户状态修改
    handleStatusChange(row) {
dcy's avatar
dcy committed
205 206
      let text = row.status === CommonStatusEnum.ENABLE ? this.$t('启用') : this.$t('停用');
      this.$modal.confirm(this.$t('确认要"') + text + '""' + row.nickname + this.$t('"用户吗?')).then(function() {
dcy's avatar
dcy committed
207 208
        return setUserUpdateStatus({id:row.id,status:row.status})
      }).then(() => {
dcy's avatar
dcy committed
209
        this.$modal.msgSuccess(text + this.$t('成功'));
dcy's avatar
dcy committed
210 211 212 213 214 215 216 217 218 219 220
      }).catch(function() {
        row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
          : CommonStatusEnum.ENABLE;
      });
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
      // 执行查询
dcy's avatar
dcy committed
221
      getWaitApprovePage(params).then(response => {
dcy's avatar
dcy committed
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
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 表单重置 */
    resetId(){
      this.IdDetails = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        cardType: 0,
        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
      }
    },//清空企业
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
dcy's avatar
dcy committed
266 267 268 269 270 271
      this.queryParams = {
        page: 1,
        rows: 10,
        isDeal:undefined,//	是否成交
        searchKey:undefined,//关键字
        auditStatus:1,//审核状态
dcy's avatar
dcy committed
272
        authType:2,//关键字
dcy's avatar
dcy committed
273
      }
dcy's avatar
dcy committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
      this.handleQuery();
    },

    getOperationLogList(){
      operationLogApi(this.operationLogFrom).then(r=>{
        if(r.code === 0){
          this.operationLogList = r.data.list
          this.totalLog = r.data.total
        }
      })
    },
    setGuarantee(){
      seTupdateBackletter({userId:this.publicObj.id,backLetter:this.guaranteeUrl}).then(r=>{
        if(r.code === 0){
          this.publicObj.backLetterImg = this.guaranteeUrl;
          this.guaranteeShow = false;
dcy's avatar
dcy committed
290
          this.$message.success(this.$t('保存成功'));
dcy's avatar
dcy committed
291 292 293 294 295 296 297
        }
      })
    },
    identityFn(row,val){
      this.attestationShow = true;
      this.activeName = val;
      this.publicObj = row;
dcy's avatar
dcy committed
298
      this.getIdentityDetails();
dcy's avatar
dcy committed
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
    },
    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
      }
      if(val === 2){
        p.auditRemark = undefined
      }
      memberUserAuditIdCard(p).then(r => {
        if(r.code === 0){
dcy's avatar
dcy committed
328
          this.$message.success(this.$t('修改成功'));
dcy's avatar
dcy committed
329
          this.getList()
dcy's avatar
dcy committed
330 331
          this.attestationShow = false;

dcy's avatar
dcy committed
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
        }
      })
    },
    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 => {
        console.log(r);
        if(r.code === 0){
dcy's avatar
dcy committed
348
          this.$message.success(this.$t('添加成功!'));
dcy's avatar
dcy committed
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
          this.enterpriseFrom.status = 2
          this.enterpriseFrom.auditTime = new Date().getTime()
          this.getEnterpriseFn();
        }
      })
    }
  },
  watch:{
    attestationShow(newVal){
      if(!newVal){
        this.resetId();
        this.resetEnterprise()
        this.publicObj = undefined;
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.details{
  .el-input {
    width: 300px;
  }
  .el-textarea{
    width: 300px;
  }
}
</style>