index.vue 39.3 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
      <div class="search-z">
        <el-form-item :label="$t('客户编号')" prop="number">
          <el-input v-model.trim="queryParams.number" :placeholder="$t('请输入客户编号')" clearable @keyup.enter.native="handleQuery" @input="queryParams.number = queryParams.number.replace(/\s+/g, '')" />
        </el-form-item>
        <el-form-item :label="$t('客户名称')" prop="name">
          <el-input v-model.trim="queryParams.name" :placeholder="$t('请输入客户名称')" clearable @keyup.enter.native="handleQuery" @input="queryParams.name = queryParams.name.replace(/\s+/g, '')" />
        </el-form-item>
        <el-form-item :label="$t('区号')">
          <el-select v-model="queryParams.areaCode" :placeholder="$t('请选择区号')">
            <el-option v-for="(item, index) in countryList" :key="index" :label="item.nameShort + (isChinese ? item.nameZh : item.nameEn) + ' +' + item.tel" :value="item.tel" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('联系方式')">
          <el-input :placeholder="$t('请输入联系方式')" clearable v-model.trim="queryParams.defaultContactPhone" @input="queryParams.defaultContactPhone = queryParams.defaultContactPhone.replace(/\s+/g, '')"></el-input>
        </el-form-item>
zs嵩's avatar
zs嵩 committed
20 21 22 23 24 25 26 27 28 29
        <!--        <el-form-item :label="$t('部门')" v-if="path != '/customer/department-customers'">-->
        <!--          <el-select v-model="queryParams.deptIds" :placeholder="$t('请选择部门')">-->
        <!--            <el-option v-for="item in deptList" :key="item.id" :label="item.name" :value="item.id" />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <!--        <el-form-item :label="$t('客户经理')" prop="customerService">-->
        <!--          <el-select multiple clearable v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" size="small" @change="handleQuery">-->
        <!--            <el-option v-for="dict in customerServiceList" :key="dict.id" :label="dict.nickname" :value="dict.id" />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
        <el-form-item :label="$t('客户来源')" prop="source">
          <el-select multiple clearable v-model="queryParams.source" :placeholder="$t('请选择客户来源')" size="small" @change="handleQuery">
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_SOURCE)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('客户类别')" prop="level">
          <dict-selector multiple clearable :type="DICT_TYPE.CUSTOMER_TYPE" v-model="queryParams.type" @change="handleQuery"></dict-selector>
        </el-form-item>
        <el-form-item :label="$t('角色')">
          <dict-selector multiple clearable :type="DICT_TYPE.CUSTOMER_ROLE" v-model="queryParams.role" formatter="number" @change="handleQuery" :placeholder="$t('请选择')"></dict-selector>
        </el-form-item>
        <el-form-item :label="$t('客户状态')" prop="status">
          <el-select multiple clearable v-model="queryParams.status" :placeholder="$t('请选择客户状态')" size="small" @change="handleQuery">
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_STATUS)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('国籍')" prop="country">
          <el-select multiple clearable v-model="queryParams.country" :placeholder="$t('请选择')" @change="handleQuery">
            <el-option v-for="dict in countryList" :key="dict.id" :label="isChinese ? dict.nameZh : dict.nameEn" :value="parseInt(dict.id)" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('出货渠道')">
          <dict-selector multiple clearable :type="DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" @change="handleQuery"></dict-selector>
        </el-form-item>
yujinyao's avatar
yujinyao committed
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
        <el-form-item :label="$t('业务国家')" v-show="showSearch">
          <el-select multiple clearable v-model="queryParams.busiCountryIds" :placeholder="$t('请选择')" @change="handleQuery">
            <el-option v-for="dict in countryList" :key="dict.id" :label="isChinese ? dict.nameZh : dict.nameEn" :value="parseInt(dict.id)" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('常用提货网点')" v-show="showSearch">
          <el-select multiple v-model="queryParams.pickupPoints">
            <el-option v-for="item in getNodeLists" :key="item.id" :value="item.id" :label="isChinese ? item.titleZh : item.titleEn"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('创建人')" v-show="showSearch">
          <el-select v-model="queryParams.founder">
            <el-option v-for="item in allSimplList" :key="item.id" :label="item.nickname" :value="item.id"> </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('业绩类型')" v-show="showSearch">
          <el-select clearable v-model="queryParams.isNew">
            <el-option :label="$t('新客户')" :value="true" />
            <el-option :label="$t('老客户')" :value="false" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('年度发货量')" v-show="showSearch">
          <el-input v-model.trim="weightYearly.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" @input="weightYearly.value = weightYearly.value.replace(/\s+/g, '')">
            <template slot="prepend">
              <dict-selector :type="DICT_TYPE.CUSTOMER_QUERY_NUMBER_FIELD" defaultable v-model="weightYearly.key" />
            </template>
          </el-input>
        </el-form-item>
        <el-form-item :label="$t('商品类别')" v-show="showSearch">
          <el-select @change="handleSelectProductType" multiple v-model="queryParams.productTypes" :placeholder="$t('请选择')">
            <el-option :label="item.titleZh" :value="item.id" v-for="item in productTypeList" :key="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('商品名称')" v-show="showSearch">
          <el-select multiple filterable clearable v-model="queryParams.productIds" :placeholder="$t('请选择商品名称')">
            <el-option :label="item.titleZh" :value="parseInt(item.id)" v-for="item in productList" :key="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('主要竞争对手')" v-show="showSearch">
zs嵩's avatar
zs嵩 committed
94 95 96
          <el-select multiple filterable clearable v-model="queryParams.competitorIds" :placeholder="$t('请选择竞争对手')" size="small" @change="handleQuery">
            <el-option v-for="item in competitorList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
          </el-select>
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
        </el-form-item>
        <el-form-item :label="$t('年度发货次数')" v-show="showSearch">
          <el-input v-model.trim="numYearly.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" @input="numYearly.value = numYearly.value.replace(/\s+/g, '')">
            <template slot="prepend">
              <dict-selector :type="DICT_TYPE.CUSTOMER_QUERY_NUMBER_FIELD" defaultable v-model="numYearly.key" />
            </template>
          </el-input>
        </el-form-item>
        <el-form-item :label="$t('推介人')" v-show="showSearch">
          <el-select clearable remote :remote-method="remoteMethod" v-model="queryParams.promoter" :placeholder="$t('请输入推介人')" filterable>
            <el-option v-for="item in customerSelectFn" :key="item.id" :label="item.name" :value="item.id"> </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('获取方式')" v-show="showSearch">
          <el-select v-model="queryParams.getMethod" multiple :placeholder="$t('请选择')">
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_GET_METHOD)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('创建入口')" v-show="showSearch">
          <el-select v-model="queryParams.createFroms" multiple :placeholder="$t('请选择')">
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_FROM)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('结算方式')" v-show="showSearch">
          <el-select v-model="queryParams.balances" multiple :placeholder="$t('请选择结算方式')">
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_BALANCE)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('入仓确认')" v-show="showSearch">
          <el-select clearable v-model="queryParams.arrivalConfirm">
            <el-option :label="$t('是')" :value="1" />
            <el-option :label="$t('否')" :value="0" />
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('控货无收货人')" v-show="showSearch" label-width="100px">
          <div style="width: 194px">
            <el-switch v-model="queryParams.noConsignee" />
          </div>
        </el-form-item>
        <el-form-item :label="$t('默认付款')" v-show="showSearch" label-width="70px">
          <div style="width: 194px">
            <el-switch v-model="queryParams.defaultPay" />
          </div>
        </el-form-item>
        <el-form-item :label="$t('是否显示提单价格')" v-show="showSearch" label-width="130px">
          <div style="width: 194px">
            <el-switch v-model="queryParams.isShowTidanPrice" />
          </div>
        </el-form-item>
      </div>
      <div class="search-time">
        <el-form-item :label="$t('入公海时间')" v-show="showSearch">
          <el-date-picker type="datetimerange" clearable v-model="enterOpenSeaTime" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
        </el-form-item>
        <el-form-item :label="$t('归属时间')" v-show="showSearch">
          <el-date-picker type="datetimerange" clearable v-model="customerServiceConfirmedTime" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
        </el-form-item>
        <el-form-item :label="$t('首次成交时间')" v-show="showSearch">
          <el-date-picker type="datetimerange" clearable v-model="firstDealTime" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
        </el-form-item>

        <el-form-item :label="$t('创建时间')" v-show="showSearch">
          <el-date-picker type="datetimerange" clearable v-model="dateRangeCreateTime" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
        </el-form-item>
        <el-form-item style="padding-left: 20px">
          <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>
      </div>
lanbaoming's avatar
lanbaoming committed
166 167 168 169 170
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
332784038@qq.com's avatar
332784038@qq.com committed
171
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ecw:customer:my-create']">{{ $t("新增") }}</el-button>
lanbaoming's avatar
lanbaoming committed
172 173
      </el-col>
      <el-col :span="1.5">
332784038@qq.com's avatar
332784038@qq.com committed
174
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" v-hasPermi="['ecw:customer:my-export']">{{ $t("导出") }}</el-button>
lanbaoming's avatar
lanbaoming committed
175
      </el-col>
332784038@qq.com's avatar
332784038@qq.com committed
176
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
lanbaoming's avatar
lanbaoming committed
177 178 179
    </el-row>

    <!-- 列表 -->
332784038@qq.com's avatar
332784038@qq.com committed
180
    <el-table ref="multipleTable" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
yujinyao's avatar
yujinyao committed
181
      <el-table-column type="selection" width="55" fixed></el-table-column>
余金瑶's avatar
余金瑶 committed
182
      <el-table-column :label="$t('客户编号')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
183
        <template v-slot="{ row }">
余金瑶's avatar
余金瑶 committed
184 185 186
          <router-link :to="`/customer/query/${row.id}`" class="link-type">
            {{ row.number }}
          </router-link>
lanbaoming's avatar
lanbaoming committed
187 188
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
189
      <el-table-column :label="$t('客户名称')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
190 191 192 193
        <template v-slot="{ row }">
          <p style="display: inline-block; white-space: pre-wrap">
            {{ $l(row, "name") }}
          </p>
lanbaoming's avatar
lanbaoming committed
194 195
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
196
      <!--
lanbaoming's avatar
lanbaoming committed
197 198 199 200 201
      <el-table-column
        :label="$t('客户等级')"
        align="center"
        prop="vipLevelNameZh"
      >
lanbaoming's avatar
lanbaoming committed
202 203 204 205
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL" :value="scope.row.level" />
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
206 207 208 209
      <el-table-column
        :label="$t('信用等级')"
        :prop="isChinese ? 'creditLevelNameZh' : 'creditLevelNameEn'"
      ></el-table-column>
lanbaoming's avatar
lanbaoming committed
210 211
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
        <template slot-scope="scope">
lanbaoming's avatar
lanbaoming committed
212 213 214 215
          <dict-tag
            :type="DICT_TYPE.CUSTOMER_STATUS"
            :value="scope.row.status"
          />
lanbaoming's avatar
lanbaoming committed
216 217
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
218 219 220
      -->
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
221
          <dict-tag :type="DICT_TYPE.CUSTOMER_STATUS" :value="scope.row.status" />
余金瑶's avatar
余金瑶 committed
222 223
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
224
      <el-table-column :label="$t('主联系人')" prop="defaultContactName"></el-table-column>
zs嵩's avatar
zs嵩 committed
225 226 227 228 229 230 231 232
      <!--      <el-table-column :label="$t('主联系方式')" prop="defaultContactPhone">-->
      <!--        <template v-slot="{ row }">-->
      <!--          +{{ row.defaultContactPhone }} <br />-->
      <!--          <contacts :id="row.id">-->
      <!--            <el-button type="text">更多</el-button>-->
      <!--          </contacts>-->
      <!--        </template>-->
      <!--      </el-table-column>-->
233
      <el-table-column :label="$t('最新跟进时间')" width="120">
zs嵩's avatar
zs嵩 committed
234
        <template slot-scope="scope" v-if="scope.row.followupBackVO">
235 236 237 238
          {{ parseTime(scope.row.followupBackVO.followTime) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('最新跟进记录')" width="120">
zs嵩's avatar
zs嵩 committed
239
        <template slot-scope="scope" v-if="scope.row.followupBackVO">
240
          <a href="javascript:void(0)" @click="handleCustomerFollowLink(scope.row.followupBackVO)" class="link-type">{{ scope.row.followupBackVO.number }}</a>
lanbaoming's avatar
lanbaoming committed
241 242
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
243
      <el-table-column :label="$t('客户类别')" align="center" prop="status">
244
        <template slot-scope="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
245 246 247 248 249 250 251 252 253
          {{
            getDictDatas2(DICT_TYPE.CUSTOMER_TYPE, (row.type || "").split(","))
              .map((e) => (isChinese ? e.label : e.labelEn))
              .join(", ")
          }}
          <!--          <dict-tag-->
          <!--            :type="DICT_TYPE.CUSTOMER_TYPE"-->
          <!--            :value="scope.row.type"-->
          <!--          />-->
lanbaoming's avatar
lanbaoming committed
254 255
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
256
      <el-table-column :label="$t('角色')" align="center" prop="status">
zhengyi's avatar
zhengyi committed
257
        <template slot-scope="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
258 259 260 261 262 263 264 265 266
          {{
            getDictDatas2(DICT_TYPE.CUSTOMER_ROLE, (row.roles || "").split(","))
              .map((e) => (isChinese ? e.label : e.labelEn))
              .join(", ")
          }}
          <!--          <dict-tag-->
          <!--            :type="DICT_TYPE.CUSTOMER_ROLE"-->
          <!--            :value="scope.row.roles"-->
          <!--          />-->
余金瑶's avatar
余金瑶 committed
267 268 269 270 271 272 273 274 275 276 277
        </template>
      </el-table-column>
      <el-table-column :label="$t('客户经理')" align="center" prop="customerServiceName"></el-table-column>
      <el-table-column :label="$t('国籍')" align="center" prop="country" :formatter="countryFormatter"></el-table-column>
      <el-table-column :label="$t('出货渠道')" align="center">
        <template slot-scope="{ row }">
          {{ channel(row.transportType) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('客户来源')">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
278
          <dict-tag :type="DICT_TYPE.CUSTOMER_SOURCE" :value="scope.row.source" />
余金瑶's avatar
余金瑶 committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
        </template>
      </el-table-column>
      <el-table-column :label="$t('业务国家')">
        <template slot-scope="{ row }">
          {{ getBusiCountryNames(row.busiCountryIds) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('常用提货网点')">
        <template slot-scope="{ row }">
          {{ getPickupPointNames(row.pickupPoints) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('年度发货量')" align="center">
        <template slot-scope="{ row }">
          {{ row.weightYearly }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('主营类别')">
        <template slot-scope="{ row }">
298
          {{ getProductTypeNames(row.productTypes) }}
余金瑶's avatar
余金瑶 committed
299 300
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
301
      <el-table-column :label="$t('主要竞争对手')" prop="competitorNames"> </el-table-column>
余金瑶's avatar
余金瑶 committed
302 303 304 305 306 307 308 309 310 311 312
      <el-table-column :label="$t('年度发货次数')" align="center">
        <template slot-scope="{ row }">
          {{ row.numYearly }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('推介人')">
        <template slot-scope="{ row }">
          {{ getPromoterName(row.promoter) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('入公海时间')" align="center" width="160">
lanbaoming's avatar
lanbaoming committed
313
        <template v-slot="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
314
          {{ parseTime(row.enterOpenSeaTime ? row.enterOpenSeaTime : row.estimateEnterOpenSeaTime) }}
lanbaoming's avatar
lanbaoming committed
315 316
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
317 318
      <el-table-column :label="$t('入仓确认')" align="center">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
319 320
          <el-tag type="success" v-if="scope.row.arrivalConfirm == 1">{{ $t("") }}</el-tag>
          <el-tag type="info" v-else>{{ $t("") }}</el-tag>
余金瑶's avatar
余金瑶 committed
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
        </template>
      </el-table-column>
      <el-table-column :label="$t('控货无收货人')" align="center">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.noConsignee" disabled />
        </template>
      </el-table-column>
      <el-table-column :label="$t('默认付款')" align="center">
        <template slot-scope="scope">
          <el-switch v-model="scope.row.defaultPay" disabled />
        </template>
      </el-table-column>
      <el-table-column :label="$t('归属时间')" width="160" align="center">
        <template slot-scope="scope">
          {{ parseTime(scope.row.customerServiceConfirmedTime) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('首次成交时间')" width="160" align="center">
        <template slot-scope="scope">
          {{ parseTime(scope.row.firstDealTime) }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('获取方式')" align="center">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
345
          <dict-tag :type="DICT_TYPE.CUSTOMER_GET_METHOD" :value="scope.row.getMethod" />
余金瑶's avatar
余金瑶 committed
346 347
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
348
      <el-table-column :label="$t('创建人')" prop="createUsername" align="center"> </el-table-column>
余金瑶's avatar
余金瑶 committed
349 350 351 352 353 354 355
      <el-table-column :label="$t('创建时间')" align="center" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('最后更新时间')" align="center" width="160">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
356
          <span>{{ parseTime(scope.row.updateTime) }}</span>
余金瑶's avatar
余金瑶 committed
357
        </template>
lanbaoming's avatar
lanbaoming committed
358
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
359
      <el-table-column width="200px" :label="$t('操作')" align="center" fixed="right" class-name="small-padding fixed-width">
lanbaoming's avatar
lanbaoming committed
360
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
361 362 363 364 365 366
          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-hasPermi="['ecw:customer:my-query']">{{ $t("查看") }}</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ecw:customer:my-update']">{{ $t("修改") }}</el-button>
          <el-button size="mini" v-has-permi="['ecw:customer:my-follow-up']" type="text" icon="el-icon-collection" @click="followUp(scope.row)">{{ $t("跟进") }}</el-button>
          <el-button size="mini" type="text" icon="el-icon-user" v-hasPermi="['ecw:customer:my-customer-complaint']" @click="complaint(scope.row)">{{ $t("客诉") }}</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ecw:customer:my-delete']">{{ $t("删除") }}</el-button>
          <el-button v-has-permi="['ecw:customer:my-postpone']" :disabled="scope.row.isInOpenSea" size="mini" type="text" icon="el-icon-user" @click="delay(scope.row)">{{ $t("延期") }}</el-button>
lanbaoming's avatar
lanbaoming committed
367
          <!--lanbm 2024-05-26 添加的报价功能按钮,取消了权限控制-->
332784038@qq.com's avatar
332784038@qq.com committed
368 369
          <el-button size="mini" type="text" icon="el-icon-user" @click="quote(scope.row)">{{ $t("报价") }}</el-button>
          <el-button v-has-permi="['ecw:customer:setting']" size="mini" type="text" icon="el-icon-user" @click="handleSetting(scope.row)">{{ $t("设置") }}</el-button>
lanbaoming's avatar
lanbaoming committed
370 371 372 373
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
332784038@qq.com's avatar
332784038@qq.com committed
374 375
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" />
    <customer-follow-list :customer-id="customerId" :id="customerId" :customer-service="customerService" :customer-number="customerNumber" ref="CustomerFollowList" v-if="customerFollowVisible"></customer-follow-list>
zs嵩's avatar
zs嵩 committed
376
    <customer-follow ref="customerFollow" @close="customerFollowVisible = false" @refresh="handleQuery" v-if="customerFollowVisible" />
332784038@qq.com's avatar
332784038@qq.com committed
377 378 379
    <customer-complaints ref="customerComplaint" :customer-id.sync="customerId"></customer-complaints>
    <transfer-customer :show.sync="show" :customer-ids.sync="selectCustomerList"></transfer-customer>
    <customer-setting ref="customerSetting" @refresh="getList"></customer-setting>
lanbaoming's avatar
lanbaoming committed
380 381 382 383
  </div>
</template>

<script>
332784038@qq.com's avatar
332784038@qq.com committed
384 385 386 387
import { createCustomer, updateCustomer, deleteCustomer, getMyCustomerService, mineExporteExcel, mineExportExcel, competitorListAll } from "@/api/ecw/customer"
import { getDictDatas, DICT_TYPE, getDictDatas2 } from "@/utils/dict"
import upload from "@/components/ImageUpload"
import customerFollowList from "../customer/components/customerFollow"
388
import customerFollow from "../customer/components/customerFollow"
332784038@qq.com's avatar
332784038@qq.com committed
389 390 391 392 393 394 395 396 397 398 399 400 401
import customerComplaints from "@/components/customerComplaints"
import { listServiceUser, getUserProfile, listAllSimpl } from "@/api/system/user"
import { getCountryListAll } from "@/api/ecw/country"
import { getCreditPage } from "@/api/customer/credit"
import transferCustomer from "@/views/ecw/customer/transferCustomer"
import Template from "@/views/cms/template/index.vue"
import Contacts from "@/views/ecw/customer/components/contacts.vue"
import CustomerSetting from "../customer/components/customerSetting.vue"
import AreaCodeSelector from "@/components/AreaCodeSelector/index.vue"
import { getNodeList } from "@/api/ecw/node"
import { getCustomerSelect, changeCustomerDefaultPay, changeCustomerNoConsignee, changeCustomerDefaultBilling } from "@/api/ecw/customer"
import { getProductTypeList } from "@/api/ecw/productType"
import { getProductList } from "@/api/ecw/product"
zs嵩's avatar
zs嵩 committed
402
import CompetitorSelector from "@/components/CompetitorSelector/index.vue"
lanbaoming's avatar
lanbaoming committed
403
export default {
404
  name: "EcwMyCustomerServiceIndex",
lanbaoming's avatar
lanbaoming committed
405
  components: {
406
    CompetitorSelector,
lanbaoming's avatar
lanbaoming committed
407 408
    Contacts,
    Template,
lanbaoming's avatar
lanbaoming committed
409 410
    upload,
    customerFollowList,
411
    customerFollow,
lanbaoming's avatar
lanbaoming committed
412
    customerComplaints,
lanbaoming's avatar
lanbaoming committed
413
    transferCustomer,
yujinyao's avatar
yujinyao committed
414 415
    AreaCodeSelector,
    CustomerSetting
lanbaoming's avatar
lanbaoming committed
416
  },
lanbaoming's avatar
lanbaoming committed
417 418
  computed: {
    isChinese() {
332784038@qq.com's avatar
332784038@qq.com committed
419
      return this.$i18n.locale === "zh_CN"
lanbaoming's avatar
lanbaoming committed
420
    },
余金瑶's avatar
余金瑶 committed
421 422 423 424 425 426 427
    channel() {
      return (val) => {
        return !!val
          ? this.getDictDatas(this.DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE)
              .filter((i) => (val.split(",") || []).includes(i.value))
              .map((i) => (this.isChinese ? i.label : i.labelEn))
              .join("")
332784038@qq.com's avatar
332784038@qq.com committed
428 429
          : ""
      }
余金瑶's avatar
余金瑶 committed
430
    },
yujinyao's avatar
yujinyao committed
431 432
    customerSelectFn() {
      if (this.recommended.length > 0) {
332784038@qq.com's avatar
332784038@qq.com committed
433
        let i = this.customerSelect.find((item) => item.id === this.recommended[0].id)
yujinyao's avatar
yujinyao committed
434
        if (!i) {
332784038@qq.com's avatar
332784038@qq.com committed
435
          this.customerSelect.push(this.recommended[0])
yujinyao's avatar
yujinyao committed
436
        }
332784038@qq.com's avatar
332784038@qq.com committed
437
        return this.customerSelect
yujinyao's avatar
yujinyao committed
438
      } else {
332784038@qq.com's avatar
332784038@qq.com committed
439
        return this.customerSelect
yujinyao's avatar
yujinyao committed
440 441 442 443 444 445 446 447 448
      }
    },
    combinedQueryParams() {
      let queryParams = {}
      if (this.enterOpenSeaTime && this.enterOpenSeaTime.length == 2) {
        queryParams.beginEnterOpenSeaTime = this.enterOpenSeaTime[0]
        queryParams.endEnterOpenSeaTime = this.enterOpenSeaTime[1]
      }
      if (this.customerServiceConfirmedTime && this.customerServiceConfirmedTime.length == 2) {
yujinyao's avatar
yujinyao committed
449 450
        queryParams.beginCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[0]
        queryParams.endCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[1]
yujinyao's avatar
yujinyao committed
451 452 453 454 455 456 457 458 459 460
      }
      if (this.dateRangeCreateTime && this.dateRangeCreateTime.length == 2) {
        queryParams.beginCreateTime = this.dateRangeCreateTime[0]
        queryParams.endCreateTime = this.dateRangeCreateTime[1]
      }
      if (this.firstDealTime && this.firstDealTime.length == 2) {
        queryParams.beginFirstDealTime = this.firstDealTime[0]
        queryParams.endFirstDealTime = this.firstDealTime[1]
      }
      if (this.weightYearly.value) {
332784038@qq.com's avatar
332784038@qq.com committed
461 462 463 464 465
        let key = "eqWeightYearly"
        if (this.weightYearly.key == "leNumberKey") {
          key = "leWeightYearly"
        } else if (this.weightYearly.key == "geNumberKey") {
          key = "geWeightYearly"
yujinyao's avatar
yujinyao committed
466
        }
332784038@qq.com's avatar
332784038@qq.com committed
467
        queryParams[key] = this.weightYearly.value
yujinyao's avatar
yujinyao committed
468 469
      }
      if (this.numYearly.value) {
332784038@qq.com's avatar
332784038@qq.com committed
470 471 472 473 474
        let key = "eqNumYearly"
        if (this.numYearly.key == "leNumberKey") {
          key = "leNumYearly"
        } else if (this.numYearly.key == "geNumberKey") {
          key = "geNumYearly"
yujinyao's avatar
yujinyao committed
475
        }
332784038@qq.com's avatar
332784038@qq.com committed
476
        queryParams[key] = this.numYearly.value
yujinyao's avatar
yujinyao committed
477 478
      }

332784038@qq.com's avatar
332784038@qq.com committed
479 480
      return queryParams
    }
lanbaoming's avatar
lanbaoming committed
481 482 483
  },
  data() {
    return {
484
      customerFollowVisible: false,
lanbaoming's avatar
lanbaoming committed
485 486 487 488
      show: false,
      creditList: [],
      countryList: [],
      customerServiceList: [],
lanbaoming's avatar
lanbaoming committed
489
      getDictDatas,
zhengyi's avatar
zhengyi committed
490
      getDictDatas2,
lanbaoming's avatar
lanbaoming committed
491 492 493 494 495 496
      DICT_TYPE,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
497
      showSearch: false,
lanbaoming's avatar
lanbaoming committed
498 499 500 501 502 503 504 505 506 507 508 509
      // 总条数
      total: 0,
      // 客户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
332784038@qq.com's avatar
332784038@qq.com committed
510
        pageSize: 10
yujinyao's avatar
yujinyao committed
511
        /*number: null,
lanbaoming's avatar
lanbaoming committed
512 513 514 515 516 517
        name: null,
        level: null,
        source: null,
        customerService: null,
        status: null,
        department: null,
lanbaoming's avatar
lanbaoming committed
518 519
        creditLevel: null,
        country: null,
lanbaoming's avatar
lanbaoming committed
520
        marketType: null,
521 522 523
        memberCode: null,
        memberName: null,
        memberMobile: null,
yujinyao's avatar
yujinyao committed
524
        memberAreaCode: null*/
lanbaoming's avatar
lanbaoming committed
525 526 527 528 529
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
lanbaoming's avatar
lanbaoming committed
530 531 532 533
        name: [
          {
            required: true,
            message: this.$t("客户名称不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
534 535
            trigger: "blur"
          }
lanbaoming's avatar
lanbaoming committed
536
        ],
332784038@qq.com's avatar
332784038@qq.com committed
537
        country: [{ required: true, message: this.$t("国家不能为空"), trigger: "blur" }],
lanbaoming's avatar
lanbaoming committed
538 539 540 541
        level: [
          {
            required: true,
            message: this.$t("客户等级不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
542 543
            trigger: "blur"
          }
lanbaoming's avatar
lanbaoming committed
544 545 546 547 548
        ],
        type: [
          {
            required: true,
            message: this.$t("客户类别不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
549 550
            trigger: "blur"
          }
lanbaoming's avatar
lanbaoming committed
551
        ],
lanbaoming's avatar
lanbaoming committed
552
        // createTime: [{ required: true, message: this.$t("创建时间不能为空"), trigger: "blur" }],
lanbaoming's avatar
lanbaoming committed
553 554 555 556
        source: [
          {
            required: true,
            message: this.$t("客户来源不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
557 558
            trigger: "blur"
          }
lanbaoming's avatar
lanbaoming committed
559 560 561 562 563
        ],
        status: [
          {
            required: true,
            message: this.$t("客户状态不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
564 565
            trigger: "blur"
          }
lanbaoming's avatar
lanbaoming committed
566 567 568 569 570
        ],
        founder: [
          {
            required: true,
            message: this.$t("创建人不能为空"),
332784038@qq.com's avatar
332784038@qq.com committed
571 572 573
            trigger: "blur"
          }
        ]
lanbaoming's avatar
lanbaoming committed
574 575 576 577
      },
      // 网点
      nodeList: [],
      showLine: false,
lanbaoming's avatar
lanbaoming committed
578 579 580
      customerId: undefined,
      selectCustomerList: [],
      //lanbm 2024-05-26 添加参数
332784038@qq.com's avatar
332784038@qq.com committed
581
      userId: undefined,
582
      customerService: undefined,
583
      customerNumber: undefined,
yujinyao's avatar
yujinyao committed
584 585 586 587 588 589 590 591 592
      enterOpenSeaTime: [],
      customerServiceConfirmedTime: [],
      firstDealTime: [],
      customerSelect: [],
      recommended: [],
      getNodeLists: [],
      allSimplList: [],
      weightYearly: {
        key: "eqNumberKey",
332784038@qq.com's avatar
332784038@qq.com committed
593
        value: ""
yujinyao's avatar
yujinyao committed
594 595 596
      },
      numYearly: {
        key: "eqNumberKey",
332784038@qq.com's avatar
332784038@qq.com committed
597
        value: ""
yujinyao's avatar
yujinyao committed
598 599 600 601
      },
      productTypeList: [],
      productList: [],
      competitorList: [],
332784038@qq.com's avatar
332784038@qq.com committed
602 603
      deptList: []
    }
lanbaoming's avatar
lanbaoming committed
604
  },
lanbaoming's avatar
lanbaoming committed
605
  activated() {
332784038@qq.com's avatar
332784038@qq.com committed
606
    this.getList()
lanbaoming's avatar
lanbaoming committed
607 608
  },
  created() {
332784038@qq.com's avatar
332784038@qq.com committed
609
    this.getList()
lanbaoming's avatar
lanbaoming committed
610 611 612
    // getNodeList().then(r => {
    //   this.nodeList = r.data
    // })
lanbaoming's avatar
lanbaoming committed
613
    getCreditPage({ page: 1, rows: 999 }).then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
614 615
      this.creditList = r.data.list
    })
lanbaoming's avatar
lanbaoming committed
616
    listServiceUser().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
617 618
      this.customerServiceList = r.data
    })
lanbaoming's avatar
lanbaoming committed
619
    getCountryListAll().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
620 621
      this.countryList = r.data
    })
lanbaoming's avatar
lanbaoming committed
622 623 624

    //获取用户id信息 lanbm 2024-05-23 add
    getUserProfile().then((res) => {
332784038@qq.com's avatar
332784038@qq.com committed
625 626 627
      this.userId = res.data.id
    })
    this.getCustomerSelect()
yujinyao's avatar
yujinyao committed
628
    getNodeList().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
629 630
      this.getNodeLists = r.data
    })
yujinyao's avatar
yujinyao committed
631
    listAllSimpl().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
632 633
      this.allSimplList = r.data
    })
yujinyao's avatar
yujinyao committed
634
    getProductTypeList().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
635 636
      this.productTypeList = r.data
    })
yujinyao's avatar
yujinyao committed
637
    competitorListAll().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
638
      this.competitorList = r.data
yujinyao's avatar
yujinyao committed
639
    })
lanbaoming's avatar
lanbaoming committed
640
  },
yujinyao's avatar
yujinyao committed
641 642 643 644 645
  updated() {
    this.$nextTick(() => {
      this.$refs.multipleTable.doLayout()
    })
  },
lanbaoming's avatar
lanbaoming committed
646
  methods: {
lanbaoming's avatar
lanbaoming committed
647
    handleSelectionChange(val) {
332784038@qq.com's avatar
332784038@qq.com committed
648
      this.selectCustomerList = val.map((i) => i.id)
lanbaoming's avatar
lanbaoming committed
649
    },
lanbaoming's avatar
lanbaoming committed
650
    delay(row) {
332784038@qq.com's avatar
332784038@qq.com committed
651
      this.$router.push({ path: "/customer/delay", query: { id: row.id } })
lanbaoming's avatar
lanbaoming committed
652 653
    },
    countryFormatter(row, column, cellValue) {
332784038@qq.com's avatar
332784038@qq.com committed
654 655
      const country = this.countryList.find((e) => e.id === cellValue)
      return this.isChinese ? country?.nameZh : country?.nameEn
lanbaoming's avatar
lanbaoming committed
656 657 658
    },
    /** 查询列表 */
    getList() {
332784038@qq.com's avatar
332784038@qq.com committed
659
      this.loading = true
lanbaoming's avatar
lanbaoming committed
660
      // 处理查询参数
332784038@qq.com's avatar
332784038@qq.com committed
661 662
      let params = { ...this.queryParams, ...this.combinedQueryParams }
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime", false)
lanbaoming's avatar
lanbaoming committed
663
      // 执行查询
lanbaoming's avatar
lanbaoming committed
664
      getMyCustomerService(params).then((response) => {
332784038@qq.com's avatar
332784038@qq.com committed
665 666 667 668
        this.list = response.data.list
        this.total = response.data.total
        this.loading = false
      })
lanbaoming's avatar
lanbaoming committed
669
    },
yujinyao's avatar
yujinyao committed
670
    remoteMethod(val) {
332784038@qq.com's avatar
332784038@qq.com committed
671
      this.getCustomerSelect(val)
yujinyao's avatar
yujinyao committed
672 673
    },
    getCustomerSelect(val = "") {
332784038@qq.com's avatar
332784038@qq.com committed
674 675 676
      getCustomerSelect({ pageNo: 1, pageSize: 30, searchKey: val }).then((res) => {
        this.customerSelect = res.data.list
      })
yujinyao's avatar
yujinyao committed
677 678
    },
    handleSelectProductType(val) {
yujinyao's avatar
yujinyao committed
679 680 681 682
      if (val && val.length >= 1) {
        this.queryParams.productIds = []
        getProductList({ typeIds: val }).then((r) => {
          this.productList = r.data
332784038@qq.com's avatar
332784038@qq.com committed
683
        })
yujinyao's avatar
yujinyao committed
684 685 686 687
      } else {
        this.queryParams.productIds = []
        this.productList = []
      }
yujinyao's avatar
yujinyao committed
688
    },
689 690 691 692 693 694
    handleCustomerFollowLink(row) {
      this.customerFollowVisible = true
      this.$nextTick((_) => {
        this.$refs["customerFollow"].handleView(row)
      })
    },
lanbaoming's avatar
lanbaoming committed
695 696
    /** 取消按钮 */
    cancel() {
332784038@qq.com's avatar
332784038@qq.com committed
697 698
      this.open = false
      this.reset()
lanbaoming's avatar
lanbaoming committed
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
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        number: undefined,
        name: undefined,
        level: undefined,
        country: undefined,
        type: undefined,
        agentId: undefined,
        company: undefined,
        address: undefined,
        productType: undefined,
        productId: undefined,
        pickupPoint: undefined,
        memberId: undefined,
        birthday: undefined,
        balance: undefined,
        source: undefined,
        picture: undefined,
        customerService: undefined,
        customerContacts: [],
        customerLines: [],
        promoter: undefined,
        status: undefined,
        founder: undefined,
        department: undefined,
        invoiceTitle: undefined,
        licenseNumber: undefined,
        bank: undefined,
        bankNumber: undefined,
        project: undefined,
        billingAddress: undefined,
        billingTell: undefined,
        taxRate: undefined,
        remarks: undefined,
        arrivalConfirm: undefined,
332784038@qq.com's avatar
332784038@qq.com committed
737 738 739
        weightUnit: undefined
      }
      this.resetForm("form")
lanbaoming's avatar
lanbaoming committed
740 741 742
    },
    /** 搜索按钮操作 */
    handleQuery() {
332784038@qq.com's avatar
332784038@qq.com committed
743 744
      this.queryParams.pageNo = 1
      this.getList()
lanbaoming's avatar
lanbaoming committed
745 746 747
    },
    /** 重置按钮操作 */
    resetQuery() {
332784038@qq.com's avatar
332784038@qq.com committed
748
      this.dateRangeCreateTime = []
yujinyao's avatar
yujinyao committed
749 750 751
      this.enterOpenSeaTime = []
      this.customerServiceConfirmedTime = []
      this.firstDealTime = []
332784038@qq.com's avatar
332784038@qq.com committed
752
      this.resetForm("queryForm")
lanbaoming's avatar
lanbaoming committed
753 754
      this.queryParams = {
        pageNo: 1,
332784038@qq.com's avatar
332784038@qq.com committed
755 756 757 758 759
        pageSize: 10
      }
      this.weightYearly.value = ""
      this.numYearly.value = ""
      this.handleQuery()
lanbaoming's avatar
lanbaoming committed
760 761 762
    },
    /** 新增按钮操作 */
    handleAdd() {
lanbaoming's avatar
lanbaoming committed
763 764
      this.$router.push({
        path: "/customer/add-edit/0",
332784038@qq.com's avatar
332784038@qq.com committed
765 766
        query: { isCustomerServiceConfirmed: true }
      })
lanbaoming's avatar
lanbaoming committed
767 768 769 770 771 772
      // this.reset();
      // this.open = true;
      // this.title = this.$t("添加客户");
    },
    /** 查看按钮操作 */
    handleView(row) {
332784038@qq.com's avatar
332784038@qq.com committed
773
      this.$router.push("/customer/query/" + row.id)
lanbaoming's avatar
lanbaoming committed
774 775 776
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
332784038@qq.com's avatar
332784038@qq.com committed
777
      this.$router.push("/customer/add-edit/" + row.id)
lanbaoming's avatar
lanbaoming committed
778 779 780 781 782 783 784 785
      // this.reset();
      // const id = row.id;
      // getCustomer(id).then(response => {
      //   this.form = { ...this.form, ...response.data };
      //   this.open = true;
      //   this.title = this.$t("修改客户");
      // });
    },
lanbaoming's avatar
lanbaoming committed
786 787 788 789 790
    //报价
    quote(row) {
      //lanbm 2024-05-26 添加的报价功能按钮
      // 添加报价是判断客户所属客户经理,不是就不能报价
      if (row.customerService != this.userId) {
332784038@qq.com's avatar
332784038@qq.com committed
791 792
        this.$message.error(this.$t("此客户属于其他客户经理名下的客户。"))
        return
lanbaoming's avatar
lanbaoming committed
793 794
      }
      //this.$router.push({path:'/offer/create',query:{id:row.id}})
332784038@qq.com's avatar
332784038@qq.com committed
795 796 797 798

      this.$router.push({ path: "/offer/create", query: { customerId: row.id, customerType: row.type, type: 1 } }).then({
        //this.$refs.push({path:'/customer-contacts/select',query:{pageNo:1,pageSize:10,searchKey:row.defaultContactPhone}})
      })
lanbaoming's avatar
lanbaoming committed
799 800 801
    },
    selectAuthorityFn() {
      return (val) => {
332784038@qq.com's avatar
332784038@qq.com committed
802 803
        let t = val.split(":")
        t[t.length - 1] = this.authorityFn + t[t.length - 1]
lanbaoming's avatar
lanbaoming committed
804
        //console.log(t.join(":"));
332784038@qq.com's avatar
332784038@qq.com committed
805 806
        return t.join(":")
      }
lanbaoming's avatar
lanbaoming committed
807
    },
lanbaoming's avatar
lanbaoming committed
808 809
    /** 提交按钮 */
    submitForm() {
lanbaoming's avatar
lanbaoming committed
810
      this.$refs["form"].validate((valid) => {
lanbaoming's avatar
lanbaoming committed
811 812 813 814 815
        if (!valid) {
          // return;
        }
        // 修改的提交
        if (this.form.id != null) {
lanbaoming's avatar
lanbaoming committed
816
          updateCustomer(this.form).then((response) => {
332784038@qq.com's avatar
332784038@qq.com committed
817 818 819 820 821
            this.$modal.msgSuccess(this.$t("修改成功"))
            this.open = false
            this.getList()
          })
          return
lanbaoming's avatar
lanbaoming committed
822 823
        }
        // 添加的提交
lanbaoming's avatar
lanbaoming committed
824
        createCustomer(this.form).then((response) => {
332784038@qq.com's avatar
332784038@qq.com committed
825 826 827 828 829
          this.$modal.msgSuccess(this.$t("新增成功"))
          this.open = false
          this.getList()
        })
      })
lanbaoming's avatar
lanbaoming committed
830 831 832
    },
    /** 删除按钮操作 */
    handleDelete(row) {
332784038@qq.com's avatar
332784038@qq.com committed
833
      const id = row.id
lanbaoming's avatar
lanbaoming committed
834
      this.$modal
332784038@qq.com's avatar
332784038@qq.com committed
835
        .confirm(this.$t('是否确认删除客户编号为"') + row.number + this.$t('"的数据项?'))
lanbaoming's avatar
lanbaoming committed
836
        .then(function () {
332784038@qq.com's avatar
332784038@qq.com committed
837
          return deleteCustomer(id)
lanbaoming's avatar
lanbaoming committed
838 839
        })
        .then(() => {
332784038@qq.com's avatar
332784038@qq.com committed
840 841
          this.getList()
          this.$modal.msgSuccess(this.$t("删除成功"))
lanbaoming's avatar
lanbaoming committed
842
        })
332784038@qq.com's avatar
332784038@qq.com committed
843
        .catch(() => {})
lanbaoming's avatar
lanbaoming committed
844 845 846 847 848 849 850 851 852
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      // let params = {...this.queryParams};
      // params.pageNo = undefined;
      // params.pageSize = undefined;
      // this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // // 执行导出
lanbaoming's avatar
lanbaoming committed
853 854 855 856
      this.$modal
        .confirm(this.$t("是否确认导出我的客户数据项?"))
        .then(() => {
          mineExportExcel().then(() => {
332784038@qq.com's avatar
332784038@qq.com committed
857 858
            this.$message.success(this.$t("已加入导出队列,请稍后在下载日志中下载"))
          })
lanbaoming's avatar
lanbaoming committed
859
        })
332784038@qq.com's avatar
332784038@qq.com committed
860
        .catch(() => {})
lanbaoming's avatar
lanbaoming committed
861
    },
lanbaoming's avatar
lanbaoming committed
862
    followUp(row) {
863 864 865
      this.customerId = row.id
      this.customerService = row.customerService
      this.customerNumber = row.number
余金瑶's avatar
余金瑶 committed
866
      this.customerFollowVisible = true
332784038@qq.com's avatar
332784038@qq.com committed
867
      this.$nextTick((_) => {
868
        // this.$refs.CustomerFollowList.customerFollow.dialogVisible = true;
332784038@qq.com's avatar
332784038@qq.com committed
869 870
        this.$refs["CustomerFollowList"].init()
        this.$refs["CustomerFollowList"].handleAdd()
余金瑶's avatar
余金瑶 committed
871
      })
lanbaoming's avatar
lanbaoming committed
872
    },
lanbaoming's avatar
lanbaoming committed
873
    complaint(row) {
332784038@qq.com's avatar
332784038@qq.com committed
874
      this.customerId = row.id
lanbaoming's avatar
lanbaoming committed
875
      this.$nextTick(() => {
332784038@qq.com's avatar
332784038@qq.com committed
876 877
        this.$refs["customerComplaint"].handleAdd()
      })
lanbaoming's avatar
lanbaoming committed
878
    },
yujinyao's avatar
yujinyao committed
879
    handleSetting(row) {
332784038@qq.com's avatar
332784038@qq.com committed
880 881 882
      this.$refs["customerSetting"].dialogVisible = true
      this.$nextTick((_) => {
        this.$refs["customerSetting"].init(row.id)
883 884
      })
    },
余金瑶's avatar
余金瑶 committed
885 886
    getBusiCountryNames(ids) {
      if (ids) {
332784038@qq.com's avatar
332784038@qq.com committed
887
        const idsArr = ids.split(",")
余金瑶's avatar
余金瑶 committed
888
        const strArr = []
332784038@qq.com's avatar
332784038@qq.com committed
889
        this.countryList.forEach((item) => {
余金瑶's avatar
余金瑶 committed
890 891 892 893
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.nameZh : item.nameEn)
          }
        })
332784038@qq.com's avatar
332784038@qq.com committed
894
        return strArr.length > 0 ? strArr.join(",") : null
余金瑶's avatar
余金瑶 committed
895 896 897 898 899 900
      } else {
        return null
      }
    },
    getPickupPointNames(ids) {
      if (ids) {
332784038@qq.com's avatar
332784038@qq.com committed
901
        const idsArr = ids.split(",")
余金瑶's avatar
余金瑶 committed
902
        const strArr = []
332784038@qq.com's avatar
332784038@qq.com committed
903
        this.getNodeLists.forEach((item) => {
余金瑶's avatar
余金瑶 committed
904 905 906 907
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.titleZh : item.titleEn)
          }
        })
332784038@qq.com's avatar
332784038@qq.com committed
908
        return strArr.length > 0 ? strArr.join(",") : null
余金瑶's avatar
余金瑶 committed
909 910 911 912 913 914
      } else {
        return null
      }
    },
    getProductTypeNames(ids) {
      if (ids) {
332784038@qq.com's avatar
332784038@qq.com committed
915
        const idsArr = ids.toString().split(",")
余金瑶's avatar
余金瑶 committed
916
        const strArr = []
332784038@qq.com's avatar
332784038@qq.com committed
917
        this.productTypeList.forEach((item) => {
余金瑶's avatar
余金瑶 committed
918 919 920 921
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.titleZh : item.titleEn)
          }
        })
332784038@qq.com's avatar
332784038@qq.com committed
922
        return strArr.length > 0 ? strArr.join(",") : null
余金瑶's avatar
余金瑶 committed
923 924 925 926 927 928
      } else {
        return null
      }
    },
    getPromoterName(id) {
      if (id) {
332784038@qq.com's avatar
332784038@qq.com committed
929 930
        let strName = ""
        for (const item of this.customerSelectFn) {
余金瑶's avatar
余金瑶 committed
931 932 933 934 935 936 937 938 939 940
          if (item.id == id) {
            strName = item.name
            break
          }
        }
        return strName
      } else {
        return null
      }
    }
lanbaoming's avatar
lanbaoming committed
941
  },
lanbaoming's avatar
lanbaoming committed
942 943 944
  watch: {
    selectCustomerList(val) {
      if (val.length === 0) {
332784038@qq.com's avatar
332784038@qq.com committed
945 946
        this.getList()
        this.$refs.multipleTable.clearSelection()
lanbaoming's avatar
lanbaoming committed
947
      }
332784038@qq.com's avatar
332784038@qq.com committed
948 949 950
    }
  }
}
lanbaoming's avatar
lanbaoming committed
951
</script>