index.vue 8.25 KB
<template>
  <div class="layout">
    <div class="user-box flex">
      <!-- <div
        class="tips text-center"
        @click="closeWindow"
      >
        <div class="sprite-icon icon-index-tips"></div>
        <div class="num">9999</div>
      </div> -->
      <div class="avatar">
        <template v-if="userInfo.staffAvatar">
          <img :src="userInfo.staffAvatar" />
        </template>
        <template v-else>
          <div class="sprite-icon icon-default-avatar"></div>
        </template>
      </div>
      <div class="info">
        <div class="name text-hide">{{ userInfo.userName || '' }}</div>
        <div class="merchant">
          <template v-if="accountList.length">
            <van-dropdown-menu
              active-color="#3975C6"
              class="merchant"
            >
              <van-dropdown-item
                v-model="userInfo.merchantId"
                :options="accountList"
                @change="changeAccount"
              />
            </van-dropdown-menu>
          </template>
          <template v-else>{{ userInfo.merchantName }}</template>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="title">您共有{{ taskCountData.sum }}个任务</div>
      <div class="list flex">
        <template v-for="(i, index) in list">
          <div
            :key="index"
            class="item"
          >
            <template v-if="i.isCanvas">
              <div class="ball">
                <water-polo :num="taskCountData.num"></water-polo>
              </div>
            </template>
            <template v-else>
              <div class="num text-center">{{ taskCountData[i.key] }}</div>
            </template>
            <div class="text">{{ i.text }}</div>
          </div>
        </template>
      </div>
    </div>
    <div class="sticky-box">
      <div class="title flex">
        我的任务
        <span>({{ tasksList.length }})</span>
        <div
          class="time"
          @click="showCalendar = true"
        >
          {{ dateRange }}
          <van-icon name="arrow-down" />
        </div>
      </div>
      <div class="drop-down-box flex">
        <div class="item flex left">
          <div class="label">状态</div>
          <van-dropdown-menu active-color="#3975C6">
            <van-dropdown-item
              v-model="status"
              :options="statusOption"
              @change="changeType($event, 'status')"
              data-target="status"
            />
          </van-dropdown-menu>
        </div>
        <div class="item flex">
          <div class="label">类型</div>
          <van-dropdown-menu active-color="#3975C6">
            <van-dropdown-item
              v-model="taskType"
              :options="taskTypeOption"
              @change="changeType($event, 'taskType')"
            />
          </van-dropdown-menu>
        </div>
      </div>
    </div>
    <div class="task-list">
      <template v-if="tasksFlag">
        <template v-if="tasksList.length">
          <template v-for="(i, index) in tasksList">
            <div
              :key="index"
              class="item"
            >
              <div class="title flex">
                {{ taskTypeEnum[i.taskType] }}
                <div class="time">{{ new Date(i.createdDate).format('yyyy.MM.dd hh:mm') }}</div>
              </div>
              <div class="content">{{ i.content }}</div>
              <div
                :class="['btn', 'text-center', { finish: i.status == 2 }]"
                @touchstart="touchstart"
                @touchend="touchend"
                @click="click(i)"
              >{{ statusEnum[i.status] }}</div>
            </div>
          </template>
        </template>
        <template v-else>
          <van-empty description="暂无任务" />
        </template>
      </template>
    </div>
    <van-calendar
      ref="calendar"
      v-model="showCalendar"
      title="时间范围"
      type="range"
      @confirm="onConfirmCalendar"
      allow-same-day
      color="#3975C6"
      :min-date="minDate"
      :max-date="maxDate"
      :default-date="default_Date"
    />
  </div>
</template>

<script>
import { indexMixin } from '@/mixins'
export default {
  name: '',
  mixins: [indexMixin],
  data () {
    return {}
  },
  mounted () { },
  methods: {
  }
}
</script>

<style lang="scss" scoped>
.layout {
  padding: 0 16px;

  &::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 162px;
    background: var(--themeColor);
    border-radius: 0px 0px 16px 16px;
    content: '';
    z-index: -1;
  }

  .user-box {
    height: 84px;
    box-sizing: border-box;
    padding: 20px 0 16px;
    color: #ffffff;
    font-size: 14px;
    position: relative;

    .tips {
      position: absolute;
      width: 44px;
      height: 44px;
      background: rgba(255, 255, 255, 0.19);
      top: 21px;
      right: 16px;
      border-radius: 100%;

      .num {
        position: absolute;
        top: 0;
        height: 13px;
        background: #eb4e4e;
        border-radius: 7px;
        font-size: 10px;
        color: #fff;
        padding: 0 4px;
        right: 0;
        transform: translateX(50%);
      }
    }

    .avatar {
      width: 44px;
      height: 44px;
      margin-right: 16px;
      background: #d8d8d8;
    }
    .info {
      // max-width: calc(100% - 130px);
      max-width: calc(100% - 60px);
    }
    .name {
      font-size: 16px;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .merchant {
      /deep/.van-dropdown-menu__title {
        font-size: 14px;
        color: #fff !important;
      }
      /deep/.van-dropdown-menu__item {
        justify-content: flex-start;
      }
    }
  }

  .box {
    height: 115px;
    background: #ffffff;
    border-radius: 4px;
    box-sizing: border-box;
    padding: 14px 10px;
    margin-bottom: 16px;

    .title {
      font-size: 12px;
      color: #666666;
    }

    .list {
      justify-content: space-between;

      .item {
        flex: 1;
        font-size: 24px;
        color: #333333;
        .num,
        .ball {
          height: 46px;
        }

        .num {
          font-weight: 500;
        }

        .ball {
          width: 44px;
          height: 44px;
          margin: 0 auto;
        }

        .text {
          font-size: 12px;
          text-align: center;
          margin-top: 4px;
        }
      }
    }
  }

  .sticky-box {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f7f7f7;

    .title {
      height: 28px;
      font-weight: 500;
      font-size: 16px;
      color: #333333;

      span {
        font-size: 12px;
        margin-left: 4px;
      }

      .time {
        margin-left: auto;
        font-weight: normal;
        color: #666666;
        font-size: 12px;
      }
    }

    .drop-down-box {
      height: 40px;

      .item {
        flex: 1;
        height: 100%;
        background-color: #f7f7f7;
        font-size: 14px;
        color: #666666;
        justify-content: center;
        .label {
          width: 53px;
          flex-shrink: 0;
        }

        /deep/.van-dropdown-menu__title {
          font-size: 14px;
          color: #666;
        }
      }
      .left {
        justify-content: flex-start;
      }
    }
  }

  .task-list {
    padding-bottom: 100px;

    .item {
      margin-bottom: 16px;
      background: #ffffff;
      border-radius: 4px;
      padding: 0 10px 15px;

      .title {
        height: 49px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        font-size: 14px;
        font-weight: 500;
        color: #333333;

        .time {
          margin-left: auto;
          font-weight: 400;
          font-size: 12px;
          color: #666666;
        }
      }

      .content {
        font-size: 14px;
        color: #999999;
        padding: 9px 0;
        word-break: break-all;
        margin-bottom: 10px;
      }

      .btn {
        width: 60px;
        height: 24px;
        box-shadow: 0px 2px 6px 2px rgba(88, 80, 255, 0.11);
        border-radius: 11px;
        box-sizing: border-box;
      }

      .finish {
        background: #a2a2a2;
      }
    }
  }
}

.van-dropdown-menu {
  height: 100%;
  align-items: center;
  display: flex;
  /deep/.van-dropdown-menu__bar {
    background-color: transparent !important;
    box-shadow: none;
    height: 100%;
  }
}
</style>

// cubic-bezier(1,0.22,0,0.84)