index.vue 37.2 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
332784038@qq.com's avatar
332784038@qq.com committed
4
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="130px">
lanbaoming's avatar
lanbaoming committed
5
      <el-form-item :label="$t('客户编号')" prop="number">
332784038@qq.com's avatar
332784038@qq.com committed
6
        <el-input v-model.trim="queryParams.number" :placeholder="$t('请输入客户编号')" clearable @keyup.enter.native="handleQuery" @input="queryParams.number = queryParams.number.replace(/\s+/g, '')" />
lanbaoming's avatar
lanbaoming committed
7 8
      </el-form-item>
      <el-form-item :label="$t('客户名称')" prop="name">
332784038@qq.com's avatar
332784038@qq.com committed
9
        <el-input v-model.trim="queryParams.name" :placeholder="$t('请输入客户名称')" clearable @keyup.enter.native="handleQuery" @input="queryParams.name = queryParams.name.replace(/\s+/g, '')" />
lanbaoming's avatar
lanbaoming committed
10
      </el-form-item>
yujinyao's avatar
yujinyao committed
11
      <el-form-item :label="$t('区号')">
332784038@qq.com's avatar
332784038@qq.com committed
12 13
        <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" />
yujinyao's avatar
yujinyao committed
14 15
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
16
      <el-form-item :label="$t('联系方式')">
332784038@qq.com's avatar
332784038@qq.com committed
17
        <el-input :placeholder="$t('请输入联系方式')" v-model.trim="queryParams.defaultContactPhone" @input="queryParams.defaultContactPhone = queryParams.defaultContactPhone.replace(/\s+/g, '')"></el-input>
lanbaoming's avatar
lanbaoming committed
18
      </el-form-item>
yujinyao's avatar
yujinyao committed
19
      <!--
yujinyao's avatar
yujinyao committed
20 21
      <el-form-item :label="$t('客户经理')" prop="customerService">
        <el-select
yujinyao's avatar
yujinyao committed
22
          multiple
yujinyao's avatar
yujinyao committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36
          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>
yujinyao's avatar
yujinyao committed
37
      -->
lanbaoming's avatar
lanbaoming committed
38
      <el-form-item :label="$t('客户来源')" prop="source">
332784038@qq.com's avatar
332784038@qq.com committed
39 40
        <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" />
lanbaoming's avatar
lanbaoming committed
41 42
        </el-select>
      </el-form-item>
yujinyao's avatar
yujinyao committed
43
      <el-form-item :label="$t('客户类别')" prop="level">
332784038@qq.com's avatar
332784038@qq.com committed
44
        <dict-selector multiple clearable :type="DICT_TYPE.CUSTOMER_TYPE" v-model="queryParams.type" @change="handleQuery"></dict-selector>
45
      </el-form-item>
yujinyao's avatar
yujinyao committed
46
      <el-form-item :label="$t('角色')">
332784038@qq.com's avatar
332784038@qq.com committed
47
        <dict-selector multiple clearable :type="DICT_TYPE.CUSTOMER_ROLE" v-model="queryParams.role" formatter="number" @change="handleQuery" :placeholder="$t('请选择')"></dict-selector>
yujinyao's avatar
yujinyao committed
48
      </el-form-item>
yujinyao's avatar
yujinyao committed
49
      <el-form-item :label="$t('客户状态')" prop="status">
332784038@qq.com's avatar
332784038@qq.com committed
50 51
        <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" />
yujinyao's avatar
yujinyao committed
52 53 54
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('国籍')" prop="country">
332784038@qq.com's avatar
332784038@qq.com committed
55 56
        <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)" />
yujinyao's avatar
yujinyao committed
57 58
        </el-select>
      </el-form-item>
yujinyao's avatar
yujinyao committed
59
      <el-form-item :label="$t('出货渠道')">
332784038@qq.com's avatar
332784038@qq.com committed
60
        <dict-selector multiple clearable :type="DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" @change="handleQuery"></dict-selector>
yujinyao's avatar
yujinyao committed
61
      </el-form-item>
yujinyao's avatar
yujinyao committed
62

yujinyao's avatar
yujinyao committed
63
      <el-form-item :label="$t('业务国家')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
64 65
        <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)" />
yujinyao's avatar
yujinyao committed
66 67 68 69
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('常用提货网点')" v-show="showSearch">
        <el-select multiple v-model="queryParams.pickupPoints">
332784038@qq.com's avatar
332784038@qq.com committed
70
          <el-option v-for="item in getNodeLists" :key="item.id" :value="item.id" :label="isChinese ? item.titleZh : item.titleEn"></el-option>
yujinyao's avatar
yujinyao committed
71 72
        </el-select>
      </el-form-item>
yujinyao's avatar
yujinyao committed
73 74
      <el-form-item :label="$t('创建人')" v-show="showSearch">
        <el-select v-model="queryParams.founder">
332784038@qq.com's avatar
332784038@qq.com committed
75
          <el-option v-for="item in allSimplList" :key="item.id" :label="item.nickname" :value="item.id"> </el-option>
yujinyao's avatar
yujinyao committed
76 77 78
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('创建时间')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
79
        <el-date-picker type="datetimerange" clearable v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
yujinyao's avatar
yujinyao committed
80
      </el-form-item>
yujinyao's avatar
yujinyao committed
81
      <el-form-item :label="$t('入公海时间')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
82
        <el-date-picker type="datetimerange" clearable v-model="enterOpenSeaTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
yujinyao's avatar
yujinyao committed
83 84 85 86 87 88 89 90
      </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">
332784038@qq.com's avatar
332784038@qq.com committed
91
        <el-input v-model.trim="weightYearly.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" @input="weightYearly.value = weightYearly.value.replace(/\s+/g, '')">
yujinyao's avatar
yujinyao committed
92
          <template slot="prepend">
332784038@qq.com's avatar
332784038@qq.com committed
93
            <dict-selector :type="DICT_TYPE.CUSTOMER_QUERY_NUMBER_FIELD" defaultable v-model="weightYearly.key" class="w-50" />
yujinyao's avatar
yujinyao committed
94 95 96 97
          </template>
        </el-input>
      </el-form-item>
      <el-form-item :label="$t('商品类别')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
98 99
        <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" />
yujinyao's avatar
yujinyao committed
100 101 102
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('商品名称')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
103 104
        <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" />
yujinyao's avatar
yujinyao committed
105 106 107
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('主要竞争对手')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
108 109
        <el-select clearable multiple v-model="queryParams.competitorIds" :placeholder="$t('请选择')" @change="handleQuery">
          <el-option v-for="item in competitorList" :key="item.id" :label="item.name" :value="item.id" />
yujinyao's avatar
yujinyao committed
110 111 112
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('年度发货次数')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
113
        <el-input v-model.trim="numYearly.value" :placeholder="$t('请输入数字')" clearable @keyup.enter.native="handleQuery" @input="numYearly.value = numYearly.value.replace(/\s+/g, '')">
yujinyao's avatar
yujinyao committed
114
          <template slot="prepend">
332784038@qq.com's avatar
332784038@qq.com committed
115
            <dict-selector :type="DICT_TYPE.CUSTOMER_QUERY_NUMBER_FIELD" defaultable v-model="numYearly.key" class="w-50" />
yujinyao's avatar
yujinyao committed
116 117 118
          </template>
        </el-input>
      </el-form-item>
yujinyao's avatar
yujinyao committed
119
      <el-form-item :label="$t('推介人')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
120 121
        <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>
yujinyao's avatar
yujinyao committed
122 123
        </el-select>
      </el-form-item>
余金瑶's avatar
余金瑶 committed
124 125 126 127 128 129
      <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>
yujinyao's avatar
yujinyao committed
130 131 132 133 134 135 136 137 138 139
      <el-form-item :label="$t('控货无收货人')" v-show="showSearch">
        <el-switch v-model="queryParams.noConsignee" />
      </el-form-item>
      <el-form-item :label="$t('默认付款')" v-show="showSearch">
        <el-switch v-model="queryParams.defaultPay" />
      </el-form-item>
      <el-form-item :label="$t('是否显示提单价格')" v-show="showSearch">
        <el-switch v-model="queryParams.isShowTidanPrice" />
      </el-form-item>
      <el-form-item :label="$t('归属时间')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
140
        <el-date-picker type="datetimerange" clearable v-model="customerServiceConfirmedTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
yujinyao's avatar
yujinyao committed
141 142
      </el-form-item>
      <el-form-item :label="$t('首次成交时间')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
143
        <el-date-picker type="datetimerange" clearable v-model="firstDealTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
yujinyao's avatar
yujinyao committed
144 145
      </el-form-item>
      <el-form-item :label="$t('获取方式')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
146 147
        <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)" />
yujinyao's avatar
yujinyao committed
148 149 150
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('创建入口')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
151 152
        <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)" />
yujinyao's avatar
yujinyao committed
153 154 155
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('结算方式')" v-show="showSearch">
332784038@qq.com's avatar
332784038@qq.com committed
156 157
        <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)" />
yujinyao's avatar
yujinyao committed
158 159
        </el-select>
      </el-form-item>
lanbaoming's avatar
lanbaoming committed
160
      <el-form-item>
332784038@qq.com's avatar
332784038@qq.com committed
161 162
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t("搜索") }}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{ $t("重置") }}</el-button>
lanbaoming's avatar
lanbaoming committed
163 164 165 166 167 168
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
332784038@qq.com's avatar
332784038@qq.com committed
169
        <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
170 171
      </el-col>
      <el-col :span="1.5">
332784038@qq.com's avatar
332784038@qq.com committed
172
        <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
173
      </el-col>
332784038@qq.com's avatar
332784038@qq.com committed
174
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
lanbaoming's avatar
lanbaoming committed
175 176 177
    </el-row>

    <!-- 列表 -->
332784038@qq.com's avatar
332784038@qq.com committed
178
    <el-table ref="multipleTable" v-loading="loading" :data="list" @selection-change="handleSelectionChange">
yujinyao's avatar
yujinyao committed
179
      <el-table-column type="selection" width="55" fixed></el-table-column>
余金瑶's avatar
余金瑶 committed
180
      <el-table-column :label="$t('客户编号')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
181
        <template v-slot="{ row }">
余金瑶's avatar
余金瑶 committed
182 183 184
          <router-link :to="`/customer/query/${row.id}`" class="link-type">
            {{ row.number }}
          </router-link>
lanbaoming's avatar
lanbaoming committed
185 186
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
187
      <el-table-column :label="$t('客户名称')" align="center" fixed>
lanbaoming's avatar
lanbaoming committed
188 189 190 191
        <template v-slot="{ row }">
          <p style="display: inline-block; white-space: pre-wrap">
            {{ $l(row, "name") }}
          </p>
lanbaoming's avatar
lanbaoming committed
192 193
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
194
      <!--
lanbaoming's avatar
lanbaoming committed
195 196 197 198 199
      <el-table-column
        :label="$t('客户等级')"
        align="center"
        prop="vipLevelNameZh"
      >
lanbaoming's avatar
lanbaoming committed
200 201 202 203
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL" :value="scope.row.level" />
        </template>
      </el-table-column>
lanbaoming's avatar
lanbaoming committed
204 205 206 207
      <el-table-column
        :label="$t('信用等级')"
        :prop="isChinese ? 'creditLevelNameZh' : 'creditLevelNameEn'"
      ></el-table-column>
lanbaoming's avatar
lanbaoming committed
208 209
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
        <template slot-scope="scope">
lanbaoming's avatar
lanbaoming committed
210 211 212 213
          <dict-tag
            :type="DICT_TYPE.CUSTOMER_STATUS"
            :value="scope.row.status"
          />
lanbaoming's avatar
lanbaoming committed
214 215
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
216 217 218
      -->
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
219
          <dict-tag :type="DICT_TYPE.CUSTOMER_STATUS" :value="scope.row.status" />
余金瑶's avatar
余金瑶 committed
220 221
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
222
      <el-table-column :label="$t('主联系人')" prop="defaultContactName"></el-table-column>
lanbaoming's avatar
lanbaoming committed
223
      <el-table-column :label="$t('主联系方式')" prop="defaultContactPhone">
lanbaoming's avatar
lanbaoming committed
224 225 226 227
        <template v-slot="{ row }">
          +{{ row.defaultContactPhone }} <br />
          <contacts :id="row.id">
            <el-button type="text">更多</el-button>
lanbaoming's avatar
lanbaoming committed
228 229 230
          </contacts>
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
231
      <el-table-column :label="$t('客户类别')" align="center" prop="status">
232
        <template slot-scope="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
233 234 235 236 237 238 239 240 241
          {{
            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
242 243
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
244
      <el-table-column :label="$t('角色')" align="center" prop="status">
zhengyi's avatar
zhengyi committed
245
        <template slot-scope="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
246 247 248 249 250 251 252 253 254
          {{
            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
255 256 257 258 259 260 261 262 263 264 265
        </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
266
          <dict-tag :type="DICT_TYPE.CUSTOMER_SOURCE" :value="scope.row.source" />
余金瑶's avatar
余金瑶 committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
        </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 }">
          {{ getProductTypeNames(row.productType) }}
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
289
      <el-table-column :label="$t('主要竞争对手')" prop="competitorNames"> </el-table-column>
余金瑶's avatar
余金瑶 committed
290 291 292 293 294 295 296 297 298 299 300
      <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
301
        <template v-slot="{ row }">
332784038@qq.com's avatar
332784038@qq.com committed
302
          {{ parseTime(row.enterOpenSeaTime ? row.enterOpenSeaTime : row.estimateEnterOpenSeaTime) }}
lanbaoming's avatar
lanbaoming committed
303 304
        </template>
      </el-table-column>
余金瑶's avatar
余金瑶 committed
305 306
      <el-table-column :label="$t('入仓确认')" align="center">
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
307 308
          <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
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
        </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
333
          <dict-tag :type="DICT_TYPE.CUSTOMER_GET_METHOD" :value="scope.row.getMethod" />
余金瑶's avatar
余金瑶 committed
334 335
        </template>
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
336
      <el-table-column :label="$t('创建人')" prop="createUsername" align="center"> </el-table-column>
余金瑶's avatar
余金瑶 committed
337 338 339 340 341 342 343
      <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
344
          <span>{{ parseTime(scope.row.updateTime) }}</span>
余金瑶's avatar
余金瑶 committed
345
        </template>
lanbaoming's avatar
lanbaoming committed
346
      </el-table-column>
332784038@qq.com's avatar
332784038@qq.com committed
347
      <el-table-column width="200px" :label="$t('操作')" align="center" fixed="right" class-name="small-padding fixed-width">
lanbaoming's avatar
lanbaoming committed
348
        <template slot-scope="scope">
332784038@qq.com's avatar
332784038@qq.com committed
349 350 351 352 353 354
          <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
355
          <!--lanbm 2024-05-26 添加的报价功能按钮,取消了权限控制-->
332784038@qq.com's avatar
332784038@qq.com committed
356 357
          <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
358 359 360 361
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
332784038@qq.com's avatar
332784038@qq.com committed
362 363 364 365 366
    <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>
    <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
367 368 369 370
  </div>
</template>

<script>
332784038@qq.com's avatar
332784038@qq.com committed
371 372 373 374 375 376 377 378 379 380 381 382 383 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"
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"
lanbaoming's avatar
lanbaoming committed
388
export default {
389
  name: "EcwMyCustomerServiceIndex",
lanbaoming's avatar
lanbaoming committed
390
  components: {
lanbaoming's avatar
lanbaoming committed
391 392
    Contacts,
    Template,
lanbaoming's avatar
lanbaoming committed
393 394 395
    upload,
    customerFollowList,
    customerComplaints,
lanbaoming's avatar
lanbaoming committed
396
    transferCustomer,
yujinyao's avatar
yujinyao committed
397 398
    AreaCodeSelector,
    CustomerSetting
lanbaoming's avatar
lanbaoming committed
399
  },
lanbaoming's avatar
lanbaoming committed
400 401
  computed: {
    isChinese() {
332784038@qq.com's avatar
332784038@qq.com committed
402
      return this.$i18n.locale === "zh_CN"
lanbaoming's avatar
lanbaoming committed
403
    },
余金瑶's avatar
余金瑶 committed
404 405 406 407 408 409 410
    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
411 412
          : ""
      }
余金瑶's avatar
余金瑶 committed
413
    },
yujinyao's avatar
yujinyao committed
414 415
    customerSelectFn() {
      if (this.recommended.length > 0) {
332784038@qq.com's avatar
332784038@qq.com committed
416
        let i = this.customerSelect.find((item) => item.id === this.recommended[0].id)
yujinyao's avatar
yujinyao committed
417
        if (!i) {
332784038@qq.com's avatar
332784038@qq.com committed
418
          this.customerSelect.push(this.recommended[0])
yujinyao's avatar
yujinyao committed
419
        }
332784038@qq.com's avatar
332784038@qq.com committed
420
        return this.customerSelect
yujinyao's avatar
yujinyao committed
421
      } else {
332784038@qq.com's avatar
332784038@qq.com committed
422
        return this.customerSelect
yujinyao's avatar
yujinyao committed
423 424 425 426 427 428 429 430 431
      }
    },
    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
432 433
        queryParams.beginCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[0]
        queryParams.endCustomerServiceConfirmedTime = this.customerServiceConfirmedTime[1]
yujinyao's avatar
yujinyao committed
434 435 436 437 438 439 440 441 442 443
      }
      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
444 445 446 447 448
        let key = "eqWeightYearly"
        if (this.weightYearly.key == "leNumberKey") {
          key = "leWeightYearly"
        } else if (this.weightYearly.key == "geNumberKey") {
          key = "geWeightYearly"
yujinyao's avatar
yujinyao committed
449
        }
332784038@qq.com's avatar
332784038@qq.com committed
450
        queryParams[key] = this.weightYearly.value
yujinyao's avatar
yujinyao committed
451 452
      }
      if (this.numYearly.value) {
332784038@qq.com's avatar
332784038@qq.com committed
453 454 455 456 457
        let key = "eqNumYearly"
        if (this.numYearly.key == "leNumberKey") {
          key = "leNumYearly"
        } else if (this.numYearly.key == "geNumberKey") {
          key = "geNumYearly"
yujinyao's avatar
yujinyao committed
458
        }
332784038@qq.com's avatar
332784038@qq.com committed
459
        queryParams[key] = this.numYearly.value
yujinyao's avatar
yujinyao committed
460 461
      }

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

    //获取用户id信息 lanbm 2024-05-23 add
    getUserProfile().then((res) => {
332784038@qq.com's avatar
332784038@qq.com committed
608 609 610
      this.userId = res.data.id
    })
    this.getCustomerSelect()
yujinyao's avatar
yujinyao committed
611
    getNodeList().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
612 613
      this.getNodeLists = r.data
    })
yujinyao's avatar
yujinyao committed
614
    listAllSimpl().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
615 616
      this.allSimplList = r.data
    })
yujinyao's avatar
yujinyao committed
617
    getProductTypeList().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
618 619
      this.productTypeList = r.data
    })
yujinyao's avatar
yujinyao committed
620
    competitorListAll().then((r) => {
332784038@qq.com's avatar
332784038@qq.com committed
621
      this.competitorList = r.data
yujinyao's avatar
yujinyao committed
622
    })
lanbaoming's avatar
lanbaoming committed
623
  },
yujinyao's avatar
yujinyao committed
624 625 626 627 628
  updated() {
    this.$nextTick(() => {
      this.$refs.multipleTable.doLayout()
    })
  },
lanbaoming's avatar
lanbaoming committed
629
  methods: {
lanbaoming's avatar
lanbaoming committed
630
    handleSelectionChange(val) {
332784038@qq.com's avatar
332784038@qq.com committed
631
      this.selectCustomerList = val.map((i) => i.id)
lanbaoming's avatar
lanbaoming committed
632
    },
lanbaoming's avatar
lanbaoming committed
633
    delay(row) {
332784038@qq.com's avatar
332784038@qq.com committed
634
      this.$router.push({ path: "/customer/delay", query: { id: row.id } })
lanbaoming's avatar
lanbaoming committed
635 636
    },
    countryFormatter(row, column, cellValue) {
332784038@qq.com's avatar
332784038@qq.com committed
637 638
      const country = this.countryList.find((e) => e.id === cellValue)
      return this.isChinese ? country?.nameZh : country?.nameEn
lanbaoming's avatar
lanbaoming committed
639 640 641
    },
    /** 查询列表 */
    getList() {
332784038@qq.com's avatar
332784038@qq.com committed
642
      this.loading = true
lanbaoming's avatar
lanbaoming committed
643
      // 处理查询参数
332784038@qq.com's avatar
332784038@qq.com committed
644 645
      let params = { ...this.queryParams, ...this.combinedQueryParams }
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, "createTime", false)
lanbaoming's avatar
lanbaoming committed
646
      // 执行查询
lanbaoming's avatar
lanbaoming committed
647
      getMyCustomerService(params).then((response) => {
332784038@qq.com's avatar
332784038@qq.com committed
648 649 650 651
        this.list = response.data.list
        this.total = response.data.total
        this.loading = false
      })
lanbaoming's avatar
lanbaoming committed
652
    },
yujinyao's avatar
yujinyao committed
653
    remoteMethod(val) {
332784038@qq.com's avatar
332784038@qq.com committed
654
      this.getCustomerSelect(val)
yujinyao's avatar
yujinyao committed
655 656
    },
    getCustomerSelect(val = "") {
332784038@qq.com's avatar
332784038@qq.com committed
657 658 659
      getCustomerSelect({ pageNo: 1, pageSize: 30, searchKey: val }).then((res) => {
        this.customerSelect = res.data.list
      })
yujinyao's avatar
yujinyao committed
660 661
    },
    handleSelectProductType(val) {
yujinyao's avatar
yujinyao committed
662 663 664 665
      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
666
        })
yujinyao's avatar
yujinyao committed
667 668 669 670
      } else {
        this.queryParams.productIds = []
        this.productList = []
      }
yujinyao's avatar
yujinyao committed
671
    },
lanbaoming's avatar
lanbaoming committed
672 673
    /** 取消按钮 */
    cancel() {
332784038@qq.com's avatar
332784038@qq.com committed
674 675
      this.open = false
      this.reset()
lanbaoming's avatar
lanbaoming committed
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713
    },
    /** 表单重置 */
    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
714 715 716
        weightUnit: undefined
      }
      this.resetForm("form")
lanbaoming's avatar
lanbaoming committed
717 718 719
    },
    /** 搜索按钮操作 */
    handleQuery() {
332784038@qq.com's avatar
332784038@qq.com committed
720 721
      this.queryParams.pageNo = 1
      this.getList()
lanbaoming's avatar
lanbaoming committed
722 723 724
    },
    /** 重置按钮操作 */
    resetQuery() {
332784038@qq.com's avatar
332784038@qq.com committed
725
      this.dateRangeCreateTime = []
yujinyao's avatar
yujinyao committed
726 727 728
      this.enterOpenSeaTime = []
      this.customerServiceConfirmedTime = []
      this.firstDealTime = []
332784038@qq.com's avatar
332784038@qq.com committed
729
      this.resetForm("queryForm")
lanbaoming's avatar
lanbaoming committed
730 731
      this.queryParams = {
        pageNo: 1,
332784038@qq.com's avatar
332784038@qq.com committed
732 733 734 735 736
        pageSize: 10
      }
      this.weightYearly.value = ""
      this.numYearly.value = ""
      this.handleQuery()
lanbaoming's avatar
lanbaoming committed
737 738 739
    },
    /** 新增按钮操作 */
    handleAdd() {
lanbaoming's avatar
lanbaoming committed
740 741
      this.$router.push({
        path: "/customer/add-edit/0",
332784038@qq.com's avatar
332784038@qq.com committed
742 743
        query: { isCustomerServiceConfirmed: true }
      })
lanbaoming's avatar
lanbaoming committed
744 745 746 747 748 749
      // this.reset();
      // this.open = true;
      // this.title = this.$t("添加客户");
    },
    /** 查看按钮操作 */
    handleView(row) {
332784038@qq.com's avatar
332784038@qq.com committed
750
      this.$router.push("/customer/query/" + row.id)
lanbaoming's avatar
lanbaoming committed
751 752 753
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
332784038@qq.com's avatar
332784038@qq.com committed
754
      this.$router.push("/customer/add-edit/" + row.id)
lanbaoming's avatar
lanbaoming committed
755 756 757 758 759 760 761 762
      // 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
763 764 765 766 767
    //报价
    quote(row) {
      //lanbm 2024-05-26 添加的报价功能按钮
      // 添加报价是判断客户所属客户经理,不是就不能报价
      if (row.customerService != this.userId) {
332784038@qq.com's avatar
332784038@qq.com committed
768 769
        this.$message.error(this.$t("此客户属于其他客户经理名下的客户。"))
        return
lanbaoming's avatar
lanbaoming committed
770 771
      }
      //this.$router.push({path:'/offer/create',query:{id:row.id}})
332784038@qq.com's avatar
332784038@qq.com committed
772 773 774 775

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