tmp
This commit is contained in:
+39
-17
@@ -4,18 +4,20 @@ const API = require('../../utils/api.js')
|
||||
Page({
|
||||
data: {
|
||||
today: '',
|
||||
greeting: '',
|
||||
todayText: '',
|
||||
pendingCount: 0,
|
||||
completedCount: 0,
|
||||
recentOrders: [],
|
||||
// 快捷入口:前3个为快捷操作(橙色系),后4个为功能入口(绿色系)
|
||||
// 快捷入口:type=quick 为快捷操作(橙色系),type=function 为功能入口(绿色系),分行显示
|
||||
quickEntries: [
|
||||
{ icon: 'add-circle', name: '增加预约', url: '/pages/order/orderEdit', color: '#ff8f4d' },
|
||||
{ icon: 'file-add', name: '增加档案', url: '/pages/healthprofile/profileInfo', color: '#ff8f4d' },
|
||||
{ icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#ff8f4d' },
|
||||
{ icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#1abc9c' },
|
||||
{ icon: 'heart', name: '健康档案', url: '/pages/healthprofile/index', color: '#1abc9c' },
|
||||
{ icon: 'user', name: '注册用户', url: '/pages/customer/index', color: '#1abc9c' },
|
||||
{ icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#1abc9c' }
|
||||
{ type: 'quick', icon: 'add-circle', name: '增加预约', url: '/pages/order/orderEdit', color: '#ff8f4d' },
|
||||
{ type: 'quick', icon: 'file-add', name: '增加档案', url: '/pages/healthprofile/profileInfo', color: '#ff8f4d' },
|
||||
{ type: 'quick', icon: 'lightbulb-circle-filled', name: 'AI办公', url: '/pages/ai/index', isTab: true, color: '#ff8f4d' },
|
||||
{ type: 'function', icon: 'bill', name: '预约订单', url: '/pages/order/index', color: '#1abc9c' },
|
||||
{ type: 'function', icon: 'heart', name: '健康档案', url: '/pages/healthprofile/index', color: '#1abc9c' },
|
||||
{ type: 'function', icon: 'user', name: '注册用户', url: '/pages/customer/index', color: '#1abc9c' },
|
||||
{ type: 'function', icon: 'user-circle', name: '个人信息', url: '/pages/me/index', color: '#1abc9c' }
|
||||
],
|
||||
online: true,
|
||||
profile: {
|
||||
@@ -23,7 +25,7 @@ Page({
|
||||
level: '初级陪诊师',
|
||||
avatar: ''
|
||||
},
|
||||
todayIncome: 168,
|
||||
todayIncome: 0,
|
||||
todayOrderCount: 0,
|
||||
pendingOrder: {
|
||||
count: 1,
|
||||
@@ -63,7 +65,10 @@ Page({
|
||||
this.loadUser()
|
||||
const now = new Date();
|
||||
const today = now.toISOString().substring(0, 10);
|
||||
this.setData({ today });
|
||||
const hour = now.getHours();
|
||||
const greeting = hour < 6 ? '夜深了' : hour < 9 ? '早上好' : hour < 12 ? '上午好' : hour < 14 ? '中午好' : hour < 18 ? '下午好' : '晚上好';
|
||||
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][now.getDay()];
|
||||
this.setData({ today, greeting, todayText: `${now.getMonth() + 1}月${now.getDate()}日 ${week}` });
|
||||
this.getRecentOrders();
|
||||
this.getStats();
|
||||
},
|
||||
@@ -104,16 +109,33 @@ Page({
|
||||
},
|
||||
|
||||
async getStats() {
|
||||
const today = new Date().toISOString().substring(0, 10);
|
||||
const [todayRes, pendingRes, completedRes] = await Promise.all([
|
||||
API.escort.getAllRecords({ appointmentDate: today }),
|
||||
API.escort.getAllRecords({ status: 'pending,confirmed' }),
|
||||
const now = new Date();
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
// 本地日期(toISOString 是 UTC,早晨会差一天)
|
||||
const todayStr = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
||||
const isSameDay = (d, ref) =>
|
||||
d.getFullYear() === ref.getFullYear() && d.getMonth() === ref.getMonth() && d.getDate() === ref.getDate();
|
||||
const feeOf = (item) => Number(item.payment && item.payment.totalFee) || 0;
|
||||
|
||||
const [todayRes, completedRes] = await Promise.all([
|
||||
API.escort.getAllRecords({ appointmentDate: todayStr }),
|
||||
API.escort.getAllRecords({ status: 'completed' })
|
||||
]);
|
||||
|
||||
// 今日收益:当日已完成订单的费用合计
|
||||
let todayIncome = 0;
|
||||
if (completedRes.code === 0) {
|
||||
(completedRes.data.records || []).forEach(item => {
|
||||
const d = item.schedule && item.schedule.date ? new Date(item.schedule.date) : null;
|
||||
if (d && !isNaN(d.getTime()) && isSameDay(d, now)) {
|
||||
todayIncome += feeOf(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({
|
||||
todayOrderCount: todayRes.code === 0 ? (todayRes.data.records || []).length : 0,
|
||||
pendingCount: pendingRes.code === 0 ? (pendingRes.data.records || []).length : 0,
|
||||
completedCount: completedRes.code === 0 ? (completedRes.data.records || []).length : 0,
|
||||
todayIncome,
|
||||
todayOrderCount: todayRes.code === 0 ? (todayRes.data.records || []).length : 0
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
+18
-5
@@ -15,6 +15,7 @@
|
||||
<text class="level-text">{{profile.level}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="greeting">{{greeting}},{{todayText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="online-switch" bindtap="toggleOnline">
|
||||
@@ -33,6 +34,7 @@
|
||||
<text class="stat-num">{{todayIncome}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat stat-right">
|
||||
<text class="stat-label">今日接单</text>
|
||||
<view class="stat-value">
|
||||
@@ -47,11 +49,21 @@
|
||||
<view class="section">
|
||||
<text class="section-title">快捷入口</text>
|
||||
<view class="quick-grid card">
|
||||
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" bindtap="onEntryTap" data-index="{{index}}">
|
||||
<view class="quick-icon" style="background-color: {{item.color}}1a;">
|
||||
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
|
||||
<view class="quick-row">
|
||||
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" wx:if="{{item.type === 'quick'}}" bindtap="onEntryTap" data-index="{{index}}">
|
||||
<view class="quick-icon" style="background-color: {{item.color}}1a;">
|
||||
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
|
||||
</view>
|
||||
<text class="quick-label">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="quick-row">
|
||||
<view class="quick-item" wx:for="{{quickEntries}}" wx:key="name" wx:if="{{item.type === 'function'}}" bindtap="onEntryTap" data-index="{{index}}">
|
||||
<view class="quick-icon" style="background-color: {{item.color}}1a;">
|
||||
<t-icon name="{{item.icon}}" size="40rpx" color="{{item.color}}" />
|
||||
</view>
|
||||
<text class="quick-label">{{item.name}}</text>
|
||||
</view>
|
||||
<text class="quick-label">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -65,7 +77,7 @@
|
||||
<text class="section-title">近7日订单</text>
|
||||
<view class="view-all" bindtap="viewAllOrders">
|
||||
<text>全部</text>
|
||||
<text class="arrow">→</text>
|
||||
<t-icon name="chevron-right" size="28rpx" color="#a0a3bd" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -86,6 +98,7 @@
|
||||
</view>
|
||||
|
||||
<view class="empty-state" wx:else>
|
||||
<t-icon name="inbox" size="72rpx" color="#d8dde8" />
|
||||
<text class="empty-text">暂无近7日订单</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
+53
-42
@@ -1,7 +1,7 @@
|
||||
/* pages/home/index.wxss */
|
||||
|
||||
page {
|
||||
background: linear-gradient(180deg, #ffb97a 0%, #f5f6fa 420rpx);
|
||||
background: #f5f6fa;
|
||||
color: #1a1a2e;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
@@ -12,16 +12,15 @@ page {
|
||||
padding: 24rpx 24rpx 64rpx;
|
||||
}
|
||||
|
||||
/* === 头部信息卡(浅色玻璃) === */
|
||||
/* === 头部信息卡(翡翠绿实底) === */
|
||||
.header-card {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: rgba(255, 255, 255, 0.62);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.85);
|
||||
background: linear-gradient(135deg, #29b785 0%, #1a8a63 100%);
|
||||
border-radius: 28rpx;
|
||||
padding: 36rpx 32rpx;
|
||||
color: #3d2f25;
|
||||
box-shadow: 0 12rpx 32rpx rgba(242, 100, 80, 0.16);
|
||||
color: #ffffff;
|
||||
box-shadow: 0 12rpx 32rpx rgba(26, 138, 99, 0.25);
|
||||
}
|
||||
|
||||
/* 装饰光斑,增加层次 */
|
||||
@@ -30,7 +29,7 @@ page {
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 138, 61, 0.1);
|
||||
background: rgba(255, 255, 255, 0.07);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@@ -46,7 +45,7 @@ page {
|
||||
height: 160rpx;
|
||||
bottom: -80rpx;
|
||||
left: -40rpx;
|
||||
background: rgba(242, 100, 80, 0.08);
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
.profile-row {
|
||||
@@ -65,8 +64,8 @@ page {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(255, 138, 61, 0.15);
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.9);
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.45);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -82,7 +81,7 @@ page {
|
||||
.avatar-text {
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
color: #f2633f;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
@@ -101,21 +100,28 @@ page {
|
||||
|
||||
.level-tag {
|
||||
margin-left: 12rpx;
|
||||
background-color: rgba(242, 100, 80, 0.12);
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 16rpx;
|
||||
padding: 4rpx 14rpx;
|
||||
}
|
||||
|
||||
.level-text {
|
||||
font-size: 20rpx;
|
||||
color: #e05a3a;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.greeting {
|
||||
display: block;
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.65);
|
||||
}
|
||||
|
||||
.online-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: rgba(255, 255, 255, 0.75);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.9);
|
||||
background-color: rgba(255, 255, 255, 0.16);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.28);
|
||||
border-radius: 28rpx;
|
||||
padding: 6rpx 6rpx 6rpx 18rpx;
|
||||
}
|
||||
@@ -123,14 +129,14 @@ page {
|
||||
.switch-text {
|
||||
font-size: 24rpx;
|
||||
margin-right: 10rpx;
|
||||
color: #3d2f25;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.switch-track {
|
||||
width: 56rpx;
|
||||
height: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: rgba(61, 47, 37, 0.15);
|
||||
background-color: rgba(255, 255, 255, 0.35);
|
||||
position: relative;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
@@ -152,7 +158,7 @@ page {
|
||||
|
||||
.switch-track.on .switch-thumb {
|
||||
left: 26rpx;
|
||||
background-color: #ff8f4d;
|
||||
background-color: #1a8a63;
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
@@ -170,9 +176,14 @@ page {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.stat-divider {
|
||||
width: 2rpx;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 24rpx;
|
||||
color: rgba(61, 47, 37, 0.65);
|
||||
color: rgba(255, 255, 255, 0.75);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
@@ -191,7 +202,7 @@ page {
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #f2633f;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* === 通用 Section === */
|
||||
@@ -230,16 +241,10 @@ page {
|
||||
.view-all {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #a0a3bd;
|
||||
}
|
||||
|
||||
.view-all .arrow {
|
||||
font-size: 28rpx;
|
||||
color: #a0a3bd;
|
||||
}
|
||||
|
||||
/* === 快捷功能入口 === */
|
||||
.card {
|
||||
background-color: #ffffff;
|
||||
@@ -255,6 +260,11 @@ page {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.quick-row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.quick-item {
|
||||
width: 25%;
|
||||
display: flex;
|
||||
@@ -272,7 +282,6 @@ page {
|
||||
.quick-icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
background-color: #e6f9f3;
|
||||
border-radius: 26rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -282,7 +291,7 @@ page {
|
||||
}
|
||||
|
||||
.quick-label {
|
||||
font-size: 24rpx;
|
||||
font-size: 26rpx;
|
||||
color: #3a3f4d;
|
||||
}
|
||||
|
||||
@@ -338,23 +347,23 @@ page {
|
||||
}
|
||||
|
||||
.status-pending {
|
||||
background: #fff8e6;
|
||||
color: #e6a23c;
|
||||
background: #fdf3e0;
|
||||
color: #d99a2b;
|
||||
}
|
||||
|
||||
.status-confirmed {
|
||||
background: #ecf5ff;
|
||||
color: #409eff;
|
||||
background: #e9f1f8;
|
||||
color: #5c88a8;
|
||||
}
|
||||
|
||||
.status-in_progress {
|
||||
background: #f0f9eb;
|
||||
color: #67c23a;
|
||||
background: #e6f4ee;
|
||||
color: #43a08a;
|
||||
}
|
||||
|
||||
.status-completed {
|
||||
background: #f4f0ff;
|
||||
color: #7c5cfc;
|
||||
background: #efedf6;
|
||||
color: #8a7bb5;
|
||||
}
|
||||
|
||||
.status-cancelled {
|
||||
@@ -370,7 +379,7 @@ page {
|
||||
}
|
||||
|
||||
.order-hospital {
|
||||
font-size: 24rpx;
|
||||
font-size: 26rpx;
|
||||
color: #888888;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
@@ -380,7 +389,7 @@ page {
|
||||
}
|
||||
|
||||
.order-time {
|
||||
font-size: 24rpx;
|
||||
font-size: 26rpx;
|
||||
color: #a0a3bd;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -390,13 +399,15 @@ page {
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
border: 1rpx solid rgba(31, 61, 56, 0.06);
|
||||
padding: 80rpx 0;
|
||||
text-align: center;
|
||||
padding: 64rpx 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-shadow: 0 6rpx 20rpx rgba(31, 61, 56, 0.07);
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
margin-top: 16rpx;
|
||||
font-size: 26rpx;
|
||||
color: #c0c3d4;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user