qualityDetail.vue 8.88 KB
<!-- 关联活动订单弹窗 -->
<template>
  <d2-dialog
    title="查看结果"
    :is-visible="isQualityVisible"
    class="qualityDailog"
    width="100%"
    @closeDialog="handleClose"
    @confirmDialog="handleClose"
    :isShowFooter="false"
    :noCancel="true"
  >
    <div class="quality-box">
      <template v-if="qualityDetailList.length">
        <div class="overview">
          <template v-for="(i, index) in overviewObject">
            <div
              :key="index"
              class="overview-item"
            >
              <div class="label">{{ i.label }}</div>
              <div class="value">
                <template v-if="i.formatter">
                  <div v-html="i.formatter(qualityDetailList[currentNum])"></div>
                </template>
                <template v-else>
                  {{ qualityDetailList[currentNum][i.key] || "-" }}
                </template>
              </div>
            </div>
          </template>
        </div>

        <div
          class="content"
          :key="currentNum"
        >
          <div class="dialogue-box">
            <dialogue-detail :detailObj="qualityDetailList[currentNum]" />
          </div>
          <div class="analyse-box">
            <quality-analyse :detailObj="qualityDetailList[currentNum]" />
          </div>
        </div>
      </template>
      <div class="footer-box">
        <el-button
          size="small"
          :class="{ opacity: currentNum == 0 }"
          @click="jump(-1)"
          :data-track="JSON.stringify({
            batchId:qualityDetailList[currentNum].id
          })"
          data-event-code="previous"
        >上一条</el-button>
        <div class="text">
          {{ currentNum + 1 }}/{{ qualityDetailList.length }}
        </div>
        <el-button
          type="primary"
          size="small"
          :class="{ opacity: currentNum == qualityDetailList.length - 1 }"
          @click="jump(1)"
          :data-track="JSON.stringify({
            batchId:qualityDetailList[currentNum].id
          })"
          data-event-code="next"
        >下一条</el-button>
      </div>
    </div>
  </d2-dialog>
</template>

<script>
import { Util, deepClone } from "@/common/util"
import { shopmallOrderList, relatedActivityOrder } from "@api/order"
import QualityAnalyse from "./qualityAnalyse"
import DialogueDetail from "./dialogueDetail"
const toMinutesAndSeconds = (seconds) => {
  seconds = Math.floor(seconds / 1000)
  let formattedTime = ""
  if (seconds < 60) {
    return seconds + '<span class="unit">秒</span>'
  } else if (seconds > 3600) {
    let hours = Math.floor(seconds / 3600),
      minutes = Math.floor((seconds % 3600) / 60)
    if (hours > 0) formattedTime += hours + '<span class="unit">小时</span>'
    if (minutes > 0 || hours > 0)
      formattedTime += minutes + '<span class="unit">分钟</span>'
    return formattedTime
  } else {
    let hours = Math.floor(seconds / 3600),
      minutes = Math.floor((seconds % 3600) / 60),
      remainingSeconds = seconds % 60
    if (hours > 0) formattedTime += hours + '<span class="unit">小时</span>'
    if (minutes > 0 || hours > 0)
      formattedTime += minutes + '<span class="unit">分钟</span>'
    if (remainingSeconds > 0)
      formattedTime += remainingSeconds + '<span class="unit">秒</span>'
    return formattedTime
  }
}
import reportTrackFunMixin from '@/mixins/reportTrackFunMixin'
export default {
  mixins: [reportTrackFunMixin],
  name: "RelatActivityOrderDialog",
  components: {
    QualityAnalyse,
    DialogueDetail
  },
  data () {
    return {
      overviewObject: [
        {
          label: "客户姓名",
          key: "customerName"
        },
        {
          label: "车型",
          key: "carModel"
        },
        {
          label: "业务场景",
          key: "bussinessType",
          formatter (row) {
            let result = { 1: "会员权益/升级", 2: "轻改" }[row.bussinessType]
            return result || "-"
          }
        },
        {
          label: "APP接待结果",
          formatter (row) {
            // if (row.bussinessType == 2) return "-"
            const val = {
              1: "成交",
              0: "战败"
            }[row.receptionStatus],
              color = {
                1: "#2CCA74",
                0: "#EB4E4E"
              }[row.receptionStatus]
            return `<span style="font-size:20px;color:${color}">${val || "-"
              }</span>`
          }
        },
        {
          label: "预计营销结果",
          formatter (row) {
            // if (row.bussinessType == 2) return "-"
            const color =
              {
                成交: "#2CCA74",
                战败: "#EB4E4E"
              }[row.estimatedResult] || "#999999"
            return `<span style="font-size:20px;color:${color}">${row.estimatedResult || "分析中"
              }</span>`
          }
        },
        {
          label: "质检得分",
          formatter (row) {
            // if (row.bussinessType == 2) return "-"
            return row.score != null
              ? `<div class="num">${row.score}<span class="unit">分</span></div>`
              : `<span style="font-size:20px;color:#999">分析中</span>`
          }
        },
        {
          label: "攻防得分",
          formatter (row) {
            return row.defence === 2
              ? `<div class="num">${row.defencePoint}<span class="unit">分</span></div>`
              : row.defence === 1 || row.defence === 0 || row.defence === 4
                ? `<span style="font-size:22px;color:#999">分析中</span>`
                : row.defence === 3
                  ? `<span style="font-size:22px;color:#999">未发现攻防</span>`
                  : `<span style="font-size:22px;color:#999">-</span>`
          }
        }
      ],
      activeName: "analyse",
      track_event_code: 'reception_detail',
      track_businessParam_key: 'searchForm',
      searchForm: {
        batchId: ""
      }
    }
  },

  props: {
    isQualityVisible: {
      type: Boolean,
      default: false
    },
    currentNum: {
      type: Number,
      default: 0
    },
    qualityDetailList: {
      type: Array,
      default: () => []
    }
  },
  watch: {
    currentNum: {
      handler (val) {
        this.searchForm.batchId = this.qualityDetailList[val].id
        this.onPageShow()
      },
      immediate: true
    }
  },
  computed: {},
  mounted () {
    console.log(this.qualityDetailList[this.currentNum])
  },

  methods: {
    handleClose () {
      this.$emit("closeDialog", false)
    },
    jump (num) {
      try {
        const { qualityDetailList, currentNum } = this,
          max = qualityDetailList.length - 1
        if ((currentNum == 0 && num == -1) || (currentNum == max && num == 1))
          throw "无更多接待记录"
        this.onPageHide()
        this.currentNum += num
      } catch (error) {
        if (error) this.$message.error(error)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep.qualityDailog {
  .el-dialog {
    height: 100vh !important;
    margin: 0 !important;
    background-color: #f0f1f7;
  }
  .el-dialog__header {
    padding: 16px 20px !important;
    font-weight: 500;
    font-size: 16px;
    color: #1d1d1d;
    line-height: 24px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
  }
  .el-dialog__body {
    padding: 0 !important;
  }
  .el-dialog__footer {
    display: none;
  }
  .quality-box {
    .overview {
      display: flex;
      align-items: center;
      background: #ffffff;
      padding: 20px;
      justify-content: space-between;
      &-item {
        width: calc((100% - 40px) / 7);
        background: #f7f9fa;
        border-radius: 4px;
        box-sizing: border-box;
        height: 92px;
        padding: 16px;
        font-size: 14px;
        color: #333333;
        .label {
          line-height: 20px;
        }
        .value {
          font-weight: 600;
          font-size: 20px;
          color: #333333;
          margin-top: 8px;
          line-height: 32px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          .num {
            font-weight: 700;
            font-size: 26px;
            .unit {
              font-weight: 400;
              font-size: 14px;
              color: #333333;
              margin: 0 2px;
            }
          }
        }
      }
    }
    .content {
      display: flex;
      margin-top: 16px;
      height: calc(100vh - 270px);
      overflow: hidden;
      .dialogue-box {
        width: 40%;
      }
      .analyse-box {
        width: calc(60% - 16px);
        margin-left: auto;
      }
    }
    .footer-box {
      position: fixed;

      left: 0;
      bottom: 0;
      width: 100%;
      height: 64px;
      font-size: 14px;
      color: #666666;
      display: flex;
      align-items: center;
      justify-content: center;
      .text {
        margin: 0 16px;
      }
      .opacity {
        opacity: 0.5;
      }
    }
  }
}
</style>