优化员工排班与规划月视图体验
This commit is contained in:
@@ -5,7 +5,8 @@ App({
|
||||
globalData: {
|
||||
appName: BRAND_CONFIG.appName,
|
||||
shopName: BRAND_CONFIG.defaultShopName,
|
||||
userInfo: null
|
||||
userInfo: null,
|
||||
planningNeedRefresh: false
|
||||
},
|
||||
|
||||
onLaunch() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,12 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (this._needRefresh) {
|
||||
const app = getApp()
|
||||
const storageRefresh = wx.getStorageSync('planningNeedRefresh') === '1'
|
||||
if (this._needRefresh || app.globalData.planningNeedRefresh || storageRefresh) {
|
||||
this._needRefresh = false
|
||||
app.globalData.planningNeedRefresh = false
|
||||
wx.removeStorageSync('planningNeedRefresh')
|
||||
this.loadCalendar()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
.control-card {
|
||||
padding: 18rpx;
|
||||
animation: pageFadeIn 180ms ease both;
|
||||
}
|
||||
|
||||
.calendar-error-card {
|
||||
@@ -136,12 +137,14 @@
|
||||
color: #7d756c;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.segment.active {
|
||||
background: #fffdf8;
|
||||
color: #2f2a25;
|
||||
box-shadow: 0 6rpx 14rpx rgba(58, 48, 34, 0.07);
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.artist-filter {
|
||||
@@ -162,11 +165,13 @@
|
||||
color: #625b52;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.artist-chip.active {
|
||||
background: #e5eee9;
|
||||
color: #4e7165;
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.chip-dot {
|
||||
@@ -284,6 +289,12 @@
|
||||
border-radius: 10px;
|
||||
background: #fff7ee;
|
||||
box-shadow: 0 8rpx 16rpx rgba(58, 48, 34, 0.08);
|
||||
transition: transform 160ms ease, box-shadow 160ms ease;
|
||||
}
|
||||
|
||||
.appointment-block:active {
|
||||
transform: scale(0.98);
|
||||
box-shadow: 0 4rpx 10rpx rgba(58, 48, 34, 0.08);
|
||||
}
|
||||
|
||||
.appointment-block.pending {
|
||||
@@ -444,12 +455,14 @@
|
||||
color: #766e65;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.month-mode.active {
|
||||
background: #fffdf8;
|
||||
color: #2f6f62;
|
||||
box-shadow: 0 4rpx 12rpx rgba(58, 48, 34, 0.07);
|
||||
transform: translateY(-1rpx);
|
||||
}
|
||||
|
||||
.row-name-switch {
|
||||
@@ -487,6 +500,7 @@
|
||||
border-radius: 50%;
|
||||
background: #fffdf8;
|
||||
box-shadow: 0 2rpx 6rpx rgba(58, 48, 34, 0.16);
|
||||
transition: transform 180ms ease;
|
||||
}
|
||||
|
||||
.row-name-switch.active .switch-track {
|
||||
@@ -520,6 +534,11 @@
|
||||
border-right: 1rpx solid #eee8df;
|
||||
border-bottom: 1rpx solid #eee8df;
|
||||
background: #fffdf8;
|
||||
transition: background-color 180ms ease, transform 160ms ease;
|
||||
}
|
||||
|
||||
.month-cell:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
.month-cell:nth-child(7n) {
|
||||
@@ -543,7 +562,7 @@
|
||||
|
||||
.month-day {
|
||||
color: #2c2824;
|
||||
font-size: 26rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
@@ -552,7 +571,7 @@
|
||||
}
|
||||
|
||||
.day-mark {
|
||||
font-size: 18rpx;
|
||||
font-size: 17rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
@@ -584,6 +603,7 @@
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
transition: transform 160ms ease;
|
||||
}
|
||||
|
||||
.month-blocks {
|
||||
@@ -632,3 +652,14 @@
|
||||
font-size: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes pageFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,6 @@ Page({
|
||||
workDays: [1, 2, 3, 4, 5],
|
||||
startTime: '09:00',
|
||||
endTime: '17:00',
|
||||
slotMinutes: 60,
|
||||
capacity: 1,
|
||||
remark: ''
|
||||
},
|
||||
exceptionForm: {
|
||||
@@ -91,8 +89,6 @@ Page({
|
||||
exceptionType: 'REST',
|
||||
startTime: '10:00',
|
||||
endTime: '18:00',
|
||||
slotMinutes: 60,
|
||||
capacity: 1,
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
@@ -117,8 +113,6 @@ Page({
|
||||
workDays: copyWorkDays(rule.workDays || preset.workDays),
|
||||
startTime: String(rule.startTime || preset.startTime).slice(0, 5),
|
||||
endTime: String(rule.endTime || preset.endTime).slice(0, 5),
|
||||
slotMinutes: rule.slotMinutes || 60,
|
||||
capacity: rule.capacity || 1,
|
||||
remark: rule.remark || ''
|
||||
}
|
||||
this.setData({
|
||||
@@ -235,11 +229,10 @@ Page({
|
||||
workDays,
|
||||
startTime: form.startTime,
|
||||
endTime: form.endTime,
|
||||
slotMinutes: Number(form.slotMinutes) || 60,
|
||||
capacity: Number(form.capacity) || 1,
|
||||
status: 1,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
this.markPlanningRefresh()
|
||||
wx.showToast({ title: '排班规则已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
@@ -267,10 +260,9 @@ Page({
|
||||
exceptionType: form.exceptionType,
|
||||
startTime: form.exceptionType === 'REST' ? null : form.startTime,
|
||||
endTime: form.exceptionType === 'REST' ? null : form.endTime,
|
||||
slotMinutes: Number(form.slotMinutes) || 60,
|
||||
capacity: Number(form.capacity) || 1,
|
||||
remark: String(form.remark || '').trim()
|
||||
})
|
||||
this.markPlanningRefresh()
|
||||
wx.showToast({ title: '例外已保存', icon: 'success' })
|
||||
await this.loadRule()
|
||||
} catch (error) {
|
||||
@@ -282,5 +274,17 @@ Page({
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
markPlanningRefresh() {
|
||||
const app = getApp()
|
||||
app.globalData.planningNeedRefresh = true
|
||||
wx.setStorageSync('planningNeedRefresh', '1')
|
||||
const pages = getCurrentPages()
|
||||
pages.forEach(page => {
|
||||
if (page.route === 'pages/planning/index') {
|
||||
page._needRefresh = true
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -21,14 +21,6 @@
|
||||
<text class="field-label">结束时间</text>
|
||||
<picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker>
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">预约间隔</text>
|
||||
<input type="number" value="{{form.slotMinutes}}" data-field="slotMinutes" bindinput="onInput" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">容量</text>
|
||||
<input type="number" value="{{form.capacity}}" data-field="capacity" bindinput="onInput" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="可选" />
|
||||
@@ -55,14 +47,6 @@
|
||||
<text class="field-label">结束时间</text>
|
||||
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker>
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">预约间隔</text>
|
||||
<input type="number" value="{{exceptionForm.slotMinutes}}" data-field="slotMinutes" bindinput="onExceptionInput" />
|
||||
</view>
|
||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
|
||||
<text class="field-label">容量</text>
|
||||
<input type="number" value="{{exceptionForm.capacity}}" data-field="capacity" bindinput="onExceptionInput" />
|
||||
</view>
|
||||
<view class="field">
|
||||
<text class="field-label">备注</text>
|
||||
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
color: #5f5951;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.preset-chip.active,
|
||||
@@ -30,6 +31,7 @@
|
||||
border-color: #6f8f83;
|
||||
background: #e5eee9;
|
||||
color: #55786d;
|
||||
transform: translateY(-2rpx);
|
||||
}
|
||||
|
||||
.field-block {
|
||||
@@ -49,6 +51,16 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
min-height: 58rpx;
|
||||
padding: 14rpx 20rpx;
|
||||
border-radius: 999rpx;
|
||||
background: #f4f0ea;
|
||||
color: #4d473f;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.exception-btn {
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
@@ -68,6 +80,11 @@
|
||||
color: #4c4740;
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
transition: transform 180ms ease, box-shadow 180ms ease;
|
||||
}
|
||||
|
||||
.exception-card:active {
|
||||
transform: scale(0.99);
|
||||
}
|
||||
|
||||
.exception-remark {
|
||||
|
||||
Reference in New Issue
Block a user