AppointTable.vue 6.24 KB
<!-- 邀约详情 -->
<template>
  <div class="appoint-table">
    <div class="appoint-header">
      <p>今日邀约详情</p>
    </div>
    <div class="appoint-table-content">
      <table
        cellpadding="0"
        cellspacing="0">
        <tr class="appoint-table-header">
          <td>邀约时间</td>
          <td>邀约详情</td>
          <td>服务状态</td>
        </tr>
        <template v-if="detailData.length">
          <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 ? './images/header-man-grey.png' : './images/header-woman.png'">
              <template class="detail-info">
                <p>{{ item.info.name }}</p>
                <p>{{ item.info.project }}</p>
              </template>
              <template 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>
              </template>
            </td>
            <td>
              {{ item.status === 1 ? '完成服务' : '未到店' }}
            </td>
          </tr>
        </template>
        <tr v-else>
          <td colspan="3">
            无数据
          </td>
        </tr>
      </table>
    </div>
  </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
      }, {
        time: '上午10:00',
        info: {
          header: '',
          name: '张一二',
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }, {
        time: '上午10:00',
        info: {
          header: '',
          name: '张一二',
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }, {
        time: '上午10:00',
        info: {
          header: '',
          name: '张一二',
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }, {
        time: '上午10:00',
        info: {
          header: '',
          name: '张一二',
          sex: 1,
          project: '预约项目',
          phone: ''
        },
        // 0 - 未到店; 1 - 完成服务
        status: 0
      }, {
        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: 49%;
  min-width: 536px;
  padding: 20px;
  margin-right: 10px;
  box-shadow: 0 0 11px 0 rgba(207, 207, 207, 0.5);
  p {
    margin: 0 0;
  }
  .flex {
    display: flex;
  }
  .appoint-header {
    font-size: 16px;
    color: #6c6f71;
    margin-bottom: 16px;
  }
  .appoint-table-header {
    height: 40px;
  }
  .appoint-table-content {
    height: 533px;
    overflow-y: scroll;
  }
  table {
    width: 98%;
    color: #666666;
    border: 1px solid #e5e6e7;
    border-width: 1px 0 0 1px;
    td {
      font-size: 12px;
      padding: 0px 10px;
      border: 1px solid #e5e6e7;
      border-width: 0px 1px 1px 0px;
      border-spacing: 0;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      .detail-header {
        height: 30px;
        width: 30px;
        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;
      }
      .secret-phone {
        position: absolute;
        left: 0;
        transition: left 1s;
        cursor: pointer;
        span {
          display: inline-template;
          width: 180px;
          height: 100%;
        }
        .two-tip {
          color: #ffffff;
          background-color: #4ECB73;
        }
      }
      .secret-phone:hover {
        left: -180px;
      }
    }
  }
}
</style>