indirectCustomer.vue 7.84 KB
Newer Older
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">
      <el-form-item :label="$t('客户名称')" prop="name">
Marcus's avatar
Marcus committed
7
        <el-input v-model="queryParams.name" :placeholder="$t('请输入客户名称')" clearable @keyup.enter.native="handleQuery"/>
8 9 10 11 12 13 14 15 16 17 18 19 20
      </el-form-item>
      <el-form-item :label="$t('联系方式')">
        <el-input :placeholder="$t('请输入联系方式')" v-model="queryParams.defaultContactPhone"></el-input>
      </el-form-item>
      <el-form-item :label="$t('客户经理')" prop="customerService">
        <el-select clearable  v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" clearable size="small">
          <el-option v-for="dict in customerServiceList"
                     :key="dict.id" :label="dict.nickname" :value="dict.id"/>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('客户来源')" prop="source">
        <el-select clearable  v-model="queryParams.source" :placeholder="$t('请选择客户来源')" clearable size="small">
          <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_SOURCE)"
21
                       :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value"/>
22 23 24
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('创建时间')">
25 26
        <el-date-picker clearable  v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="datetimerange"  range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
27
      </el-form-item>
28
      <el-form-item>
29 30
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
31 32
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
                                                                                                   v-hasPermi="['ecw:customer:export']">{{$t('导出')}}</el-button>
33 34 35 36 37 38 39 40 41
      </el-form-item>
    </el-form>

    <!-- 列表 -->
    <el-table ref="multipleTable" v-loading="loading" :data="list"   @selection-change="handleSelectionChange">
      <el-table-column
        type="selection"
        width="55">
      </el-table-column>
42 43 44 45 46 47 48
      <el-table-column :label="$t('客户名称')" align="center" prop="name" >
        <template v-slot="scope">
        <router-link :to="{path: '/customer/indirectInfo',query: {id: scope.row.id}}" class="link-type">
          <span>{{ scope.row.name }}</span>
        </router-link>
        </template>
      </el-table-column>
49 50 51 52 53 54 55
      <el-table-column :label="$t('联系方式')" prop="defaultContactPhone">
        <template v-slot="{row}">
          +{{row.defaultContactPhone}}
        </template>
      </el-table-column>
       <el-table-column :label="$t('客户来源')" align="center" prop="sourse">
         <template v-slot="{row}">
56 57
           <span>{{row.agentCustomerName}}</span>
             <!-- <dict-tag :value="row.resourceType" :type="DICT_TYPE.CUSTOMER_SOURCE" /> -->
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
           </template>
         </el-table-column>
       <el-table-column :label="$t('资源类型')" align="center" prop="resourceType">
         <template v-slot="{row}">
             <dict-tag :value="row.resourceType" :type="DICT_TYPE.CUSTOMER_ESOURCE_TYPE" />
           </template>
         </el-table-column>
       <el-table-column :label="$t('客户类别')" align="center" prop="sourse">
        <template v-slot="{row}">
           <dict-tag :value="row.type" :type="DICT_TYPE.CUSTOMER_TYPE" />
         </template>
       </el-table-column>
      <el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('客户经理')" align="center" prop="customerService" :formatter="customerServiceFn">
      </el-table-column>
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-user" @click="delay(scope.row)">{{$t('完善')}}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

  </div>
</template>

<script>
91 92
import {updateCustomer, getCustomer,
  getCustomerPage, exportCustomerExcel } from "@/api/ecw/indirectCustomer";
93 94 95
import { getDictDatas, DICT_TYPE } from '@/utils/dict';

import {listServiceUser} from "@/api/system/user";
96 97
import {exportCustomerComplaintExcel} from "@/api/ecw/customerComplaint";
import {indirectCustomerExportExcel} from "@/api/ecw/customer";
98 99

export default {
100 101 102 103
  name: "EcwCustomerIndirectcustomer",
  activated() {
    this.getList()
    },
104 105
  data() {
    return {
106
      exportLoading:false,
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
      getDictDatas,
      DICT_TYPE,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        name: null,
        source: null,
        customerService: null,
      },
      // 网点
      nodeList: [],
      customerId:undefined,
      customerServiceList:[],
    };
  },
  created() {
    this.getList();
    listServiceUser().then(r=>{
      this.customerServiceList = r.data;
    })
  },
143 144 145 146 147
  computed:{
    isChinese(){
      return this.$i18n.locale === 'zh_CN'
    },
  },
148
  methods: {
149 150 151 152 153 154
    // 导出
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
155
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime', false);
156 157 158 159 160 161 162 163 164
      // 执行导出
      this.$modal.confirm(this.$t('是否确认导出间接客户数据项?')).then(() => {
        this.exportLoading = true;
        return indirectCustomerExportExcel(params);
      }).then(response => {
        this.$download.excel(response, '间接客户列表.xls');
        this.exportLoading = false;
      }).catch(() => {});
    },
165 166 167 168 169 170 171 172 173 174 175 176 177
    customerServiceFn(val){
      if(this.customerServiceList.length > 0){
        let index =this.customerServiceList.findIndex(item => item.id === val.customerService);
        return index !== -1  ? this.customerServiceList[index]?.nickname :''
      }else {
        return ''
      }
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
178
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime', false);
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
      // 执行查询
      getCustomerPage(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.queryParams = {
        pageNo: 1,
        pageSize: 10,
        name: null,
        source: null,
        customerService: null,
      }
      this.handleQuery();
    },

    delay(row){
      this.$router.push({path:'/customer/editIndirect',query:{id:row.id}})
    },
    handleSelectionChange(val){

    }
  }
};
</script>