AppointTable.vue 3.96 KB
<!-- 邀约详情 -->
<template>
  <div class="appoint-table">
    <table
      cellpadding='0'
      cellspacing='0'
    >
      <tr>
        <td>邀约时间</td>
        <td>邀约详情</td>
        <td>服务状态</td>
      </tr>
      <tr
        v-for="(item, index) in detailData"
        :key="index"
      >
        <td>{{item.time}}</td>
        <td class="flex">
          <img
            class="detail-header"
            :src="item.info.sex === 1 ? './header-man.jpg' : './header-woman.jpg'"
          />
          <block class="detail-info">
            <p>{{item.info.name}}</p>
            <p>{{item.info.project}}</p>
          </block>
          <block class="detail-phone">
            <p
              class="secret-phone"
              v-show="!item.info.phone"
            >
              <span class="one-tip">手机号码已加密</span>
              <span
                class="two-tip"
                @click="handleGetPhone(item, index)"
              >获取虚拟手机号</span>
            </p>
            <p v-show="item.info.phone">{{item.info.phone}}</p>
          </block>
        </td>
        <td>
          {{item.status === 1 ? '完成服务' : '未到店'}}
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: 'AppointTable',
  data() {
    return {
      hoursList: [
        { 'hour': '9:00' }, { 'hour': '10:00' },
        { 'hour': '11:00' }, { 'hour': '12:00' },
        { 'hour': '13:00' }, { 'hour': '14:00' },
        { 'hour': '15:00' }, { 'hour': '16:00' },
        { 'hour': '17:00' }, { 'hour': '18:00' }],
      detailData: [{
        time: '9:00',
        info: {
          header: '',
          name: '张三',
          // 1 - 男; 2 - 女
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }, {
        time: '9:00',
        info: {
          header: '',
          name: '张兰',
          sex: 2,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 1
      }, {
        time: '10:00',
        info: {
          header: '',
          name: '张一二',
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }]
    }
  },

  mounted() { },

  methods: {
    handleGetPhone(targetItem, targetIndex) {
      this.$confirm('客户手机号码已加密,是否获取虚拟号码?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.detailData[targetIndex].info.phone = '13088889999'
      }).catch(err => {
        console.log(err)
      })
    }
  }
}

</script>
<style lang="scss" scoped>
.appoint-table {
  width: 50%;
  min-width: 536px;
  .flex {
    display: flex;
  }
  table {
    width: 98%;
    color: #333;
    border: 1px solid #cfd3d5;
    border-width: 1px 0 0 1px;
    td {
      padding: 0px 10px;
      border: 1px solid #cfd3d5;
      border-width: 0px 1px 1px 0px;
      border-spacing: 0;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      .detail-header {
        height: 70px;
        width: 70px;
        border-radius: 50%;
        margin: 6px 10px;
      }
      .detail-info {
        width: calc(100% - 250px);
      }
      .detail-phone {
        position: relative;
        width: 180px;
        height: 70px;
        line-height: 70px;
        overflow: hidden;
        p {
          margin: 0 0;
        }
      }
      .secret-phone {
        position: absolute;
        left: 0;
        transition: left 1s;
        cursor: pointer;
        span {
          display: inline-block;
          width: 180px;
          height: 100%;
        }
        .two-tip {
          background-color: #cccccc;
        }
      }
      .secret-phone:hover {
        left: -180px;
      }
    }
  }
}
</style>