index.vue 41.2 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4

<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
5 6 7 8 9 10
    <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">
11
          <el-input v-model="queryParams.name" :placeholder="$t('请输入客户名称')" clearable @keyup.enter.native="handleQuery"  @blur="trimCustomerName"/>
12 13
        </el-form-item>
        <el-form-item :label="$t('区号')">
14
          <el-select filterable v-model="queryParams.areaCode" :placeholder="$t('请选择区号')">
15 16 17 18 19 20 21
            <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>
        <el-form-item :label="$t('部门')" v-if="path != '/customer/department-customers'">
22
          <el-select filterable v-model="queryParams.deptIds" :placeholder="$t('请选择部门')" clearable>
23 24 25 26
            <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">
27
          <el-select filterable multiple clearable v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" size="small" @change="handleQuery">
28 29 30 31
            <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">
32
          <el-select filterable multiple clearable v-model="queryParams.source" :placeholder="$t('请选择客户来源')" size="small" @change="handleQuery">
33 34 35 36
            <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">
37
          <dict-selector filterable multiple clearable :type="DICT_TYPE.CUSTOMER_TYPE" v-model="queryParams.type" @change="handleQuery"></dict-selector>
38 39
        </el-form-item>
        <el-form-item :label="$t('角色')">
40
          <dict-selector filterable multiple clearable :type="DICT_TYPE.CUSTOMER_ROLE" v-model="queryParams.role" formatter="number" @change="handleQuery" :placeholder="$t('请选择')"></dict-selector>
41 42
        </el-form-item>
        <el-form-item :label="$t('客户状态')" prop="status">
43
          <el-select filterable multiple clearable v-model="queryParams.status" :placeholder="$t('请选择客户状态')" size="small" @change="handleQuery">
44 45 46 47
            <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">
48
          <el-select filterable multiple clearable v-model="queryParams.country" :placeholder="$t('请选择')" @change="handleQuery">
49 50 51 52
            <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('出货渠道')">
53
          <dict-selector filterable multiple clearable :type="DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" @change="handleQuery"></dict-selector>
54
        </el-form-item>
yujinyao's avatar
yujinyao committed
55

56
        <el-form-item :label="$t('业务国家')" v-show="showSearch">
57
          <el-select filterable multiple clearable v-model="queryParams.busiCountryIds" :placeholder="$t('请选择')" @change="handleQuery">
58 59 60 61
            <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">
62
          <el-select filterable multiple v-model="queryParams.pickupPoints" :placeholder="$t('请选择提货网点')">
zhengyi's avatar
zhengyi committed
63
            <el-option v-for="dict in getDictDatas(DICT_TYPE.PICKUP_POINTS)" :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
zhengyi's avatar
zhengyi committed
64
          </el-select>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
        </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">
85
          <el-select filterable @change="handleSelectProductType" multiple v-model="queryParams.productTypes" :placeholder="$t('请选择')">
86 87 88 89 90 91 92 93 94
            <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">
95 96 97
          <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>
98 99 100 101 102 103 104 105 106 107 108 109 110 111
        </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">
112
          <el-select filterable v-model="queryParams.getMethod" multiple :placeholder="$t('请选择')">
113 114 115 116 117 118 119 120 121
            <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">
122
          <el-select filterable v-model="queryParams.balances" multiple :placeholder="$t('请选择结算方式')">
123 124 125 126 127 128 129 130 131
            <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>
132
        <el-form-item :label="$t('会员电话')" prop="department" label-width="100px" v-show="showSearch">
133 134 135 136 137 138
          <el-input :placeholder="$t('请输入会员电话')" class="w-200" clearable v-model.trim="queryParams.memberMobile" @input="queryParams.memberMobile = queryParams.memberMobile.replace(/\s+/g, '')">
            <template slot="prepend">
              <area-code-selector  v-model="queryParams.memberAreaCode" class="w-50"/>
            </template>
          </el-input>
        </el-form-item>
139
        <el-form-item :label="$t('会员编号')" prop="number" v-show="showSearch">
140 141 142 143 144 145 146
          <el-input
            v-model.trim="queryParams.memberCode"
            :placeholder="$t('请输入会员编号')"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
        <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
182 183 184 185 186
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
lanbaoming's avatar
lanbaoming committed
187 188 189 190 191 192 193 194 195
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['ecw:customer:sea-create']"
          >{{ $t("新增") }}</el-button
        >
lanbaoming's avatar
lanbaoming committed
196 197
      </el-col>
      <el-col :span="1.5">
lanbaoming's avatar
lanbaoming committed
198 199 200 201 202 203 204 205 206 207
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          :loading="exportLoading"
          v-hasPermi="['ecw:customer:sea-export']"
          >{{ $t("导出") }}</el-button
        >
lanbaoming's avatar
lanbaoming committed
208
      </el-col>
lanbaoming's avatar
lanbaoming committed
209 210 211 212
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
lanbaoming's avatar
lanbaoming committed
213 214 215
    </el-row>

    <!-- 列表 -->
lanbaoming's avatar
lanbaoming committed
216
    <el-table
yujinyao's avatar
yujinyao committed
217
      ref="multipleTable"
218
      border
lanbaoming's avatar
lanbaoming committed
219 220 221
      v-loading="loading"
      :data="list"
      @selection-change="handleSelectionChange"
222
      id="dataTable" :height="autoHeight"
lanbaoming's avatar
lanbaoming committed
223
    >
yujinyao's avatar
yujinyao committed
224
      <el-table-column type="selection" width="55" fixed></el-table-column>
余金瑶's avatar
余金瑶 committed
225
      <el-table-column :label="$t('客户编号')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
226
        <template v-slot="{ row }">
余金瑶's avatar
余金瑶 committed
227 228 229
          <router-link :to="`/customer/query/${row.id}`" class="link-type">
            {{ row.number }}
          </router-link>
lanbaoming's avatar
lanbaoming committed
230 231
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
232
      <el-table-column :label="$t('客户名称')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
233 234 235 236
        <template v-slot="{ row }">
          <p style="display: inline-block; white-space: pre-wrap">
            {{ $l(row, "name") }}
          </p>
lanbaoming's avatar
lanbaoming committed
237 238
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
239
      <!--
lanbaoming's avatar
lanbaoming committed
240 241 242 243 244
      <el-table-column
        :label="$t('客户等级')"
        align="center"
        prop="vipLevelNameZh"
      >
lanbaoming's avatar
lanbaoming committed
245 246 247 248
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL" :value="scope.row.level" />
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
249 250 251 252
      <el-table-column
        :label="$t('信用等级')"
        :prop="isChinese ? 'creditLevelNameZh' : 'creditLevelNameEn'"
      ></el-table-column>
余金瑶's avatar
余金瑶 committed
253
      -->
lanbaoming's avatar
lanbaoming committed
254 255
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
        <template slot-scope="scope">
lanbaoming's avatar
lanbaoming committed
256 257 258 259
          <dict-tag
            :type="DICT_TYPE.CUSTOMER_STATUS"
            :value="scope.row.status"
          />
lanbaoming's avatar
lanbaoming committed
260 261
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
262 263 264 265
      <el-table-column
        :label="$t('主联系人')"
        prop="defaultContactName"
      ></el-table-column>
lanbaoming's avatar
lanbaoming committed
266
      <el-table-column :label="$t('主联系方式')" prop="defaultContactPhone">
lanbaoming's avatar
lanbaoming committed
267 268 269 270
        <template v-slot="{ row }">
          +{{ row.defaultContactPhone }} <br />
          <contacts :id="row.id">
            <el-button type="text">更多</el-button>
lanbaoming's avatar
lanbaoming committed
271 272 273
          </contacts>
        </template>
      </el-table-column>
274 275 276 277 278 279 280
      <el-table-column :label="$t('最新发货时间')" width="120">
        <template slot-scope="scope" v-if="scope.row.lastLoadOrderId">
          <router-link :to="`/order/detail?orderId=${scope.row.lastLoadOrderId}`" class="link-type">
            {{ parseTime(scope.row.lastLoadOrderLoadTime) }}
          </router-link>
        </template>
      </el-table-column>
281
      <el-table-column :label="$t('最新报价单')" width="120">
282 283 284 285 286 287
        <template slot-scope="scope" v-if="scope.row.offerId">
          <router-link :to="`/offer/detail?offerId=${scope.row.offerId}`" class="link-type">
            {{ scope.row.offerNumber }}
          </router-link>
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
288
      <el-table-column :label="$t('客户类别')" align="center" prop="status">
289 290 291 292 293 294
        <template slot-scope="{ row }">
          {{ 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
295 296
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
297
      <el-table-column :label="$t('角色')" align="center" prop="status">
zhengyi's avatar
zhengyi committed
298 299 300 301 302 303
        <template slot-scope="{ row }">
          {{ 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"-->
<!--          />-->
lanbaoming's avatar
lanbaoming committed
304 305
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
306 307 308 309 310 311
      <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>
lanbaoming's avatar
lanbaoming committed
312
      </el-table-column>
余金瑶's avatar
余金瑶 committed
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
      <el-table-column :label="$t('客户来源')">
        <template slot-scope="scope">
          <dict-tag
            :type="DICT_TYPE.CUSTOMER_SOURCE"
            :value="scope.row.source"
          />
        </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 }">
328 329 330 331 332 333
          {{
            getDictDatas2(DICT_TYPE.PICKUP_POINTS, (row.pickupPoints || "").split(","))
              .map((e) => (isChinese ? e.label : e.labelEn))
              .join(", ")
          }}
<!--          {{ getPickupPointNames(row.pickupPoints) }}-->
余金瑶's avatar
余金瑶 committed
334 335 336 337 338 339 340 341 342
        </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 }">
343
          {{ getProductTypeNames(row.productTypes) }}
余金瑶's avatar
余金瑶 committed
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
        </template>
      </el-table-column>
      <el-table-column :label="$t('主要竞争对手')" prop="competitorNames">
      </el-table-column>
      <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">
        <template v-slot="{ row }">
          {{ parseTime( row.enterOpenSeaTime ? row.enterOpenSeaTime : row.estimateEnterOpenSeaTime)}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('入仓确认')" align="center">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.arrivalConfirm == 1">{{ $t('') }}</el-tag>
366
          <el-tag type="info" v-else>{{ $t('') }}</el-tag>
余金瑶's avatar
余金瑶 committed
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
        </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">
          <dict-tag
            :type="DICT_TYPE.CUSTOMER_GET_METHOD"
zhengyi's avatar
zhengyi committed
393
            :value="scope.row.getMethod"
余金瑶's avatar
余金瑶 committed
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
          />
        </template>
      </el-table-column>
      <el-table-column :label="$t('创建人')"  prop="createUsername" align="center">
      </el-table-column>
      <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">
          <span >{{ parseTime(scope.row.updateTime) }}</span>
        </template>
      </el-table-column>
yujinyao's avatar
yujinyao committed
409
      <el-table-column width="200px" :label="$t('操作')" align="center" fixed="right">
lanbaoming's avatar
lanbaoming committed
410 411
        <template slot-scope="scope">
          <router-link :to="'/customer/query/' + scope.row.id">
lanbaoming's avatar
lanbaoming committed
412 413 414 415 416
            <el-button
              v-has-permi="['ecw:customer:sea-view']"
              size="mini"
              style="margin-right: 10px"
              type="text"
yujinyao's avatar
yujinyao committed
417
              icon="el-icon-view"
lanbaoming's avatar
lanbaoming committed
418 419
              >查看</el-button
            >
lanbaoming's avatar
lanbaoming committed
420
          </router-link>
lanbaoming's avatar
lanbaoming committed
421 422 423 424 425
          <!--          <el-button size="mini" type="text"  @click="distribution(scope.row)">{{$t('移交')}}</el-button>-->
          <el-button
            v-has-permi="['ecw:customer:sea-gain']"
            size="mini"
            type="text"
yujinyao's avatar
yujinyao committed
426
            icon="el-icon-edit"
lanbaoming's avatar
lanbaoming committed
427 428 429
            @click="fishingFn(scope.row)"
            >{{ $t("捞取") }}</el-button
          >
yujinyao's avatar
yujinyao committed
430 431 432 433 434 435 436 437
          <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
438 439 440 441 442 443 444 445
        </template>
      </el-table-column>
    </el-table>
    <!--   移交 -->
    <el-dialog
      center
      :title="$t('客服')"
      :visible.sync="transferShow"
lanbaoming's avatar
lanbaoming committed
446 447 448 449 450 451 452 453 454 455 456 457 458 459
      width="30%"
    >
      <div style="width: 100%; min-height: 200px; text-align: center">
        <el-select filterable v-model="service">
          <el-option
            v-for="(item, index) in customerServiceList"
            :key="index"
            :label="item.nickname"
            :value="item.id"
          ></el-option>
        </el-select>
        <!--        <el-radio-group v-model="service">-->
        <!--          <el-radio style="margin: 5px;" v-for="(item,index) in customerServiceList" :key="index" :label="item.id">{{item.nickname}}</el-radio>-->
        <!--        </el-radio-group>-->
lanbaoming's avatar
lanbaoming committed
460 461
      </div>
      <span slot="footer" class="dialog-footer">
lanbaoming's avatar
lanbaoming committed
462 463 464 465 466 467 468 469 470 471 472 473 474 475
        <el-button @click="transferShow = false">{{ $t("取 消") }}</el-button>
        <el-button
          type="primary"
          v-if="isBatch"
          @click="transferFn(multipleSelection.map((item) => item.id))"
          >{{ $t("确 定") }}</el-button
        >
        <el-button
          type="primary"
          v-else
          @click="transferFn([transferData.id])"
          >{{ $t("确 定") }}</el-button
        >
      </span>
lanbaoming's avatar
lanbaoming committed
476 477
    </el-dialog>
    <!-- 分页组件 -->
lanbaoming's avatar
lanbaoming committed
478 479 480 481 482 483 484
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
yujinyao's avatar
yujinyao committed
485 486 487 488
    <customer-setting
      ref="customerSetting"
      @refresh="getList"
    ></customer-setting>
lanbaoming's avatar
lanbaoming committed
489 490 491 492 493 494 495 496 497 498 499
  </div>
</template>

<script>
import {
  createCustomer,
  updateCustomer,
  deleteCustomer,
  handOverCustomer,
  getPublicList,
  setFishing,
lanbaoming's avatar
lanbaoming committed
500
  publicExportExcel,
yujinyao's avatar
yujinyao committed
501
  competitorListAll
lanbaoming's avatar
lanbaoming committed
502
} from "@/api/ecw/customer";
zhengyi's avatar
zhengyi committed
503
import { getDictDatas, DICT_TYPE, getDictDatas2 } from "@/utils/dict";
lanbaoming's avatar
lanbaoming committed
504
import upload from "@/components/ImageUpload";
yujinyao's avatar
yujinyao committed
505
import { listServiceUser, listAllSimpl } from "@/api/system/user";
lanbaoming's avatar
lanbaoming committed
506 507
import { getCountryListAll } from "@/api/ecw/country";
import { getCreditPage } from "@/api/customer/credit";
lanbaoming's avatar
lanbaoming committed
508 509
import Template from "@/views/cms/template/index.vue";
import Contacts from "@/views/ecw/customer/components/contacts.vue";
yujinyao's avatar
yujinyao committed
510
import CustomerSetting from "../customer/components/customerSetting.vue";
511
import AreaCodeSelector from "@/components/AreaCodeSelector/index.vue";
512
import CompetitorSelector from "@/components/CompetitorSelector/index.vue";
yujinyao's avatar
yujinyao committed
513
import { getNodeList } from "@/api/ecw/node";
yujinyao's avatar
yujinyao committed
514
import { getCustomerSelect, changeCustomerDefaultPay, changeCustomerNoConsignee,changeCustomerDefaultBilling } from "@/api/ecw/customer";
yujinyao's avatar
yujinyao committed
515 516
import { getProductTypeList } from "@/api/ecw/productType";
import { getProductList } from "@/api/ecw/product";
yujinyao's avatar
yujinyao committed
517
import { listMySimpleDepts } from "@/api/system/dept";
lanbaoming's avatar
lanbaoming committed
518 519 520
export default {
  name: "EcwOceancustomerIndex",
  activated() {
lanbaoming's avatar
lanbaoming committed
521
    this.getList();
lanbaoming's avatar
lanbaoming committed
522 523
  },
  components: {
524
    CompetitorSelector,
lanbaoming's avatar
lanbaoming committed
525 526 527
    Contacts,
    Template,
    upload,
yujinyao's avatar
yujinyao committed
528 529
    AreaCodeSelector,
    CustomerSetting
lanbaoming's avatar
lanbaoming committed
530 531 532 533
  },
  data() {
    return {
      getDictDatas,
zhengyi's avatar
zhengyi committed
534
      getDictDatas2,
lanbaoming's avatar
lanbaoming committed
535 536 537 538 539 540
      DICT_TYPE,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
541
      showSearch: false,
lanbaoming's avatar
lanbaoming committed
542 543 544 545 546 547 548 549 550
      // 总条数
      total: 0,
      // 客户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      dateRangeCreateTime: [],
lanbaoming's avatar
lanbaoming committed
551
      customerServiceList: [],
lanbaoming's avatar
lanbaoming committed
552 553 554 555 556 557 558 559 560 561 562
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        number: null,
        name: null,
        level: null,
        source: null,
        customerService: null,
        status: null,
        department: null,
lanbaoming's avatar
lanbaoming committed
563
        marketType: null,
564 565 566 567
        memberCode: null,
        memberName: null,
        memberMobile: null,
        memberAreaCode: null
lanbaoming's avatar
lanbaoming committed
568 569 570 571 572
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
lanbaoming's avatar
lanbaoming committed
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
        name: [
          {
            required: true,
            message: this.$t("客户名称不能为空"),
            trigger: "blur",
          },
        ],
        country: [
          { required: true, message: this.$t("国家不能为空"), trigger: "blur" },
        ],
        level: [
          {
            required: true,
            message: this.$t("客户等级不能为空"),
            trigger: "blur",
          },
        ],
        type: [
          {
            required: true,
            message: this.$t("客户类别不能为空"),
            trigger: "blur",
          },
        ],
lanbaoming's avatar
lanbaoming committed
597
        // createTime: [{ required: true, message: this.$t('创建时间不能为空'), trigger: "blur" }],
lanbaoming's avatar
lanbaoming committed
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
        source: [
          {
            required: true,
            message: this.$t("客户来源不能为空"),
            trigger: "blur",
          },
        ],
        customerService: [
          {
            required: true,
            message: this.$t("客户经理不能为空"),
            trigger: "blur",
          },
        ],
        status: [
          {
            required: true,
            message: this.$t("客户状态不能为空"),
            trigger: "blur",
          },
        ],
        founder: [
          {
            required: true,
            message: this.$t("创建人不能为空"),
            trigger: "blur",
          },
        ],
lanbaoming's avatar
lanbaoming committed
626 627 628 629
      },
      // 网点
      nodeList: [],
      showLine: false,
lanbaoming's avatar
lanbaoming committed
630 631 632
      service: undefined, //客服
      transferData: undefined, //移交数据
      transferShow: false,
yujinyao's avatar
yujinyao committed
633
      selectCustomerList: [],
lanbaoming's avatar
lanbaoming committed
634 635 636 637
      multipleSelection: [],
      isBatch: false,
      countryList: [],
      creditList: [],
yujinyao's avatar
yujinyao committed
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
      customerFollowVisible: false,
      enterOpenSeaTime: [],
      customerServiceConfirmedTime: [],
      firstDealTime: [],
      customerSelect: [],
      recommended: [],
      getNodeLists: [],
      allSimplList: [],
      weightYearly: {
        key: "eqNumberKey",
        value: "",
      },
      numYearly: {
        key: "eqNumberKey",
        value: "",
      },
      productTypeList: [],
      productList: [],
      competitorList: [],
      deptList: [],
658
      autoHeight: 500
lanbaoming's avatar
lanbaoming committed
659 660 661 662
    };
  },
  created() {
    this.getList();
lanbaoming's avatar
lanbaoming committed
663 664
    listServiceUser().then((r) => {
      console.log(r, "客服");
lanbaoming's avatar
lanbaoming committed
665
      this.customerServiceList = r.data;
lanbaoming's avatar
lanbaoming committed
666 667 668 669 670 671 672
    });
    getCountryListAll().then((r) => {
      this.countryList = r.data;
    });
    getCreditPage({ page: 1, rows: 999 }).then((r) => {
      this.creditList = r.data.list;
    });
lanbaoming's avatar
lanbaoming committed
673 674 675
    // getNodeList().then(r => {
    //   this.nodeList = r.data
    // })
yujinyao's avatar
yujinyao committed
676 677 678 679 680 681 682 683 684 685 686 687 688
    this.getCustomerSelect();
    getNodeList().then((r) => {
      this.getNodeLists = r.data;
    });
    listAllSimpl().then((r) => {
      this.allSimplList = r.data;
    });
    getProductTypeList().then((r) => {
      this.productTypeList = r.data;
    });
    competitorListAll().then((r) => {
      this.competitorList = r.data;
    })
yujinyao's avatar
yujinyao committed
689
    listMySimpleDepts().then(response => {
yujinyao's avatar
yujinyao committed
690 691
      this.deptList = response.data
    })
lanbaoming's avatar
lanbaoming committed
692
  },
yujinyao's avatar
yujinyao committed
693 694 695 696 697
  updated() {
    this.$nextTick(() => {
      this.$refs.multipleTable.doLayout()
    })
  },
honghy's avatar
honghy committed
698 699
  watch: {
    showSearch() {
honghy's avatar
honghy committed
700 701 702
      this.$nextTick(() => {
        this.getHeight()
      })
honghy's avatar
honghy committed
703 704
    }
  },
lanbaoming's avatar
lanbaoming committed
705
  computed: {
706 707 708 709 710 711
    isMobile() {
      const userAgent = navigator.userAgent || navigator.vendor || window.opera;
      // 匹配常见的移动设备标识
      const mobileIdentifiers = ['Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone'];
      return mobileIdentifiers.some(identifier => userAgent.includes(identifier));
    },
lanbaoming's avatar
lanbaoming committed
712 713
    isChinese() {
      return this.$i18n.locale === "zh_CN";
lanbaoming's avatar
lanbaoming committed
714
    },
余金瑶's avatar
余金瑶 committed
715 716 717 718 719 720 721 722 723 724
    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("")
          : "";
      };
    },
yujinyao's avatar
yujinyao committed
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
    customerSelectFn() {
      if (this.recommended.length > 0) {
        let i = this.customerSelect.find(
          (item) => item.id === this.recommended[0].id
        );
        if (!i) {
          this.customerSelect.push(this.recommended[0]);
        }
        return this.customerSelect;
      } else {
        return this.customerSelect;
      }
    },
    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
745 746
        queryParams.beginCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[0]
        queryParams.endCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[1]
yujinyao's avatar
yujinyao committed
747 748 749 750 751 752 753 754 755 756
      }
      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) {
yujinyao's avatar
yujinyao committed
757
        console.log(this.weightYearly.key)
yujinyao's avatar
yujinyao committed
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777
        let key = 'eqWeightYearly'
        if (this.weightYearly.key == 'leNumberKey') {
          key = 'leWeightYearly'
        } else if (this.weightYearly.key == 'geNumberKey') {
          key = 'geWeightYearly'
        }
        queryParams[key] = this.weightYearly.value;
      }
      if (this.numYearly.value) {
        let key = 'eqNumYearly'
        if (this.numYearly.key == 'leNumberKey') {
          key = 'leNumYearly'
        } else if (this.numYearly.key == 'geNumberKey') {
          key = 'geNumYearly'
        }
        queryParams[key] = this.numYearly.value;
      }

      return queryParams;
    },
lanbaoming's avatar
lanbaoming committed
778 779 780
  },
  methods: {
    countryFormatter(row, column, cellValue) {
lanbaoming's avatar
lanbaoming committed
781 782
      const country = this.countryList.find((e) => e.id === cellValue);
      return this.isChinese ? country?.nameZh : country?.nameEn;
lanbaoming's avatar
lanbaoming committed
783 784 785 786 787
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
yujinyao's avatar
yujinyao committed
788
      let params = { ...this.queryParams, ...this.combinedQueryParams };
lanbaoming's avatar
lanbaoming committed
789
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime");
lanbaoming's avatar
lanbaoming committed
790
      // 执行查询
lanbaoming's avatar
lanbaoming committed
791
      getPublicList(params).then((response) => {
lanbaoming's avatar
lanbaoming committed
792 793 794
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
795
        this.getHeight();
lanbaoming's avatar
lanbaoming committed
796 797
      });
    },
yujinyao's avatar
yujinyao committed
798 799 800 801 802 803 804 805 806 807 808
    remoteMethod(val) {
      this.getCustomerSelect(val);
    },
    getCustomerSelect(val = "") {
      getCustomerSelect({ pageNo: 1, pageSize: 30, searchKey: val }).then(
        (res) => {
          this.customerSelect = res.data.list;
        }
      );
    },
    handleSelectProductType(val) {
yujinyao's avatar
yujinyao committed
809 810 811 812 813 814 815 816 817
      if (val && val.length >= 1) {
        this.queryParams.productIds = []
        getProductList({ typeIds: val }).then((r) => {
          this.productList = r.data
        });
      } else {
        this.queryParams.productIds = []
        this.productList = []
      }
yujinyao's avatar
yujinyao committed
818
    },
lanbaoming's avatar
lanbaoming committed
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    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,
        weightUnit: undefined,
      };
      this.resetForm("form");
    },
865 866 867 868
    // 去掉客户名称的首尾空格
    trimCustomerName(){
      this.queryParams.name = this.queryParams.name.trim()
    },
lanbaoming's avatar
lanbaoming committed
869 870 871 872 873 874 875 876
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
yujinyao's avatar
yujinyao committed
877 878 879
      this.enterOpenSeaTime = []
      this.customerServiceConfirmedTime = []
      this.firstDealTime = []
lanbaoming's avatar
lanbaoming committed
880 881 882 883
      this.resetForm("queryForm");
      this.queryParams = {
        pageNo: 1,
        pageSize: 10,
lanbaoming's avatar
lanbaoming committed
884
      };
yujinyao's avatar
yujinyao committed
885 886
      this.weightYearly.value = "";
      this.numYearly.value = "";
lanbaoming's avatar
lanbaoming committed
887 888 889 890
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
lanbaoming's avatar
lanbaoming committed
891
      this.$router.push("/customer/add-edit/0");
lanbaoming's avatar
lanbaoming committed
892 893 894 895
      // this.reset();
      // this.open = true;
      // this.title = this.$t("添加客户");
    },
lanbaoming's avatar
lanbaoming committed
896
    /** 查看按钮操作 */
lanbaoming's avatar
lanbaoming committed
897
    handleView(row) {
lanbaoming's avatar
lanbaoming committed
898
      this.$router.push("/customer/query/" + row.id);
lanbaoming's avatar
lanbaoming committed
899 900 901
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
lanbaoming's avatar
lanbaoming committed
902
      this.$router.push("/customer/add-edit/" + row.id);
lanbaoming's avatar
lanbaoming committed
903 904 905 906 907 908 909 910 911 912
      // this.reset();
      // const id = row.id;
      // getCustomer(id).then(response => {
      //   this.form = { ...this.form, ...response.data };
      //   this.open = true;
      //   this.title = this.$t("修改客户");
      // });
    },
    /** 提交按钮 */
    submitForm() {
lanbaoming's avatar
lanbaoming committed
913
      this.$refs["form"].validate((valid) => {
lanbaoming's avatar
lanbaoming committed
914 915 916 917 918
        if (!valid) {
          // return;
        }
        // 修改的提交
        if (this.form.id != null) {
lanbaoming's avatar
lanbaoming committed
919 920
          updateCustomer(this.form).then((response) => {
            this.$modal.msgSuccess(this.$t("修改成功"));
lanbaoming's avatar
lanbaoming committed
921 922 923 924 925 926
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
lanbaoming's avatar
lanbaoming committed
927 928
        createCustomer(this.form).then((response) => {
          this.$modal.msgSuccess(this.$t("新增成功"));
lanbaoming's avatar
lanbaoming committed
929 930 931 932 933 934 935 936
          this.open = false;
          this.getList();
        });
      });
    },
    /** 移交按钮操作 */
    handleDelete(row) {
      const id = row.id;
lanbaoming's avatar
lanbaoming committed
937 938 939 940 941 942 943 944 945 946 947 948
      this.$modal
        .confirm(
          this.$t('是否确认删除客户编号为"') + id + this.$t('"的数据项?')
        )
        .then(function () {
          return deleteCustomer(id);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess(this.$t("删除成功"));
        })
        .catch(() => {});
lanbaoming's avatar
lanbaoming committed
949 950 951
    },
    /** 导出按钮操作 */
    handleExport() {
lanbaoming's avatar
lanbaoming committed
952 953 954 955 956 957 958 959
      this.$modal
        .confirm(this.$t("是否确认导出公海池客户数据项?"))
        .then(() => {
          publicExportExcel().then(() => {
            this.$message.success(
              this.$t("已加入导出队列,请稍后在下载日志中下载")
            );
          });
lanbaoming's avatar
lanbaoming committed
960
        })
lanbaoming's avatar
lanbaoming committed
961
        .catch(() => {});
lanbaoming's avatar
lanbaoming committed
962 963
    },
    //分配客服
lanbaoming's avatar
lanbaoming committed
964 965
    distribution(row) {
      this.service = row.customerService;
lanbaoming's avatar
lanbaoming committed
966
      this.transferData = row;
lanbaoming's avatar
lanbaoming committed
967
      this.transferShow = true;
lanbaoming's avatar
lanbaoming committed
968 969
      this.isBatch = false;
    },
lanbaoming's avatar
lanbaoming committed
970 971 972
    transferFn(val) {
      if (!this.service) {
        return this.$message.warning(this.$t("请选择客户经理!"));
lanbaoming's avatar
lanbaoming committed
973 974
      }
      handOverCustomer({
lanbaoming's avatar
lanbaoming committed
975 976 977 978
        customerServiceId: this.service,
        customerIdList: val,
      }).then((r) => {
        if (r.code === 0) {
lanbaoming's avatar
lanbaoming committed
979
          this.transferShow = false;
lanbaoming's avatar
lanbaoming committed
980
          this.service = "";
lanbaoming's avatar
lanbaoming committed
981 982
          this.getList();
          this.multipleSelection = [];
lanbaoming's avatar
lanbaoming committed
983
          this.$message.success(this.$t("移交成功!"));
lanbaoming's avatar
lanbaoming committed
984
        }
lanbaoming's avatar
lanbaoming committed
985
      });
lanbaoming's avatar
lanbaoming committed
986
    },
lanbaoming's avatar
lanbaoming committed
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
    fishingFn(row) {
      this.$confirm(
        `${this.$t("是否要捞取")}${row.name}${this.$t("的客户")}`,
        this.$t("提示"),
        {
          confirmButtonText: this.$t("确定"),
          cancelButtonText: this.$t("取消"),
          type: "warning",
        }
      )
        .then(() => {
          setFishing({ id: row.id }).then((r) => {
            if (r.code === 0) {
              this.getList();
              this.$message({
                type: "success",
                message: this.$t("捞取成功!"),
              });
            }
          });
lanbaoming's avatar
lanbaoming committed
1007
        })
lanbaoming's avatar
lanbaoming committed
1008 1009 1010 1011 1012
        .catch(() => {
          this.$message({
            type: "info",
            message: this.$t("已取消捞取"),
          });
lanbaoming's avatar
lanbaoming committed
1013 1014
        });
    },
lanbaoming's avatar
lanbaoming committed
1015
    batchHandover() {
lanbaoming's avatar
lanbaoming committed
1016
      this.transferShow = true;
lanbaoming's avatar
lanbaoming committed
1017
      this.isBatch = true;
lanbaoming's avatar
lanbaoming committed
1018
    },
lanbaoming's avatar
lanbaoming committed
1019
    handleSelectionChange(val) {
lanbaoming's avatar
lanbaoming committed
1020
      this.multipleSelection = val;
yujinyao's avatar
yujinyao committed
1021
      this.selectCustomerList = val.map((i) => i.id);
lanbaoming's avatar
lanbaoming committed
1022
    },
yujinyao's avatar
yujinyao committed
1023 1024 1025 1026 1027
    handleSetting(row) {
      this.$refs['customerSetting'].dialogVisible = true
      this.$nextTick(_ => {
        this.$refs['customerSetting'].init(row.id)
      })
余金瑶's avatar
余金瑶 committed
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058
    },
    getBusiCountryNames(ids) {
      if (ids) {
        const idsArr = ids.split(',')
        const strArr = []
        this.countryList.forEach(item => {
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.nameZh : item.nameEn)
          }
        })
        return strArr.length > 0 ? strArr.join(',') : null
      } else {
        return null
      }
    },
    getPickupPointNames(ids) {
      if (ids) {
        const idsArr = ids.split(',')
        const strArr = []
        this.getNodeLists.forEach(item => {
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.titleZh : item.titleEn)
          }
        })
        return strArr.length > 0 ? strArr.join(',') : null
      } else {
        return null
      }
    },
    getProductTypeNames(ids) {
      if (ids) {
1059
        const idsArr = ids.toString().split(',')
余金瑶's avatar
余金瑶 committed
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083
        const strArr = []
        this.productTypeList.forEach(item => {
          if (idsArr.includes(item.id.toString())) {
            strArr.push(this.isChinese ? item.titleZh : item.titleEn)
          }
        })
        return strArr.length > 0 ? strArr.join(',') : null
      } else {
        return null
      }
    },
    getPromoterName(id) {
      if (id) {
        let strName = ''
        for(const item of this.customerSelectFn) {
          if (item.id == id) {
            strName = item.name
            break
          }
        }
        return strName
      } else {
        return null
      }
yujinyao's avatar
yujinyao committed
1084
    },
1085 1086
    //表格高度自适应
    getHeight() {
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
      if(!this.isMobile) {
        this.$refs.multipleTable.doLayout()
        let getHeightFromBottom = (element, variableHeight) => {
          const elementRect = element.getBoundingClientRect().top;
          const windowHeight = document.documentElement.clientHeight;
          const elementHeightFromBottom = windowHeight - elementRect;
          const result = elementHeightFromBottom - variableHeight;
          return result;
        }
        const element = document.getElementById('dataTable');
        const variableHeight = 70; // 给定的变量高度 一般留于分页器高度
        this.autoHeight =getHeightFromBottom(element, variableHeight);
1099 1100
      }
    },
lanbaoming's avatar
lanbaoming committed
1101
  },
lanbaoming's avatar
lanbaoming committed
1102 1103
};
</script>