index.vue 23.6 KB
Newer Older
yanghao's avatar
yanghao committed
1 2 3 4
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
5
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch && !!!customerId" label-width="68px">
dcy's avatar
dcy committed
6
      <el-form-item :label="$t('客户名称')" prop="customerId">
dcy's avatar
dcy committed
7
       <customer-select v-model="queryParams.customerId" ></customer-select>
yanghao's avatar
yanghao committed
8
      </el-form-item>
dcy's avatar
dcy committed
9 10
      <el-form-item :label="$t('投诉类型')" prop="type">
        <el-select v-model="queryParams.type" :placeholder="$t('请选择投诉类型')" clearable size="small">
邓春圆's avatar
邓春圆 committed
11 12
          <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_COMPLAINT_TYPE)"
                       :key="dict.value" :label="$i18n.locale === 'zh_CN' ? dict.label : dict.labelEn" :value="dict.value"/>
yanghao's avatar
yanghao committed
13 14
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
15 16
      <el-form-item :label="$t('订单号')" prop="orderId">
        <el-input v-model="queryParams.orderId" :placeholder="$t('请输入订单号')" clearable @keyup.enter.native="handleQuery"/>
yanghao's avatar
yanghao committed
17
      </el-form-item>
dcy's avatar
dcy committed
18 19
      <el-form-item :label="$t('提单号')" prop="ladingbillId">
        <el-input v-model="queryParams.ladingbillId" :placeholder="$t('请输入提单号')" clearable @keyup.enter.native="handleQuery"/>
yanghao's avatar
yanghao committed
20
      </el-form-item>
dcy's avatar
dcy committed
21 22
      <el-form-item :label="$t('处理状态')" prop="status">
        <el-select v-model="queryParams.status" :placeholder="$t('请选择处理状态')" clearable size="small">
yanghao's avatar
yanghao committed
23
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.CUSTOMER_COMPLAINT_STATUS)"
24
                       :key="dict.value" :label=" isChinese ? dict.label : dict.labelEn" :value="dict.value"/>
yanghao's avatar
yanghao committed
25 26
        </el-select>
      </el-form-item>
dcy's avatar
dcy committed
27 28
      <el-form-item :label="$t('投诉编号')" prop="code">
        <el-input v-model="queryParams.code" :placeholder="$t('请输入投诉编号')" clearable @keyup.enter.native="handleQuery"/>
yanghao's avatar
yanghao committed
29
      </el-form-item>
dcy's avatar
dcy committed
30
      <el-form-item :label="$t('创建时间')">
yanghao's avatar
yanghao committed
31
        <el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
dcy's avatar
dcy committed
32
                        type="daterange" range-separator="-" :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
yanghao's avatar
yanghao committed
33 34
      </el-form-item>
      <el-form-item>
dcy's avatar
dcy committed
35 36
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
yanghao's avatar
yanghao committed
37 38 39 40
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
41
    <el-row :gutter="10" v-show="!!!customerId" class="mb8">
yanghao's avatar
yanghao committed
42 43
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
dcy's avatar
dcy committed
44
                   v-hasPermi="['ecw:customer-complaint:create']">{{$t('新增')}}</el-button>
yanghao's avatar
yanghao committed
45 46 47
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
dcy's avatar
dcy committed
48
                   v-hasPermi="['ecw:customer-complaint:export']">{{$t('导出')}}</el-button>
yanghao's avatar
yanghao committed
49 50 51 52 53 54
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
dcy's avatar
dcy committed
55
      <el-table-column :label="$t('投诉编号')" align="center" prop="code" >
dcy's avatar
dcy committed
56 57 58 59 60 61
      </el-table-column>
      <el-table-column :label="$t('投诉类型')" align="center" prop="type">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_COMPLAINT_TYPE" :value="scope.row.type" />
        </template>
      </el-table-column>
dcy's avatar
dcy committed
62
      <el-table-column :label="$t('客户名称')" align="center" >
yanghao's avatar
yanghao committed
63 64 65 66
        <template slot-scope="scope">
          <div>{{ formatCustomerName(scope.row.customerId) }}</div>
        </template>
      </el-table-column>
dcy's avatar
dcy committed
67
      <el-table-column :label="$t('投诉日期')" align="center"  width="180">
yanghao's avatar
yanghao committed
68
        <template slot-scope="scope">
dcy's avatar
dcy committed
69
          <span>{{ parseTime(scope.row.createTime)}}</span>
yanghao's avatar
yanghao committed
70 71
        </template>
      </el-table-column>
dcy's avatar
dcy committed
72 73 74
      <el-table-column :label="$t('登记客服')" align="center" prop="adminNickname">
      </el-table-column>
      <el-table-column :label="$t('状态')" align="center" prop="status">
yanghao's avatar
yanghao committed
75 76 77 78
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.CUSTOMER_COMPLAINT_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
dcy's avatar
dcy committed
79 80 81
      <el-table-column :label="$t('提单号')" align="center" prop="ladingbillId" />
      <el-table-column :label="$t('订单号')" align="center" prop="orderId" />
      <el-table-column :label="$t('处理时间')" align="center" prop="handleAt" width="180">
yanghao's avatar
yanghao committed
82
        <template slot-scope="scope">
dcy's avatar
dcy committed
83 84 85 86 87
          <span>{{ parseTime(scope.row.handleAt)}}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('赔付金额')" align="center" prop="handleAt" width="180">
        <template slot-scope="scope">
dcy's avatar
dcy committed
88
          {{ scope.row.status === 3 ?  scope.row.indemnity  : '/'}}
我在何方's avatar
我在何方 committed
89
          <span v-if="scope.row.status === 3">{{getCurrencyLabel(scope.row.currencyUnit)}}</span>
yanghao's avatar
yanghao committed
90 91
        </template>
      </el-table-column>
dcy's avatar
dcy committed
92
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
yanghao's avatar
yanghao committed
93 94
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
dcy's avatar
dcy committed
95
                     v-hasPermi="['ecw:customer-complaint:update']">{{$t('修改')}}</el-button>
黄卓's avatar
黄卓 committed
96
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleHandle(scope.row)"
dcy's avatar
dcy committed
97
                     v-hasPermi="['ecw:customer-complaint:update']" v-show="scope.row.status != 3">{{$t('处理')}}</el-button>
yanghao's avatar
yanghao committed
98
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
dcy's avatar
dcy committed
99 100
                     v-hasPermi="['ecw:customer-complaint:delete']">{{$t('删除')}}</el-button>
           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleSee(scope.row)">{{$t('查看')}}</el-button>
yanghao's avatar
yanghao committed
101 102 103 104 105 106 107 108
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

    <!-- 对话框(添加 / 修改) -->
Marcus's avatar
Marcus committed
109
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
yanghao's avatar
yanghao committed
110
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
我在何方's avatar
我在何方 committed
111 112
        <div class="formShow">
          <div>
dcy's avatar
dcy committed
113
          <el-form-item :label="$t('客户名称')" prop="customerId">
dcy's avatar
dcy committed
114
            <customer-select v-model="form.customerId" ></customer-select>
我在何方's avatar
我在何方 committed
115
          </el-form-item>
dcy's avatar
dcy committed
116 117
          <el-form-item :label="$t('投诉类型')" prop="type">
            <el-select v-model="form.type" :placeholder="$t('请选择投诉类型')">
我在何方's avatar
我在何方 committed
118
              <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_COMPLAINT_TYPE)"
邓春圆's avatar
邓春圆 committed
119
                         :key="dict.value" :label="$i18n.locale === 'zh_CN' ? dict.label : dict.labelEn" :value="parseInt(dict.value)" />
我在何方's avatar
我在何方 committed
120 121
            </el-select>
          </el-form-item>
dcy's avatar
dcy committed
122
          <el-form-item :label="$t('订单号')" prop="orderId">
我在何方's avatar
我在何方 committed
123 124 125 126
            <el-select
              v-model="form.orderId"
              filterable
              remote
dcy's avatar
dcy committed
127
              :placeholder="$t('请输入订单号')"
我在何方's avatar
我在何方 committed
128 129 130 131 132 133 134 135 136 137
              :remote-method="getOrderList"
              :loading="loading">
              <el-option
                v-for="item in orderList"
                :key="item.value"
                :label="item.value"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
dcy's avatar
dcy committed
138
          <el-form-item :label="$t('提单号')" prop="ladingbillId">
我在何方's avatar
我在何方 committed
139 140 141 142
            <el-select
              v-model="form.ladingbillId"
              filterable
              remote
dcy's avatar
dcy committed
143
              :placeholder="$t('请输入提单号')"
我在何方's avatar
我在何方 committed
144 145 146 147 148 149 150 151 152 153 154 155
              :remote-method="getBillList"
              :loading="loading">
              <el-option
                v-for="item in billList"
                :key="item.value"
                :label="item.value"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          </div>
          <div v-if="form.id">
dcy's avatar
dcy committed
156
            <el-form-item :label="$t('投诉时间')">
我在何方's avatar
我在何方 committed
157 158
                <span>{{parseTime(form.createTime)}}</span>
            </el-form-item>
dcy's avatar
dcy committed
159
            <el-form-item :label="$t('投诉状态')">
我在何方's avatar
我在何方 committed
160 161 162 163 164
              <dict-selector :type="DICT_TYPE.CUSTOMER_COMPLAINT_STATUS" :disabled="true" form-type="radio" v-model="form.status" :filter="(e) => e.value == '1' ||e.value == '2' || e.value == '3'"
                             :formatter="Number"></dict-selector>
            </el-form-item>
          </div>
        </div>
dcy's avatar
dcy committed
165 166
        <el-form-item :label="$t('投诉内容')" prop="content">
          <el-input v-model="form.content" type="textarea" :placeholder="$t('请输入内容')" />
yanghao's avatar
yanghao committed
167
        </el-form-item>
dcy's avatar
dcy committed
168 169
        <el-form-item v-show="form.status == '2'||form.status == '3'" :label="$t('查明原因')" required>
          <el-input type="textarea" :placeholder="$t('请输入查明原因')" v-model="form.ascertainReason"></el-input>
yanghao's avatar
yanghao committed
170
        </el-form-item>
dcy's avatar
dcy committed
171 172
        <el-form-item v-show="form.status == '2'||form.status == '3'" :label="$t('处理方案')">
          <el-input v-model="form.plan" :placeholder="$t('请输入处理方案')"></el-input>
yanghao's avatar
yanghao committed
173
        </el-form-item>
我在何方's avatar
我在何方 committed
174

dcy's avatar
dcy committed
175 176
        <el-form-item v-show="form.status == '3'" :label="$t('处理结果')" required>
          <el-input type="textarea" :placeholder="$t('请输入处理结果')" v-model="form.result"></el-input>
yanghao's avatar
yanghao committed
177
        </el-form-item>
dcy's avatar
dcy committed
178 179
       <el-form-item v-show="form.status == '3'" :label="$t('赔付金额')">
         <el-input v-model="form.indemnity" :placeholder="$t('请输入赔付金额')">
我在何方's avatar
我在何方 committed
180
            <el-select slot="append" defaultable v-model="form.currencyUnit" :placeholder="$t('请选择货币单位')" style="width: 110px">
邓春圆's avatar
邓春圆 committed
181
              <el-option v-for="item in currencyList" :key="item.id" :label="isChinese ? item.titleZh : item.titleEn " :value="item.id" />
我在何方's avatar
我在何方 committed
182
            </el-select>
我在何方's avatar
我在何方 committed
183 184
         </el-input>
       </el-form-item>
dcy's avatar
dcy committed
185
        <el-form-item v-show="form.status == '3'" :label="$t('处理时间')" required>
我在何方's avatar
我在何方 committed
186
          <span>{{parseTime(form.handleAt)}}</span>
yanghao's avatar
yanghao committed
187
        </el-form-item>
Marcus's avatar
Marcus committed
188
 <!--       <el-form-item :label="$t('处理状态')" prop="status" v-if="form.id">
189
          <span v-if="!form.id">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_COMPLAINT_STATUS, 1) }}</span>
Marcus's avatar
Marcus committed
190
          <el-select v-else v-model="form.status" :placeholder="$t('请选择处理状态')">
191
            <el-option v-for="dict in getDictDatas(DICT_TYPE.CUSTOMER_COMPLAINT_STATUS)"
yanghao's avatar
yanghao committed
192 193
                       :key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
          </el-select>
我在何方's avatar
我在何方 committed
194
        </el-form-item> -->
yanghao's avatar
yanghao committed
195
      </el-form>
Marcus's avatar
Marcus committed
196

我在何方's avatar
我在何方 committed
197
      <!-- <customer-follow v-if="!!this.form.id" :id="form.id" :customer-id="form.customerId"></customer-follow> -->
Marcus's avatar
Marcus committed
198

yanghao's avatar
yanghao committed
199
      <div slot="footer" class="dialog-footer">
dcy's avatar
dcy committed
200 201
        <el-button type="primary" @click="submitForm">{{$t('确 定')}}</el-button>
        <el-button @click="cancel">{{$t('取 消')}}</el-button>
yanghao's avatar
yanghao committed
202 203
      </div>
    </el-dialog>
黄卓's avatar
黄卓 committed
204

我在何方's avatar
我在何方 committed
205 206

    <el-dialog :title="title" :visible.sync="openCustomer" width="900px" append-to-body>
dcy's avatar
dcy committed
207
      <el-form ref="form" :inline="true" :model="form" label-width="80px">
dcy's avatar
dcy committed
208
          <el-form-item :label="$t('客户名称')+':'">
我在何方's avatar
我在何方 committed
209 210
            <div>{{ formatCustomerName(form.customerId) }}</div>
          </el-form-item>
dcy's avatar
dcy committed
211
          <el-form-item :label="$t('投诉类型') +':'">
我在何方's avatar
我在何方 committed
212 213
              <dict-tag :type="DICT_TYPE.CUSTOMER_COMPLAINT_TYPE" :value="form.type" />
          </el-form-item>
dcy's avatar
dcy committed
214
          <el-form-item :label="$t('订单号')+':'" prop="orderId" >
我在何方's avatar
我在何方 committed
215 216
            <div>{{form.orderId}}</div>
          </el-form-item>
邓春圆's avatar
邓春圆 committed
217
          <el-form-item :label="$t('提单号') + ':'" prop="ladingbillId" >
dcy's avatar
dcy committed
218
            <div>{{form.ladingbillId|| $t('无')}}</div>
我在何方's avatar
我在何方 committed
219 220
          </el-form-item>
          <div>
dcy's avatar
dcy committed
221
            <el-form-item :label="$t('投诉时间')+':'">
我在何方's avatar
我在何方 committed
222 223
                <span>{{parseTime(form.createTime)}}</span>
            </el-form-item>
dcy's avatar
dcy committed
224
            <el-form-item :label="$t('投诉状态')+':'">
我在何方's avatar
我在何方 committed
225
               <dict-tag :type="DICT_TYPE.CUSTOMER_COMPLAINT_STATUS" :value="form.status" />
我在何方's avatar
我在何方 committed
226 227
            </el-form-item>
          </div>
dcy's avatar
dcy committed
228 229
        <el-form-item  :label="$t('投诉内容')+':'" >
          <div>{{form.content|| $t('无')}}</div>
我在何方's avatar
我在何方 committed
230
          </el-form-item>
dcy's avatar
dcy committed
231
        <el-form-item v-show="form.status == '2'||form.status == '3'" :label="$t('查明原因')+':'" prop="ascertainReason" >
我在何方's avatar
我在何方 committed
232 233
          <div>{{form.ascertainReason||'无'}}</div>
          </el-form-item>
dcy's avatar
dcy committed
234 235
        <el-form-item v-show="form.status == '2'||form.status == '3'" :label="$t('处理方案')+':'" prop="plan" >
          <div>{{form.plan||$t('无')}}</div>
我在何方's avatar
我在何方 committed
236
          </el-form-item>
dcy's avatar
dcy committed
237 238
        <el-form-item v-show="form.status == '3'" :label="$t('处理结果')+':'" prop="result" >
        <div>{{form.result||$t('无')}}</div>
我在何方's avatar
我在何方 committed
239
        </el-form-item>
dcy's avatar
dcy committed
240
        <el-form-item v-show="form.status == '3'" :label="$t('赔付金额')+':'">
我在何方's avatar
我在何方 committed
241
          <span>{{form.indemnity||0}}</span>
我在何方's avatar
我在何方 committed
242
          <span>{{getCurrencyLabel(form.currencyUnit)}}</span>
我在何方's avatar
我在何方 committed
243
        </el-form-item>
dcy's avatar
dcy committed
244
        <el-form-item v-show="form.status == '3'" :label="$t('处理时间')+':'">
我在何方's avatar
我在何方 committed
245 246 247 248 249
          <span>{{parseTime(form.handleAt)}}</span>
        </el-form-item>
      </el-form>
      <customer-follow v-if="!!this.form.id" :id="form.id" :customer-id="form.customerId"></customer-follow>
      <div slot="footer" class="dialog-footer">
dcy's avatar
dcy committed
250
        <el-button type="primary" @click="openCustomer=false">{{$t('确 定')}}</el-button>
我在何方's avatar
我在何方 committed
251 252 253
      </div>
    </el-dialog>

黄卓's avatar
黄卓 committed
254
    <el-dialog
dcy's avatar
dcy committed
255
      :title="$t('提示')"
黄卓's avatar
黄卓 committed
256 257 258
      :visible.sync="handle.dialogVisible"
      width="30%"
    >
我在何方's avatar
我在何方 committed
259
      <el-form ref="form" :model="form" label-width="80px"  :rules="rules">
dcy's avatar
dcy committed
260
        <el-form-item :label="$t('投诉类型')">
黄卓's avatar
黄卓 committed
261 262 263
          <dict-selector :type="DICT_TYPE.CUSTOMER_COMPLAINT_STATUS" form-type="radio" v-model="form.status"
                         :filter="(e) => e.value == '2' || e.value == '3'" :formatter="Number"></dict-selector>
        </el-form-item>
dcy's avatar
dcy committed
264 265
        <el-form-item v-show="form.status == '2'" :label="$t('查明原因')" required >
          <el-input type="textarea" :placeholder="$t('请输入查明原因')" v-model="form.ascertainReason"></el-input>
黄卓's avatar
黄卓 committed
266
        </el-form-item>
dcy's avatar
dcy committed
267 268
        <el-form-item v-show="form.status == '2'" :label="$t('处理方案')">
          <el-input v-model="form.plan" :placeholder="$t('请输入处理方案')"></el-input>
黄卓's avatar
黄卓 committed
269 270
        </el-form-item>

dcy's avatar
dcy committed
271 272
        <el-form-item v-show="form.status == '3'" :label="$t('处理结果')" required>
          <el-input type="textarea" :placeholder="$t('请输入处理结果')" v-model="form.result"></el-input>
黄卓's avatar
黄卓 committed
273
        </el-form-item>
dcy's avatar
dcy committed
274 275
        <el-form-item v-show="form.status == '3'" :label="$t('赔付金额')">
          <el-input v-model="form.indemnity" :placeholder="$t('请输入赔付金额')">
我在何方's avatar
我在何方 committed
276
            <el-select slot="append" defaultable v-model="form.currencyUnit" :placeholder="$t('请选择货币单位')" style="width: 110px">
邓春圆's avatar
邓春圆 committed
277
              <el-option v-for="item in currencyList" :key="item.id" :label="isChinese ? item.titleZh :item.titleEn" :value="item.id" />
我在何方's avatar
我在何方 committed
278
            </el-select>
黄卓's avatar
黄卓 committed
279 280
          </el-input>
        </el-form-item>
dcy's avatar
dcy committed
281
        <el-form-item v-show="form.status == '3'" :label="$t('处理时间')" required>
我在何方's avatar
我在何方 committed
282
          <el-date-picker type="datetime" v-model="form.handleAt" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
黄卓's avatar
黄卓 committed
283 284 285
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
dcy's avatar
dcy committed
286 287
        <el-button @click="handle.dialogVisible = false">{{$t('取 消')}}</el-button>
        <el-button type="primary" @click="submitForm">{{$t('确 定')}}</el-button>
黄卓's avatar
黄卓 committed
288 289
      </span>
    </el-dialog>
yanghao's avatar
yanghao committed
290 291 292 293 294
  </div>
</template>

<script>
import { createCustomerComplaint, updateCustomerComplaint, deleteCustomerComplaint, getCustomerComplaint, getCustomerComplaintPage, exportCustomerComplaintExcel } from "@/api/ecw/customerComplaint";
dcy's avatar
dcy committed
295
import {getCustomerList, getCustomerSelect} from '@/api/ecw/customer'
Marcus's avatar
Marcus committed
296
import CustomerFollow from "../../../components/CustomerFollow"
黄卓's avatar
黄卓 committed
297
import DictSelector from '@/components/DictSelector'
298
import { DICT_TYPE, getDictDataLabel, getDictDatas } from '@/utils/dict'
黄卓's avatar
黄卓 committed
299
import { getBillNoSearch, getOrderNoSearch } from '@/api/ecw/order'
dcy's avatar
dcy committed
300
import customerSelect from '@/views/ecw/customer/customerSelect'
我在何方's avatar
我在何方 committed
301 302
import { getCurrencyPage } from "@/api/ecw/currency";

yanghao's avatar
yanghao committed
303 304
export default {
  name: "CustomerComplaint",
305 306 307 308 309
  /**
   * 可以单独作为页面,也可以作为组件被被客户详情页调用。
   * 作为组件时要传入 customerId,用于限制范围和隐藏搜索筛选
   */
  props: {
黄卓's avatar
黄卓 committed
310
    customerId: Number
311
  },
yanghao's avatar
yanghao committed
312
  components: {
黄卓's avatar
黄卓 committed
313
    CustomerFollow,
dcy's avatar
dcy committed
314 315
    DictSelector,
    customerSelect
yanghao's avatar
yanghao committed
316
  },
邓春圆's avatar
邓春圆 committed
317 318 319 320 321
  computed:{
    isChinese(){
      return this.$i18n.locale === 'zh_CN'
    },
  },
yanghao's avatar
yanghao committed
322 323
  data() {
    return {
黄卓's avatar
黄卓 committed
324
      DICT_TYPE,
325 326
      getDictDatas,
      getDictDataLabel,
yanghao's avatar
yanghao committed
327 328 329 330 331 332 333 334 335 336 337 338 339 340
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户投诉列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
我在何方's avatar
我在何方 committed
341
      openCustomer:false,
yanghao's avatar
yanghao committed
342 343 344 345 346
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
347
        customerId: this.customerId,
yanghao's avatar
yanghao committed
348 349 350 351 352 353 354 355 356 357 358
        type: null,
        orderId: null,
        ladingbillId: null,
        status: null,
        adminId: null,
        code: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
dcy's avatar
dcy committed
359 360 361
        customerId: [{ required: true, message: this.$t('客户名称不能为空'), trigger: "change" }],
        type: [{ required: true, message: this.$t('投诉类型不能为空'), trigger: "change" }],
        content: [{ required: true, message: this.$t('投诉内容不能为空'), trigger: "blur" }],
yanghao's avatar
yanghao committed
362 363
      },

364 365
      myFollowCustomerList: [],

黄卓's avatar
黄卓 committed
366 367 368 369 370
      customerSelect: [],

      // 处理
      handle: {
        dialogVisible: false
黄卓's avatar
黄卓 committed
371 372 373
      },

      billList: [],
我在何方's avatar
我在何方 committed
374 375 376 377 378 379
      orderList: [],
      params: {
        page: 1,
        rows: 20,
      },
      currencyList:[]
yanghao's avatar
yanghao committed
380 381 382 383
    };
  },
  created() {
    this.getList();
我在何方's avatar
我在何方 committed
384
     getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
385

yanghao's avatar
yanghao committed
386 387
  },
  methods: {
黄卓's avatar
黄卓 committed
388 389 390 391 392 393 394 395

    getBillList(key){
      getBillNoSearch({key, pageNo: 1, pageSize: 20}).then(r => {
        if (r.code === 0){
          this.billList = r.data.list
        }
      })
    },
我在何方's avatar
我在何方 committed
396 397
    getCurrencyLabel(id){
      var label = this.currencyList.filter(item=>item.id == id)
邓春圆's avatar
邓春圆 committed
398
      if(label.length>0) return this.isChinese ? label[0].titleZh : label[0].titleEn
我在何方's avatar
我在何方 committed
399 400
      return ''
    },
黄卓's avatar
黄卓 committed
401 402 403 404 405 406 407
    getOrderList(key){
      getOrderNoSearch({key, pageNo: 1, pageSize: 20}).then(r => {
        if (r.code === 0){
          this.orderList = r.data.list
        }
      })
    },
yanghao's avatar
yanghao committed
408 409 410 411 412 413 414 415 416 417 418
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行查询
      getCustomerComplaintPage(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
dcy's avatar
dcy committed
419 420 421
        getCustomerList({ids:this.list.map(i => i.customerId).join(',')}).then(r => {
          this.customerSelect = r.data
        })
yanghao's avatar
yanghao committed
422 423 424 425 426 427 428 429 430 431 432
      });
    },
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
433
        customerId: this.customerId,
yanghao's avatar
yanghao committed
434 435 436 437 438
        type: undefined,
        orderId: undefined,
        ladingbillId: undefined,
        content: undefined,
        status: undefined,
黄卓's avatar
黄卓 committed
439 440 441 442 443 444 445
        ascertainReason: undefined,
        plan: undefined,
        result: undefined,
        indemnity: undefined,
        currencyUnit: undefined,
        handleAt: undefined,
        cancelReason: undefined,
yanghao's avatar
yanghao committed
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
dcy's avatar
dcy committed
464
      this.title = this.$t('添加客户投诉');
465 466
      // 新增客诉默认状态为待处理
      this.form.status = 1;
yanghao's avatar
yanghao committed
467
    },
我在何方's avatar
我在何方 committed
468 469 470 471 472 473 474 475

    /** 查看按钮操作 */
    handleSee(row) {
      this.reset();
      const id = row.id;
      getCustomerComplaint(id).then(response => {
        this.form = response.data;
        this.openCustomer = true;
dcy's avatar
dcy committed
476
        this.title = this.$t('投诉详情');
我在何方's avatar
我在何方 committed
477 478
      });
    },
yanghao's avatar
yanghao committed
479 480 481 482 483 484 485
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getCustomerComplaint(id).then(response => {
        this.form = response.data;
        this.open = true;
dcy's avatar
dcy committed
486
        this.title = this.$t('修改客户投诉');
yanghao's avatar
yanghao committed
487 488
      });
    },
黄卓's avatar
黄卓 committed
489 490 491 492 493 494 495 496
    handleHandle(row){
      this.reset();
      const id = row.id;
      getCustomerComplaint(id).then(response => {
        this.form = response.data;
        this.handle.dialogVisible = true;
      });
    },
yanghao's avatar
yanghao committed
497 498 499 500 501 502
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
我在何方's avatar
我在何方 committed
503

yanghao's avatar
yanghao committed
504 505
        // 修改的提交
        if (this.form.id != null) {
我在何方's avatar
我在何方 committed
506 507
          if(this.form.status==2){
            if(!this.form.ascertainReason){
dcy's avatar
dcy committed
508
              this.$modal.msgError(this.$t('请输入查明原因'));
我在何方's avatar
我在何方 committed
509 510 511 512 513
              return
            }
          }
          if(this.form.status==3){
            if(!this.form.result){
dcy's avatar
dcy committed
514
              this.$modal.msgError(this.$t('请输入处理结果'));
我在何方's avatar
我在何方 committed
515 516 517
              return
            }
            if(!this.form.handleAt){
dcy's avatar
dcy committed
518
              this.$modal.msgError(this.$t('请输入处理时间'));
我在何方's avatar
我在何方 committed
519 520 521
              return
            }
          }
yanghao's avatar
yanghao committed
522
          updateCustomerComplaint(this.form).then(response => {
dcy's avatar
dcy committed
523
            this.$modal.msgSuccess(this.$t('修改成功'));
yanghao's avatar
yanghao committed
524
            this.open = false;
黄卓's avatar
黄卓 committed
525
            this.handle.dialogVisible = false
yanghao's avatar
yanghao committed
526 527 528 529 530 531
            this.getList();
          });
          return;
        }
        // 添加的提交
        createCustomerComplaint(this.form).then(response => {
dcy's avatar
dcy committed
532
          this.$modal.msgSuccess(this.$t('新增成功'));
yanghao's avatar
yanghao committed
533 534 535 536 537 538 539 540
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
dcy's avatar
dcy committed
541
      this.$modal.confirm(this.$t('是否确认删除客户投诉编号为"') + id + this.$t('"的数据项?')).then(function() {
yanghao's avatar
yanghao committed
542 543 544
          return deleteCustomerComplaint(id);
        }).then(() => {
          this.getList();
dcy's avatar
dcy committed
545
          this.$modal.msgSuccess(this.$t('删除成功'));
yanghao's avatar
yanghao committed
546 547 548 549 550 551 552 553 554 555
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行导出
dcy's avatar
dcy committed
556
      this.$modal.confirm(this.$t('是否确认导出所有客户投诉数据项?')).then(() => {
yanghao's avatar
yanghao committed
557 558 559
          this.exportLoading = true;
          return exportCustomerComplaintExcel(params);
        }).then(response => {
dcy's avatar
dcy committed
560
          this.$download.excel(response, '客户投诉列表.xls');
yanghao's avatar
yanghao committed
561 562 563 564 565
          this.exportLoading = false;
        }).catch(() => {});
    },
    /** 格式化邮件账号 */
    formatCustomerName(customerId) {
566
      for (const customer of this.customerSelect) {
yanghao's avatar
yanghao committed
567 568 569 570
        if (customer.id === customerId) {
          return customer.name;
        }
      }
dcy's avatar
dcy committed
571
      return this.$t('找不到客户') + ':' + customerId;
yanghao's avatar
yanghao committed
572 573 574 575
    }
  }
};
</script>
我在何方's avatar
我在何方 committed
576 577 578 579 580 581 582 583
<style scoped>
  .formShow{
    display: flex;
  }
  .formShow div{
    flex: 1;
  }
</style>