index.vue 26.9 KB
Newer Older
1 2 3 4 5
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
dcy's avatar
dcy committed
6
      <el-form-item :label="$t('客户编号')" prop="number">
Marcus's avatar
Marcus committed
7
        <el-input v-model="queryParams.number" :placeholder="$t('请输入客户编号')" clearable @keyup.enter.native="handleQuery"/>
8
      </el-form-item>
dcy's avatar
dcy committed
9
      <el-form-item :label="$t('客户名称')" prop="name">
Marcus's avatar
Marcus committed
10
        <el-input v-model="queryParams.name" :placeholder="$t('请输入客户名称')" clearable @keyup.enter.native="handleQuery"/>
11
      </el-form-item>
dcy's avatar
dcy committed
12 13 14
      <el-form-item :label="$t('客户等级')" prop="level">
        <el-select clearable  v-model="queryParams.level" :placeholder="$t('请选择客户等级')" clearable size="small">
          <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_LEVEL)"
15
                     :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value"/>
16 17
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
18 19 20 21
      <el-form-item :label="$t('联系方式')">
        <el-input :placeholder="$t('请输入联系方式')" v-model="queryParams.defaultContactPhone"></el-input>
      </el-form-item>
      <el-form-item :label="$t('客户类别')" prop="level">
dcy's avatar
dcy committed
22
        <dict-selector :type="DICT_TYPE.CUSTOMER_TYPE"   v-model="queryParams.type"></dict-selector>
dcy's avatar
dcy committed
23 24 25 26 27
      </el-form-item>
      <el-form-item :label="$t('客户经理')" prop="customerService">
        <el-select clearable  v-model="queryParams.customerService" :placeholder="$t('请选择客户经理')" clearable size="small">
          <el-option v-for="dict in customerServiceList"
                     :key="dict.id" :label="dict.nickname" :value="dict.id"/>
28 29
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
30 31 32
      <el-form-item :label="$t('客户来源')" prop="source">
        <el-select clearable  v-model="queryParams.source" :placeholder="$t('请选择客户来源')" clearable size="small">
          <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_SOURCE)"
33
                     :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value"/>
34 35
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
36 37 38
      <el-form-item :label="$t('国家')" prop="source">
        <el-select clearable  v-model="form.country" :placeholder="$t('请选择国家')">
          <el-option v-for="dict in countryList"
39
                     :key="dict.id" :label=" isChinese ? dict.nameZh : dict.nameEn" :value="parseInt(dict.id)" />
40 41
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
42 43 44
      <el-form-item :label="$t('客户状态')" prop="status">
        <el-select clearable  v-model="queryParams.status" :placeholder="$t('请选择客户状态')" clearable size="small">
          <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_STATUS)"
45
                     :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value"/>
dcy's avatar
dcy committed
46
        </el-select>
47
      </el-form-item>
dcy's avatar
dcy committed
48
      <el-form-item :label="$t('创建时间')">
49 50
        <el-date-picker clearable  v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="datetimerange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
dcy's avatar
dcy committed
51 52
      </el-form-item>
      <el-form-item :label="$t('信用等级')" prop="department">
dcy's avatar
dcy committed
53
        <el-select clearable  v-model="queryParams.creditLevel" >
54
          <el-option  v-for="(item,index) in creditList" :label=" isChinese ? item.nameZh : item.nameEn" :key="index" :value="item.id" ></el-option>
dcy's avatar
dcy committed
55
        </el-select>
56
      </el-form-item>
57 58 59
      <el-form-item  :label="$t('市场获客')" prop="department">
        <dict-selector clearable  :type="DICT_TYPE.ECW_CUSTOMER_RESOURCE_TYPE" v-model="queryParams.marketType" formatter="number"></dict-selector>
      </el-form-item>
60
      <el-form-item>
dcy's avatar
dcy committed
61 62
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
63 64 65 66 67
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
68 69
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="$router.push({path:'/customer/add-edit/0',query:{isCustomerServiceConfirmed:true,}})"
邓春圆's avatar
邓春圆 committed
70
                   v-hasPermi="['ecw:customer: treat-create']">{{$t('新增')}}</el-button>
71
      </el-col>
72 73
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
邓春圆's avatar
邓春圆 committed
74
                   v-hasPermi="['ecw:customer:treat-export']">{{$t('导出')}}</el-button>
75
      </el-col>
76 77 78 79 80
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
81 82 83 84 85
      <el-table-column :label="$t('客户编号')" align="center" prop="number" >
        <template v-slot="{row}">
            {{row.number}}
        </template>
      </el-table-column>
86 87
      <el-table-column :label="$t('客户名称')" align="center" prop="name" >
        <template v-slot="{row}">
88
          <p style="display:inline-block;white-space: pre-wrap;">{{$l(row, 'name')}}</p>
89 90
        </template>
      </el-table-column>
dcy's avatar
dcy committed
91
      <el-table-column :label="$t('客户等级')" align="center" prop="vipLevelNameZh">
92 93 94 95
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL" :value="scope.row.level" />
        </template>
      </el-table-column>
邓春圆's avatar
邓春圆 committed
96
      <el-table-column :label="$t('信用等级')" :prop="isChinese ? 'creditLevelNameZh' : 'creditLevelNameEn'"></el-table-column>
dcy's avatar
dcy committed
97
      <el-table-column :label="$t('客户状态')" align="center" prop="status">
98 99 100 101
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
dcy's avatar
dcy committed
102
      <el-table-column :label="$t('主联系人')" prop="defaultContactName"></el-table-column>
dcy's avatar
dcy committed
103
      <el-table-column :label="$t('主联系方式')" prop="defaultContactPhone">
104 105 106 107 108 109
        <template v-slot="{row}">
          +{{row.defaultContactPhone}} <br/>
          <contacts :id="row.id" >
            <el-button  type="text">更多</el-button>
          </contacts>
        </template>
dcy's avatar
dcy committed
110
      </el-table-column>
dcy's avatar
dcy committed
111
      <el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="180">
112 113 114 115
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
116 117 118 119 120
      <el-table-column :label="$t('分配时间')" align="center" prop="createTime" width="180">
        <template  v-slot = {row}>
          <span>{{ parseTime(row.customerServiceAssignedTime ) }}</span>
        </template>
      </el-table-column>
邓春圆's avatar
邓春圆 committed
121
      <el-table-column :label="$t('客户经理')" align="center" prop="customerServiceName">
dcy's avatar
dcy committed
122 123
      </el-table-column>
      <el-table-column :label="$t('国家')" align="center" prop="country" :formatter="countryFormatter"></el-table-column>
dcy's avatar
dcy committed
124
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
125
        <template slot-scope="scope">
126 127 128
          <router-link :to="'/customer/query/' + scope.row.id">
            <el-button v-has-permi="['ecw:customer:treat-view']" size="mini" style="margin-right: 10px" type="text" >查看</el-button>
          </router-link>
dcy's avatar
dcy committed
129
          <el-button size="mini" type="text"  @click="handleConfirmService(scope.row)"
邓春圆's avatar
邓春圆 committed
130
                     v-hasPermi="['ecw:customer:treat-accept']">{{$t('确认接收')}}</el-button>
dcy's avatar
dcy committed
131
          <el-button size="mini" type="text"  @click="handOver(scope.row)"
邓春圆's avatar
邓春圆 committed
132
                     v-hasPermi="['ecw:customer:treat-transfer']">{{$t('移交')}}</el-button>
dcy's avatar
dcy committed
133
           <router-link style="margin: 0 10px;" to="/offer/create">
邓春圆's avatar
邓春圆 committed
134
             <el-button v-has-permi="['ecw:customer:treat-quoted-price']"  size="mini" type="text">
dcy's avatar
dcy committed
135 136 137
               {{$t('报价')}}
             </el-button>
           </router-link>
dcy's avatar
dcy committed
138
          <el-button size="mini" type="text"   @click="handleUpdate(scope.row)"
邓春圆's avatar
邓春圆 committed
139
                     v-hasPermi="['ecw:customer:treat-perfect']">{{$t('完善')}}</el-button>
邓春圆's avatar
邓春圆 committed
140
          <el-button  v-has-permi="['ecw:customer:treat-recovery']" size="mini"  type="text" @click="recovery(scope.row)" > {{$t('回收客户')}} </el-button>
141
        </template>
邓春圆's avatar
邓春圆 committed
142

143 144 145 146 147 148 149 150 151 152 153
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">

        <el-col :span="12">
dcy's avatar
dcy committed
154 155
          <el-form-item :label="$t('客户名称')" prop="name">
            <el-input v-model="form.name" :placeholder="$t('请输入客户名称')" />
156 157 158
          </el-form-item>
        </el-col>
        <el-col :span="12">
Marcus's avatar
Marcus committed
159
          <el-form-item :label="$t('国家')" prop="country">
dcy's avatar
dcy committed
160
            <el-select v-model="form.country" :placeholder="$t('请选择国家')">
161 162 163 164 165 166
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
                         :key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
167 168
          <el-form-item :label="$t('客户等级')" prop="level">
            <el-select v-model="form.level" :placeholder="$t('请选择客户等级')">
169
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_LEVEL)"
170
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
171 172 173 174
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
175 176
          <el-form-item :label="$t('所属代理')" prop="agentId">
            <el-select v-model="form.agentId" :placeholder="$t('请选择所属代理')">
177
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
178
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
179 180 181 182
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
183 184
          <el-form-item :label="$t('联系地址')" prop="address">
            <el-input v-model="form.address" :placeholder="$t('请输入联系地址')" />
185 186 187
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
188 189
          <el-form-item :label="$t('客户类别')" prop="type">
            <el-select v-model="form.type" :placeholder="$t('请选择客户类别')">
190
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_TYPE)"
191
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="dict.value" />
192 193 194 195
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
196 197 198
          <el-form-item :label="$t('常用提货网点')" prop="pickupPoint">
            <el-select v-model="form.pickupPoint" :placeholder="$t('请输入常用提货网点')">
              <el-option :label="$t('请选择字典生成')" value="" />
199 200 201 202 203
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
204 205
          <el-form-item :label="$t('公司名称')" prop="company">
            <el-input v-model="form.company" :placeholder="$t('请输入公司名称')" />
206 207 208 209
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
210 211
          <el-form-item :label="$t('客户生日')" prop="birthday">
            <el-input v-model="form.birthday" :placeholder="$t('请输入客户生日')" />
212 213 214
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
215 216 217
          <el-form-item :label="$t('产品类型')" prop="productType">
            <el-select v-model="form.productType" :placeholder="$t('请选择产品类型')">
              <el-option :label="$t('请选择字典生成')" value="" />
218 219
            </el-select>
          </el-form-item>
dcy's avatar
dcy committed
220 221
          <el-form-item :label="$t('产品id')" prop="productId">
            <el-input v-model="form.productId" :placeholder="$t('请输入产品id')" />
222 223 224 225
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
226 227
          <el-form-item :label="$t('客户来源')" prop="source">
            <el-select v-model="form.source" :placeholder="$t('请选择客户来源')">
228
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_SOURCE)"
229
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
230 231 232 233 234
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
235 236
          <el-form-item :label="$t('结算方式')" prop="balance">
            <el-select v-model="form.balance" :placeholder="$t('请选择结算方式')">
237
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_BALANCE)"
238
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
239 240 241 242 243
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
244 245
          <el-form-item :label="$t('客户经理')" prop="customerService">
            <el-select v-model="form.customerService" :placeholder="$t('请选择客户经理')">
246 247
              <el-option v-for="dict in serviceStaffOptions"
                         :key="dict.id" :label="dict.nickname" :value="dict.id" />
248 249 250 251 252
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">

dcy's avatar
dcy committed
253 254
          <el-form-item :label="$t('图片')" prop="picture">
            <el-input v-model="form.picture" :placeholder="$t('请输入图片')" />
255 256 257 258
          </el-form-item>

        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
259 260
          <el-form-item :label="$t('客户状态')" prop="status">
            <el-select v-model="form.status" :placeholder="$t('请选择客户状态')">
261
              <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_STATUS)"
262
                         :key="dict.value" :label="isChinese ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
263 264 265 266
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
267 268
          <el-form-item :label="$t('推介人')" prop="promoter">
            <el-input v-model="form.promoter" :placeholder="$t('请输入推介人')" />
269 270 271
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
272 273
          <el-form-item :label="$t('创建人')" prop="founder">
            <el-input v-model="form.founder" :placeholder="$t('请输入创建人')" />
274 275 276
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
277 278
          <el-form-item :label="$t('创建时间')" prop="founder">
            <el-input v-model="form.founder" :placeholder="$t('请输入创建人')" />
279 280 281
          </el-form-item>
        </el-col>
        <el-col :span="12">
dcy's avatar
dcy committed
282 283
          <el-form-item :label="$t('备注')" prop="remarks">
            <el-input v-model="form.remarks" :placeholder="$t('请输入备注')" />
284 285 286
          </el-form-item>
        </el-col>
        <el-col :span="24">
dcy's avatar
dcy committed
287
          <el-form-item :label="$t('到仓确认')" prop="arrivalConfirm">
288 289 290 291
            <el-switch v-model="form.arrivalConfirm" :active-value="0" :inactive-value="1" />
          </el-form-item>
        </el-col>
        <el-col :span="24">
dcy's avatar
dcy committed
292 293
          <el-form-item :label="$t('重货标准(CBM)')" prop="weightUnit">
            <el-input v-model="form.weightUnit" :placeholder="$t('请输入重货标准(CBM)')" />
294 295 296 297 298 299
          </el-form-item>
        </el-col>




dcy's avatar
dcy committed
300 301
        <el-form-item :label="$t('关联会员账号')" prop="memberId">
          <el-input v-model="form.memberId" :placeholder="$t('请输入关联会员账号')" />
302 303
        </el-form-item>

dcy's avatar
dcy committed
304 305
        <el-form-item :label="$t('部门')" prop="department">
          <el-input v-model="form.department" :placeholder="$t('请输入部门')" />
306
        </el-form-item>
dcy's avatar
dcy committed
307 308
        <el-form-item :label="$t('发票抬头')" prop="invoiceTitle">
          <el-input v-model="form.invoiceTitle" :placeholder="$t('请输入发票抬头')" />
309
        </el-form-item>
dcy's avatar
dcy committed
310 311
        <el-form-item :label="$t('纳税人识别号')" prop="licenseNumber">
          <el-input v-model="form.licenseNumber" :placeholder="$t('请输入纳税人识别号')" />
312
        </el-form-item>
dcy's avatar
dcy committed
313 314
        <el-form-item :label="$t('开户行')" prop="bank">
          <el-input v-model="form.bank" :placeholder="$t('请输入开户行')" />
315
        </el-form-item>
dcy's avatar
dcy committed
316 317
        <el-form-item :label="$t('账户')" prop="bankNumber">
          <el-input v-model="form.bankNumber" :placeholder="$t('请输入账户')" />
318
        </el-form-item>
dcy's avatar
dcy committed
319 320
        <el-form-item :label="$t('项目')" prop="project">
          <el-input v-model="form.project" :placeholder="$t('请输入项目')" />
321
        </el-form-item>
dcy's avatar
dcy committed
322 323
        <el-form-item :label="$t('开票地址')" prop="billingAddress">
          <el-input v-model="form.billingAddress" :placeholder="$t('请输入开票地址')" />
324
        </el-form-item>
dcy's avatar
dcy committed
325 326
        <el-form-item :label="$t('开票电话')" prop="billingTell">
          <el-input v-model="form.billingTell" :placeholder="$t('请输入开票电话')" />
327
        </el-form-item>
dcy's avatar
dcy committed
328 329
        <el-form-item :label="$t('税率')" prop="taxRate">
          <el-input v-model="form.taxRate" :placeholder="$t('请输入税率')" />
330 331 332
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
dcy's avatar
dcy committed
333 334
        <el-button type="primary" @click="submitForm">{{$t('确 定')}}</el-button>
        <el-button @click="cancel">{{$t('取 消')}}</el-button>
335 336 337 338 339 340 341
      </div>
    </el-dialog>

    <!-- 移交 -->
    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="title" :visible.sync="openHandOver" width="500px" append-to-body>
      <el-form ref="handOverForm" :model="handOverForm" :rules="rules" label-width="80px">
dcy's avatar
dcy committed
342 343
        <el-form-item :label="$t('客户经理')" prop="customerServiceId">
          <el-select v-model="handOverForm.customerServiceId" :placeholder="$t('请选择客户经理')" clearable filterable>
344 345 346 347 348 349 350
            <el-option v-for="user in serviceStaffOptions"
                       :key="user.id" :value="user.id"
                       :label="user.nickname" />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
dcy's avatar
dcy committed
351 352
        <el-button type="primary" @click="submitHandOverForm">{{$t('确 定')}}</el-button>
        <el-button @click="cancelHandOver">{{$t('取 消')}}</el-button>
353 354
      </div>
    </el-dialog>
邓春圆's avatar
邓春圆 committed
355
    <transfer-customer :show.sync="openHandOver" :customer-ids.sync="handOverForm.customerIdList"></transfer-customer>
356 357 358 359
  </div>
</template>

<script>
360 361 362 363 364 365
import {
  updateCustomer,
  getCustomer,
  exportCustomerExcel,
  getWaitForConfirmList,
  confirm,
邓春圆's avatar
邓春圆 committed
366
  waiteConfirmExportExcel, waiteConfirEexportExcel, recycleUnconfirmedCustomer
367
} from "@/api/ecw/customer";
368 369 370 371
import { listServiceUser } from "@/api/system/user"
import { getDictDatas, DICT_TYPE } from '@/utils/dict'
import {CommonStatusEnum} from '@/utils/constants'
import {handOverCustomer} from "../../../api/ecw/customer";
dcy's avatar
dcy committed
372 373
import {getCountryListAll} from "@/api/ecw/country";
import {getCreditPage} from "@/api/customer/credit";
邓春圆's avatar
邓春圆 committed
374
import transferCustomer from "@/views/ecw/customer/transferCustomer.vue";
375
import Contacts from "@/views/ecw/customer/components/contacts.vue";
376 377 378 379



export default {
380 381 382 383
  name: "EcwCustomerconfirmIndex",
  activated() {
    this.getList();
  },
邓春圆's avatar
邓春圆 committed
384
  computed:{
385 386 387
    DICT_TYPE() {
      return DICT_TYPE
    },
邓春圆's avatar
邓春圆 committed
388 389 390 391
    isChinese(){
      return this.$i18n.locale === 'zh_CN'
    },
  },
392
  components: {
393
    Contacts,
邓春圆's avatar
邓春圆 committed
394
    transferCustomer
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openHandOver: false,
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        number: null,
        name: null,
        level: null,
        source: null,
        customerService: null,
        status: null,
        department: null,
dcy's avatar
dcy committed
425 426
        creditLevel:null,
        country:null,
427
        marketType:null,
428 429 430 431 432 433
      },
      // 表单参数
      form: {},
      handOverForm: {},
      // 表单校验
      rules: {
dcy's avatar
dcy committed
434 435
        name: [{ required: true, message: this.$t('客户名称不能为空'), trigger: "blur" }],
        weightUnit: [{ required: true, message: this.$t('重货标准(CBM)不能为空'), trigger: "blur" }],
436 437
      },

dcy's avatar
dcy committed
438 439 440 441
      serviceStaffOptions: [],
      customerServiceList:[],
      countryList:[],
      creditList:[]
442 443 444 445
    };
  },
  created() {
    this.getList();
dcy's avatar
dcy committed
446 447 448
    getCreditPage({page:1,rows:999}).then(r => {
      this.creditList = r.data.list
    })
449 450 451 452
    // 获得客服人员列表
    listServiceUser().then(response => {
      this.serviceStaffOptions = response.data;
    })
dcy's avatar
dcy committed
453 454 455 456 457 458
    listServiceUser().then(r=>{
      this.customerServiceList = r.data;
    })
    getCountryListAll().then(r => {
      this.countryList = r.data
    })
459 460
  },
  methods: {
邓春圆's avatar
邓春圆 committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474
    recovery(row){
      console.log(row,'row')
      this.$confirm(this.$t('是否要回收当前{name}',row), '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        recycleUnconfirmedCustomer({customerId:row.id}).then(r =>{
          this.$message.success(this.$t('回收成功。'))
        })
      }).catch(() => {
        this.$message.info(this.$t('已取消'))
      });
    },
475
    getDictDatas,
dcy's avatar
dcy committed
476 477
    countryFormatter(row, column, cellValue) {
      const country = this.countryList.find((e) => e.id === cellValue)
邓春圆's avatar
邓春圆 committed
478
      return this.isChinese ? country?.nameZh : country?.nameEn
dcy's avatar
dcy committed
479
    },
480 481 482 483 484
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
485
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime', false);
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
      // 执行查询
      getWaitForConfirmList(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    /** 取消按钮 */
    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,
        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");
    },
    /** 表单重置 */
    resetHandOverForm() {
      this.form = {
540
        customerIdList: undefined,
541 542 543 544 545 546 547 548 549 550 551 552 553
        customerServiceId: undefined
      };
      this.resetForm("handOverForm");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
dcy's avatar
dcy committed
554 555 556 557 558 559 560 561 562 563 564 565 566
      this.queryParams = {
        pageNo: 1,
        pageSize: 10,
        number: null,
        name: null,
        level: null,
        source: null,
        customerService: null,
        status: null,
        department: null,
        creditLevel:null,
        country:null,
      }
567 568 569 570 571 572
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
dcy's avatar
dcy committed
573
      this.title = this.$t('添加客户');
574 575 576 577 578
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
579
      this.$router.push({path:'/customer/perfect/'+id,query:{isCustomerServiceConfirmed:true,}});
580 581 582
      // getCustomer(id).then(response => {
      //   this.form = response.data;
      //   this.open = true;
Marcus's avatar
Marcus committed
583
      //   this.title = this.$t("完善客户");
584
      // });
585 586 587 588
    },
    /** 修改按钮操作 */
    handleConfirmService(row) {
      const id = row.id;
dcy's avatar
dcy committed
589
      this.$modal.confirm(this.$t('是否确认接收客户')+'["' + row.name + '"]?').then(function() {
590 591 592
        return confirm({"customerId": id});
      }).then(() => {
        this.getList();
dcy's avatar
dcy committed
593
        this.$modal.msgSuccess(this.$t('接收成功'));
594 595 596 597 598
      }).catch(() => {});

    },
    /** 修改按钮操作 */
    handOver(row) {
邓春圆's avatar
邓春圆 committed
599
      // this.resetHandOverForm();
600
      this.openHandOver = true;
邓春圆's avatar
邓春圆 committed
601

602
      this.handOverForm.customerIdList   = [row.id];
603 604 605 606 607 608 609 610 611 612 613
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
        // 修改的提交
        if (this.form.id != null) {
          updateCustomer(this.form).then(response => {
dcy's avatar
dcy committed
614
            this.$modal.msgSuccess(this.$t('修改成功'));
615 616 617 618 619 620 621 622 623 624
            this.open = false;
            this.getList();
          });
          return;
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
dcy's avatar
dcy committed
625
      this.$modal.confirm(this.$t('是否确认删除客户编号为"') + id + this.$t('"的数据项?')).then(function() {
626 627 628
          return deleteCustomer(id);
        }).then(() => {
          this.getList();
dcy's avatar
dcy committed
629
          this.$modal.msgSuccess(this.$t('删除成功'));
630 631 632 633 634
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
邓春圆's avatar
邓春圆 committed
635 636 637 638
      // let params = {...this.queryParams};
      // params.pageNo = undefined;
      // params.pageSize = undefined;
      // this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
639
      // 执行导出
640
      this.$modal.confirm(this.$t('是否确认导出我的待接受客户数据项?')).then(() => {
邓春圆's avatar
邓春圆 committed
641 642 643
        waiteConfirEexportExcel().then(()=>{
          this.$message.success(this.$t('已加入导出队列,请稍后在下载日志中下载'))
        })
644 645 646 647 648 649 650 651 652
        }).catch(() => {});
    },



    /** 提交按钮 */
    submitHandOverForm() {
      // 移交的提交
      handOverCustomer(this.handOverForm).then(response => {
dcy's avatar
dcy committed
653
        this.$modal.msgSuccess(this.$t('移交成功'));
654 655 656 657 658 659 660 661 662 663
        this.openHandOver = false;
        this.getList();
      });
    },

    /** 取消按钮 */
    cancelHandOver() {
      this.openHandOver = false;
      this.handOverForm = {
        customerId: undefined,
664
        customerIdList : undefined
665 666 667 668 669 670
      };
    },

  }
};
</script>