query.vue 37.6 KB
Newer Older
黄卓's avatar
黄卓 committed
1 2 3 4 5
<template>
  <div>
    <el-row type="flex" style="margin-top: 15px;margin-bottom: 15px" justify="center">
      <el-col :xs="24" :sm="24" :md="24" :lg="20" :xl="16">
        <div style="display: flex;justify-content: space-between;align-items: flex-end;">
6
          <h2>{{$t('查看')}}</h2>
黄卓's avatar
黄卓 committed
7
          <div>
邓春圆's avatar
邓春圆 committed
8
            <el-button type="primary" size="small" v-has-permi="['ecw:customer:query-edit']" @click="$router.push('/customer/add-edit/' + id)">{{$t('编辑')}}</el-button>
邓春圆's avatar
邓春圆 committed
9
            <el-button v-has-permi="['ecw:customer:query-quoted-price']" @click="$router.push('/offer/create')" type="primary" size="small">{{$t('报价')}}</el-button>
邓春圆's avatar
邓春圆 committed
10 11
            <el-button v-has-permi="['ecw:customer:query-follow-up']" type="primary" size="small" @click="customerFollowFn('follow')">{{$t('跟进')}}</el-button>
            <el-button v-has-permi="['ecw:customer:query-customer-complaint']" type="primary" size="small" @click="customerFollowFn('complain')">{{$t('客诉')}}</el-button>
邓春圆's avatar
邓春圆 committed
12
            <el-button  v-hasPermi="['ecw:customer:query-delete']" type="danger" size="small" @click="deleteCustomerFn()">{{$t('删除')}}</el-button>
黄卓's avatar
黄卓 committed
13 14 15 16
          </div>
        </div>
        <el-card style="margin-top: 15px;">
          <el-descriptions :column="4" border>
17
            <el-descriptions-item :label="$t('客户编号')">{{ customer.number }}</el-descriptions-item>
18
            <el-descriptions-item :label="$t('客户名称')"><span style="white-space: pre-wrap;">{{ customer.name}}</span></el-descriptions-item>
19
            <el-descriptions-item :label="$t('客户英文名称')">{{customer.nameEn }}</el-descriptions-item>
20 21
            <el-descriptions-item :label="$t('结算方式')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_BALANCE, customer.balance) }}</el-descriptions-item>
            <el-descriptions-item :label="$t('客户生日')">{{ parseTime(customer.birthday, '{y}-{m}-{d}') }}</el-descriptions-item>
22
            <el-descriptions-item :label="$t('出货渠道')">
邓春圆's avatar
邓春圆 committed
23
              {{ getDictDatas2(DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE, (customer.transportType||'').split(',')).map(e => isChinese ? e.label : e.labelEn).join(', ') }}
24
<!--              <dict-tag v-if="customer.transportType" v-for="item in (customer.transportType || '').split(',')" :type="DICT_TYPE.ECW_CUSTOMER_TRANSPORT_TYPE" :value="item"></dict-tag>-->
25 26 27 28
            </el-descriptions-item>
            <el-descriptions-item :label="$t('资源类型')">
              <dict-tag :type="DICT_TYPE.ECW_CUSTOMER_RESOURCE_TYPE" :value="customer.resourceType"></dict-tag>
            </el-descriptions-item>
29
            <el-descriptions-item :label="$t('客户等级')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_LEVEL, customer.level) }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
30
            <el-descriptions-item :label="$t('信用等级')">{{isChinese ? customer.creditLevelNameZh :customer.creditLevelNameEn }}</el-descriptions-item>
31

邓春圆's avatar
邓春圆 committed
32
            <el-descriptions-item :label="$t('国家')">{{$l(customer,'countryName')}}{{customer.countryName}}</el-descriptions-item>
33 34
<!--            <el-descriptions-item :label="$t('业务员')">{{ customer }}</el-descriptions-item>-->
            <el-descriptions-item :label="$t('客户来源')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_SOURCE, customer.source) }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
35 36 37
            <el-descriptions-item :label="$t('客户类别')">
              {{ getDictDatas2(DICT_TYPE.CUSTOMER_TYPE, (customer.type||'').split(',')).map(e => isChinese ? e.label : e.labelEn).join(', ')}}
            </el-descriptions-item>
38
<!--            <el-descriptions-item :label="$t('联系方式')">{{ customer }}</el-descriptions-item>-->
邓春圆's avatar
邓春圆 committed
39
            <el-descriptions-item :label="$t('推介人')">{{ customer.promoterName }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
40
            <el-descriptions-item :label="$t('客户经理')">{{customer.customerServiceName }}</el-descriptions-item>
41
            <el-descriptions-item :label="$t('公司名称')">{{ customer.company }}</el-descriptions-item>
42
            <el-descriptions-item :label="$t('公司英文名称')">{{ customer.companyEn }}</el-descriptions-item>
43 44
            <el-descriptions-item :label="$t('联系地址')">{{ customer.address }}</el-descriptions-item>
            <el-descriptions-item :label="$t('创建时间')">{{ parseTime(customer.createTime) }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
45
            <el-descriptions-item :label="$t('创建人')">{{ customer.founderName }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
46 47 48
            <el-descriptions-item :label="$t('状态')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_STATUS, customer.status)}}</el-descriptions-item>
            <el-descriptions-item :label="$t('主营类别')">{{ $l(customer,'productTypeName') }}</el-descriptions-item>
            <el-descriptions-item :label="$t('常提货网点')">{{ $l(customer,'pickupPointName') }}</el-descriptions-item>
49
            <el-descriptions-item :label="$t('图片')">
50 51 52
                <image-display :picture-urls="customer.picture ? customer.picture.split(',') : []" >
                   <el-button type="text" > 查看图片</el-button>
                </image-display>
黄卓's avatar
黄卓 committed
53
            </el-descriptions-item>
54
            <el-descriptions-item :label="$t('备注')">{{ customer.remarks  }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
55
            <el-descriptions-item :label="$t('业绩类型')">{{ customer.isNew ?$t('新客户') : $t('老客户')  }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
56
            <el-descriptions-item :label="$t('付款人姓名')">{{ customer.payerName  }}</el-descriptions-item>
57
            <el-descriptions-item v-if="permissions.includes('ecw:customer:query-card')"  :label="$t('身份证姓名')">{{ customer.carName }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
58
            <el-descriptions-item v-if="permissions.includes('ecw:customer:query-card')"  :label="$t('身份证号码')">{{ customer.carNo }}</el-descriptions-item>
邓春圆's avatar
邓春圆 committed
59
            <el-descriptions-item :label="$t('询盘信息')">{{ customer.inquiry }}</el-descriptions-item>
黄卓's avatar
黄卓 committed
60 61 62 63
          </el-descriptions>
        </el-card>

        <el-card style="margin-top: 15px">
64
          <h3>{{$t('联系人')}}</h3>
黄卓's avatar
黄卓 committed
65 66

          <el-table
黄卓's avatar
黄卓 committed
67
            :data="customerContacts"
黄卓's avatar
黄卓 committed
68 69 70 71 72
            style="width: 100%"
            border
          >
            <el-table-column
              prop="department"
73
              :label="$t('部门')"
黄卓's avatar
黄卓 committed
74 75 76 77
            >
            </el-table-column>
            <el-table-column
              prop="position"
78
              :label="$t('职位')"
黄卓's avatar
黄卓 committed
79 80 81 82
            >
            </el-table-column>
            <el-table-column
              prop="name"
83
              :label="$t('联系人')"
黄卓's avatar
黄卓 committed
84
            >
85 86 87 88 89 90

            </el-table-column>
            <el-table-column
              prop="nameEn"
              :label="$t('联系人英文名称')"
            >
黄卓's avatar
黄卓 committed
91 92 93
            </el-table-column>
            <el-table-column
              prop="phoneNew"
94
              :label="$t('联系方式')"
黄卓's avatar
黄卓 committed
95
            >
黄卓's avatar
黄卓 committed
96
              <template v-slot="{row}">
邓春圆's avatar
邓春圆 committed
97
               +{{ row.areaCode}}  {{row.phoneNew}}
黄卓's avatar
黄卓 committed
98
              </template>
黄卓's avatar
黄卓 committed
99 100
            </el-table-column>
            <el-table-column
101
              prop="userid"
102
              :label="$t('关联账号')"
103
              :formatter="userIdFormatter"
黄卓's avatar
黄卓 committed
104 105 106 107
            >
            </el-table-column>
            <el-table-column
              prop="social"
108
              :label="$t('社交软件')"
109
              :formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.SOCIAL, cellValue)"
黄卓's avatar
黄卓 committed
110 111 112 113
            >
            </el-table-column>
            <el-table-column
              prop="socialNumber"
114
              :label="$t('社交软件号码')"
黄卓's avatar
黄卓 committed
115 116 117 118
            >
            </el-table-column>
            <el-table-column
              prop="email"
119
              :label="$t('邮箱')"
黄卓's avatar
黄卓 committed
120 121 122 123
            >
            </el-table-column>
          </el-table>
        </el-card>
邓春圆's avatar
邓春圆 committed
124 125 126
        <el-card style="margin-top: 15px;">
          <h3>{{$t('银行账户')}}</h3>
          <el-table :data="customer.customerBankBackVOList" border>
邓春圆's avatar
邓春圆 committed
127 128 129
            <el-table-column :label="$t('编号')" type="index"></el-table-column>
            <el-table-column :label="$t('账户名称')" prop="accountName"></el-table-column>
            <el-table-column :label="$t('币别')">
邓春圆's avatar
邓春圆 committed
130 131
              <template v-slot="{row}">
               {{$l(currecyList.find(i => row.currency == i.id),'title')}}
邓春圆's avatar
邓春圆 committed
132 133
              </template>
            </el-table-column>
邓春圆's avatar
邓春圆 committed
134 135 136 137
            <el-table-column :label="$t('银行名称')" prop="bankName"></el-table-column>
            <el-table-column :label="$t('银行账户')" prop="bankAccount"></el-table-column>
            <el-table-column :label="$t('银行代码')" prop="bankCode"></el-table-column>
            <el-table-column :label="$t('账户类型')">
邓春圆's avatar
邓春圆 committed
138
              <template v-slot="{row}">
139
                {{Number(row.accountType) === 1 ? $t('公账') : $t('私账')}}
邓春圆's avatar
邓春圆 committed
140
              </template>
邓春圆's avatar
邓春圆 committed
141
            </el-table-column>
邓春圆's avatar
邓春圆 committed
142
            <el-table-column :label="$t('状态')">
邓春圆's avatar
邓春圆 committed
143
            <template v-slot="{row}">
邓春圆's avatar
邓春圆 committed
144
              {{row.status ? $t('正常') : $t('停用')}}
邓春圆's avatar
邓春圆 committed
145 146
            </template>
            </el-table-column>
邓春圆's avatar
邓春圆 committed
147
            <el-table-column :label="$t('银行地址')" prop="bankAddress"></el-table-column>
邓春圆's avatar
邓春圆 committed
148 149
          </el-table>
        </el-card>
黄卓's avatar
黄卓 committed
150

邓春圆's avatar
邓春圆 committed
151 152
        <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
          <el-tab-pane name="order" :label="$t('订单')">
dcy's avatar
dcy committed
153 154 155
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <el-form :inline="true">
156
                  <el-form-item :label="$t('运输方式:')">
157
                    <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportId" formatter="number" />
dcy's avatar
dcy committed
158
                  </el-form-item>
159
                  <el-form-item :label="$t('订单状态:')">
dcy's avatar
dcy committed
160 161
                    <dict-selector :type="DICT_TYPE.ORDER_STATUS" v-model="queryParams.status"/>
                  </el-form-item>
162
                  <el-form-item :label="$t('报关方式:')">
dcy's avatar
dcy committed
163 164
                    <dict-selector
                      :type="DICT_TYPE.ECW_CUSTOMS_TYPE"
165
                      v-model="queryParams.customsType"
dcy's avatar
dcy committed
166 167
                    />
                  </el-form-item>
168
                  <el-form-item :label="$t('控货')">
dcy's avatar
dcy committed
169 170 171 172 173
                    <dict-selector
                      :type="DICT_TYPE.INFRA_BOOLEAN_STRING"
                      v-model="queryParams.isCargoControl"
                    />
                  </el-form-item>
174
                  <el-form-item :label="$t('入仓时间:')">
dcy's avatar
dcy committed
175 176
                    <el-date-picker v-model="rucangtime"
                                    @change="changeDate"
dcy's avatar
dcy committed
177 178
                                    style="width: 240px"
                                    value-format="yyyy-MM-dd HH:mm:ss"
179
                                      type="datetimerange"
dcy's avatar
dcy committed
180
                                    range-separator="-"
181
                                    :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
dcy's avatar
dcy committed
182 183
                  </el-form-item>
                  <el-form-item>
184
                    <el-button type="primary" @click="getorderList">{{$t('搜索')}}</el-button>
dcy's avatar
dcy committed
185
                    <el-button type="primary" @click="()=>{
186
                         queryParams = { rows:10,page:1}; getorderList();rucangtime  = [];
187
                    }">{{$t('重置')}}</el-button>
dcy's avatar
dcy committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
                  </el-form-item>
                </el-form>
              </div>
              <el-table :data="orderList">
                <el-table-column :label="$t('订单编号')" width="120px" align="center" prop="orderNo" >
                  <template slot-scope="scope">
                    <router-link :to="{path: '/order/detail',query: {orderId: scope.row.orderId}}" class="link-type">
                      <span>{{ scope.row.orderNo }}</span>
                    </router-link>
                  </template>
                </el-table-column>
                <el-table-column :label="$t('唛头')" align="center" prop="marks" />
                <el-table-column :label="$t('总箱数/入仓箱数')" align="center" prop="sumNum">
                  <template slot-scope="{row}">
                    {{row.totalNum}}{{$t('')}}/{{row.sumNum}}{{$t('')}}
                  </template>
                </el-table-column>
                <el-table-column :label="$t('体积/重量')" align="center" prop="sumWeight">
                  <template slot-scope="{row}">
                    <!--入仓前是填单数据,入仓后是入仓数据-->
邓春圆's avatar
邓春圆 committed
208 209 210 211 212 213 214 215 216 217 218 219 220 221
<!--                    <template v-if="row.inWarehouseState <= 1">{{row.costVO.totalVolume}}m³ /{{row.costVO.totalWeight}}Kg</template>-->
<!--                    <template v-else>{{row.sumVolume}}m³ /{{row.sumWeight}}Kg</template>-->
                    <component
                      :is="row.orderType ==  2 ? 'el-tooltip' : 'div'"
                      class="item"
                      :style="{
            color: row.orderType ==  2 ? 'red' : null
          }"
                      effect="dark"
                      :content="(row.wvolume||0)+'m³'"
                      placement="bottom">
                      <div v-if="row.sumNum > 0">{{row.sumVolume}}m³ /{{row.sumWeight}}Kg</div>
                      <div v-else>{{row.costVO.totalVolume}}m³ /{{row.costVO.totalWeight}}Kg</div>
                    </component>
dcy's avatar
dcy committed
222 223
                  </template>
                </el-table-column>
224 225 226 227 228 229
                <el-table-column :label="$t('始发仓')" align="center" prop="startWarehouseName">
                  <template slot-scope="{row}">
                    {{row.startWarehouseName}}
                    <span style="color:red" v-if="row.isExternalWarehouse">({{$t('外部仓')}})</span>
                  </template>
                </el-table-column>
dcy's avatar
dcy committed
230 231 232 233 234 235 236 237 238 239
                <el-table-column :label="$t('运输方式/目的地')" align="center" prop="transportId">
                  <template slot-scope="{row}">
                    <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportId" /> / {{row.objectiveName}}
                  </template>
                </el-table-column>
                <el-table-column :label="$t('控货')" align="center" prop="transportId">
                  <template slot-scope="{row}">
                    <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.isCargoControl" />
                  </template>
                </el-table-column>
240 241 242 243
                <el-table-column :label="$t('订单状态')" align="center" prop="statusMsg">
<!--                  <template slot-scope="scope">-->
<!--                    <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" />-->
<!--                  </template>-->
dcy's avatar
dcy committed
244
                </el-table-column>
邓春圆's avatar
邓春圆 committed
245 246 247 248 249
                <el-table-column :label="$t('入仓时间')">
                  <template v-slot="{row}">
                    {{parseTime(row.rucangTime)}}
                  </template>
                </el-table-column>
dcy's avatar
dcy committed
250
                </el-table>
邓春圆's avatar
邓春圆 committed
251
              <pagination @pagination="getorderList" :page.sync="queryParams.page" :limit.sync="queryParams.rows"  :total="orderTotal" ></pagination>
dcy's avatar
dcy committed
252
            </el-card>
黄卓's avatar
黄卓 committed
253
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
254
          <el-tab-pane name="quote" :label="$t('报价')">
黄卓's avatar
黄卓 committed
255
            <el-table
dcy's avatar
dcy committed
256
              :data="infoListOfferList"
黄卓's avatar
黄卓 committed
257 258 259
              style="width: 100%"
            >
              <el-table-column
dcy's avatar
dcy committed
260
                type="index"
261
                :label="$t('序号')"
黄卓's avatar
黄卓 committed
262 263 264
              >
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
265
                prop="number"
266
                :label="$t('报价单号')"
黄卓's avatar
黄卓 committed
267 268 269
              >
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
270
                prop="orderNo"
271
                :label="$t('订单号')"
黄卓's avatar
黄卓 committed
272 273 274
              >
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
275
                prop="consignorName"
276
                :label="$t('客户名称')"
黄卓's avatar
黄卓 committed
277
              >
278 279 280
                <template v-slot>
                  {{customer.name}}
                </template>
黄卓's avatar
黄卓 committed
281 282
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
283
                prop="objectiveName"
284
                :label="$t('目的地')"
黄卓's avatar
黄卓 committed
285 286 287
              >
              </el-table-column>
              <el-table-column
288
                :label="$t('销售阶段')"
黄卓's avatar
黄卓 committed
289
              >
dcy's avatar
dcy committed
290 291 292
                <template v-slot="{row}">
                  {{STATUS[row.status]}}
                </template>
黄卓's avatar
黄卓 committed
293 294
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
295
                prop="stopTime"
296
                :label="$t('预计结束时间')"
黄卓's avatar
黄卓 committed
297 298 299
              >
              </el-table-column>
              <el-table-column
dcy's avatar
dcy committed
300
                prop="businessManagerName"
301
                :label="$t('负责人')"
黄卓's avatar
黄卓 committed
302 303 304
              >
              </el-table-column>
            </el-table>
dcy's avatar
dcy committed
305
            <pagination @pagination="getInfoListOfferPage" :page.sync="infoListOfferFrom.pageNo" :limit.sync="infoListOfferFrom.pageSize"  :total="infoListOfferTotal" ></pagination>
黄卓's avatar
黄卓 committed
306
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
307
          <el-tab-pane name="follow" :label="$t('跟进')">
邓春圆's avatar
邓春圆 committed
308
            <customer-follow  v-if="activeName === 'follow'" customerQuery ref="customerFollow" :id="id" :customer-id="id"></customer-follow>
黄卓's avatar
黄卓 committed
309
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
310
          <el-tab-pane name="complain" :label="$t('客户投诉')">
邓春圆's avatar
邓春圆 committed
311
            <customer-complaint  v-if="activeName === 'complain'"  ref="customerComplaint" :customer-id="id" hidden-search></customer-complaint>
黄卓's avatar
黄卓 committed
312
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
313
          <el-tab-pane name="bill" :label="$t('账单')">
314
            <el-table style="width: 100%" :data="infoListReceiptList">
315 316 317 318 319 320 321
              <el-table-column :label="$t('序号')" type="index"></el-table-column>
              <el-table-column :label="$t('账单')" prop="receiptNo"></el-table-column>
              <el-table-column :label="$t('订单号')" prop="orderNo"></el-table-column>
              <el-table-column :label="$t('箱数')" prop="num"></el-table-column>
              <el-table-column :label="$t('方数')" prop="volume" ></el-table-column>
              <el-table-column :label="$t('重量')" prop="weight" ></el-table-column>
              <el-table-column :label="$t('类型')">
322 323 324 325
                <template v-slot="{row}">
                  <dict-tag :type="DICT_TYPE.PAYMENT_TYPE" :value="row.collectionType" />
                </template>
              </el-table-column>
326
              <el-table-column :label="$t('费用类型')">
327 328 329 330
                <template v-slot="{row}">
                  <dict-tag :type="DICT_TYPE.FEE_TYPE" :value="row.feeType" />
                </template>
              </el-table-column>
331
              <el-table-column :label="$t('金额')" prop="totalAmount">
332
              </el-table-column>
333
              <el-table-column :label="$t('已核销比例')" prop="writeOffScale"></el-table-column>
334 335 336 337 338
              <el-table-column :label="$t('实收日期')">
                <template v-slot="{row}">
                  {{parseTime(row.writeOffAt)}}
                </template>
              </el-table-column>
339
              <el-table-column :label="$t('业务员')" prop="salesmanName"></el-table-column>
340
            </el-table>
邓春圆's avatar
邓春圆 committed
341 342
            <pagination v-show="infoListReceiptList.length" :total="infoListReceiptTotal" :page.sync="infoListReceiptFrom.pageNo" :limit.sync="infoListReceiptFrom.pageSize"
                        @pagination="infoListReceiptFn"/>
黄卓's avatar
黄卓 committed
343
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
344
          <el-tab-pane name="data" :label="$t('数据')">
345
            <el-descriptions :column="2">
346 347 348 349 350 351 352
              <el-descriptions-item :label="$t('海空联运/海运拼柜/海运整柜/专线空运')">{{orderStatisticsObj.hklyTotal || 0}}/{{orderStatisticsObj.hypgTotal  || 0 }}/{{orderStatisticsObj.hyzgTotal  || 0}}/{{orderStatisticsObj.zxkyTotal  || 0}}</el-descriptions-item>
              <el-descriptions-item :label="$t('最后交易日期')">{{orderStatisticsObj.lastBusinessDate}}</el-descriptions-item>
              <el-descriptions-item :label="$t('全部订单/控货订单')">{{orderStatisticsObj.allOrderTotal  || 0}}/{{orderStatisticsObj.controlOrderTotal  || 0}}</el-descriptions-item>
              <el-descriptions-item :label="$t('最后交易单号')">{{orderStatisticsObj.lastBusinessOrderNo}}</el-descriptions-item>
              <el-descriptions-item :label="$t('报价/下单/入仓')">{{orderStatisticsObj.offerOrderTotal  || 0}}/{{orderStatisticsObj.pickOrderTotal  || 0}}/{{orderStatisticsObj.wareHousingTotal  || 0}}</el-descriptions-item>
              <el-descriptions-item :label="$t('储存量')">{{orderStatisticsObj.stock  || 0}}</el-descriptions-item>
              <el-descriptions-item :label="$t('已出货订单')">{{orderStatisticsObj.shipmentTotal  || 0}}</el-descriptions-item>
353
            </el-descriptions>
黄卓's avatar
黄卓 committed
354
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
355
          <el-tab-pane name="empower" :label="$t('品牌授权')">
dcy's avatar
dcy committed
356
              <el-table  border style="width:100%" :data="brandAuthorizationList">
357 358 359 360
                <el-table-column   type="index" :prop="$t('序号')"></el-table-column>
                <el-table-column  :label="$t('中文标题')" prop="titleZh" ></el-table-column>
                <el-table-column prop="titleEn" :label="$t('英文标题')"></el-table-column>
                <el-table-column :label="$t('有无备案')">
dcy's avatar
dcy committed
361 362 363 364
                 <template v-slot="{row}">
                   <dict-tag :type="DICT_TYPE.BRAND_REG_TYPE" :value="row.filing" />
                 </template>
                </el-table-column>
365
                <el-table-column :label="$t('授权开始')">
dcy's avatar
dcy committed
366 367 368 369
                  <template v-slot="{row}">
                    {{parseTime(row.startTime)}}
                  </template>
                </el-table-column>
370
                <el-table-column :label="$t('授权结束')">
dcy's avatar
dcy committed
371 372 373 374
                  <template v-slot="{row}">
                    {{parseTime(row.endTime)}}
                  </template>
                </el-table-column>
375
                <el-table-column :label="$t('授权证明')">
dcy's avatar
dcy committed
376 377
                  <template v-slot="{row}">
                    <div v-if="!!row.fileUrl && row.fileUrl.length > 0">
dcy's avatar
dcy committed
378
                  <span v-for="(item, index) in (row.fileUrl||'').split(',')">
379
                    <a :href="item" target="_blank">{{$t('附件')}}{{ index + 1 }}</a>,
dcy's avatar
dcy committed
380 381 382 383 384 385 386
                  </span>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="feeScale"
                  :formatter="(row) => getDictDataLabel(DICT_TYPE.BRAND_CUSTOMER_CHARGING_MODEL, row.feeScale)"
387
                  :label="$t('收费标准')">
dcy's avatar
dcy committed
388 389 390
                </el-table-column>
                <el-table-column
                  prop="createUsername"
391
                  :label="$t('添加人')">
dcy's avatar
dcy committed
392
                </el-table-column>
393
                <el-table-column :label="$t('创建时间')">
dcy's avatar
dcy committed
394 395 396 397 398
                  <template v-slot="{row}">
                    {{parseTime(row.createTime)}}
                  </template>
                </el-table-column>
              </el-table>
邓春圆's avatar
邓春圆 committed
399
            <pagination v-show="brandAuthorizationTotal.length" :total="brandAuthorizationTotal" :page.sync="brandAuthorizationFrom.pageNo" :limit.sync="brandAuthorizationFrom.pageSize"
dcy's avatar
dcy committed
400
                        @pagination="getBrankByCustomerList"/>
黄卓's avatar
黄卓 committed
401
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
402
          <el-tab-pane name="credit" :label="$t('信用日志')">
403 404
            <el-card class="box-card">
              <div slot="header" class="clearfix">
405
                <el-button style="float: right;" type="primary" @click="dialogVisible = true" >{{$t('添加信用日志')}}</el-button>
dcy's avatar
dcy committed
406
                <el-descriptions :column="5" border>
407
                  <el-descriptions-item v-for="(item,index) in creditScoreStatisticObj" :key="index" :label="creditScoreCalculation(item.type)">{{item.score}}</el-descriptions-item>
dcy's avatar
dcy committed
408
                </el-descriptions>
409 410
              </div>
              <el-table :data="customerCreditLogList">
411
                <el-table-column :label="$t('序号')" type="index"></el-table-column>
412 413 414 415 416
                <el-table-column   :label="$t('规则名称')">
                  <template v-slot="{row}">
                    {{ isChinese ? row.name : row.nameEn}}
                  </template>
                </el-table-column>
417
                <el-table-column prop="type" :label="$t('规则分类')">
dcy's avatar
dcy committed
418 419 420 421
                  <template v-slot="{row}">
                    <dict-tag :type="DICT_TYPE.CUSTOMER_CREDIT_RULE_TYPE" :value="row.type" />
                  </template>
                </el-table-column>
422 423 424 425
                <el-table-column prop="score" :label="$t('规则得分')"></el-table-column>
                <el-table-column prop="remark" :label="$t('备注')"></el-table-column>
                <el-table-column :label="$t('添加人')" prop="createName"></el-table-column>
                <el-table-column :label="$t('时间')">
426 427 428 429 430
                  <template v-slot="{row}">
                    {{parseTime(row.createTime)}}
                  </template>
                </el-table-column>
              </el-table>
dcy's avatar
dcy committed
431
              <pagination @pagination="creditLogPage" :page.sync="customerCreditLogFrom.pageNo" :limit.sync="customerCreditLogFrom.pageSize"  :total="customerCreditLogFrom.total" ></pagination>
432
            </el-card>
黄卓's avatar
黄卓 committed
433
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
434
          <el-tab-pane name="grade" :label="$t('等级日志')">
435
           <el-table style="width: 100%"  :data="getCustomerGradeList">
436 437 438
             <el-table-column  :label="$t('序号')" type="index"></el-table-column>
             <el-table-column :label="$t('规则名称')" prop="name"></el-table-column>
             <el-table-column :label="$t('规则分类')" prop="type">
dcy's avatar
dcy committed
439 440 441 442
               <template v-slot="{row}">
                 <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL_RULE_TYPE" :value="row.type" />
               </template>
             </el-table-column>
443 444 445
             <el-table-column :label="$t('规则得分')" prop="score"></el-table-column>
             <el-table-column :label="$t('备注')" prop="remark"></el-table-column>
             <el-table-column :label="$t('时间')">
446 447 448 449 450
               <template v-slot="{row}">
                 {{parseTime(row.createTime)}}
               </template>
             </el-table-column>
           </el-table>
dcy's avatar
dcy committed
451
            <pagination @pagination="getCustomerGrade" :page.sync="getCustomerGradeFrom.pageNo" :limit.sync="getCustomerGradeFrom.pageSize"  :total="getCustomerGradeFrom.total" ></pagination>
黄卓's avatar
黄卓 committed
452
          </el-tab-pane>
邓春圆's avatar
邓春圆 committed
453
          <el-tab-pane name="operationLog" v-if="checkPermi(['customer:operate-log:query'])"  :label="$t('操作日志')" >
454 455
            <customer-log  :customerId="id" v-if="'operationLog' === activeName"></customer-log>
          </el-tab-pane>
黄卓's avatar
黄卓 committed
456 457 458
        </el-tabs>
      </el-col>
    </el-row>
459 460 461 462 463
    <el-dialog
      :visible.sync="dialogVisible"
      width="30%"
      >
      <h1 slot="title">
464
        {{$t('给客户')}}{{customer.name}}{{$t('添加信用日志')}}
465 466
      </h1>
      <el-form label-width="100">
467 468
        <el-form-item :label="$t('客户编号:')">{{customer.number}}</el-form-item>
        <el-form-item :label="$t('信用类别')">
469
          <el-select v-model="creditFrom.ruleId">
470
            <el-option v-for="(item,index) in creditTypeList" :key="index" :value="item.id"  :label="isChinese ? item.name : item.nameEn"></el-option>
471
          </el-select>
472
        </el-form-item>
473 474
        <el-form-item v-if="creditTypeList.length > 0" :label="$t('信用分')">{{(creditTypeList.find(r=>creditFrom.ruleId === r.id) || {}).score }}{{$t('')}}</el-form-item>
        <el-form-item :label="$t('备注')">
475
          <el-input type="textarea" v-model="creditFrom.remark"> </el-input>
476 477 478
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
479 480
       <el-button @click="submit">{{$t('提交')}}</el-button>
       <el-button @click="dialogVisible = false" >{{$t('取消')}}</el-button>
481 482
  </span>
    </el-dialog>
黄卓's avatar
黄卓 committed
483 484 485 486
  </div>
</template>

<script>
487 488 489 490 491
import {
  getCustomer,
  getCustomerSelect,
  getBrankByCustomer,
  levelLogPage,
492 493 494 495 496 497
  customerCreditLogPage,
  infoListOrderPage,
  infoListOfferPage,
  orderStatistics,
  creditLogCreate,
  creditScoreStatistic,
498
  infoListReceiptPage, memberUserList, deleteCustomer,
499

500
} from '@/api/ecw/customer'
Marcus's avatar
Marcus committed
501
import { DICT_TYPE, getDictDataLabel, getDictDatas2 } from '@/utils/dict'
黄卓's avatar
黄卓 committed
502 503
import { getProductTypeList } from '@/api/ecw/productType'
import { getNodeList } from '@/api/ecw/node'
黄卓's avatar
黄卓 committed
504 505 506
import CustomerFollow from "@/components/CustomerFollow"
import { parseTime } from '@/utils/ruoyi'
import CustomerComplaint from '@/views/ecw/customerComplaint'
黄卓's avatar
黄卓 committed
507
import { listServiceUser } from '@/api/system/user'
黄卓's avatar
黄卓 committed
508
import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
dcy's avatar
dcy committed
509
import {getOrderPage} from "@/api/ecw/order";
dcy's avatar
dcy committed
510
import Template from "@/views/cms/template";
511
import {getCreditRulePage} from "@/api/customer/creditRule";
512
import {getCountry} from "@/api/ecw/country"
邓春圆's avatar
邓春圆 committed
513
import {getCurrencyList} from "@/api/ecw/currency";
514
import customerLog from "@/views/ecw/customer/customerLog.vue";
邓春圆's avatar
邓春圆 committed
515
import {checkPermi} from "@/utils/permission";
516
import ImageDisplay from "@/views/ecw/order/components/imageDisplay.vue";
黄卓's avatar
黄卓 committed
517

黄卓's avatar
黄卓 committed
518 519
export default {
  name: 'query',
Marcus's avatar
Marcus committed
520
  components: {
521
    ImageDisplay,
dcy's avatar
dcy committed
522
    Template,
Marcus's avatar
Marcus committed
523
    CustomerFollow,
524 525
    CustomerComplaint,
    customerLog,
Marcus's avatar
Marcus committed
526
  },
黄卓's avatar
黄卓 committed
527
  created() {
邓春圆's avatar
邓春圆 committed
528 529 530 531
    // 获取币种
    getCurrencyList().then(response => {
      this.currecyList = response.data;
    })
532 533 534 535
    //获取信用类型
    getCreditRulePage({page:1,rows:999,type:2}).then(r => {
     this.creditTypeList = r.data.list
    })
邓春圆's avatar
邓春圆 committed
536 537 538
    // getNodeList().then(r => {
    //   this.nodeList = r.data
    // })
黄卓's avatar
黄卓 committed
539
    getCustomer(this.id).then(response => {
黄卓's avatar
黄卓 committed
540
      this.customer = { ...this.customer, ...response.data }
邓春圆's avatar
邓春圆 committed
541
      console.log( this.customer,'this.customer')
黄卓's avatar
黄卓 committed
542

黄卓's avatar
黄卓 committed
543
      getCustomerContactsListByCustomer({customerId: this.id}).then(r => {
黄卓's avatar
黄卓 committed
544
        this.customerContacts = r.data
邓春圆's avatar
邓春圆 committed
545 546 547 548 549 550
        let list =  this.customerContacts.filter(r => r.userid)
        if(list.length > 0){
          memberUserList({ids:list.map(i=>i.userid).join(',')}).then(r => {
            this.memberList = r.data
          })
        }
黄卓's avatar
黄卓 committed
551
      })
552

黄卓's avatar
黄卓 committed
553
    })
Marcus's avatar
Marcus committed
554

邓春圆's avatar
邓春圆 committed
555 556 557
    // getCustomerSelect({pageSize:1000,pageNo:1}).then(r => {
    //   this.customerSelect = r.data.list
    // })
558

邓春圆's avatar
邓春圆 committed
559
    // this.getBrankByCustomerList()//品牌授权
邓春圆's avatar
邓春圆 committed
560
    // this.getCustomerGrade()
邓春圆's avatar
邓春圆 committed
561 562 563 564 565 566
    // this.creditLogPage()//等级日志
    this.getorderList()//订单
    // this.getInfoListOfferPage()//报价
    // this.getOrderStatistics()//数据
    // this.creditScoreStatisticFn() //信用日志
    // this.infoListReceiptFn()//账单
567

dcy's avatar
dcy committed
568

邓春圆's avatar
邓春圆 committed
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
  },
  watch:{
    activeName(val){
      switch (val) {
        case 'order':
          this.getorderList()//订单
          break
        case 'quote':
          this.getInfoListOfferPage()//报价
          break
        case 'bill':
          this.infoListReceiptFn()//账单
          break
        case 'data':
          this.getOrderStatistics()//数据
          break
        case 'empower':
          this.getBrankByCustomerList()//品牌授权
          break
        case 'credit':
          this.creditScoreStatisticFn() //信用日志
590
          this.creditLogPage()
邓春圆's avatar
邓春圆 committed
591 592
          break
        case 'grade':
593 594
          this.getCustomerGrade()
          //等级日志
邓春圆's avatar
邓春圆 committed
595 596 597 598
          break

      }
    }
黄卓's avatar
黄卓 committed
599
  },
黄卓's avatar
黄卓 committed
600 601
  data() {
    return {
邓春圆's avatar
邓春圆 committed
602
      activeName:'order',
邓春圆's avatar
邓春圆 committed
603
      currecyList:[],
dcy's avatar
dcy committed
604
      STATUS:{
605 606 607 608 609 610
        0:this.$t('取消报价'),
        1:this.$t('特价审批中'),
        2:this.$t('需求确认'),
        3:this.$t('跟进中'),
        4:this.$t('赢单'),
        5:this.$t('输单'),
611 612
        6:this.$t('报价完成'),
        7:this.$t('跟进中')
dcy's avatar
dcy committed
613
      },
614
      dialogVisible:false,
黄卓's avatar
黄卓 committed
615 616
      DICT_TYPE,
      getDictDataLabel,
Marcus's avatar
Marcus committed
617
      getDictDatas2,
黄卓's avatar
黄卓 committed
618
      parseTime,
黄卓's avatar
黄卓 committed
619 620
      nodeList: [],
      productTypeList: [],
黄卓's avatar
黄卓 committed
621 622
      customerSelect: [],
      serviceUserList: [],
黄卓's avatar
黄卓 committed
623
      customerContacts: [],
624
      memberList: [],
黄卓's avatar
黄卓 committed
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
      customer: {
        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,
        customerLines: [],
        promoter: undefined,
        status: undefined,
        founder: undefined,
        department: undefined,
        invoiceTitle: undefined,
        licenseNumber: undefined,
        bank: undefined,
        bankNumber: undefined,
        project: undefined,
        billingAddress: undefined,
        billingTell: undefined,
        taxRate: undefined,
        remarks: undefined,
        arrivalConfirm: undefined,
        weightUnit: undefined,
        createTime: undefined
Marcus's avatar
Marcus committed
661
      },
dcy's avatar
dcy committed
662 663 664 665 666 667
      brandAuthorizationFrom:{
        pageNo:1,
        pageSize:10,
      },
      brandAuthorizationList:[],
      brandAuthorizationTotal:0,
668
      getCustomerGradeFrom:{
dcy's avatar
dcy committed
669 670
        pageNo:1,
        pageSize:10,
671 672 673 674
        total:0
    },
      getCustomerGradeList:[],
      customerCreditLogFrom:{
dcy's avatar
dcy committed
675 676 677
        pageNo:1,
        pageSize:10,
        total:0
678
      },
dcy's avatar
dcy committed
679
      customerCreditLogList:[],
dcy's avatar
dcy committed
680
      rucangtime:[],
dcy's avatar
dcy committed
681
      queryParams:{
邓春圆's avatar
邓春圆 committed
682 683
        rows:10,
        page:1
dcy's avatar
dcy committed
684 685
      },
      orderList:[],
dcy's avatar
dcy committed
686 687 688 689 690 691 692
      orderTotal:0,
      infoListOfferFrom:{
        pageNo:1,
        pageSize:10,
      },
      infoListOfferTotal:0,
      infoListOfferList:[],
693 694 695 696 697 698 699 700 701
      orderStatisticsObj:{},
      creditTypeList:[],
      creditFrom:{},//添加信用 日志
      creditScoreStatisticObj:[],
      infoListReceiptList:[],
      infoListReceiptFrom:{
        pageNo:1,
        pageSize:10,
      },
702 703
      infoListReceiptTotal:0,
      country: ''
Marcus's avatar
Marcus committed
704
    }
黄卓's avatar
黄卓 committed
705 706
  },
  computed: {
707 708 709 710 711 712
    permissions(){
      return this.$store.state.user.permissions
    },
    customerId(){
      return this.$route.params.customerId;
    },
邓春圆's avatar
邓春圆 committed
713
      isChinese(){
邓春圆's avatar
邓春圆 committed
714 715
      return this.$i18n.locale === 'zh_CN'
    },
黄卓's avatar
黄卓 committed
716 717 718
    pickupPoint(){
      const pickupPoint = this.nodeList.find(p => p.id === parseInt(this.customer.pickupPoint))
      return pickupPoint ? pickupPoint.titleZh : ''
黄卓's avatar
黄卓 committed
719
    },
邓春圆's avatar
邓春圆 committed
720 721 722 723
    // promoter() {
    //   return this.customerSelect.find(e => e.id === this.customer.promoter)?.name || ''
    // },

黄卓's avatar
黄卓 committed
724
    id() {
邓春圆's avatar
邓春圆 committed
725
      return parseInt(this.$route.params.customerId)
726 727 728 729
    },
    creditScoreCalculation(){
      return (val)=>{
        if(val === 'all'){
730
          return this.$t('信用分')
731
        }else{
732 733
          if(this.isChinese) return (this.getDictDatas(DICT_TYPE.CUSTOMER_CREDIT_RULE_TYPE).find(i => i.value === val)||{}).label
            else return (this.getDictDatas(DICT_TYPE.CUSTOMER_CREDIT_RULE_TYPE).find(i => i.value === val)||{}).labelEn
734 735
        }
      }
黄卓's avatar
黄卓 committed
736
    }
dcy's avatar
dcy committed
737 738
  },
  methods:{
邓春圆's avatar
邓春圆 committed
739 740 741 742 743 744 745 746 747 748
    customerFollowFn(val){
      this.activeName = val
      this.$nextTick(()=>{
        if(val === 'follow'){
          this.$refs['customerFollow'].customerFollow.dialogVisible = true;
        }else {
         this.$refs['customerComplaint'].handleAdd()
        }
      })
    },
邓春圆's avatar
邓春圆 committed
749
    checkPermi,
750 751 752 753 754 755 756 757
    userIdFormatter(row, column, cellValue){
      const member = this.memberList.find(e => e.id === cellValue)
      if (member) {
        return member.nickname + '(' + member.mobile + ')'
      } else {
        return ''
      }
    },
dcy's avatar
dcy committed
758 759
    changeDate(val){
     if(val){
760 761
        this.queryParams.beginRucangTime =  val[0];
       this.queryParams. endRucangTime =  val[1];
dcy's avatar
dcy committed
762
     }else {
763 764
       this.queryParams.beginRucangTime = undefined;
       this.queryParams.endRucangTime =  undefined;
dcy's avatar
dcy committed
765 766 767
     }
    },
    //品牌授权
dcy's avatar
dcy committed
768 769
    getBrankByCustomerList(){
      getBrankByCustomer({...this.brandAuthorizationFrom,customerId:this.id}).then(r => {this.brandAuthorizationList = r.data.list; this.brandAuthorizationTotal = r.data.total})
770
    },
771
    // 信用等级日志
772
    getCustomerGrade(){
dcy's avatar
dcy committed
773
      levelLogPage({...this.getCustomerGradeFrom,customerId:this.id,total:undefined}).then(r => {
774 775 776 777 778 779
        if(r.code === 0){
          this.getCustomerGradeList = r.data.list;
          this.getCustomerGradeFrom.total = r.data.total;
        }
      })
    },
780
  // 信用日志
781 782 783 784 785 786 787
   creditLogPage(){
     customerCreditLogPage({...this.customerCreditLogFrom,customerId:this.id}).then(r => {
         if(r.code === 0){
           this.customerCreditLogList = r.data.list;
           this.customerCreditLogFrom.total = r.data.total;
         }
     })
dcy's avatar
dcy committed
788
   },
dcy's avatar
dcy committed
789
    //订单
dcy's avatar
dcy committed
790
    getorderList(){
791
      infoListOrderPage({customerDetailId:this.id,...this.queryParams}).then(r => {
dcy's avatar
dcy committed
792 793 794 795 796
        if(r.code === 0){
          this.orderList = r.data.list
          this.orderTotal = r.data.total
        }
      })
dcy's avatar
dcy committed
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
    },
  // 客户报价
    getInfoListOfferPage(){
      infoListOfferPage({...this.infoListOfferFrom,customerId:this.id}).then(r => {
        this.infoListOfferList = r.data.list;
        this.infoListOfferTotal = r.data.total;
      }).catch(r => {
      })
    },
  //  数据
    getOrderStatistics(){
      orderStatistics({customerId:this.id}).then(r => {
        if(r.code === 0){
          this.orderStatisticsObj = r.data
        }
      })
813 814 815 816 817 818
    },
    submit(){
      creditLogCreate({customerId:this.id,...this.creditFrom}).then(r => {
      if(r.code === 0){
        this.creditLogPage();
        this.creditFrom = {};
819
        this.creditScoreStatisticFn()
820 821 822 823 824 825 826 827 828 829 830 831 832
        this.dialogVisible = false;
      }
      })
    },
    //获得信用客户统计
    creditScoreStatisticFn(){
      creditScoreStatistic({customerId:this.id}).then(r => {
        if(r.code === 0) this.creditScoreStatisticObj = r.data
      })
    },
  //  获取账单数据
    infoListReceiptFn(){
      infoListReceiptPage({...this.infoListReceiptFrom,customerId:this.id}).then(r => {
邓春圆's avatar
邓春圆 committed
833

834 835 836 837 838
        if(r.code === 0){
          this.infoListReceiptList = r.data.list;
          this.infoListReceiptTotal = r.data.total;
        }
      })
839 840 841 842 843 844 845 846 847 848 849 850
    },
    deleteCustomerFn(){
      this.$confirm(`${this.$t('是否要删除当前客户')}《${this.customer.name}》?`, `${this.$t('提示')}`, {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(() => {
        deleteCustomer(this.customerId).then(r => {
          this.$modal.msgSuccess(this.$t('删除成功'));
          this.$router.back()
        })
      })
dcy's avatar
dcy committed
851
    }
852 853
  },

黄卓's avatar
黄卓 committed
854 855 856 857 858 859
}
</script>

<style scoped>

</style>