CustomerInfoPopup.vue 10.3 KB
<template>
  <div>
    <van-action-sheet v-model="showCustomerDetail" cancel-text="关闭详情" close-on-click-action @cancel="onCancel" @click-overlay="clickOverlay">
      <div class="popup-card">
        <div class="name-title">
          <div class="name-title-text text-hide">{{ customerList.customerName }}</div>
        </div>
        <!-- 客户信息 -->
        <div class="customer-message">
          <div class="customer-info-title">客户信息</div>
          <div class="customer-info-box">
            <div class="customer-info-item">
              <div class="customer-info-item-title">VIN码</div>
              <div class="customer-info-item-content">{{ customerList.cars && customerList.cars.length > 0 && customerList.cars[0].carVin }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">车系</div>
              <div class="customer-info-item-content">{{ customerList.cars && customerList.cars.length > 0 && customerList.cars[0].carSeries }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">车牌号码</div>
              <div class="customer-info-item-content">{{ customerList.cars && customerList.cars.length > 0 && customerList.cars[0].carNumber }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">购车日期</div>
              <div class="customer-info-item-content">{{ customerList.cars && customerList.cars.length > 0 && customerList.cars[0].carBuyDate }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">最近保养</div>
              <div class="customer-info-item-content">{{ maintennceList.length > 0 ? maintennceList[0].maDate : '' }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">人群分组</div>
              <div class="customer-info-item-content text-hide">{{ groupName }}</div>
            </div>
            <div class="customer-info-item">
              <div class="customer-info-item-title">企微账号</div>
              <div v-if="customerList.nickName">
                <span class="customer-info-item-content">{{ customerList.nickName }}</span>
                <span class="customer-info-item-wechat customer-info-item-message" v-if="customerList.type == 1">@微信</span>
                <span class="customer-info-item-qiwei customer-info-item-message" v-else>@企微</span>
              </div>
              <div class="customer-info-message" v-else>未添加</div>
            </div>
          </div>
        </div>
        <!-- 维保记录 -->
        <div class="customer-message">
          <div class="customer-info-title">维保记录</div>
          <template v-if="maintennceList.length">
            <div class="stepItem" v-for="(item, index) in maintennceList" :key="index">
              <div class="sprite-icon icon-maintant"></div>
              <div class="stepBox">
                <div class="stepBox-left">
                  <div class="stepBox-left-name">{{ item.repairItems }}</div>
                  <div class="stepBox-left-title">
                    费用:
                    <span class="stepBox-left-content">{{ item.price }}</span>
                  </div>
                  <div class="stepBox-left-title">
                    跟进人:
                    <span class="stepBox-left-content">{{ item.follower }}</span>
                  </div>
                </div>
                <div class="stepBox-right">{{ item.maDate }}</div>
              </div>
            </div>
          </template>
          <div v-else class="no-data">暂无数据</div>
        </div>
        <!-- 跟进记录 -->
        <div class="record">
          <div class="customer-info-title">跟进记录</div>
          <template v-if="followRecordList.length">
            <div class="stepItem" v-for="(item, index) in followRecordList" :key="index">
              <div class="sprite-icon icon-followRecord"></div>
              <div style="width: 90%">
                <div class="stepBox-follow">
                  <div class="stepBox-left-name">{{ item.followResultEcho }}</div>
                  <div class="stepBox-right">{{ item.createdTime }}</div>
                </div>
                <div class="stepBox-left-title">
                  预约时间:
                  <span class="stepBox-left-content">{{ item.orderTime ? item.orderTime : '-' }}</span>
                </div>
                <div class="stepBox-left-title" style="display: flex">
                  <div class="stepBox-left-title-tip">备注:</div>
                  <div class="stepBox-left-content stepBox-left-content-overflow">{{ item.followMark ? item.followMark : '-' }}</div>
                </div>
              </div>
            </div>
          </template>
          <div v-else class="no-data">暂无数据</div>
        </div>
      </div>
    </van-action-sheet>
  </div>
</template>

<script>
import { solicitApi } from '@/api'
export default {
  name: 'CustomerInfoPopup',
  data() {
    return {
      // 客户信息弹出层展示
      showCustomerDetail: false,
      // 客户信息表
      customerList: {},
      // 车辆信息列表
      carInfoList: [],
      // 维保记录表
      maintennceList: [],
      // 跟进记录列表
      followRecordList: []
    }
  },
  created() {
    this.groupName = this.getQuery().groupName ? this.getQuery().groupName : ''
  },
  methods: {
    // 获取客户详情
    getCustomerDetail(val) {
      this.showCustomerDetail = true
      var params = {
        customerId: val.actCutId
      }
      solicitApi.getCustomerDetail(params).then(({ code, data, message }) => {
        if (code == 0) {
          this.customerList = data
          if (data.cars && data.cars.length) {
            this.carInfoList = data.cars
            this.carInfoList.map(item => {
              item.carBuyDate = item.carBuyDate && this.timeTransfer(item.carBuyDate)
            })
          }
          if (data.maList && data.maList.length) {
            this.maintennceList = data.maList
            this.maintennceList.map(item => {
              item.maDate = item.maDate && this.timeTransfer(item.maDate)
            })
          }
          if (data.followRecordList && data.followRecordList.length) {
            this.followRecordList = data.followRecordList
            this.followRecordList.map(item => {
              item.orderTime = item.orderTime && this.timeTransfer(item.orderTime)
              item.createdTime = item.createdTime && this.timeTransfer(item.createdTime)
            })
          }
        }
      })
    },
    // 时间戳转换
    timeTransfer(val) {
      let time = new Date(val)
      let year = time.getFullYear() + '-'
      let month = time.getMonth() + 1
      let date = time.getDate()
      let hour = time.getHours()
      let minute = time.getMinutes()
      month = month < 10 ? '0' + month + '-' : month + '-'
      date = date < 10 ? '0' + date : date
      hour = hour < 10 ? '0' + hour + ':' : hour + ':'
      minute = minute < 10 ? '0' + minute : minute
      let result = String(year) + String(month) + String(date) + ' ' + String(hour) + String(minute)
      return result
    },
    // 关闭弹窗
    onCancel() {
      this.showCustomerDetail = false
      this.customerList = {}
      this.carInfoList = []
      this.maintennceList = []
      this.followRecordList = []
    },
    clickOverlay() {
      this.showCustomerDetail = false
      this.customerList = {}
      this.carInfoList = []
      this.maintennceList = []
      this.followRecordList = []
    }
  }
}
</script>

<style lang="scss" scoped>
.popup-card {
  padding: 0 0 16px 0;
}
.name-title {
  box-sizing: border-box;
  padding: 0 16px;
  width: 100%;
  height: 48px;
  background-color: #fff;
  border-bottom: 1px solid rgba(195, 195, 195, 0.3);
  position: sticky;
  top: 0;
  z-index: 999;
  &-text {
    font-size: 16px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 600;
    color: #333333;
    line-height: 48px;
  }
}
.customer-message {
  box-sizing: border-box;
  padding: 16px 0;
  margin: 0 16px;
  border-bottom: 1px solid rgba(195, 195, 195, 0.3);
}
.customer-info-title {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #333333;
  line-height: 22px;
  margin-bottom: 12px;
}
.customer-info-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  line-height: 22px;
  padding-top: 8px;
  &-title {
    color: #666666;
  }
  &-content {
    color: #333333;
    max-width: 200px;
  }
  &-message {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    line-height: 18px;
  }
  &-wechat {
    color: #2cca74;
  }
  &-qiwei {
    color: #3975c6;
  }
}
.record {
  margin: 16px 16px 0 16px;
}
.stepItem {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding-bottom: 5px;
  margin-top: 17px;
}
.stepItem:not(:last-of-type):after {
  content: '';
  font-size: 0;
  height: 100%;
  width: 1px;
  background: #e6e8eb;
  position: absolute;
  left: 10px;
  top: 20px;
}
.stepBox {
  width: 90%;
  display: flex;
  justify-content: space-between;
  &-follow {
    display: flex;
    justify-content: space-between;
  }
}
.stepBox-left {
  &-name {
    font-size: 14px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 600;
    color: #333333;
    line-height: 22px;
  }
  &-title {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999;
    line-height: 18px;
    &-tip {
      display: inline-block;
      min-width: 36px;
    }
  }
  &-content {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #330000;
    line-height: 18px;
    &-overflow {
      display: inline-block;
      padding-right: 16px;
    }
  }
}
.stepBox-right {
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #999999;
  line-height: 18px;
}
.no-data {
  height: 50px;
  width: 100%;
  text-align: center;
  line-height: 50px;
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #999999;
}
/deep/ .van-action-sheet {
  max-height: 100%;
}
</style>