From 9ac56115d070f6742f370da6098bd007fab47f71 Mon Sep 17 00:00:00 2001
From: xiaowang <2161656029@qq.com>
Date: Fri, 4 Sep 2026 16:13:58 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=B0=8F=E7=A8=8B=E5=BA=8F?=
=?UTF-8?q?=E6=8E=92=E7=8F=AD=E4=B8=8E=E9=A2=84=E7=BA=A6=E5=BF=AB=E6=8D=B7?=
=?UTF-8?q?=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
JC-Salon-WeChat/pages/employees/index.js | 23 +++++++++-
JC-Salon-WeChat/pages/employees/index.wxml | 4 +-
JC-Salon-WeChat/pages/planning/index.js | 43 +++++++++++++++++++
JC-Salon-WeChat/pages/planning/index.wxml | 5 +++
JC-Salon-WeChat/pages/planning/index.wxss | 13 ++++++
.../pages/schedule-setting/index.js | 6 ++-
6 files changed, 88 insertions(+), 6 deletions(-)
diff --git a/JC-Salon-WeChat/pages/employees/index.js b/JC-Salon-WeChat/pages/employees/index.js
index 6b20dd23..417c9c61 100644
--- a/JC-Salon-WeChat/pages/employees/index.js
+++ b/JC-Salon-WeChat/pages/employees/index.js
@@ -1,4 +1,6 @@
const employeesApi = require('../../api/employees')
+const planningApi = require('../../api/planning')
+const dateUtil = require('../../utils/date')
const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
@@ -34,8 +36,14 @@ Page({
async loadEmployees() {
try {
- const data = await employeesApi.list({ page: 1, size: 50 })
+ const today = dateUtil.formatDate(new Date())
+ const [data, calendar] = await Promise.all([
+ employeesApi.list({ page: 1, size: 50 }),
+ planningApi.calendar({ startDate: today, endDate: today })
+ ])
const list = data.list || data || []
+ const appointments = calendar.appointments || []
+ const artists = calendar.artists || []
this.setData({
loadError: '',
employees: list.map((item, index) => ({
@@ -46,7 +54,18 @@ Page({
color: EMPLOYEE_COLORS[index % EMPLOYEE_COLORS.length],
monthOrders: item.monthOrders || item.orderCount || 0,
monthAmount: item.monthAmount || item.turnover || 0,
- scheduleSummary: buildScheduleSummary(item)
+ scheduleSummary: buildScheduleSummary(item),
+ todaySchedule: (() => {
+ const artist = artists.find(entry => String(entry.id) === String(item.userId || item.id))
+ return artist && artist.workStartTime && artist.workEndTime
+ ? `${artist.workStartTime.slice(0, 5)}-${artist.workEndTime.slice(0, 5)}`
+ : '今日未排班'
+ })(),
+ todayAvailable: (() => {
+ const artist = artists.find(entry => String(entry.id) === String(item.userId || item.id))
+ return !!artist && Number(artist.status) !== 0
+ })(),
+ todayOrders: appointments.filter(entry => String(entry.artistId) === String(item.userId || item.id)).length
}))
})
} catch (error) {
diff --git a/JC-Salon-WeChat/pages/employees/index.wxml b/JC-Salon-WeChat/pages/employees/index.wxml
index d73c99ef..af3f16dc 100644
--- a/JC-Salon-WeChat/pages/employees/index.wxml
+++ b/JC-Salon-WeChat/pages/employees/index.wxml
@@ -18,8 +18,8 @@
{{item.shortName}}
{{item.name}}
- {{item.scheduleSummary}}
- 本月 {{item.monthOrders}} 单 · ¥{{item.monthAmount}}
+ {{item.todaySchedule}} · {{item.todayAvailable ? '可预约' : '休息中'}}
+ 今日 {{item.todayOrders}} 单 · 本月 {{item.monthOrders}} 单
diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js
index d968c88a..76bc069f 100644
--- a/JC-Salon-WeChat/pages/planning/index.js
+++ b/JC-Salon-WeChat/pages/planning/index.js
@@ -418,5 +418,48 @@ Page({
wx.navigateTo({
url: `/pages/appointment-detail/index?id=${event.currentTarget.dataset.id}`
})
+ },
+
+ stopTap() {
+ },
+
+ async quickUpdateStatus(event) {
+ const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
+ if (!appointment) return
+ try {
+ await planningApi.updateStatus(appointment.orderId, Number(event.currentTarget.dataset.status))
+ wx.showToast({ title: '预约已确认', icon: 'success' })
+ this.loadCalendar()
+ } catch (error) {
+ wx.showToast({ title: error.message || '预约状态更新失败', icon: 'none' })
+ }
+ },
+
+ quickTransfer(event) {
+ wx.navigateTo({ url: `/pages/artist-transfer/index?id=${event.currentTarget.dataset.id}` })
+ },
+
+ quickCancel(event) {
+ const appointment = this.data.appointments.find(item => String(item.orderItemId) === String(event.currentTarget.dataset.id))
+ if (!appointment) return
+ wx.showModal({
+ title: '取消预约',
+ content: '确定取消这条预约吗?',
+ success: result => {
+ if (result.confirm) {
+ this.updateAppointmentStatus(appointment.orderId, 3)
+ }
+ }
+ })
+ },
+
+ async updateAppointmentStatus(orderId, status) {
+ try {
+ await planningApi.updateStatus(orderId, status)
+ wx.showToast({ title: '预约已取消', icon: 'success' })
+ this.loadCalendar()
+ } catch (error) {
+ wx.showToast({ title: error.message || '预约取消失败', icon: 'none' })
+ }
}
})
diff --git a/JC-Salon-WeChat/pages/planning/index.wxml b/JC-Salon-WeChat/pages/planning/index.wxml
index aef0dc8f..0537673b 100644
--- a/JC-Salon-WeChat/pages/planning/index.wxml
+++ b/JC-Salon-WeChat/pages/planning/index.wxml
@@ -67,6 +67,11 @@
{{block.customerName}}
{{block.timeText}} · {{block.productTitle}}
{{block.statusText}}
+
+ 确认
+ 改派
+ 取消
+
全天可约
diff --git a/JC-Salon-WeChat/pages/planning/index.wxss b/JC-Salon-WeChat/pages/planning/index.wxss
index 0dd11e67..cc11d399 100644
--- a/JC-Salon-WeChat/pages/planning/index.wxss
+++ b/JC-Salon-WeChat/pages/planning/index.wxss
@@ -320,6 +320,19 @@
line-height: 1.25;
}
+.block-actions {
+ display: flex;
+ gap: 10rpx;
+ margin-top: 6rpx;
+ color: #2f6f62;
+ font-size: 20rpx;
+ font-weight: 800;
+}
+
+.block-actions text {
+ padding: 2rpx 6rpx;
+}
+
.lane-empty {
position: absolute;
top: 76rpx;
diff --git a/JC-Salon-WeChat/pages/schedule-setting/index.js b/JC-Salon-WeChat/pages/schedule-setting/index.js
index d28f3e95..fcf1f1a8 100644
--- a/JC-Salon-WeChat/pages/schedule-setting/index.js
+++ b/JC-Salon-WeChat/pages/schedule-setting/index.js
@@ -237,7 +237,8 @@ Page({
wx.showToast({ title: '排班规则已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
- wx.showToast({ title: error.message || '保存失败', icon: 'none' })
+ const message = error.message || '保存失败'
+ wx.showModal({ title: '排班保存失败', content: message, showCancel: false, confirmText: '知道了' })
} finally {
this.setData({ saving: false })
}
@@ -267,7 +268,8 @@ Page({
wx.showToast({ title: '例外已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
- wx.showToast({ title: error.message || '例外保存失败', icon: 'none' })
+ const message = error.message || '例外保存失败'
+ wx.showModal({ title: '特殊日期保存失败', content: message, showCancel: false, confirmText: '知道了' })
} finally {
this.setData({ saving: false })
}