PotentialCustomerStoreDetailSection.vue 12.5 KB
<!-- 潜客详情 — 门店详情只读区块(与 CustomerDetailDialog 门店 Tab 一致) -->
<template>
  <div class="detail-info potential-customer-store-detail">
    <div v-if="showSectionTitle" class="title">
      门店详情
    </div>
    <glsx-combi-form class="edit-form-container" ref="editFormRef" :label-width="labelWidth" :form-obj="detailInfo"
      :form-data="editFormData">
      <div slot="storePhoto" slot-scope="scope">
        <glskPreview v-if="detailInfo[scope.scope.name]" :image-url-arr="[detailInfo[scope.scope.name]]"
          :pic-options="{ ...picOptions, type: 'image' }" limit="1"></glskPreview>
        <div v-else>-</div>
      </div>
    </glsx-combi-form>
    <template v-if="showVisitRecord">
      <div class="title">拜访记录</div>
      <d2-table ref="detailTable" class="detailTable" :table-data="detailInfo.visitRecordList"
        :table-params="tableParams" :has-page="hasPage">
        <div slot="visitPhotos" slot-scope="scope">
          <glskPreview v-if="scope.scope.visitPhotos" :image-url-arr="[scope.scope.visitPhotos]"
            :pic-options="{ ...picOptions, type: 'image' }" limit="1"></glskPreview>
          <div v-else>-</div>
        </div>
      </d2-table>
    </template>
  </div>
</template>

<script>
import dayjs from 'dayjs'
import { deepClone } from '@/common/util'
import { potentialCustomersDetail } from '@api/salesManagement'
import { busTypeOpt, cooperModeOpt, flowSituateOpt, potentialCustomerOpt } from '../constant/baseData'
import glskPreview from '@/views/usedCarManagement/components/preview'

export default {
  name: 'PotentialCustomerStoreDetailSection',
  components: {
    glskPreview
  },
  props: {
    recordId: {
      type: [Number, String],
      required: true
    },
    /** 是否展示「拜访记录」表格(信息核验弹框为 false) */
    showVisitRecord: {
      type: Boolean,
      default: true
    },
    /** 是否展示分区标题「门店详情」(详情弹框内常与 Tab 文案重复,可关闭) */
    showSectionTitle: {
      type: Boolean,
      default: false
    }
  },
  data() {
    const editItemStyle = {
      width: '50%',
      marginRight: '0px'
    }
    const contentStyle = {
      width: '358px',
      display: 'inline-block',
      'word-break': 'break-all',
      'white-space': 'pre-wrap'
    }
    return {
      picOptions: {
        width: '90px',
        height: '90px',
        isClose: false
      },
      labelWidth: '140px',
      detailInfo: {},
      editFormData: [],
      editFormSatusObj: {
        1: [],
        2: [{
          label: '战败原因',
          name: 'failureReason',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle
        }],
        3: [{
          label: '预计展业时间',
          name: 'expectedOperationDate',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle,
          formatter: (cellValue) => {
            return cellValue.expectedOperationDate ? dayjs(cellValue.expectedOperationDate).format('YYYY-MM-DD') : '-'
          }
        }, {
          label: '分润规则',
          name: 'profitRule',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle
        }, {
          label: '上架产品信息',
          name: 'productShelfInfo',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle
        }],
        4: [{
          label: '关联商户',
          name: 'merchantName',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle,
          formatter: (cellValue) => {
            return ((cellValue.merchantName || '') + (cellValue.merchantId ? ('(' + cellValue.merchantId + ')') : '')) || '-'
          }
        }, {
          label: '签约时间',
          name: 'signedTime',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle
        }, {
          label: '展业时间',
          name: 'expectedOperationDate',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle,
          formatter: (cellValue) => {
            return cellValue.expectedOperationDate ? dayjs(cellValue.expectedOperationDate).format('YYYY-MM-DD') : '-'
          }
        }, {
          label: '分润规则',
          name: 'profitRule',
          type: 'showTxt',
          style: editItemStyle,
          txtStyle: contentStyle
        }]
      },
      hasPage: false,
      tableParams: {
        btnId: Date.now() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: false,
        tableColumns: [{
          label: '跟进人',
          prop: 'followUpPersonName',
          formatter: (cellValue) => {
            return this.detailInfo.followUpPersonName || '-'
          }
        }, {
          label: '拜访时间',
          prop: 'visitTime',
          formatter: (cellValue) => {
            return cellValue.visitTime ? dayjs(cellValue.visitTime).format('YYYY-MM-DD HH:mm') : '-'
          }
        }, {
          label: '联系人',
          prop: 'contactPerson'
        }, {
          label: '拜访内容',
          prop: 'visitContent',
          width: '300px'
        }, {
          label: '拜访照片',
          prop: 'visitPhotos',
          addHtml: 'visitPhotos'
        }, {
          label: '拜访签到',
          prop: 'checkInLocation'
        }]
      },
      baseData: {
        busTypeOpt,
        cooperModeOpt,
        flowSituateOpt,
        potentialCustomerOpt
      }
    }
  },
  watch: {
    recordId: {
      handler(val) {
        if (val != null && val !== '') {
          this.getDetail()
        }
      },
      immediate: true
    }
  },
  methods: {
    buildBaseEditFormData() {
      const editItemStyle = {
        width: '50%',
        marginRight: '0px'
      }
      const contentStyle = {
        width: '358px',
        display: 'inline-block',
        'word-break': 'break-all',
        'white-space': 'pre-wrap'
      }
      return [{
        label: '状态',
        name: 'potentialCustomersStatus',
        type: 'showTxt',
        style: editItemStyle,
        formatter: (cellValue) => {
          return (
            this.baseData.potentialCustomerOpt.find(
              (item) => item.confId == cellValue.potentialCustomersStatus
            )?.confLabel || '-'
          )
        },
        className: (cellValue) => {
          return {
            1: 'yellowSpot',
            2: 'redSpot',
            3: 'greenSpot',
            4: 'greenSpot'
          }[cellValue.potentialCustomersStatus]
        }
      }, {
        label: '门店名称',
        name: 'storeName',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle
      }, {
        label: '业务类型',
        name: 'businessTypeList',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          return cellValue.businessTypeList ? cellValue.businessTypeList.map(item => this.baseData.busTypeOpt.find(opt => opt.confId == item)?.confLabel || '').join(',') : '-'
        }
      }, {
        label: '合作模式',
        name: 'cooperationMode',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          return this.baseData.cooperModeOpt.find(opt => opt.confId == cellValue.cooperationMode)?.confLabel || '-'
        }
      }, {
        label: '主营品牌',
        name: 'salePotentialCustomerBrandDTOList',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          return cellValue.salePotentialCustomerBrandDTOList ? cellValue.salePotentialCustomerBrandDTOList.map(item => item.subBrandName).join(',') : '-'
        }
      }, {
        label: '流量情况',
        name: 'flowSituation',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          return this.baseData.flowSituateOpt.find(opt => opt.confId == cellValue.flowSituation)?.confLabel || '-'
        }
      }, {
        label: '所在地区',
        name: '',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          return (cellValue.provinceName || '') + (cellValue.city || '') + (cellValue.districtName || '') || '-'
        }
      }, {
        label: '详细地址',
        name: 'address',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle
      }, {
        label: '店面门头照片',
        name: 'storePhoto',
        addHtml: 'storePhoto',
        style: { width: '100%', marginRight: '0px' }
      }, {
        label: '备注信息',
        name: 'remark',
        type: 'showTxt',
        style: { width: '100%', marginRight: '0px' },
        txtStyle: { ...contentStyle, width: '890px' }
      }, {
        label: '店总',
        name: 'salePotentialCustomerPersonnelInfoDTOList',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
          return (list && list.length) ? (list.filter(item => item.personnelType == 1).map(item => (item.personnelName ? item.personnelName : '') + (item.personnelPhone ? '(' + item.personnelPhone + ')' : '')).join(',') || '-') : '-'
        }
      }, {
        label: '销售经理',
        name: '',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
          return (list && list.length) ? (list.filter(item => item.personnelType == 2).map(item => (item.personnelName ? item.personnelName : '') + (item.personnelPhone ? '(' + item.personnelPhone + ')' : '')).join(',') || '-') : '-'
        }
      }, {
        label: '交付经理',
        name: '',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
          return (list && list.length) ? (list.filter(item => item.personnelType == 3).map(item => (item.personnelName ? item.personnelName : '') + (item.personnelPhone ? '(' + item.personnelPhone + ')' : '')).join(',') || '-') : '-'
        }
      }, {
        label: '装饰经理',
        name: '',
        type: 'showTxt',
        style: editItemStyle,
        txtStyle: contentStyle,
        formatter: (cellValue) => {
          const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
          return (list && list.length) ? (list.filter(item => item.personnelType == 4).map(item => (item.personnelName ? item.personnelName : '') + (item.personnelPhone ? '(' + item.personnelPhone + ')' : '')).join(',') || '-') : '-'
        }
      }, {
        label: '保险经理',
        name: '',
        type: 'showTxt',
        txtStyle: contentStyle,
        style: editItemStyle,
        formatter: (cellValue) => {
          const list = cellValue.salePotentialCustomerPersonnelInfoDTOList
          return (list && list.length) ? (list.filter(item => item.personnelType == 5).map(item => (item.personnelName ? item.personnelName : '') + (item.personnelPhone ? '(' + item.personnelPhone + ')' : '')).join(',') || '-') : '-'
        }
      }]
    },

    dealShowAttr() {
      const status = this.detailInfo.potentialCustomersStatus || 1
      this.editFormData.push(...this.editFormSatusObj[status] || [])
    },

    getDetail() {
      this.editFormData = this.buildBaseEditFormData()
      const params = { id: deepClone(this.recordId) }
      potentialCustomersDetail(params).then(res => {
        this.detailInfo = res
        this.dealShowAttr()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-form-item--small .el-form-item__label,
::v-deep .el-form-item--small .el-form-item__content {
  line-height: 20px;
}

::v-deep .detailTable .activity-img-box {
  justify-content: center;
}

::v-deep .detailTable .activity-img-box .pic-box {
  margin: 0px;
}

::v-deep .detailTable .activity-img-box .pic-box .photo-activity {
  position: relative;
}

.potential-customer-store-detail.detail-info {
  .title {
    width: 100%;
    height: 50px;
    line-height: 50px;
    font-weight: 500;
    color: #333333;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
  }

  span {
    color: #333333ff;
  }
}
</style>