From 1fc46f3835528407b3faa4fa6aa100a135b650ea Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Tue, 3 Nov 2026 22:40:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=B5=84=E6=96=99=E5=BF=85=E5=A1=AB=E6=A0=A1=E9=AA=8C=E5=9B=9E?= =?UTF-8?q?=E6=BA=AF=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JC-Salon-WeChat/pages/register/index.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JC-Salon-WeChat/pages/register/index.wxml b/JC-Salon-WeChat/pages/register/index.wxml index 2ed0d0cb..707209a7 100644 --- a/JC-Salon-WeChat/pages/register/index.wxml +++ b/JC-Salon-WeChat/pages/register/index.wxml @@ -3,7 +3,7 @@ 123 !申请入口已失效这次注册凭证已过期或已使用,请返回登录页重新点击微信快捷登录获取新凭证。 *选择工作身份无需手机号和密码,审核人会根据你的身份处理申请店店长创建并负责一家 Salon 门店{{role === 'manager' ? '✓' : '○'}}员店员加入已有门店协同工作{{role === 'staff' ? '✓' : '○'}} - 补充资料{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核,昵称和头像为必填资料'}}*店铺名称店铺地址 选填地图选点为可选项,仅用于门店展示和预约导航,不会在后台静默获取位置。*选择店铺{{selectedShopName || '请选择要加入的店铺'}}›*昵称可从微信昵称中选择,也可以手动填写,最多20个字。*头像请选择头像,头像会先上传并完成资料登记,提交时只引用已上传的文件。审核通过前不会获得门店业务权限返回上一步 + 补充资料{{role === 'manager' ? '提交后由平台管理员审核' : '提交后由对应店长审核,昵称和头像为必填资料'}}*店铺名称店铺地址 选填地图选点为可选项,仅用于门店展示和预约导航,不会在后台静默获取位置。*选择店铺{{selectedShopName || '请选择要加入的店铺'}}›*昵称可从微信昵称中选择,也可以手动填写,最多20个字。*头像请选择头像,头像会先上传并完成资料登记,提交时只引用已上传的文件。审核通过前不会获得门店业务权限返回上一步 {{registrationStatusText === '已驳回' ? '!' : registrationStatusText === '已通过' ? '✓' : '…'}}{{registrationStatusText === '已通过' ? '申请已通过' : registrationStatusText === '已驳回' ? '申请未通过' : '申请已提交'}}{{registrationStatusText === '已通过' ? '现在可以返回登录页,使用微信快捷登录。' : registrationStatusText === '已驳回' ? (registrationStatus.rejectReason || '返回登录并重新快捷登录后,可修改资料再次申请。') : (role === 'manager' ? '申请由平台管理员处理,通过后即可使用快捷登录。' : '申请由门店店长处理,通过后即可使用快捷登录。')}}当前状态:{{registrationStatusText}}申请门店{{registrationStatus.shopName || selectedShopName || form.shopName || '—'}}申请身份{{role === 'manager' ? '店长' : '店员'}}申请昵称{{form.applicantNickname || '—'}}申请编号{{registrationStatus.applicationNo}}提交时间{{applicationSubmittedAt || '刚刚'}}{{contentStatusText}}{{contentStatusReason}} OpenID 仅用于识别你的微信身份,不会在页面中展示。 From 4b4c1ddef56e42517593f2f2ac3d6ac37a92a0a4 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Tue, 3 Nov 2026 23:29:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BA=97=E5=91=98?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=85=B3=E8=81=94=E4=B8=8E=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PlanningServiceImpl.java | 1 + .../planning/vo/PlanningAppointmentVO.java | 1 + .../service/impl/PlanningServiceImplTest.java | 2 + .../pages/appointment-detail/index.js | 63 ++++++++++-- .../pages/appointment-detail/index.test.js | 98 ++++++++++++++++++ .../pages/appointment-detail/index.wxml | 49 +++++---- .../pages/appointment-detail/index.wxss | 99 +++++++++++++++++-- .../pages/employee-create/index.js | 60 ++++++++++- .../pages/employee-create/index.test.js | 31 ++++++ .../pages/employee-create/index.wxml | 23 +++-- .../pages/employee-create/index.wxss | 7 ++ JC-Salon-WeChat/pages/employees/index.js | 25 ++++- JC-Salon-WeChat/pages/employees/index.test.js | 7 +- JC-Salon-WeChat/pages/employees/index.wxss | 12 +++ JC-Salon-WeChat/pages/planning/index.js | 11 ++- JC-Salon-WeChat/pages/planning/index.test.js | 12 ++- JC-Salon-WeChat/pages/planning/index.wxml | 2 +- JC-Salon-WeChat/pages/planning/index.wxss | 3 +- 18 files changed, 442 insertions(+), 64 deletions(-) create mode 100644 JC-Salon-WeChat/pages/appointment-detail/index.test.js diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java index d1102b3e..7a77525e 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImpl.java @@ -647,6 +647,7 @@ public class PlanningServiceImpl implements PlanningService { vo.setConflictReason(resolveAppointmentConflictReason(occupancyStatus)); vo.setAmount(order == null ? null : order.getActualAmount()); vo.setRemark(order == null ? null : order.getCustomerRemark()); + vo.setCancelReason(order == null ? null : order.getCancelReason()); return vo; } diff --git a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/vo/PlanningAppointmentVO.java b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/vo/PlanningAppointmentVO.java index 1df34537..edd3899a 100644 --- a/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/vo/PlanningAppointmentVO.java +++ b/JC-Salon-Core/src/main/java/com/xiaowang/jayucloud/salon/core/modules/planning/vo/PlanningAppointmentVO.java @@ -32,4 +32,5 @@ public class PlanningAppointmentVO { private String conflictReason; private BigDecimal amount; private String remark; + private String cancelReason; } diff --git a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java index 392b4627..46273f97 100644 --- a/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java +++ b/JC-Salon-Core/src/test/java/com/xiaowang/jayucloud/salon/core/modules/planning/service/impl/PlanningServiceImplTest.java @@ -504,6 +504,7 @@ class PlanningServiceImplTest { OrderDO order = order(54L, OrderStatus.PENDING_SERVICE.getCode()); order.setCustomerNameSnapshot("散客预约"); order.setCustomerPhoneSnapshot("13800138000"); + order.setCancelReason("门店临时闭店"); OrderItemDO item = new OrderItemDO(); item.setId(64L); item.setOrderId(54L); @@ -520,6 +521,7 @@ class PlanningServiceImplTest { assertNull(result.getCustomerId()); assertEquals("散客预约", result.getCustomerName()); assertEquals("13800138000", result.getCustomerPhone()); + assertEquals("门店临时闭店", result.getCancelReason()); verify(userMapper, never()).selectById(org.mockito.ArgumentMatchers.isNull()); } diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.js b/JC-Salon-WeChat/pages/appointment-detail/index.js index 775fc609..c49e37eb 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.js +++ b/JC-Salon-WeChat/pages/appointment-detail/index.js @@ -1,6 +1,17 @@ const planningApi = require('../../api/planning') const { markPlanningRefresh } = require('../../utils/planning-refresh') +function displayValue(value, fallback) { + if (value === null || value === undefined) return fallback + const text = String(value).trim() + return !text || text === 'null' || text === 'undefined' ? fallback : text +} + +function formatAmount(value) { + const amount = displayValue(value, '') + return amount ? `¥${amount}` : '未记录' +} + Page({ data: { id: '', @@ -8,6 +19,11 @@ Page({ avatarText: '', timeText: '', isUnassigned: false, + showTransfer: false, + showConfirm: false, + showComplete: false, + showCancel: false, + updating: false, loadError: '' }, @@ -31,20 +47,50 @@ Page({ }, applyAppointment(appointment) { + const safeAppointment = appointment || {} + const status = Number(safeAppointment.status) + const historicalBackfill = Boolean(safeAppointment.historicalBackfill) + const isUnassigned = safeAppointment.assignmentStatus === 'UNASSIGNED' || !safeAppointment.artistId + const startTime = displayValue(safeAppointment.startTime, '') + const endTime = displayValue(safeAppointment.endTime, '') + const timeText = historicalBackfill && !startTime + ? '时间未记录' + : startTime + ? `${startTime.slice(0, 16)}${endTime ? ` - ${endTime.slice(11, 16)}` : ''}` + : displayValue(safeAppointment.date, '时间未记录') + const normalizedAppointment = { + ...safeAppointment, + customerNameText: displayValue(safeAppointment.customerName, '散客'), + customerPhoneText: displayValue(safeAppointment.customerPhone, '未留手机号'), + orderNoText: displayValue(safeAppointment.orderNo, '未记录'), + productTitleText: displayValue(safeAppointment.productTitle, '未记录'), + artistNameText: isUnassigned ? '待分配' : displayValue(safeAppointment.artistName, '未记录'), + durationText: Number(safeAppointment.durationMinutes) > 0 ? `${safeAppointment.durationMinutes} 分钟` : '未记录', + amountText: formatAmount(safeAppointment.amount), + statusText: displayValue(safeAppointment.statusText, '状态未知'), + remarkText: displayValue(safeAppointment.remark, '暂无备注'), + cancelReasonText: displayValue(safeAppointment.cancelReason, '') + } this.setData({ - appointment, - isUnassigned: appointment.assignmentStatus === 'UNASSIGNED' || !appointment.artistId, - avatarText: String(appointment.customerName || '客').slice(0, 1), - timeText: appointment.historicalBackfill && !appointment.startTime ? '时间未记录' : `${(appointment.startTime || '').slice(0, 16)} - ${(appointment.endTime || '').slice(11, 16)}`, + appointment: normalizedAppointment, + isUnassigned, + avatarText: normalizedAppointment.customerNameText.slice(0, 1), + timeText, + showTransfer: Boolean(safeAppointment.canEdit) && !historicalBackfill, + showConfirm: Boolean(safeAppointment.canEdit) && !historicalBackfill && !isUnassigned && status === 0, + showComplete: !isUnassigned && (status === 1 || status === 4), + showCancel: Boolean(safeAppointment.canCancel), loadError: '' }) }, async updateStatus(status) { + if (this.data.updating || !this.data.appointment.orderId) return if (status !== 3 && this.data.isUnassigned) { wx.showToast({ title: '请先分配美甲师', icon: 'none' }) return } + this.setData({ updating: true }) try { await planningApi.updateStatus(this.data.appointment.orderId, status, this._cancelReason || '') markPlanningRefresh() @@ -52,19 +98,24 @@ Page({ this.loadDetail() } catch (error) { wx.showToast({ title: error.message || '操作失败', icon: 'none' }) + } finally { + this.setData({ updating: false }) } }, confirm() { - if (this.data.appointment.historicalBackfill) return + if (!this.data.showConfirm || this.data.updating) return this.updateStatus(1) }, complete() { + if (!this.data.showComplete || this.data.updating) return this.updateStatus(2) }, cancel() { + if (!this.data.showCancel || this.data.updating) return + this._cancelReason = '' wx.showModal({ title: '取消预约', editable: true, @@ -80,7 +131,7 @@ Page({ }, goTransfer() { - if (this.data.appointment.historicalBackfill) return + if (!this.data.showTransfer) return wx.navigateTo({ url: `/pages/artist-transfer/index?id=${this.data.id}` }) }, diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.test.js b/JC-Salon-WeChat/pages/appointment-detail/index.test.js new file mode 100644 index 00000000..22edb2da --- /dev/null +++ b/JC-Salon-WeChat/pages/appointment-detail/index.test.js @@ -0,0 +1,98 @@ +const assert = require('assert') +const fs = require('fs') +const path = require('path') + +global.wx = { + showToast: () => {}, + showModal: options => options.success({ confirm: false }), + navigateTo: () => {}, + navigateBack: () => {} +} + +let definition +global.Page = value => { definition = value } +require('./index') + +function createPage() { + return { + ...definition, + data: { ...definition.data }, + setData(values) { Object.assign(this.data, values) } + } +} + +const page = createPage() +page.applyAppointment({ + orderId: 1, + orderNo: 'SALON-001', + customerName: '到店客户', + customerPhone: null, + productTitle: null, + artistName: null, + artistId: null, + assignmentStatus: 'UNASSIGNED', + startTime: null, + endTime: null, + durationMinutes: null, + amount: null, + remark: null, + status: 0, + statusText: '待确认', + canEdit: true, + canCancel: true +}) +assert.strictEqual(page.data.appointment.customerPhoneText, '未留手机号') +assert.strictEqual(page.data.appointment.productTitleText, '未记录') +assert.strictEqual(page.data.appointment.artistNameText, '待分配') +assert.strictEqual(page.data.appointment.amountText, '未记录') +assert.strictEqual(page.data.appointment.remarkText, '暂无备注') +assert.strictEqual(page.data.appointment.orderNoText, 'SALON-001') +assert.strictEqual(page.data.showTransfer, true) +assert.strictEqual(page.data.showConfirm, false) +assert.strictEqual(page.data.showComplete, false) +assert.strictEqual(page.data.showCancel, true) +assert.strictEqual([ + page.data.appointment.customerNameText, + page.data.appointment.customerPhoneText, + page.data.appointment.orderNoText, + page.data.appointment.productTitleText, + page.data.appointment.artistNameText, + page.data.appointment.durationText, + page.data.appointment.amountText, + page.data.appointment.remarkText +].some(value => String(value).includes('null')), false) + +page.applyAppointment({ + artistId: 9, + assignmentStatus: 'ASSIGNED', + status: 3, + statusText: '已取消', + canEdit: false, + canCancel: false, + cancelReason: '客户临时调整时间' +}) +assert.strictEqual(page.data.appointment.cancelReasonText, '客户临时调整时间') +assert.strictEqual(page.data.showTransfer, false) +assert.strictEqual(page.data.showConfirm, false) +assert.strictEqual(page.data.showComplete, false) +assert.strictEqual(page.data.showCancel, false) + +page.applyAppointment({ + artistId: 9, + assignmentStatus: 'ASSIGNED', + status: 4, + statusText: '服务中', + historicalBackfill: true, + canEdit: false, + canCancel: true +}) +assert.strictEqual(page.data.showTransfer, false) +assert.strictEqual(page.data.showComplete, true) +assert.strictEqual(page.data.showCancel, true) + +const markup = fs.readFileSync(path.join(__dirname, 'index.wxml'), 'utf8') +const styles = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8') +;['订单编号', '服务项目', '美甲师', '时长', '成交金额', '取消原因', 'remarkText', 'customerPhoneText'].forEach(text => assert(markup.includes(text))) +assert.match(markup, /class="primary-btn transfer-action"/) +assert.match(markup, /class="danger-btn"/) +assert.match(styles, /\.transfer-action\s*\{[^}]*box-shadow/) diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.wxml b/JC-Salon-WeChat/pages/appointment-detail/index.wxml index dd2fab7a..97af5b86 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.wxml +++ b/JC-Salon-WeChat/pages/appointment-detail/index.wxml @@ -9,44 +9,53 @@ {{avatarText}} - {{appointment.customerName}} - {{appointment.customerPhone}} + {{appointment.customerNameText}} + {{appointment.customerPhoneText}} - - 历史补单 · {{appointment.statusText}} - {{appointment.statusText}} - - + {{appointment.historicalBackfill ? '历史补单 · ' : ''}}{{appointment.statusText}} - - 项目 - {{appointment.productTitle}} + + 订单编号 + {{appointment.orderNoText}} - + + 服务项目 + {{appointment.productTitleText}} + + 美甲师 - {{isUnassigned ? '待分配' : appointment.artistName}} + {{appointment.artistNameText}} - + 时间 {{timeText}} - + 时长 - {{appointment.durationMinutes}}分钟 + {{appointment.durationText}} + + 成交金额 + {{appointment.amountText}} + + + + 取消原因 + {{appointment.cancelReasonText}} 备注 - {{appointment.remark || '暂无备注'}} + {{appointment.remarkText}} - - - - + + + + + diff --git a/JC-Salon-WeChat/pages/appointment-detail/index.wxss b/JC-Salon-WeChat/pages/appointment-detail/index.wxss index c8ac9961..54a5b15e 100644 --- a/JC-Salon-WeChat/pages/appointment-detail/index.wxss +++ b/JC-Salon-WeChat/pages/appointment-detail/index.wxss @@ -1,5 +1,5 @@ .detail-card { - padding: 24rpx; + padding: 28rpx 24rpx; } .detail-error { @@ -23,10 +23,16 @@ .detail-person { display: flex; align-items: center; + flex: 1; min-width: 0; gap: 18rpx; } +.detail-person > view:last-child { + flex: 1; + min-width: 0; +} + .avatar { display: flex; align-items: center; @@ -47,9 +53,12 @@ } .customer { + overflow: hidden; color: #17211f; font-size: 32rpx; font-weight: 800; + text-overflow: ellipsis; + white-space: nowrap; } .phone { @@ -58,20 +67,40 @@ font-size: 24rpx; } -.detail-actions { - display: flex; +.status-tag { flex-shrink: 0; - align-items: center; - gap: 10rpx; + padding: 8rpx 14rpx; + border-radius: 999rpx; + background: #edf6ef; + color: #247b63; + font-size: 21rpx; + font-weight: 800; +} + +.status-tag.completed { + background: #eef2f1; + color: #67766f; +} + +.status-tag.cancelled { + background: #fff0ed; + color: #ad5148; } .detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); - gap: 22rpx; + gap: 12rpx; margin-top: 28rpx; } +.detail-field { + min-width: 0; + padding: 16rpx; + border-radius: 12rpx; + background: #f6f9f7; +} + .label, .value { display: block; @@ -84,9 +113,36 @@ .value { margin-top: 8rpx; + overflow-wrap: anywhere; color: #17211f; font-size: 28rpx; font-weight: 700; + line-height: 1.45; +} + +.amount-field .value { + color: #b36f3e; + font-size: 32rpx; +} + +.cancel-reason { + display: flex; + align-items: flex-start; + gap: 18rpx; + margin-top: 18rpx; + padding: 18rpx; + border-left: 6rpx solid #cc7568; + border-radius: 10rpx; + background: #fff5f3; +} + +.cancel-reason-text { + flex: 1; + min-width: 0; + color: #8f4d46; + font-size: 24rpx; + line-height: 1.5; + overflow-wrap: anywhere; } .note-card { @@ -96,9 +152,12 @@ } .action-row { - display: grid; - grid-template-columns: 1fr 1fr 1fr; + display: flex; + align-items: center; gap: 14rpx; + padding: 18rpx 20rpx calc(18rpx + env(safe-area-inset-bottom)); + background: rgba(255, 255, 255, 0.96); + box-shadow: 0 -8rpx 24rpx rgba(31, 55, 44, 0.08); } .action-row .primary-btn, @@ -107,4 +166,28 @@ width: 100%; min-width: 0; max-width: 100%; + flex: 1; + padding: 0 12rpx; + font-size: 23rpx; + white-space: nowrap; +} + +.action-row .transfer-action { + flex: 1.25; + box-shadow: 0 8rpx 18rpx rgba(36, 123, 99, 0.18); +} + +@media (max-width: 360px) { + .action-row { + gap: 8rpx; + padding-right: 12rpx; + padding-left: 12rpx; + } + + .action-row .primary-btn, + .action-row .secondary-btn, + .action-row .danger-btn { + padding: 0 6rpx; + font-size: 20rpx; + } } diff --git a/JC-Salon-WeChat/pages/employee-create/index.js b/JC-Salon-WeChat/pages/employee-create/index.js index 0a95d798..b712102c 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.js +++ b/JC-Salon-WeChat/pages/employee-create/index.js @@ -7,6 +7,7 @@ Page({ data: { pickerMode: false, appointmentContext: { date: '', time: '', durationMinutes: '' }, + applicationId: '', employeeColors: EMPLOYEE_COLORS, onboardingVisible: false, createdEmployee: null, @@ -35,7 +36,9 @@ Page({ date: options.date || '', time: options.time || '', durationMinutes: options.durationMinutes || '' - } + }, + applicationId: options.applicationId || '', + applicationNo: options.applicationNo || '' }) }, @@ -81,6 +84,12 @@ Page({ }, async submit() { + if (this.data.creating || this.data.avatarUploading) return + if (this.data.createdEmployee) { + if (this.data.applicationId && !this.data.applicationApproved) return this.associateCreatedEmployee() + this.setData({ onboardingVisible: true }) + return + } const form = this.data.form const nickname = String(form.nickname || '').trim() const phone = String(form.phone || '').trim() @@ -106,7 +115,11 @@ Page({ }) const id = result && typeof result === 'object' ? (result.id || result.userId) : result const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' } - this.setData({ createdEmployee: employee }) + this.setData({ createdEmployee: employee, applicationApproved: false }) + if (this.data.applicationId) { + await this.associateCreatedEmployee() + return + } await this.offerPendingAssociation() } catch (error) { wx.showToast({ title: error.message || '新增失败', icon: 'none' }) @@ -115,6 +128,33 @@ Page({ } }, + async associateCreatedEmployee() { + const employee = this.data.createdEmployee + if (!employee || !employee.id || !this.data.applicationId || this.data.associatingApplication) return + this.setData({ associatingApplication: true }) + try { + await employeesApi.approveApplication(this.data.applicationId, { + targetArtistUserId: employee.id, + useApplicantNickname: false, + useApplicantAvatar: false + }) + this.setData({ applicationApproved: true, associatingApplication: false, onboardingVisible: true }) + wx.showToast({ title: '已关联并通过审核', icon: 'success' }) + } catch (error) { + this.setData({ associatingApplication: false }) + wx.showModal({ + title: '关联审核未完成', + content: error.message || '美甲师档案已创建,可重试关联申请。', + confirmText: '重试', + cancelText: '稍后处理', + success: result => { + if (result.confirm) this.associateCreatedEmployee() + else this.setData({ onboardingVisible: true }) + } + }) + } + }, + async offerPendingAssociation() { try { const data = await employeesApi.unassociatedApplications() @@ -180,6 +220,7 @@ Page({ }, setupFirstSchedule() { + if (this.data.applicationId && !this.data.applicationApproved) return const employee = this.data.createdEmployee if (!employee || !employee.id) return const context = this.data.appointmentContext @@ -202,7 +243,7 @@ Page({ }, skipFirstSchedule() { - if (this.data.savingDefaultSchedule || !this.data.createdEmployee) return + if (this.data.savingDefaultSchedule || !this.data.createdEmployee || (this.data.applicationId && !this.data.applicationApproved)) return this.setData({ savingDefaultSchedule: true }) employeesApi.saveScheduleRule({ artistId: this.data.createdEmployee.id, @@ -231,6 +272,10 @@ Page({ }, finishCreated(autoSelect, scheduleSaved) { + if (this.data.applicationId && !this.data.applicationApproved) { + this.setData({ onboardingVisible: true }) + return + } const employee = this.data.createdEmployee const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel() if (eventChannel && eventChannel.emit) { @@ -239,5 +284,14 @@ Page({ this.setData({ onboardingVisible: false }) wx.showToast({ title: scheduleSaved ? '排班已保存' : '美甲师已新增', icon: 'success' }) setTimeout(() => wx.navigateBack(), 300) + }, + + leaveAssociationForLater() { + const employee = this.data.createdEmployee + const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel() + if (eventChannel && eventChannel.emit && employee) { + eventChannel.emit('employeeCreated', { ...employee, autoSelect: this.data.pickerMode, scheduleSaved: false }) + } + wx.navigateBack() } }) diff --git a/JC-Salon-WeChat/pages/employee-create/index.test.js b/JC-Salon-WeChat/pages/employee-create/index.test.js index 6f7130cc..1d3c0971 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.test.js +++ b/JC-Salon-WeChat/pages/employee-create/index.test.js @@ -3,10 +3,12 @@ const employeesApi = require('../../api/employees') let navigatedBack = false let navigatedTo = '' +let modalConfirm = false global.wx = { getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }), getDeviceInfo: () => ({ platform: 'devtools' }), showToast: () => {}, + showModal: options => options.success({ confirm: modalConfirm }), navigateBack: () => { navigatedBack = true }, navigateTo: options => { navigatedTo = options.url } } @@ -102,6 +104,35 @@ async function run() { page.data.appointmentContext = { date: '2026-10-12', time: '14:00', durationMinutes: '60' } page.setupFirstSchedule() assert.strictEqual(navigatedTo.includes('/pages/schedule-setting/index?id=88&onboarding=1&source=appointment'), true) + + let employeeCreateCount = 0 + let approvalAttempts = 0 + let approvalPayload + page.data.form = { nickname: '申请档案员工', phone: '13800138001', wechatId: '', color: '#8FB89A', avatar: '', avatarUrl: '' } + page.data.createdEmployee = null + page.data.applicationId = '42' + page.data.applicationApproved = false + page.data.onboardingVisible = false + employeesApi.createUser = async () => { employeeCreateCount += 1; return { userId: 90 } } + employeesApi.approveApplication = async (applicationId, payload) => { + approvalAttempts += 1 + approvalPayload = { applicationId, ...payload } + if (approvalAttempts === 1) throw new Error('暂时无法审核') + } + await page.submit() + assert.strictEqual(employeeCreateCount, 1) + assert.deepStrictEqual(approvalPayload, { + applicationId: '42', + targetArtistUserId: 90, + useApplicantNickname: false, + useApplicantAvatar: false + }) + assert.strictEqual(page.data.createdEmployee.id, 90) + assert.strictEqual(page.data.onboardingVisible, true) + await page.associateCreatedEmployee() + assert.strictEqual(employeeCreateCount, 1) + assert.strictEqual(approvalAttempts, 2) + assert.strictEqual(page.data.applicationApproved, true) } run().catch(error => { diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxml b/JC-Salon-WeChat/pages/employee-create/index.wxml index 5d1c7de6..72166b04 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxml +++ b/JC-Salon-WeChat/pages/employee-create/index.wxml @@ -1,7 +1,7 @@ 新增美甲师档案 - {{pickerMode ? '保存后自动选择该美甲师' : '保存后即可用于预约指定和美甲师管理'}} + {{applicationId ? '保存后将自动关联当前申请并通过审核' : (pickerMode ? '保存后自动选择该美甲师' : '保存后即可用于预约指定和美甲师管理')}} @@ -42,17 +42,24 @@ - + - ✓ - 美甲师已创建 - {{pickerMode ? '设置常规排班后,可继续把当前预约分配给该美甲师。' : '为新美甲师设置首个常规排班,之后即可正常承接预约。'}} - 不立即设置时,将默认全年无休、全天排班(00:00-23:59);实际预约仍受门店营业时间限制,之后可在排班设置中调整。 - - + {{applicationId && !applicationApproved ? '!' : '✓'}} + {{applicationId && !applicationApproved ? '美甲师档案已创建' : (applicationId ? '申请已关联并通过' : '美甲师已创建')}} + {{applicationId && !applicationApproved ? '员工档案已保留,申请仍待处理。关联失败不会重复创建员工,可直接重试。' : (pickerMode ? '设置常规排班后,可继续把当前预约分配给该美甲师。' : '为新美甲师设置首个常规排班,之后即可正常承接预约。')}} + + 申请编号 {{applicationNo || applicationId}} + + + + + 不立即设置时,将默认全年无休、全天排班(00:00-23:59);实际预约仍受门店营业时间限制,之后可在排班设置中调整。 + + + diff --git a/JC-Salon-WeChat/pages/employee-create/index.wxss b/JC-Salon-WeChat/pages/employee-create/index.wxss index 9f97cb68..8140d5d1 100644 --- a/JC-Salon-WeChat/pages/employee-create/index.wxss +++ b/JC-Salon-WeChat/pages/employee-create/index.wxss @@ -148,8 +148,15 @@ font-weight: 900; } +.onboarding-icon.association-failed { + background: #fff0ed; + color: #ad5148; +} + .onboarding-title { margin-top: 22rpx; color: #17211f; font-size: 32rpx; font-weight: 900; } .onboarding-desc { margin-top: 12rpx; color: #837b72; font-size: 23rpx; line-height: 1.7; text-align: center; } .onboarding-default-note { margin-top: 14rpx; padding: 14rpx 16rpx; border-radius: 12rpx; background: #eff7f2; color: #39705d; font-size: 21rpx; line-height: 1.55; text-align: left; } .onboarding-primary { width: 100%; margin-top: 30rpx; } .onboarding-skip { margin-top: 12rpx; background: transparent; color: #7e776f; font-size: 23rpx; } +.association-retry-box { width: 100%; margin-top: 20rpx; padding: 18rpx; box-sizing: border-box; border-radius: 12rpx; background: #fff5f3; color: #8f4d46; font-size: 22rpx; text-align: center; } +.association-retry-box .onboarding-primary { margin-top: 18rpx; } diff --git a/JC-Salon-WeChat/pages/employees/index.js b/JC-Salon-WeChat/pages/employees/index.js index 2136f665..a926a20f 100644 --- a/JC-Salon-WeChat/pages/employees/index.js +++ b/JC-Salon-WeChat/pages/employees/index.js @@ -50,6 +50,11 @@ Page({ }, onShow() { + if (this._waitingForEmployeeCreate) { + this._waitingForEmployeeCreate = false + this.loadEmployees() + if (this.data.reviewExpanded) this.loadReviewApplications() + } const app = getApp() if (!this.data.isManager || !app.globalData.openEmployeeReview) return app.globalData.openEmployeeReview = false @@ -128,12 +133,13 @@ Page({ }) if (!artists.length) { this.setData({ associationSheetVisible: false }) - await confirmModal({ - title: '暂时无法通过', - content: '当前门店没有未关联微信的美甲师档案,请先新增美甲师,再审核这条申请。', - confirmText: '知道了', - showCancel: false + const result = await confirmModal({ + title: '需要先新建美甲师', + content: '当前门店没有未关联微信的美甲师档案。新建后将自动关联这条申请并通过审核。', + confirmText: '去新建', + cancelText: '稍后处理' }) + if (result.confirm) this.createEmployeeForApplication(applicationId, application && application.applicationNo) } } catch (error) { this.setData({ associationError: error.message || '未关联美甲师加载失败' }) @@ -291,6 +297,15 @@ Page({ } }, + createEmployeeForApplication(applicationId, applicationNo) { + if (!applicationId) return + this._waitingForEmployeeCreate = true + wx.navigateTo({ + url: `/pages/employee-create/index?applicationId=${encodeURIComponent(applicationId)}&applicationNo=${encodeURIComponent(applicationNo || '')}`, + fail: () => { this._waitingForEmployeeCreate = false } + }) + }, + onEmployeeAvatarError(event) { const index = Number(event.currentTarget.dataset.index) if (!Number.isInteger(index) || !this.data.employees[index]) return diff --git a/JC-Salon-WeChat/pages/employees/index.test.js b/JC-Salon-WeChat/pages/employees/index.test.js index 4f56241a..9d8e1199 100644 --- a/JC-Salon-WeChat/pages/employees/index.test.js +++ b/JC-Salon-WeChat/pages/employees/index.test.js @@ -5,6 +5,7 @@ const path = require('path') const modalChoices = [] const toasts = [] const modals = [] +const navigations = [] global.wx = { getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }), getDeviceInfo: () => ({ platform: 'devtools' }), @@ -12,7 +13,8 @@ global.wx = { showModal: options => { modals.push(options) options.success({ confirm: modalChoices.shift() !== false }) - } + }, + navigateTo: options => navigations.push(options.url) } global.getApp = () => ({ globalData: { userInfo: { type: 2 }, openEmployeeReview: false } }) @@ -83,7 +85,8 @@ async function run() { page.data.reviewApplications = [application] await page.approveApplication({ currentTarget: { dataset: { id: 12 } } }) assert.strictEqual(page.data.associationSheetVisible, false) - assert(modals.some(item => String(item.content || '').includes('当前门店没有未关联微信的美甲师档案'))) + assert(modals.some(item => item.confirmText === '去新建')) + assert.strictEqual(navigations.pop(), '/pages/employee-create/index?applicationId=12&applicationNo=') } run().catch(error => { diff --git a/JC-Salon-WeChat/pages/employees/index.wxss b/JC-Salon-WeChat/pages/employees/index.wxss index f3b343bd..ed3cf279 100644 --- a/JC-Salon-WeChat/pages/employees/index.wxss +++ b/JC-Salon-WeChat/pages/employees/index.wxss @@ -97,6 +97,8 @@ } .review-item { + box-sizing: border-box; + width: 100%; gap: 14rpx; min-width: 0; flex-wrap: wrap; @@ -115,7 +117,9 @@ } .review-info { + box-sizing: border-box; min-width: 0; + width: 0; flex: 1; overflow: hidden; } @@ -142,7 +146,9 @@ } .review-actions { + box-sizing: border-box; flex: 0 0 auto; + max-width: 100%; gap: 8rpx; margin-left: auto; } @@ -199,6 +205,12 @@ } } +@media (min-width: 391px) { + .review-actions { + max-width: 230rpx; + } +} + .review-retry { width: 150rpx; min-width: 150rpx; diff --git a/JC-Salon-WeChat/pages/planning/index.js b/JC-Salon-WeChat/pages/planning/index.js index 4e68a5b5..bd3e264e 100644 --- a/JC-Salon-WeChat/pages/planning/index.js +++ b/JC-Salon-WeChat/pages/planning/index.js @@ -121,7 +121,7 @@ function layoutAppointmentBlocks(items, startMinute, minuteScale, laneHeaderHeig return { ...entry, top: Math.max(0, entry.itemStart - startMinute) * minuteScale + laneHeaderHeight, - height: entry.durationMinutes * minuteScale, + height: Math.max(40, entry.durationMinutes * minuteScale), left: Math.round(entry.columnIndex * slotWidth + 12), width: Math.round(slotWidth - 24), compact: entry.durationMinutes <= 15, @@ -167,6 +167,7 @@ Page({ hours: [], hasTimedAppointments: false, timelineHeight: 720, + timelineViewportHeight: 720, laneWidth: 720, laneItemWidth: 240, laneHeaderHeight: 54, @@ -601,7 +602,7 @@ Page({ }, buildDayView(calendar) { - const minuteScale = 4 + const minuteScale = 2.5 const daySummary = this.summaryMap(calendar)[this.data.currentDateText] || null const businessHours = resolveBusinessHours(calendar, this.data.currentDateText) const filteredArtists = this.data.selectedArtistId @@ -622,6 +623,7 @@ Page({ hours: [], hasTimedAppointments: false, timelineHeight: 0, + timelineViewportHeight: 320, laneHeaderHeight: 54, laneItemWidth: 248, laneWidth: 720, @@ -644,7 +646,7 @@ Page({ const endMinute = businessHours ? dateUtil.minutesOfDay(businessHours.end) : Math.min(1440, Math.max(startMinute + 60, Math.ceil(latestAppointmentEnd / 60) * 60)) - const timelineHeight = Math.max(560, (endMinute - startMinute) * minuteScale) + const timelineHeight = (endMinute - startMinute) * minuteScale const laneHeaderHeight = 54 const hours = [] for (let cursor = startMinute; cursor <= endMinute; cursor += 60) { @@ -663,7 +665,7 @@ Page({ return { ...item, top: Math.max(0, itemStart - startMinute) * minuteScale + laneHeaderHeight, - height: Math.max(60, (item.durationMinutes || 60) * minuteScale), + height: Math.max(40, (item.durationMinutes || 60) * minuteScale), left: 12, width: 224, compact: Number(item.durationMinutes || 60) <= 15, @@ -696,6 +698,7 @@ Page({ hours, hasTimedAppointments: timedAppointments.length > 0, timelineHeight: timelineHeight + laneHeaderHeight, + timelineViewportHeight: Math.min(820, timelineHeight + laneHeaderHeight), laneHeaderHeight, laneItemWidth: 248, laneWidth: Math.max(720, lanes.reduce((width, lane) => width + (lane.width || 248), 0)), diff --git a/JC-Salon-WeChat/pages/planning/index.test.js b/JC-Salon-WeChat/pages/planning/index.test.js index 02a288bd..fde24878 100644 --- a/JC-Salon-WeChat/pages/planning/index.test.js +++ b/JC-Salon-WeChat/pages/planning/index.test.js @@ -123,9 +123,10 @@ async function run() { assert.strictEqual(dayState.dayLanes[0].artistId, '__unassigned__') assert.strictEqual(dayState.dayLanes[0].blocks.length, 1) assert.strictEqual(dayState.unassignedCount, 1) - assert.strictEqual(dayState.timelineHeight, 2934) - assert.strictEqual(dayState.hours.find(item => item.label === '14:00').top, 1014) - assert.strictEqual(dayState.dayLanes[0].blocks[0].height, 240) + assert.strictEqual(dayState.timelineHeight, 1854) + assert.strictEqual(dayState.timelineViewportHeight, 820) + assert.strictEqual(dayState.hours.find(item => item.label === '14:00').top, 654) + assert.strictEqual(dayState.dayLanes[0].blocks[0].height, 150) const shortAppointmentState = dayPage.buildDayView({ businessStartTime: '10:30', businessEndTime: '11:30', @@ -133,9 +134,10 @@ async function run() { appointments: [{ orderItemId: 9, date: '2026-10-12', startTime: '2026-10-12 10:45:00', durationMinutes: 15, artistId: 1 }] }) assert.strictEqual(shortAppointmentState.hours[0].top, 54) - assert.strictEqual(shortAppointmentState.hours[1].top, 294) + assert.strictEqual(shortAppointmentState.hours[1].top, 204) + assert.strictEqual(shortAppointmentState.timelineViewportHeight, 204) const shortAppointmentLane = shortAppointmentState.dayLanes.find(lane => lane.artistId === 1) - assert.strictEqual(shortAppointmentLane.blocks[0].height, 60) + assert.strictEqual(shortAppointmentLane.blocks[0].height, 40) assert.strictEqual(shortAppointmentLane.blocks[0].compact, true) const missingHoursPage = createPage({ viewMode: 'day', currentDateText: '2026-10-12' }) const missingHoursEmptyState = missingHoursPage.buildDayView({ diff --git a/JC-Salon-WeChat/pages/planning/index.wxml b/JC-Salon-WeChat/pages/planning/index.wxml index 507fd474..3298d7c9 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxml +++ b/JC-Salon-WeChat/pages/planning/index.wxml @@ -96,7 +96,7 @@ 预约时间轴暂不可用 请先设置门店营业时间,再安排普通预约。 - + {{item.label}} diff --git a/JC-Salon-WeChat/pages/planning/index.wxss b/JC-Salon-WeChat/pages/planning/index.wxss index fdffe993..4c7bcc55 100644 --- a/JC-Salon-WeChat/pages/planning/index.wxss +++ b/JC-Salon-WeChat/pages/planning/index.wxss @@ -359,14 +359,13 @@ } .day-board { - height: 820rpx; + max-height: 820rpx; margin-top: 12rpx; overflow: hidden; } .timeline-wrap { position: relative; - min-height: 774rpx; } .time-axis {