index.vue 3.87 KB
<template>
  <view class="order-icon-btn">
    <view class="order-icon-btn-box" @click="queryMyOrderList()">
      <view class="order-icon-btn-box-img">
        <image :src="orderUrl"></image>
        <view class="order-icon-btn-box-img-badge">
          <!-- <up-badge max="99" bgColor="#f3a200" :value="messageCount"></up-badge> -->
          &nbsp;
        </view>
      </view>
      <view class="order-icon-btn-box-label">
        我的订单
      </view>
    </view>
    <view class="order-icon-btn-box" @click="queryNoCleanOrderList">
      <view class="order-icon-btn-box-img">
        <image :src="cleanWaitUrl"></image>
        <view class="order-icon-btn-box-img-badge">
          <up-badge max="99" bgColor="#f3a200" :value="newBadgeCount"></up-badge>
        </view>
      </view>
      <view class="order-icon-btn-box-label">
        待清运
      </view>
    </view>
    <view class="order-icon-btn-box" @click="queryCleanOrderList">
      <view class="order-icon-btn-box-img">
        <image :src="cleanActiveUrl"></image>
        <view class="order-icon-btn-box-img-badge">
          <up-badge max="99" bgColor="#f3a200" :value="cleanBadgeCount"></up-badge>
        </view>
      </view>
      <view class="order-icon-btn-box-label">
        清运中
      </view>
    </view>
    <view class="order-icon-btn-box" @click="querySuccessOrderList">
      <view class="order-icon-btn-box-img">
        <image :src="evaluateUrl"></image>
        <view class="order-icon-btn-box-img-badge">
          &nbsp;
        </view>
      </view>
      <view class="order-icon-btn-box-label">
        已完成
      </view>
    </view>
  </view>
</template>

<script setup>
import { queryBadgeByType } from "@/apis/order";
import cleanActiveUrl from '@/static/image/clean-active.png';
import cleanWaitUrl from '@/static/image/clean-wait.png';
import evaluateUrl from '@/static/image/evaluate.png';
import orderUrl from '@/static/image/order.png';
import { onShow } from "@dcloudio/uni-app";
import { ref } from 'vue';
const cleanBadgeCount = ref(0);
const newBadgeCount = ref(0);
const queryMyOrderList = () => {
  // TODO 查询我的订单
  uni.$u.route({
    url: `pages/wode-info/wode-info-driver-order/index`,
    params: {
      type: 2
    }
  })
}
const queryNoCleanOrderList = () => {
  // TODO 查询待清运订单
  uni.$u.route({
    url: `pages/wode-info/wode-info-driver-order/index`,
    params: {
      type: 0
    }
  })
}
const queryCleanOrderList = () => {
  // TODO 查询清运中订单
  uni.$u.route({
    url: `pages/wode-info/wode-info-driver-order/index`,
    params: {
      type: 1
    }
  })
}
const querySuccessOrderList = () => {
  console.log("querySuccessOrderList");
  uni.$u.route({
    url: `pages/wode-info/wode-info-driver-order/index`,
    params: {
      type: 3
    }
  })
}
const initBadge = () => {
  let newType = 0;
  let cleanType = 1;
  queryBadgeByType(newType).then((res) => {
    newBadgeCount.value = res.data.data.badge;
  })
  queryBadgeByType(cleanType).then((res) => {
    cleanBadgeCount.value = res.data.data.badge;
  })
}
onShow(() => {
  initBadge();
})
</script>

<style lang="scss" scoped>
.order-icon-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 150rpx;
  box-sizing: border-box;
  padding: 0 30rpx;
  background-color: white;
  border-radius: 15rpx;
  margin-top: 20rpx;

  .order-icon-btn-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: $u-main-color;
    @include handleClick;

    .order-icon-btn-box-img {
      margin-bottom: 20rpx;
      display: flex;
      font-weight: small;

      image {
        width: 45rpx;
        height: 45rpx;
        background-size: 100% 100%;
        transform: translate(9rpx, 8rpx);
      }

      .order-icon-btn-box-img-badge {
        z-index: 9999;
      }
    }

    .order-icon-btn-box-label {}
  }
}
</style>