app
MrShi
2026-04-27 e56792f78e4df0df2f12552d1a61dd8ca1db5c67
app/pages/index/index.vue
@@ -1,7 +1,7 @@
<template>
   <view class="hall-page">
      <view class="hall-page__header" :style="{ paddingTop: statusBarHeight + 'px' }">
         <view class="hall-page__user-row">
         <view class="hall-page__user-row" @click="handleUserClick">
            <view class="hall-page__user">
               <image class="hall-page__avatar" :src="centerUserInfo.fullImgUrl || '/static/image/ic_pic@2x.png'" mode="aspectFill"></image>
               <text class="hall-page__name">{{ centerUserInfo.name }}</text>
@@ -68,15 +68,15 @@
            <image src="/static/image/default_unverified@2x.png" mode="widthFix"></image>
            <button @click="toDriverCertification">去认证</button>
         </view>
         <view v-else-if="userInfo.auditStatus === 3 && currentOrderList.length" class="hall-page__list">
         <view v-else-if="userInfo.auditStatus === 3 && acceptingStatus === 1 && currentOrderList.length" class="hall-page__list">
            <view v-for="(item, index) in currentOrderList" :key="item.id" class="order-card" @click="goToOrderDetail(item, index)">
               <view class="order-card__head">
                  <view class="order-card__time">
                     <text class="order-card__time-main">{{ item.remainMinutes }}</text>
                     <text class="order-card__time-sub">分钟</text>
                     <text class="order-card__time-main">{{ formatRemainTime(item.remainMinutes) }}</text>
                     <text class="order-card__time-sub">送达</text>
                  </view>
                  <view v-if="activeTab === 'hall'" class="order-card__price-wrap">
                     <text class="order-card__price">¥{{ (item.driverFee / 100).toFixed(1) }}</text>
                     <text class="order-card__price">¥{{ item.platformRewardAmount ? (item.driverFee + item.platformRewardAmount) / 100 : (item.driverFee / 100).toFixed(2) }}</text>
                  </view>
                  <view v-else class="order-card__price-wrap order-card__price-wrap--serial-only">
                     <text v-if="item.code" class="order-card__serial">#{{ index + 1 }}</text>
@@ -90,7 +90,7 @@
                     <text v-if="item.isValuable === true" class="order-card__tag order-card__tag--orange">贵重物品</text>
                     <text v-else class="order-card__tag order-card__tag--blue">{{ item.goodLevelName }}</text>
                  </view>
                  <text v-if="activeTab === 'hall' && item.urgentAmount" class="order-card__extra">含加急¥{{ item.urgentAmount / 100 }}</text>
                  <text v-if="activeTab === 'hall' && item.platformRewardAmount" class="order-card__extra">含加急¥{{ (item.platformRewardAmount / 100).toFixed(2) }}</text>
               </view>
               <view class="order-card__route">
@@ -105,7 +105,7 @@
                           <text class="order-card__route-title">{{ item.depositShopName }}</text>
                           <text class="order-card__route-desc">{{ item.depositShopAddress }}</text>
                        </view>
                        <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav"></image>
                        <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav" @click.stop="navigateToAddress(item, 'deposit')"></image>
                     </view>
                     <view class="order-card__route-item order-card__route-item--destination">
                        <view class="order-card__route-texts">
@@ -115,7 +115,7 @@
                           </template>
                           <text v-else class="order-card__route-title">{{ item.takeAddress }}</text>
                        </view>
                        <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav"></image>
                        <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav" @click.stop="navigateToAddress(item, 'take')"></image>
                     </view>
                  </view>
               </view>
@@ -148,13 +148,13 @@
                     </view>
                     <button class="order-card__button order-card__button--code" hover-class="order-card__button--hover" @click.stop="handleShowPickupCode(item)">存件码</button>
                  </template>
                  <button v-else class="order-card__button" hover-class="order-card__button--hover" @click="handleGrabOrder(item)">立即抢单</button>
                  <button v-else class="order-card__button" hover-class="order-card__button--hover" @click.stop="handleGrabOrder(item)">立即抢单</button>
               </view>
            </view>
         </view>
         <view v-else class="hall-page__empty">
            <image class="hall-page__empty-icon" src="/static/image/default_nodata_grey@2x.png" mode="aspectFit"></image>
            <image class="hall-page__empty-icon" :src="acceptingStatus === 0 ? '/static/image/default_nodata_grey@2x.png' : '/static/image/default_nodata@2x.png'" mode="aspectFit"></image>
         </view>
      </scroll-view>
      
@@ -326,6 +326,8 @@
         this.headerHeight = this.statusBarHeight + uni.upx2px(308)
         this.tabbarHeight = uni.upx2px(100) + safeBottom
         this.scrollHeight = Math.max(windowHeight - this.headerHeight, 0)
         if (this.userInfo.auditStatus === 99) return;
         this.acceptingStatus = this.userInfo.acceptingStatus || 0
         this.loadOrdersByTab(this.activeTab)
      },
@@ -336,6 +338,7 @@
      },
      onReachBottom() {
         if (this.acceptingStatus === 0) return;
         if (this.activeTab === 'hall') {
            this.hallPage++
            this.getHallOrders()
@@ -379,6 +382,49 @@
      },
      methods: {
         formatRemainTime(minutes) {
            if (!minutes) return 0
            if (minutes >= 60) {
               return (minutes / 60).toFixed(2) + '小时内'
            }
            return minutes + '分钟内'
         },
         navigateToAddress(item, type) {
            let latitude, longitude, name, address
            if (type === 'deposit') {
               latitude = item.depositLat
               longitude = item.depositLng
               name = item.depositShopName
               address = item.depositShopAddress
            } else {
               latitude = item.takeLat
               longitude = item.takeLng
               name = item.takeName
               address = item.takeAddress
            }
            if (!latitude || !longitude) {
               uni.showToast({ title: '地址坐标缺失', icon: 'none' })
               return
            }
            uni.openLocation({
               latitude,
               longitude,
               name,
               address,
               success: () => {},
               fail: (err) => {
                  uni.showToast({ title: '打开地图失败', icon: 'none' })
                  console.error('openLocation fail:', err)
               }
            })
         },
         handleUserClick() {
            uni.navigateTo({
               url: '/pages/test/test'
            })
         },
         getActiveOrderCount() {
            this.$u.api.activeOrderCount().then(res => {
               if (res.code === 200) {
@@ -456,9 +502,11 @@
         },
         goToOrderDetail(item, index) {
            uni.navigateTo({
               url: `/pages/order-detail/order-detail?id=${item.id}&index=${index + 1}`
            })
            let url = `/pages/order-detail/order-detail?id=${item.id}`
            if (this.activeTab === 'pickup' || this.activeTab === 'delivering') {
               url += `&index=${index + 1}`
            }
            uni.navigateTo({ url })
         },
         getCenterInfo() {
@@ -492,6 +540,8 @@
         },
         loadOrdersByTab(tab) {
            if (this.userInfo.auditStatus === 99) return;
            if (this.acceptingStatus === 0) return;
            if (tab === 'hall') {
               this.hallPage = 1
               this.hallHasMore = true
@@ -507,6 +557,7 @@
         },
         getHallOrders() {
            if (this.acceptingStatus === 0) return;
            if (this.hallLoading || !this.hallHasMore) {
               return
            }
@@ -559,6 +610,7 @@
         },
         getPickupOrders() {
            if (this.acceptingStatus === 0) return;
            if (this.pickupLoading) return
            this.pickupLoading = true
            this.$u.api.activeOrders({ status: 3 }).then(res => {
@@ -573,6 +625,7 @@
         },
         getDeliveringOrders() {
            if (this.acceptingStatus === 0) return;
            if (this.deliveringLoading) return
            this.deliveringLoading = true
            this.$u.api.activeOrders({ status: 4 }).then(res => {
@@ -595,7 +648,24 @@
            const selectedValue = e.value[0]
            this.$u.api.updateAcceptingStatus({ status: selectedValue.value }).then(res => {
               if (res.code === 200) {
                  this.acceptingStatus = selectedValue.value
                  this.getCenterInfo()
                  if (this.acceptingStatus === 0) {
                     this.orderList = []
                     this.pickupOrderList = []
                     this.deliveringOrderList = []
                  } else {
                     if (this.activeTab === 'pickup') {
                        this.getPickupOrders()
                     } else if (this.activeTab === 'delivering') {
                        this.getDeliveringOrders()
                     } else {
                        this.hallPage = 1
                        this.hallHasMore = true
                        this.orderList = []
                        this.getHallOrders()
                     }
                  }
               }
            })
         },
@@ -618,12 +688,13 @@
         },
         resetFilters() {
            this.showFilterPopup = false
            if (this.userInfo.auditStatus === 99) return;
            this.selectedFilters = {
               sort: '综合排序',
               level: '不限',
               distance: '不限'
            }
            this.showFilterPopup = false
            if (this.activeTab === 'hall') {
               this.hallPage = 1
               this.hallHasMore = true
@@ -634,6 +705,10 @@
         confirmFilters() {
            this.showFilterPopup = false
            if (this.userInfo.auditStatus === 99) {
               this.hallHasMore = true
               return
            }
            if (this.activeTab === 'hall') {
               this.hallPage = 1
               this.hallHasMore = true
@@ -1132,7 +1207,6 @@
      left: 0;
      right: 0;
      z-index: 20;
      background: rgba(0, 0, 0, 0.24);
      &__panel {
         display: flex;