indirectInfo.vue 30.8 KB
Newer Older
1 2 3 4 5 6 7
<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;">
          <h2>{{$t('查看')}}</h2>
          <div>
我在何方's avatar
我在何方 committed
8
            <el-button type="primary" size="small" @click="$router.push('/customer/editIndirect?id=' + id)">{{$t('编辑')}}</el-button>
9 10 11
<!--            <el-button @click="$router.push('/offer/create')" type="primary" size="small">{{$t('报价')}}</el-button>
            <el-button type="primary" size="small" @click="$refs['customerFollow'].customerFollow.dialogVisible = true">{{$t('跟进')}}</el-button>
            <el-button type="primary" size="small" @click="$refs['customerComplaint'].handleAdd()">{{$t('客诉')}}</el-button> -->
12 13
            <!-- <el-button  type="danger" @click="delCustomer" size="small">{{$t('删除')}}</el-button> -->
             <el-button v-hasPermi="['ecw:indirectCustomer:delete']" type="danger" @click="delCustomer" size="small">{{$t('删除')}}</el-button>
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
          </div>
        </div>
        <el-card style="margin-top: 15px;">
          <el-descriptions :column="4" border>
            <el-descriptions-item :label="$t('客户编号')">{{ customer.number }}</el-descriptions-item>
            <el-descriptions-item :label="$t('客户名称')">{{ customer.name }}</el-descriptions-item>
            <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>
            <el-descriptions-item :label="$t('客户等级')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_LEVEL, customer.level) }}</el-descriptions-item>
            <el-descriptions-item :label="$t('国家')">{{ country }}</el-descriptions-item>
<!--            <el-descriptions-item :label="$t('业务员')">{{ customer }}</el-descriptions-item>-->
            <el-descriptions-item :label="$t('客户来源')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_SOURCE, customer.source) }}</el-descriptions-item>
            <el-descriptions-item :label="$t('客户类别')">{{ getDictDatas2(DICT_TYPE.CUSTOMER_TYPE, (customer.type||'').split(',')).map(e => e.label).join(', ') }}</el-descriptions-item>
<!--            <el-descriptions-item :label="$t('联系方式')">{{ customer }}</el-descriptions-item>-->
            <el-descriptions-item :label="$t('推介人')">{{ promoter  }}</el-descriptions-item>
            <el-descriptions-item :label="$t('客户经理')">{{ customerService }}</el-descriptions-item>
            <el-descriptions-item :label="$t('公司名称')">{{ customer.company }}</el-descriptions-item>
            <el-descriptions-item :label="$t('联系地址')">{{ customer.address }}</el-descriptions-item>
            <el-descriptions-item :label="$t('创建时间')">{{ parseTime(customer.createTime) }}</el-descriptions-item>
            <el-descriptions-item :label="$t('状态')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_STATUS, customer.status) }}</el-descriptions-item>
            <el-descriptions-item :label="$t('主营类别')">{{ productType }}</el-descriptions-item>
            <el-descriptions-item :label="$t('常提货网点')">{{ pickupPoint }}</el-descriptions-item>
            <el-descriptions-item :label="$t('图片')">
              <el-image v-show="!!customer.picture" :src="customer.picture" style="width: 100px;height: 100px"></el-image>
            </el-descriptions-item>
            <el-descriptions-item :label="$t('备注')">{{ customer.remarks }}</el-descriptions-item>
Marcus's avatar
Marcus committed
40
<!--            <el-descriptions-item :label="$t('信用等级')">{{ customer }}</el-descriptions-item>-->
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
          </el-descriptions>
        </el-card>

        <el-card style="margin-top: 15px">
          <h3>{{$t('联系人')}}</h3>

          <el-table
            :data="customerContacts"
            style="width: 100%"
            border
          >
            <el-table-column
              prop="department"
              :label="$t('部门')"
            >
            </el-table-column>
            <el-table-column
              prop="position"
              :label="$t('职位')"
            >
            </el-table-column>
            <el-table-column
              prop="name"
              :label="$t('联系人')"
            >
            </el-table-column>
            <el-table-column
              prop="phoneNew"
              :label="$t('联系方式')"
            >
              <template v-slot="{row}">
                {{ row.areaCode + row.phoneNew }}
              </template>
            </el-table-column>
            <el-table-column
              prop="userid"
              :label="$t('关联账号')"
              :formatter="userIdFormatter"
            >
            </el-table-column>
            <el-table-column
              prop="social"
              :label="$t('社交软件')"
              :formatter="(row, column, cellValue) => getDictDataLabel(DICT_TYPE.SOCIAL, cellValue)"
            >
            </el-table-column>
            <el-table-column
              prop="socialNumber"
              :label="$t('社交软件号码')"
            >
            </el-table-column>
            <el-table-column
              prop="email"
              :label="$t('邮箱')"
            >
            </el-table-column>
          </el-table>
        </el-card>

       <!-- <el-tabs style="margin-top: 15px" type="border-card">
          <el-tab-pane :label="$t('订单')">
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <el-form :inline="true">
                  <el-form-item :label="$t('运输方式:')">
                    <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number" />
                  </el-form-item>
                  <el-form-item :label="$t('订单状态:')">
                    <dict-selector :type="DICT_TYPE.ORDER_STATUS" v-model="queryParams.status"/>
                  </el-form-item>
                  <el-form-item :label="$t('报关方式:')">
                    <dict-selector
                      :type="DICT_TYPE.ECW_CUSTOMS_TYPE"
                      v-model="queryParams.customerType"
                    />
                  </el-form-item>
                  <el-form-item :label="$t('控货')">
                    <dict-selector
                      :type="DICT_TYPE.INFRA_BOOLEAN_STRING"
                      v-model="queryParams.isCargoControl"
                    />
                  </el-form-item>
                  <el-form-item :label="$t('入仓时间:')">
                    <el-date-picker v-model="rucangtime"
                                    @change="changeDate"
                                    style="width: 240px"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    type="daterange"
                                    range-separator="-"
                                    :start-placeholder="$t('开始日期')" :end-placeholder="$t('结束日期')" />
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="getorderList">{{$t('搜索')}}</el-button>
                    <el-button type="primary" @click="()=>{
                         queryParams = { rows:10,page:1}; getorderList()
                    }">{{$t('重置')}}</el-button>
                  </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}">
                    //入仓前是填单数据,入仓后是入仓数据
                    <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>
                  </template>
                </el-table-column>
                <el-table-column :label="$t('始发仓')" align="center" prop="departureName" />
                <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>
                <el-table-column :label="$t('订单状态')" align="center" prop="status">
                  <template slot-scope="scope">
                    <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status" />
                  </template>
                </el-table-column>
                </el-table>
              <pagination @pagination="getorderList" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"  :total="orderTotal" ></pagination>
            </el-card>
          </el-tab-pane>
          <el-tab-pane :label="$t('报价')">
            <el-table
              :data="infoListOfferList"
              style="width: 100%"
            >
              <el-table-column
                type="index"
                :label="$t('序号')"
              >
              </el-table-column>
              <el-table-column
                prop="number"
                :label="$t('报价单号')"
              >
              </el-table-column>
              <el-table-column
                prop="orderNo"
                :label="$t('订单号')"
              >
              </el-table-column>
              <el-table-column
                prop="consignorName"
                :label="$t('客户名称')"
              >
              </el-table-column>
              <el-table-column
                prop="objectiveName"
                :label="$t('目的地')"
              >
              </el-table-column>
              <el-table-column
                :label="$t('销售阶段')"
              >
                <template v-slot="{row}">
                  {{STATUS[row.status]}}
                </template>
              </el-table-column>
              <el-table-column
                prop="stopTime"
                :label="$t('预计结束时间')"
              >
              </el-table-column>
              <el-table-column
                prop="businessManagerName"
                :label="$t('负责人')"
              >
              </el-table-column>
            </el-table>
            <pagination @pagination="getInfoListOfferPage" :page.sync="infoListOfferFrom.pageNo" :limit.sync="infoListOfferFrom.pageSize"  :total="infoListOfferTotal" ></pagination>
          </el-tab-pane>
          <el-tab-pane :label="$t('跟进')">
            <customer-follow ref="customerFollow" :id="id" :customer-id="id"></customer-follow>
          </el-tab-pane>
          <el-tab-pane :label="$t('客户投诉')">
            <customer-complaint ref="customerComplaint" :customer-id="id" hidden-search></customer-complaint>
          </el-tab-pane>
          <el-tab-pane :label="$t('账单')">
            <el-table style="width: 100%" :data="infoListReceiptList">
              <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('类型')">
                <template v-slot="{row}">
                  <dict-tag :type="DICT_TYPE.PAYMENT_TYPE" :value="row.collectionType" />
                </template>
              </el-table-column>
              <el-table-column :label="$t('费用类型')">
                <template v-slot="{row}">
                  <dict-tag :type="DICT_TYPE.FEE_TYPE" :value="row.feeType" />
                </template>
              </el-table-column>
              <el-table-column :label="$t('金额')" prop="totalAmount">
              </el-table-column>
              <el-table-column :label="$t('已核销比例')" prop="writeOffScale"></el-table-column>
              <el-table-column :label="$t('实收日期')" prop="writeOffAt"></el-table-column>
              <el-table-column :label="$t('业务员')" prop="salesmanName"></el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane :label="$t('数据')">
            <el-descriptions :column="2">
              <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>
            </el-descriptions>
          </el-tab-pane>
          <el-tab-pane :label="$t('品牌授权')">
              <el-table  border style="width:100%" :data="brandAuthorizationList">
                <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('有无备案')">
                 <template v-slot="{row}">
                   <dict-tag :type="DICT_TYPE.BRAND_REG_TYPE" :value="row.filing" />
                 </template>
                </el-table-column>
                <el-table-column :label="$t('授权开始')">
                  <template v-slot="{row}">
                    {{parseTime(row.startTime)}}
                  </template>
                </el-table-column>
                <el-table-column :label="$t('授权结束')">
                  <template v-slot="{row}">
                    {{parseTime(row.endTime)}}
                  </template>
                </el-table-column>
                <el-table-column :label="$t('授权证明')">
                  <template v-slot="{row}">
                    <div v-if="!!row.fileUrl && row.fileUrl.length > 0">
                  <span v-for="(item, index) in (row.fileUrl||'').split(',')">
                    <a :href="item" target="_blank">{{$t('附件')}}{{ index + 1 }}</a>,
                  </span>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="feeScale"
                  :formatter="(row) => getDictDataLabel(DICT_TYPE.BRAND_CUSTOMER_CHARGING_MODEL, row.feeScale)"
                  :label="$t('收费标准')">
                </el-table-column>
                <el-table-column
                  prop="createUsername"
                  :label="$t('添加人')">
                </el-table-column>
                <el-table-column :label="$t('创建时间')">
                  <template v-slot="{row}">
                    {{parseTime(row.createTime)}}
                  </template>
                </el-table-column>
              </el-table>
            <pagination v-show="brandAuthorizationTotal > 0" :total="brandAuthorizationTotal" :page.sync="brandAuthorizationFrom.pageNo" :limit.sync="brandAuthorizationFrom.pageSize"
                        @pagination="getBrankByCustomerList"/>
          </el-tab-pane>
          <el-tab-pane :label="$t('信用日志')">
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <el-button style="float: right;" type="primary" @click="dialogVisible = true" >{{$t('添加信用日志')}}</el-button>
                <el-descriptions :column="5" border>
                  <el-descriptions-item v-for="(item,index) in creditScoreStatisticObj" :key="index" :label="creditScoreCalculation(item.type)">{{item.score}}</el-descriptions-item>
                </el-descriptions>
              </div>
              <el-table :data="customerCreditLogList">
                <el-table-column :label="$t('序号')" type="index"></el-table-column>
                <el-table-column  prop="name" :label="$t('规则名称')"></el-table-column>
                <el-table-column prop="type" :label="$t('规则分类')">
                  <template v-slot="{row}">
                    <dict-tag :type="DICT_TYPE.CUSTOMER_CREDIT_RULE_TYPE" :value="row.type" />
                  </template>
                </el-table-column>
                <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('时间')">
                  <template v-slot="{row}">
                    {{parseTime(row.createTime)}}
                  </template>
                </el-table-column>
              </el-table>
              <pagination @pagination="creditLogPage" :page.sync="customerCreditLogFrom.pageNo" :limit.sync="customerCreditLogFrom.pageSize"  :total="customerCreditLogFrom.total" ></pagination>
            </el-card>
          </el-tab-pane>
          <el-tab-pane :label="$t('等级日志')">
           <el-table style="width: 100%"  :data="getCustomerGradeList">
             <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">
               <template v-slot="{row}">
                 <dict-tag :type="DICT_TYPE.CUSTOMER_LEVEL_RULE_TYPE" :value="row.type" />
               </template>
             </el-table-column>
             <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('时间')">
               <template v-slot="{row}">
                 {{parseTime(row.createTime)}}
               </template>
             </el-table-column>
           </el-table>
            <pagination @pagination="getCustomerGrade" :page.sync="getCustomerGradeFrom.pageNo" :limit.sync="getCustomerGradeFrom.pageSize"  :total="getCustomerGradeFrom.total" ></pagination>
          </el-tab-pane>
        </el-tabs>-->
      </el-col>
    </el-row>
    <el-dialog
      :visible.sync="dialogVisible"
      width="30%"
      >
      <h1 slot="title">
        {{$t('给客户')}}{{customer.name}}{{$t('添加信用日志')}}
      </h1>
      <el-form label-width="100">
        <el-form-item :label="$t('客户编号:')">{{customer.number}}</el-form-item>
        <el-form-item :label="$t('信用类别')">
          <el-select v-model="creditFrom.ruleId">
            <el-option v-for="(item,index) in creditTypeList" :key="index" :value="item.id"  :label="item.name"></el-option>
          </el-select>
        </el-form-item>
        <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('备注')">
          <el-input type="textarea" v-model="creditFrom.remark"> </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
       <el-button @click="submit">{{$t('提交')}}</el-button>
       <el-button @click="dialogVisible = false" >{{$t('取消')}}</el-button>
  </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  getCustomerSelect,
  getBrankByCustomer,
  levelLogPage,
  customerCreditLogPage,
  infoListOrderPage,
  infoListOfferPage,
  orderStatistics,
  creditLogCreate,
  creditScoreStatistic,
408
  infoListReceiptPage, memberUserList
409 410 411 412 413 414 415 416
} from '@/api/ecw/customer'
import { DICT_TYPE, getDictDataLabel, getDictDatas2 } from '@/utils/dict'
import { getProductTypeList } from '@/api/ecw/productType'
import { getNodeList } from '@/api/ecw/node'
import CustomerFollow from "@/components/CustomerFollow"
import { parseTime } from '@/utils/ruoyi'
import CustomerComplaint from '@/views/ecw/customerComplaint'
import { listServiceUser } from '@/api/system/user'
417
import { getCustomerContactsListByCustomer,getCustomer,deleteIndirectCustomer } from '@/api/ecw/indirectCustomer'
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
import {getOrderPage} from "@/api/ecw/order";
import Template from "@/views/cms/template";
import {getCreditRulePage} from "@/api/customer/creditRule";
import {getCountry} from "@/api/ecw/country"

export default {
  name: 'IndirectInfo',
  components: {
    Template,
    CustomerFollow,
    CustomerComplaint
  },
  created() {
    //获取信用类型
    if(this.$route.query.id){
      this.id = this.$route.query.id
    }
    getCreditRulePage({page:1,rows:999,type:2}).then(r => {
     this.creditTypeList = r.data.list
    })
    getNodeList().then(r => {
      this.nodeList = r.data
    })
    getCustomer(this.id).then(response => {
      this.customer = { ...this.customer, ...response.data }
443
      console.log(this.id)
444
      getCustomerContactsListByCustomer({customerId: this.id}).then(r => {
我在何方's avatar
我在何方 committed
445 446 447 448 449 450 451 452
        if(r.data&&r.data.length>0){
          this.customerContacts = r.data
          let list =  this.customerContacts.map(r => r.userid)
          memberUserList({ids:list.join(',')}).then(r => {
            this.memberList = r.data
          })
        }

453 454 455
      })

      getCountry(this.customer.country ? this.customer.country : 0 ).then(r => {
我在何方's avatar
我在何方 committed
456
        this.country = r.data?r.data.nameZh:''
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
      })
    })
    getProductTypeList().then(r => {
      this.productTypeList = r.data
    })

    getCustomerSelect().then(r => {
      this.customerSelect = r.data.list
    })
    listServiceUser().then(r => {
      this.serviceUserList = r.data
    })
    this.getBrankByCustomerList()
    this.getCustomerGrade()
    this.creditLogPage()
    this.getorderList()
    this.getInfoListOfferPage()
    this.getOrderStatistics()
    this.creditScoreStatisticFn()
    this.infoListReceiptFn()


  },
  data() {
    return {
      STATUS:{
        0:this.$t('取消报价'),
        1:this.$t('特价审批中'),
        2:this.$t('需求确认'),
        3:this.$t('跟进中'),
        4:this.$t('赢单'),
        5:this.$t('输单'),
        6:this.$t('报价完成')
      },
      dialogVisible:false,
      DICT_TYPE,
      getDictDataLabel,
      getDictDatas2,
      parseTime,
      nodeList: [],
      id:0,
      productTypeList: [],
      customerSelect: [],
      serviceUserList: [],
      customerContacts: [],
      memberList: [],
      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
      },
      brandAuthorizationFrom:{
        pageNo:1,
        pageSize:10,
      },
      brandAuthorizationList:[],
      brandAuthorizationTotal:0,
      getCustomerGradeFrom:{
        pageNo:1,
        pageSize:10,
        total:0
    },
      getCustomerGradeList:[],
      customerCreditLogFrom:{
        pageNo:1,
        pageSize:10,
        total:0
      },
      customerCreditLogList:[],
      rucangtime:[],
      queryParams:{
        pageSize:10,
        pageNo:1
      },
      orderList:[],
      orderTotal:0,
      infoListOfferFrom:{
        pageNo:1,
        pageSize:10,
      },
      infoListOfferTotal:0,
      infoListOfferList:[],
      orderStatisticsObj:{},
      creditTypeList:[],
      creditFrom:{},//添加信用 日志
      creditScoreStatisticObj:[],
      infoListReceiptList:[],
      infoListReceiptFrom:{
        pageNo:1,
        pageSize:10,
      },
      infoListReceiptTotal:0,
      country: ''
    }
  },
  computed: {
    productType(){
      const productType = this.productTypeList.find(p => p.id === parseInt(this.customer.productType))
      return productType ? productType.titleZh : ''
    },
    pickupPoint(){
      const pickupPoint = this.nodeList.find(p => p.id === parseInt(this.customer.pickupPoint))
      return pickupPoint ? pickupPoint.titleZh : ''
    },
    promoter() {
      console.log(this.customerSelect,'this.customerSelect.find');
      return this.customerSelect.find(e => e.id === this.customer.promoter)?.name || ''
    },
    customerService() {
      return this.serviceUserList.find(e => e.id === this.customer.customerService)?.nickname || ''
    },
    id() {
      return this.customerId ? parseInt(this.customerId) : undefined
    },
    creditScoreCalculation(){
      return (val)=>{
        if(val === 'all'){
          return this.$t('信用分')
        }else{
          return (this.getDictDatas(DICT_TYPE.CUSTOMER_CREDIT_RULE_TYPE).find(i => i.value === val)||{}).label
        }
      }
    }
  },
  methods:{
    userIdFormatter(row, column, cellValue){
      const member = this.memberList.find(e => e.id === cellValue)
      if (member) {
        return member.nickname + '(' + member.mobile + ')'
      } else {
        return ''
      }
我在何方's avatar
我在何方 committed
621 622
    },
    delCustomer(){
623 624 625 626 627 628 629 630 631 632
      this.$confirm(`${this.$t('是否要删除当前客户')}《${this.customer.name}》?`, `${this.$t('提示')}`, {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(() => {
        deleteIndirectCustomer(this.id).then(r => {
          this.$modal.msgSuccess(this.$t('删除成功'));
          this.$router.back()
        })
      })
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 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
    },
    changeDate(val){
     if(val){
        this.queryParams.houseStartDate =  val[0];
       this.queryParams.houseEndDate =  val[1];
     }else {
       this.queryParams.houseStartDate = undefined;
       this.queryParams.houseEndDate =  undefined;
     }
    },
    //品牌授权
    getBrankByCustomerList(){
      getBrankByCustomer({...this.brandAuthorizationFrom,customerId:this.id}).then(r => {this.brandAuthorizationList = r.data.list; this.brandAuthorizationTotal = r.data.total})
    },
    getCustomerGrade(){
      levelLogPage({...this.getCustomerGradeFrom,customerId:this.id,total:undefined}).then(r => {
        console.log(r,'客户等级');
        if(r.code === 0){
          this.getCustomerGradeList = r.data.list;
          this.getCustomerGradeFrom.total = r.data.total;
        }
      })
    },
   // 获取信用等级日志列表
   creditLogPage(){
     customerCreditLogPage({...this.customerCreditLogFrom,customerId:this.id}).then(r => {
         if(r.code === 0){
           console.log(r,'r');
           this.customerCreditLogList = r.data.list;
           this.customerCreditLogFrom.total = r.data.total;
         }
     })
   },
    //订单
    getorderList(){
      infoListOrderPage({customerId:this.id,...this.queryParams}).then(r => {
        console.log(r)
        if(r.code === 0){
          this.orderList = r.data.list
          this.orderTotal = r.data.total
        }
      })
    },
  // 客户报价
    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 => {
        console.log(r,'数据')
        if(r.code === 0){
          this.orderStatisticsObj = r.data
        }
      })
    },
    submit(){
      creditLogCreate({customerId:this.id,...this.creditFrom}).then(r => {
      if(r.code === 0){
        this.creditLogPage();
        this.creditFrom = {};
        this.dialogVisible = false;
      }
      })
    },
    //获得信用客户统计
    creditScoreStatisticFn(){
      creditScoreStatistic({customerId:this.id}).then(r => {
        console.log(r)
        if(r.code === 0) this.creditScoreStatisticObj = r.data
      })
    },
  //  获取账单数据
    infoListReceiptFn(){
      infoListReceiptPage({...this.infoListReceiptFrom,customerId:this.id}).then(r => {
        console.log(r)
        if(r.code === 0){
          this.infoListReceiptList = r.data.list;
          this.infoListReceiptTotal = r.data.total;
        }
      })
    }
  }
}
</script>

<style scoped>

</style>