From b7d451c91ec40bee70f23b1e2cf6a8797643faef Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期六, 25 四月 2026 15:18:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
app/pages/order/order.vue | 280 ++++++++++++++++++++++++++-----------------------------
1 files changed, 133 insertions(+), 147 deletions(-)
diff --git a/app/pages/order/order.vue b/app/pages/order/order.vue
index d81b4d4..ab8b487 100644
--- a/app/pages/order/order.vue
+++ b/app/pages/order/order.vue
@@ -15,45 +15,44 @@
<scroll-view class="order-page__body" scroll-y :style="bodyStyle">
<view class="order-page__list">
- <view v-for="item in currentOrders" :key="item.id" class="order-card" @click="goToOrderDetail(item)">
+ <view v-for="(item, index) in orders" :key="item.id" class="order-card" @click="goToOrderDetail(item, index)">
<view class="order-card__head">
<view class="order-card__head-left">
- <image class="order-card__badge-icon" :src="getBadgeIcon(item.badge)" mode="widthFix"></image>
- <text class="order-card__time-text">涓嬪崟鏃堕棿: {{ item.orderTime }}</text>
+ <image class="order-card__badge-icon" :src="getBadgeIcon(item)" mode="widthFix"></image>
+ <text class="order-card__time-text">{{ item.code }}</text>
</view>
- <text class="order-card__status" :class="{ 'order-card__status--highlight': item.actions && item.actions.length }">{{ item.statusText }}</text>
+ <text class="order-card__status" :class="{ 'order-card__status--highlight': item.status === 3 || item.status === 4 }">{{ getStatusText(item.status) }}</text>
</view>
<view class="order-card__route-item">
<view class="order-card__point order-card__point--pickup">鍙�</view>
<view class="order-card__route-texts">
- <text class="order-card__route-title">{{ item.pickupName }}</text>
- <text class="order-card__route-desc">{{ item.pickupAddress }}</text>
+ <text class="order-card__route-title">{{ item.takeName }}</text>
+ <text class="order-card__route-desc">{{ item.takeAddress }}</text>
</view>
</view>
<view class="order-card__route-item order-card__route-item--delivery">
<view class="order-card__point order-card__point--delivery">閫�</view>
<view class="order-card__route-texts">
- <text class="order-card__route-title">{{ item.deliveryName }}</text>
- <text class="order-card__route-desc">{{ item.deliveryAddress }}</text>
+ <text class="order-card__route-title">{{ item.depositShopName }}</text>
+ <text class="order-card__route-desc">{{ item.depositShopAddress }}</text>
</view>
</view>
<view class="order-card__footer">
<view class="order-card__arrival">
<image class="order-card__clock" src="/static/image/ic_clock@2x.png" mode="aspectFit"></image>
- <text class="order-card__arrival-text">{{ item.arriveLabel || '閫佽揪鏃堕棿锛�' }}{{ item.arriveTime }}</text>
+ <text class="order-card__arrival-text">鍓╀綑{{ item.remainMinutes }}鍒嗛挓</text>
</view>
<view class="order-card__price-wrap">
- <text v-if="item.priceTag" class="order-card__price-tag">{{ item.priceTag }}</text>
- <text class="order-card__price">{{ item.price }}</text>
+ <text class="order-card__price">楼{{ (item.driverFee / 100).toFixed(2) }}</text>
</view>
</view>
- <view v-if="item.actions && item.actions.length" class="order-card__actions">
+ <view v-if="getActions(item).length" class="order-card__actions">
<button
- v-for="action in item.actions"
+ v-for="action in getActions(item)"
:key="action.text"
class="order-card__action-btn"
:class="['order-card__action-btn--' + action.type, { 'order-card__action-btn--primary-fill': action.fill }]"
@@ -62,6 +61,14 @@
{{ action.text }}
</button>
</view>
+ </view>
+
+ <view v-if="orders.length === 0 && !loading" class="order-page__empty">
+ <image class="order-page__empty-icon" src="/static/image/default_nodata@2x.png" mode="aspectFit"></image>
+ </view>
+
+ <view v-if="loading" class="order-page__loading">
+ <text>鍔犺浇涓�...</text>
</view>
</view>
</scroll-view>
@@ -74,130 +81,29 @@
return {
statusBarHeight: 0,
navHeight: 0,
- activeTab: 'all',
+ activeTab: null,
tabs: [
- { label: '鍏ㄩ儴', value: 'all' },
- { label: '寰呭彇璐�', value: 'pickup' },
- { label: '閰嶉�佷腑', value: 'delivering' },
- { label: '宸插畬鎴�', value: 'finished' }
+ { label: '鍏ㄩ儴', value: null },
+ { label: '寰呭彇璐�', value: 3 },
+ { label: '閰嶉�佷腑', value: 4 },
+ { label: '宸插畬鎴�', value: 7 }
],
- orders: [
- {
- id: 1,
- type: 'pickup',
- badge: '鏍囬�熻揪',
- badgeType: 'blue',
- orderTime: '2026-04-12 12:09',
- statusText: '寰呭彇璐�',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '',
- arriveTime: '45鍒嗛挓鍐呴�佽揪',
- priceTag: '',
- price: '楼20.5',
- actions: [
- { text: '鍙栨秷璁㈠崟', type: 'light', fill: false },
- { text: '鍙栬揣鐮�', type: 'primary', fill: false },
- { text: '鎷嶇収鍙栬揣', type: 'primary', fill: true }
- ]
- },
- {
- id: 4,
- type: 'pickup',
- badge: '鏋侀�熻揪',
- badgeType: 'red',
- orderTime: '2026-04-12 12:33',
- statusText: '寰呭彇璐�',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '',
- arriveTime: '50鍒嗛挓鍐呴�佽揪',
- priceTag: '',
- price: '楼20.5',
- actions: [
- { text: '鍙栨秷璁㈠崟', type: 'light', fill: false },
- { text: '鍙栬揣鐮�', type: 'primary', fill: false },
- { text: '鎷嶇収鍙栬揣', type: 'primary', fill: true }
- ]
- },
- {
- id: 2,
- type: 'delivering',
- badge: '鏋侀�熻揪',
- badgeType: 'red',
- orderTime: '2026-04-12 12:33',
- statusText: '閰嶉�佷腑',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '閫佽揪鏃堕棿锛�',
- arriveTime: '04-12 12:58',
- priceTag: '',
- price: '楼20.5'
- },
- {
- id: 5,
- type: 'rated',
- badge: '鏋侀�熻揪',
- badgeType: 'red',
- orderTime: '2026-04-12 13:08',
- statusText: '宸茶瘎浠�',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '閫佽揪鏃堕棿锛�',
- arriveTime: '04-12 13:36',
- priceTag: '',
- price: '楼18.8'
- },
- {
- id: 6,
- type: 'cancelled',
- badge: '鏍囬�熻揪',
- badgeType: 'blue',
- orderTime: '2026-04-12 13:18',
- statusText: '宸插彇娑�',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '閫佽揪鏃堕棿锛�',
- arriveTime: '04-12 13:52',
- priceTag: '',
- price: '楼16.5'
- },
- {
- id: 3,
- type: 'finished',
- badge: '鏋侀�熻揪',
- badgeType: 'red',
- orderTime: '2026-04-12 12:33',
- statusText: '宸插畬鎴�',
- pickupName: '涓搧蹇繍鍗楃珯鏃楄埌搴�',
- pickupAddress: '鑾茶姳璺�200鍙疯幉鑺变骇涓氬洯F鏍�401',
- deliveryName: '浣宠嫅宸撮粠閮藉競3鏈�10鏍�301瀹�',
- deliveryAddress: '娲炲涵婀栬矾涓庢箹鍖楄矾浜ゅ弶鍙hタ150绫�',
- arriveLabel: '閫佽揪鏃堕棿锛�',
- arriveTime: '04-12 12:58',
- priceTag: '宸茬粨绠�',
- price: '楼20.5'
- }
- ]
+ orders: [],
+ page: 1,
+ hasMore: true,
+ loading: false
}
},
computed: {
displayTabs() {
- const countMap = {
- pickup: this.orders.filter((item) => item.type === 'pickup').length,
- delivering: this.orders.filter((item) => item.type === 'delivering').length,
- finished: this.orders.filter((item) => item.type === 'finished').length
- }
+ const countMap = {}
+ this.tabs.forEach(tab => {
+ if (tab.value === null) {
+ countMap[null] = this.orders.length
+ } else {
+ countMap[tab.value] = this.orders.filter((item) => item.status === tab.value).length
+ }
+ })
return this.tabs.map((tab) => {
if (!countMap[tab.value]) {
@@ -216,32 +122,90 @@
marginTop: this.navHeight + uni.upx2px(88) + 'px',
height: `calc(100vh - ${this.navHeight + uni.upx2px(88)}px)`
}
- },
- currentOrders() {
- if (this.activeTab === 'all') {
- return this.orders
- }
-
- return this.orders.filter((item) => item.type === this.activeTab)
}
},
onLoad() {
const systemInfo = uni.getSystemInfoSync()
this.statusBarHeight = systemInfo.statusBarHeight || 0
this.navHeight = this.statusBarHeight + uni.upx2px(88)
+ this.getOrderList()
+ },
+ onShow() {
+ this.page = 1
+ this.hasMore = true
+ this.orders = []
+ this.getOrderList()
+ },
+ onReachBottom() {
+ if (!this.hasMore || this.loading) return
+ this.page++
+ this.getOrderList()
+ },
+ watch: {
+ activeTab() {
+ this.page = 1
+ this.hasMore = true
+ this.orders = []
+ this.getOrderList()
+ }
},
methods: {
- getBadgeIcon(badge) {
- const badgeMap = {
- '鏋侀�熻揪': '/static/image/ic_jisuda@2x.png',
- '鏍囬�熻揪': '/static/image/ic_biaosuda@2x.png'
- }
-
- return badgeMap[badge] || ''
+ getBadgeIcon(item) {
+ return item.isUrgent ? '/static/image/ic_jisuda@2x.png' : '/static/image/ic_biaosuda@2x.png'
},
- goToOrderDetail(item) {
+ getStatusText(status) {
+ const map = {
+ 2: '寰呮帴鍗�',
+ 3: '寰呭彇璐�',
+ 4: '閰嶉�佷腑',
+ 7: '宸插畬鎴�',
+ 99: '宸插彇娑�'
+ }
+ return map[status] || ''
+ },
+ getActions(item) {
+ if (item.status === 3) {
+ return [
+ { text: '鍙栨秷璁㈠崟', type: 'light', fill: false },
+ { text: '鍙栬揣鐮�', type: 'primary', fill: false },
+ { text: '鎷嶇収鍙栬揣', type: 'primary', fill: true }
+ ]
+ }
+ if (item.status === 4) {
+ return [
+ { text: '瀛樹欢鐮�', type: 'primary', fill: false }
+ ]
+ }
+ return []
+ },
+ getOrderList() {
+ if (this.loading) return
+ this.loading = true
+ this.$u.api.orderPage({
+ capacity: 10,
+ page: this.page,
+ model: {
+ status: this.activeTab
+ }
+ }).then(res => {
+ if (res.code === 200) {
+ const list = res.data.records || []
+ if (this.page === 1) {
+ this.orders = list
+ } else {
+ this.orders = [...this.orders, ...list]
+ }
+ this.hasMore = list.length >= 10
+ }
+ }).catch((err) => {
+ console.log(err)
+ }).finally(() => {
+ this.loading = false
+ })
+ },
+ goToOrderDetail(item, index) {
uni.navigateTo({
- url: `/pages/order-detail/order-detail?id=${item.id}&status=${item.type === 'delivering' ? 'delivering' : item.type === 'finished' ? 'finished' : item.type === 'cancelled' ? 'cancelled' : item.type === 'rated' ? 'rated' : 'pickup'}`
+ url: `/pages/order-detail/order-detail?id=${item.id}&index=${index + 1}`
})
}
}
@@ -326,6 +290,28 @@
&__list {
padding: 18rpx 22rpx calc(env(safe-area-inset-bottom) + 26rpx);
}
+
+ &__empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding-top: 200rpx;
+ }
+
+ &__empty-icon {
+ width: 320rpx;
+ height: 320rpx;
+ }
+
+ &__loading {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 30rpx 0;
+ color: #8f96a3;
+ font-size: 26rpx;
+ }
}
.order-card {
--
Gitblit v1.9.3