优化员工排班与规划月视图体验
This commit is contained in:
@@ -3,6 +3,12 @@ const employeesApi = require('../../api/employees')
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const DEFAULT_EMPLOYEE_PASSWORD = 'Fingertip@123'
|
||||
|
||||
function buildScheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || '未设置'
|
||||
const time = item.scheduleTimeSummary || item.ruleTimeSummary || ''
|
||||
return time ? `${mode} ${time}` : mode
|
||||
}
|
||||
|
||||
Page({
|
||||
data: {
|
||||
employees: [],
|
||||
@@ -32,9 +38,11 @@ Page({
|
||||
id: item.userId || item.id,
|
||||
name: item.nickname || item.name || item.artistName || `美甲师${index + 1}`,
|
||||
shortName: (item.nickname || item.name || '师').slice(-1),
|
||||
avatar: item.avatar || item.avatarUrl || '',
|
||||
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
|
||||
monthOrders: item.monthOrders || item.orderCount || 0,
|
||||
monthAmount: item.monthAmount || item.turnover || 0
|
||||
monthAmount: item.monthAmount || item.turnover || 0,
|
||||
scheduleSummary: buildScheduleSummary(item)
|
||||
}))
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
@@ -12,9 +12,13 @@
|
||||
<view wx:elif="{{employees.length === 0}}" class="empty card">暂无美甲师</view>
|
||||
<view wx:for="{{employees}}" wx:key="id" class="card employee-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{item.name}}</text>
|
||||
<text class="employee-schedule">{{item.scheduleSummary}}</text>
|
||||
<text class="employee-meta">本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 22rpx;
|
||||
animation: cardIn 180ms ease both;
|
||||
transition: transform 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.employee-card:active {
|
||||
transform: scale(0.99);
|
||||
box-shadow: 0 6rpx 18rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.employee-left {
|
||||
@@ -40,9 +47,20 @@
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
font-weight: 900;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-avatar {
|
||||
background: #f0ece5;
|
||||
}
|
||||
|
||||
.image-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.employee-name,
|
||||
.employee-schedule,
|
||||
.employee-meta {
|
||||
display: block;
|
||||
}
|
||||
@@ -59,6 +77,13 @@
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.employee-schedule {
|
||||
margin-top: 6rpx;
|
||||
color: #55786d;
|
||||
font-size: 23rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.color-pill {
|
||||
width: 44rpx;
|
||||
height: 18rpx;
|
||||
@@ -80,6 +105,7 @@
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
background: rgba(18, 15, 12, 0.48);
|
||||
animation: maskIn 180ms ease both;
|
||||
}
|
||||
|
||||
.employee-modal {
|
||||
@@ -88,6 +114,7 @@
|
||||
border-radius: 28rpx 28rpx 0 0;
|
||||
background: #fffaf4;
|
||||
box-shadow: 0 -18rpx 40rpx rgba(41, 31, 23, 0.16);
|
||||
animation: modalUp 220ms ease both;
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
@@ -171,3 +198,32 @@
|
||||
.modal-submit {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
|
||||
@keyframes cardIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes maskIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes modalUp {
|
||||
from {
|
||||
transform: translateY(40rpx);
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user