feat(order): 新增订单 tab,支持未分配与我的订单分栏
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)`。
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.4 KiB |
+3
-3
@@ -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'
|
||||
})
|
||||
},
|
||||
|
||||
+65
-13
@@ -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: []
|
||||
|
||||
+39
-39
@@ -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);
|
||||
}
|
||||
|
||||
/* === 列表区域 === */
|
||||
|
||||
+30
-18
@@ -3,28 +3,40 @@
|
||||
<!-- 顶部标题 -->
|
||||
<view class="header">
|
||||
<view class="header-content">
|
||||
<text class="header-title">订单管理</text>
|
||||
<text class="header-sub">共 {{stats.total}} 个订单</text>
|
||||
<text class="header-title">{{currentScope === 'pool' ? '接单大厅' : '我的订单'}}</text>
|
||||
<text class="header-sub">共 {{stats.total}} {{currentScope === 'pool' ? '个未分配订单' : '个订单'}}</text>
|
||||
</view>
|
||||
<view class="header-add" wx:if="{{isAdmin}}" bindtap="onAddOrder">新增预约</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态筛选 -->
|
||||
<view class="filter-bar">
|
||||
<scroll-view class="filter-scroll" scroll-x enhanced show-scrollbar="{{false}}">
|
||||
<view class="filter-list">
|
||||
<view
|
||||
class="filter-tag {{currentStatus === item.value ? 'active' : ''}}"
|
||||
wx:for="{{statusFilters}}"
|
||||
wx:key="value"
|
||||
data-status="{{item.value}}"
|
||||
bindtap="onStatusChange"
|
||||
>
|
||||
<text>{{item.label}}</text>
|
||||
<text class="filter-count" wx:if="{{item.count > 0}}">{{item.count}}</text>
|
||||
</view>
|
||||
<!-- 订单分栏:未分配订单 / 我的订单 -->
|
||||
<view class="scope-bar">
|
||||
<view
|
||||
class="scope-tab {{currentScope === 'pool' ? 'active' : ''}}"
|
||||
data-scope="pool"
|
||||
bindtap="onScopeChange"
|
||||
>未分配订单</view>
|
||||
<view
|
||||
class="scope-tab {{currentScope === 'mine' ? 'active' : ''}}"
|
||||
data-scope="mine"
|
||||
bindtap="onScopeChange"
|
||||
>我的订单</view>
|
||||
</view>
|
||||
|
||||
<!-- 状态筛选:仅「我的订单」可用,通过下拉选择,不再占用页面 tab -->
|
||||
<view class="filter-bar" wx:if="{{currentScope === 'mine'}}">
|
||||
<text class="filter-label">订单状态</text>
|
||||
<picker
|
||||
mode="selector"
|
||||
range="{{statusFilterLabels}}"
|
||||
value="{{statusIndex}}"
|
||||
bindchange="onStatusPick"
|
||||
>
|
||||
<view class="status-pill">
|
||||
<text>{{statusFilterLabels[statusIndex]}}</text>
|
||||
<t-icon name="chevron-down" size="24rpx" color="#A3988B" />
|
||||
</view>
|
||||
</scroll-view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
@@ -44,7 +56,7 @@
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-box" wx:elif="{{!isLoading && orderList.length === 0}}">
|
||||
<t-empty icon="file" description="暂无订单" t-class-description="empty-text">
|
||||
<t-empty icon="file" description="{{currentScope === 'pool' ? '暂无可接订单' : '暂无订单'}}" t-class-description="empty-text">
|
||||
<view slot="action">
|
||||
<view class="empty-btn" bindtap="onReload">刷新</view>
|
||||
</view>
|
||||
|
||||
+4
-1
@@ -49,7 +49,10 @@
|
||||
"compileWorklet": false,
|
||||
"localPlugins": false,
|
||||
"swc": false,
|
||||
"disableSWC": true
|
||||
"disableSWC": true,
|
||||
"lessSetting": {
|
||||
"commonUseFilePath": "app.less"
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.16.1",
|
||||
|
||||
Reference in New Issue
Block a user