diff --git a/app.json b/app.json
index 5d727a5..b12db04 100644
--- a/app.json
+++ b/app.json
@@ -36,6 +36,12 @@
"iconPath": "images/home.png",
"selectedIconPath": "images/home-warm.png"
},
+ {
+ "pagePath": "pages/order/index",
+ "text": "订单",
+ "iconPath": "images/order.png",
+ "selectedIconPath": "images/order-warm.png"
+ },
{
"pagePath": "pages/ai/index",
"text": "AI",
diff --git a/doc/theme-color-scheme.md b/doc/theme-color-scheme.md
index d92a7ff..ebf8f79 100644
--- a/doc/theme-color-scheme.md
+++ b/doc/theme-color-scheme.md
@@ -125,8 +125,8 @@
| 选中文字色 | `#C26A2E` |
| 未选中文字色 | `#8A8078` |
| 背景色 | `#ffffff` |
-| 选中图标 | `images/home-warm.png`、`images/chat-warm.png`、`images/set-warm.png` |
-| 未选中图标 | `images/home.png`、`images/chat.png`、`images/set.png`(暖灰 `#8A8078`) |
+| 选中图标 | `images/home-warm.png`、`images/order-warm.png`、`images/chat-warm.png`、`images/set-warm.png` |
+| 未选中图标 | `images/home.png`、`images/order.png`、`images/chat.png`、`images/set.png`(暖灰 `#8A8078`) |
图标为 128×128 PNG,选中态像素色 `rgb(194, 106, 46)`。
diff --git a/images/order-warm.png b/images/order-warm.png
new file mode 100644
index 0000000..ab5d007
Binary files /dev/null and b/images/order-warm.png differ
diff --git a/images/order.png b/images/order.png
index 8773d27..f05b070 100644
Binary files a/images/order.png and b/images/order.png differ
diff --git a/pages/home/index.js b/pages/home/index.js
index e64e7ab..6098eb3 100644
--- a/pages/home/index.js
+++ b/pages/home/index.js
@@ -16,7 +16,7 @@ const ADMIN_ENTRIES = [
{ type: 'quick', icon: 'add-circle', name: '增加预约', url: '/pages/order/orderEdit', color: '#E8A96B' },
{ type: 'quick', icon: 'file-add', name: '增加档案', url: '/pages/healthprofile/profileInfo', color: '#E8A96B' },
{ type: 'quick', icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#E8A96B' },
- { type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#C26A2E' },
+ { type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', isTab: true, color: '#C26A2E' },
{ type: 'function', icon: 'heart', name: '健康档案', url: '/pages/healthprofile/index', color: '#C26A2E' },
{ type: 'function', icon: 'user', name: '注册用户', url: '/pages/customer/index', color: '#C26A2E' },
{ type: 'function', icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#C26A2E' }
@@ -24,7 +24,7 @@ const ADMIN_ENTRIES = [
const ATTENDANT_ENTRIES = [
{ type: 'quick', icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#E8A96B' },
- { type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#C26A2E' },
+ { type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', isTab: true, color: '#C26A2E' },
{ type: 'function', icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#C26A2E' }
]
@@ -217,7 +217,7 @@ Page({
},
viewAllOrders() {
- wx.navigateTo({
+ wx.switchTab({
url: '/pages/order/index'
})
},
diff --git a/pages/order/index.js b/pages/order/index.js
index 513bdda..c21ddee 100644
--- a/pages/order/index.js
+++ b/pages/order/index.js
@@ -65,6 +65,8 @@ Page({
isAdmin: false,
// 实习陪诊师:能看到未分配订单,但不能接单
isIntern: false,
+ // 订单分栏:pool=未分配订单,mine=我的订单
+ currentScope: 'pool',
// 统计
stats: {
total: 0,
@@ -77,6 +79,9 @@ Page({
},
// 状态筛选
statusFilters: STATUS_FILTERS,
+ // 状态下拉:picker 只认索引,文案与 statusFilters 保持同序
+ statusFilterLabels: STATUS_FILTERS.map(filter => filter.label),
+ statusIndex: 0,
currentStatus: 'pending',
// 订单列表
orderList: [],
@@ -96,10 +101,20 @@ Page({
onLoad(options) {
// 先解析角色:陪诊员走订单池接口,管理员走全量接口
role.ensureRoleSafe().then(({ role: r, attendant }) => {
+ const isAdmin = r === 'admin'
+ // 管理员与陪诊员统一从「未分配订单」进入,两个分栏都可见
+ const currentStatus = isAdmin ? this.data.currentStatus : ''
+ const statusIndex = Math.max(
+ 0,
+ STATUS_FILTERS.findIndex(filter => filter.value === currentStatus)
+ )
this.setData({
role: r,
- isAdmin: r === 'admin',
- isIntern: Boolean(attendant && attendant.stage === 'intern')
+ isAdmin,
+ isIntern: Boolean(attendant && attendant.stage === 'intern'),
+ currentScope: 'pool',
+ currentStatus,
+ statusIndex
})
this.loadOrderList();
})
@@ -115,7 +130,7 @@ Page({
},
/**
- * 更新筛选标签计数(口径由后端聚合,避免按当前页统计)
+ * 更新状态下拉的计数(口径由后端聚合,避免按当前页统计)
*/
updateFilterCounts(counts) {
const c = counts || {};
@@ -132,7 +147,11 @@ Page({
...filter,
count: Number(countMap[filter.value]) || 0
}));
- this.setData({ statusFilters });
+ // 下拉项直接带计数,替代原筛选条上的数字
+ const statusFilterLabels = statusFilters.map(filter =>
+ filter.count > 0 ? `${filter.label}(${filter.count})` : filter.label
+ );
+ this.setData({ statusFilters, statusFilterLabels });
},
/**
@@ -184,14 +203,17 @@ Page({
loadOrderList(isRefresh = false) {
if (this.data.isLoading || this.data.isLoadingMore) return;
- const { currentStatus, page, pageSize } = this.data;
+ const { currentStatus, currentScope, page, pageSize } = this.data;
this.setData({ isLoading: !isRefresh, isLoadingMore: isRefresh && page > 1 });
const params = {
page,
pageSize,
- ...buildTabFilter(currentStatus)
+ // 陪诊员:pool=未分配,mine=我的;管理员不传,保持全量口径
+ ...(currentScope ? { scope: currentScope } : {}),
+ // 未分配订单不做状态筛选,所有可接订单都要能刷到
+ ...(currentScope === 'pool' ? {} : buildTabFilter(currentStatus))
};
role.queryOrders(params)
@@ -215,8 +237,11 @@ Page({
this.setData({
orderList,
- // 头部总数用后端「全部」口径,页签内条数仍由 currentStatus 决定
- stats: { ...this.data.stats, total: Number((data.counts || {}).all) || total },
+ // 头部总数用后端「全部」口径;未分配池与当前筛选完全一致,直接用 total
+ stats: {
+ ...this.data.stats,
+ total: currentScope === 'pool' ? total : Number((data.counts || {}).all) || total
+ },
isLoading: false,
isLoadingMore: false,
isRefreshing: false,
@@ -259,14 +284,41 @@ Page({
},
/**
- * 状态筛选切换
+ * 状态筛选下拉切换
*/
- onStatusChange(e) {
- const status = e.currentTarget.dataset.status;
- if (status === this.data.currentStatus) return;
+ onStatusPick(e) {
+ const index = Number(e.detail.value) || 0;
+ const filter = this.data.statusFilters[index];
+ if (!filter || filter.value === this.data.currentStatus) return;
this.setData({
- currentStatus: status,
+ currentStatus: filter.value,
+ statusIndex: index,
+ page: 1,
+ hasMore: true,
+ orderList: []
+ }, () => {
+ this.loadOrderList();
+ });
+ },
+
+ /**
+ * 未分配订单 / 我的订单切换:范围、分页、计数都由服务端按 scope 重算
+ */
+ onScopeChange(e) {
+ const scope = e.currentTarget.dataset.scope;
+ if (!scope || scope === this.data.currentScope) return;
+
+ const statusFilters = this.data.statusFilters.map(filter => ({ ...filter, count: 0 }));
+ this.setData({
+ currentScope: scope,
+ // 我的订单默认展示全部状态;未分配订单不参与状态筛选
+ currentStatus: scope === 'mine' ? '' : this.data.currentStatus,
+ statusIndex: scope === 'mine' ? 0 : this.data.statusIndex,
+ statusFilters,
+ // 清空上一分栏的状态计数,等本次请求返回后再写入
+ statusFilterLabels: statusFilters.map(filter => filter.label),
+ stats: { ...this.data.stats, total: 0 },
page: 1,
hasMore: true,
orderList: []
diff --git a/pages/order/index.less b/pages/order/index.less
index 2f0b65f..2057fcd 100644
--- a/pages/order/index.less
+++ b/pages/order/index.less
@@ -92,59 +92,59 @@ page {
border-radius: 32rpx;
}
-/* === 筛选栏 === */
-.filter-bar {
- padding: 24rpx 0 0;
-}
-
-.filter-scroll {
- white-space: nowrap;
-}
-
-.filter-list {
- display: inline-flex;
- padding: 0 24rpx;
- gap: 16rpx;
-}
-
-.filter-tag {
- display: inline-flex;
- align-items: center;
- padding: 12rpx 28rpx;
- background: #ffffff;
- border-radius: 28rpx;
- font-size: 24rpx;
- color: @muted;
+/* === 接单分栏(未分配 / 我的) === */
+.scope-bar {
+ display: flex;
+ gap: 8rpx;
+ margin-top: 24rpx;
+ padding: 8rpx;
+ background: @card;
+ border-radius: 32rpx;
border: 1rpx solid rgba(90, 62, 42, 0.06);
box-shadow: 0 4rpx 12rpx rgba(90, 62, 42, 0.05);
+}
+
+.scope-tab {
+ flex: 1;
+ padding: 16rpx 0;
+ text-align: center;
+ border-radius: 26rpx;
+ font-size: 26rpx;
+ color: @muted;
transition: all 0.25s;
&.active {
background: @accent;
color: #fff;
- border-color: transparent;
+ font-weight: 600;
box-shadow: 0 4rpx 16rpx rgba(180, 85, 42, 0.3);
-
- .filter-count {
- background: rgba(255, 255, 255, 0.25);
- color: #fff;
- }
}
}
-.filter-count {
- min-width: 32rpx;
- height: 32rpx;
- padding: 0 8rpx;
- margin-left: 8rpx;
- background: rgba(0, 0, 0, 0.06);
- border-radius: 16rpx;
- font-size: 20rpx;
+/* === 状态筛选下拉 === */
+.filter-bar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 24rpx 0 0;
+}
+
+.filter-label {
+ font-size: 24rpx;
color: @muted;
+}
+
+.status-pill {
display: inline-flex;
align-items: center;
- justify-content: center;
- font-weight: 600;
+ gap: 8rpx;
+ padding: 12rpx 24rpx;
+ background: @card;
+ border-radius: 28rpx;
+ font-size: 24rpx;
+ color: @text;
+ border: 1rpx solid rgba(90, 62, 42, 0.06);
+ box-shadow: 0 4rpx 12rpx rgba(90, 62, 42, 0.05);
}
/* === 列表区域 === */
diff --git a/pages/order/index.wxml b/pages/order/index.wxml
index cd3cf81..a6f810e 100644
--- a/pages/order/index.wxml
+++ b/pages/order/index.wxml
@@ -3,28 +3,40 @@
-
-
-
-
-
- {{item.label}}
- {{item.count}}
-
+
+
+ 未分配订单
+ 我的订单
+
+
+
+
+ 订单状态
+
+
+ {{statusFilterLabels[statusIndex]}}
+
-
+
@@ -44,7 +56,7 @@
-
+
刷新
diff --git a/project.config.json b/project.config.json
index 29e344e..4bf8cd0 100644
--- a/project.config.json
+++ b/project.config.json
@@ -49,7 +49,10 @@
"compileWorklet": false,
"localPlugins": false,
"swc": false,
- "disableSWC": true
+ "disableSWC": true,
+ "lessSetting": {
+ "commonUseFilePath": "app.less"
+ }
},
"compileType": "miniprogram",
"libVersion": "3.16.1",