From 7f9f9e74a6f34892e45922e2f30f189b7ae2e17a Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Tue, 21 Jul 2026 12:09:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BA=97=E5=8A=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E9=A2=84=E7=BA=A6=E4=BD=9C=E5=93=81=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/appointment-form/index.js | 101 +++++-- .../pages/appointment-form/index.wxml | 38 ++- .../pages/appointment-form/index.wxss | 166 ++++++++++-- .../pages/employee-detail/index.js | 28 +- .../pages/employee-detail/index.wxml | 46 +++- .../pages/employee-detail/index.wxss | 255 +++++++++++++++++- JY-Salon-WeChat/pages/planning/index.js | 4 +- JY-Salon-WeChat/pages/planning/index.wxss | 24 +- JY-Salon-WeChat/utils/upload.js | 19 +- memory/bugs.md | 16 ++ memory/progress.md | 18 +- 11 files changed, 627 insertions(+), 88 deletions(-) diff --git a/JY-Salon-WeChat/pages/appointment-form/index.js b/JY-Salon-WeChat/pages/appointment-form/index.js index 22aa37fb..5317c7d2 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.js +++ b/JY-Salon-WeChat/pages/appointment-form/index.js @@ -3,7 +3,7 @@ const productsApi = require('../../api/products') const customersApi = require('../../api/customers') const dateUtil = require('../../utils/date') const { markPlanningRefresh } = require('../../utils/planning-refresh') -const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload') +const { chooseImageFilePaths, uploadObjectFile } = require('../../utils/upload') const DRAFT_STORAGE_PREFIX = 'managerAppointmentDraft' const TIME_SLOT_MINUTES = 15 @@ -226,6 +226,13 @@ function normalizeProduct(product, artists) { } } +function splitManualImageValues(value) { + return String(value || '') + .split(',') + .map(item => item.trim()) + .filter(Boolean) +} + function isScheduleCoveringTime(schedule, form, startMinute, endMinute) { if (!schedule || String(schedule.artistId) !== String(form.artistId) || schedule.date !== form.appointmentDate) { return false @@ -284,6 +291,8 @@ Page({ selectedProduct: {}, selectedArtist: {}, productModalVisible: false, + manualProductPanelVisible: false, + manualProductImageUrls: [], productKeyword: '', productError: '', conflictTip: '', @@ -313,6 +322,7 @@ Page({ appointmentDate: options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date()), artistId: options.artistId || baseForm.artistId || '' }, + manualProductImageUrls: splitManualImageValues(baseForm.manualProductImageUrl || ''), draftSavedAtText: draftForm ? '已恢复本机草稿' : '' }) if (!creatable) { @@ -473,11 +483,34 @@ Page({ openProductModal() { this.refreshProductCards() - this.setData({ productModalVisible: true }) + this.setData({ + productModalVisible: true, + manualProductPanelVisible: false + }) }, closeProductModal() { - this.setData({ productModalVisible: false }) + this.setData({ + productModalVisible: false, + manualProductPanelVisible: false + }) + }, + + openManualProductPanel() { + const imageUrls = this.data.manualProductImageUrls.length > 0 + ? this.data.manualProductImageUrls + : splitManualImageValues(this.data.form.manualProductImageUrl) + this.setData({ + manualProductPanelVisible: true, + manualProductImageUrls: imageUrls + }) + }, + + closeManualProductPanel() { + if (this.data.manualImageUploading) { + return + } + this.setData({ manualProductPanelVisible: false }) }, stopTap() { @@ -501,6 +534,8 @@ Page({ 'form.manualProductPrecautions': '', 'form.manualProductImageFileIds': '', 'form.manualProductImageUrl': '', + manualProductImageUrls: [], + manualProductPanelVisible: false, 'form.durationMinutes': String(parseInt(selectedProduct.approximateDuration, 10) || this.data.form.durationMinutes || '') }) this.closeProductModal() @@ -519,7 +554,8 @@ Page({ selectedProduct: {}, 'form.productId': '', 'form.manualProductTitle': title, - 'form.manualProductPrice': String(price) + 'form.manualProductPrice': String(price), + manualProductPanelVisible: false }) this.closeProductModal() this.refreshAvailableTimes() @@ -530,21 +566,38 @@ Page({ if (this.data.manualImageUploading) { return } + const currentFileIds = splitManualImageValues(this.data.form.manualProductImageFileIds) + const currentImageUrls = this.data.manualProductImageUrls.length > 0 + ? this.data.manualProductImageUrls + : splitManualImageValues(this.data.form.manualProductImageUrl) + const remainingCount = 9 - currentFileIds.length + if (remainingCount <= 0) { + wx.showToast({ title: '最多上传 9 张作品图片', icon: 'none' }) + return + } try { - const filePath = await chooseImageFilePath() - if (!filePath) { + const filePaths = await chooseImageFilePaths(remainingCount) + if (filePaths.length === 0) { return } this.setData({ manualImageUploading: true }) - const uploadResult = await uploadObjectFile(filePath) - const fileId = uploadResult.id || uploadResult.fileId - const fileUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath - if (!fileId) { - throw new Error('作品图片上传成功但未返回文件ID') + const nextFileIds = currentFileIds.slice() + const nextImageUrls = currentImageUrls.slice() + for (let index = 0; index < filePaths.length; index += 1) { + const filePath = filePaths[index] + const uploadResult = await uploadObjectFile(filePath) + const fileId = uploadResult.id || uploadResult.fileId + const fileUrl = uploadResult.fileUrl || uploadResult.primaryUrl || filePath + if (!fileId) { + throw new Error('作品图片上传成功但未返回文件ID') + } + nextFileIds.push(String(fileId)) + nextImageUrls.push(fileUrl) } this.setData({ - 'form.manualProductImageFileIds': String(fileId), - 'form.manualProductImageUrl': fileUrl + 'form.manualProductImageFileIds': nextFileIds.join(','), + 'form.manualProductImageUrl': nextImageUrls.join(','), + manualProductImageUrls: nextImageUrls }) } catch (error) { wx.showToast({ title: error.message || '图片上传失败', icon: 'none' }) @@ -553,10 +606,26 @@ Page({ } }, - removeManualProductImage() { + removeManualProductImage(event) { + const currentFileIds = splitManualImageValues(this.data.form.manualProductImageFileIds) + const currentImageUrls = this.data.manualProductImageUrls.length > 0 + ? this.data.manualProductImageUrls + : splitManualImageValues(this.data.form.manualProductImageUrl) + const index = Number(event.currentTarget.dataset.index) + if (!Number.isInteger(index) || index < 0) { + this.setData({ + 'form.manualProductImageFileIds': '', + 'form.manualProductImageUrl': '', + manualProductImageUrls: [] + }) + return + } + const nextFileIds = currentFileIds.filter((item, itemIndex) => itemIndex !== index) + const nextImageUrls = currentImageUrls.filter((item, itemIndex) => itemIndex !== index) this.setData({ - 'form.manualProductImageFileIds': '', - 'form.manualProductImageUrl': '' + 'form.manualProductImageFileIds': nextFileIds.join(','), + 'form.manualProductImageUrl': nextImageUrls.join(','), + manualProductImageUrls: nextImageUrls }) }, diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxml b/JY-Salon-WeChat/pages/appointment-form/index.wxml index e7047965..20e5c68c 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxml +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxml @@ -126,7 +126,23 @@ 暂无匹配作品 - + + + 没有合适作品? + 临时新增一个预约作品,提交时会一并保存到预约信息。 + + + + + + + + + 新增预约作品 + 填写本次预约使用的作品信息 + + × + 手动新增预约作品 @@ -138,13 +154,21 @@ - - - 图 - - + + + 作品图片 + 支持上传多张图片 + + + + + × + + 图 + + - + diff --git a/JY-Salon-WeChat/pages/appointment-form/index.wxss b/JY-Salon-WeChat/pages/appointment-form/index.wxss index fafed0c2..c4dddc1e 100644 --- a/JY-Salon-WeChat/pages/appointment-form/index.wxss +++ b/JY-Salon-WeChat/pages/appointment-form/index.wxss @@ -127,7 +127,11 @@ } .textarea-field { - align-items: flex-start; + align-items: center; +} + +.textarea-field .field-label { + align-self: center; } .appointment-flags { @@ -500,11 +504,86 @@ text-align: center; } -.manual-panel { - margin-top: 12rpx; - padding: 20rpx; +.manual-entry-card { + display: flex; + align-items: center; + justify-content: space-between; + gap: 18rpx; + margin-top: 18rpx; + padding: 18rpx; + border: 1rpx solid #eadfd2; border-radius: 18rpx; + background: #fffdf8; +} + +.manual-entry-title, +.manual-entry-desc, +.manual-sheet-title, +.manual-sheet-subtitle, +.manual-image-title, +.manual-image-desc { + display: block; +} + +.manual-entry-title { + color: #302923; + font-size: 26rpx; + font-weight: 900; +} + +.manual-entry-desc { + margin-top: 8rpx; + color: #8c8177; + font-size: 22rpx; + line-height: 1.45; +} + +.manual-entry-btn { + flex: 0 0 auto; + width: 196rpx; + min-width: 196rpx; + max-width: 196rpx; +} + +.manual-mask { + position: fixed; + inset: 0; + z-index: 90; + display: flex; + align-items: center; + justify-content: center; + padding: 38rpx 28rpx; + background: rgba(18, 15, 12, 0.48); +} + +.manual-sheet { + width: 100%; + max-height: 86vh; + overflow-y: auto; + padding: 26rpx 24rpx calc(26rpx + env(safe-area-inset-bottom)); + border-radius: 28rpx; background: #f7efe7; + box-shadow: 0 24rpx 54rpx rgba(41, 31, 23, 0.22); +} + +.manual-sheet-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 18rpx; + margin-bottom: 20rpx; +} + +.manual-sheet-title { + color: #27211d; + font-size: 34rpx; + font-weight: 900; +} + +.manual-sheet-subtitle { + margin-top: 8rpx; + color: #8d8278; + font-size: 23rpx; } .manual-title { @@ -547,37 +626,94 @@ } .manual-image-row { + display: none; +} + +.manual-image-section { + margin-top: 14rpx; + padding: 16rpx; + border-radius: 16rpx; + background: #fffaf4; +} + +.manual-image-head { display: flex; align-items: center; - gap: 14rpx; - margin-top: 14rpx; + justify-content: space-between; + gap: 12rpx; + margin-bottom: 14rpx; +} + +.manual-image-title { + color: #4e4740; + font-size: 24rpx; + font-weight: 900; +} + +.manual-image-desc { + color: #958a7f; + font-size: 22rpx; +} + +.manual-image-list { + display: flex; + flex-wrap: wrap; + gap: 12rpx; } .manual-image { - flex: 0 0 auto; - width: 92rpx; - height: 92rpx; - border-radius: 14rpx; + display: block; + width: 104rpx; + height: 104rpx; + border-radius: 16rpx; background: #efe5da; } -.manual-image.placeholder { +.manual-image-item { + position: relative; + width: 104rpx; + height: 104rpx; +} + +.manual-image-empty { display: flex; align-items: center; justify-content: center; + width: 104rpx; + height: 104rpx; + border-radius: 16rpx; + background: #efe5da; color: #b79b82; font-size: 26rpx; font-weight: 900; } +.manual-image-remove { + position: absolute; + top: -10rpx; + right: -10rpx; + display: flex; + align-items: center; + justify-content: center; + width: 34rpx; + height: 34rpx; + border-radius: 50%; + background: #bf4949; + color: #fff; + font-size: 24rpx; + font-weight: 900; + line-height: 34rpx; +} + .image-btn { - flex: 1; - min-width: 0; - max-width: none; + width: 100%; + min-width: 100%; + max-width: 100%; + margin-top: 14rpx; } .image-remove { - flex: 0 0 auto; + display: none; } .manual-btn { diff --git a/JY-Salon-WeChat/pages/employee-detail/index.js b/JY-Salon-WeChat/pages/employee-detail/index.js index 7548e7e7..659b3014 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.js +++ b/JY-Salon-WeChat/pages/employee-detail/index.js @@ -7,6 +7,7 @@ Page({ id: '', employee: {}, loadError: '', + deleteConfirmVisible: false, deletingEmployee: false }, @@ -54,21 +55,25 @@ Page({ if (this.data.deletingEmployee) { return } - wx.showModal({ - title: '删除员工', - content: '确定要删除该员工吗?该操作只移除当前店铺员工关系,不会删除登录账号。', - confirmText: '删除', - confirmColor: '#BF4949', - success: (result) => { - if (result.confirm) { - this.confirmDeleteEmployee() - } - } - }) + this.setData({ deleteConfirmVisible: true }) + }, + + closeDeleteConfirm() { + if (this.data.deletingEmployee) { + return + } + this.setData({ deleteConfirmVisible: false }) + }, + + stopTap() { }, async confirmDeleteEmployee() { + if (this.data.deletingEmployee) { + return + } if (!this.data.id) { + wx.showToast({ title: '缺少员工 ID,无法删除', icon: 'none' }) return } this.setData({ deletingEmployee: true }) @@ -77,6 +82,7 @@ Page({ if (!success) { throw new Error('员工不存在或已被删除') } + this.setData({ deleteConfirmVisible: false }) wx.showToast({ title: '员工已删除', icon: 'success' }) setTimeout(() => { wx.navigateBack() diff --git a/JY-Salon-WeChat/pages/employee-detail/index.wxml b/JY-Salon-WeChat/pages/employee-detail/index.wxml index df680c17..6f9aa8bb 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.wxml +++ b/JY-Salon-WeChat/pages/employee-detail/index.wxml @@ -40,10 +40,48 @@ - - 删除员工 - 删除后该员工会从当前店铺员工列表移除,登录账号仍会保留。 + + ! + + + 删除员工 + 危险操作 + + 只会解除该员工与当前店铺的关系,登录账号和历史订单会继续保留。 + + + + + 员工列表 + 移除 + + + 登录账号 + 保留 + + + + + + + + ! + 确认删除员工 + 删除后该员工会从当前店铺员工列表移除,但登录账号不会被删除。 + + + 员工列表 + 移除 + + + 登录账号 + 保留 + + + + + + - diff --git a/JY-Salon-WeChat/pages/employee-detail/index.wxss b/JY-Salon-WeChat/pages/employee-detail/index.wxss index e616e67b..c8b34fba 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.wxss +++ b/JY-Salon-WeChat/pages/employee-detail/index.wxss @@ -85,16 +85,54 @@ } .delete-card { + margin-top: 24rpx; + padding: 28rpx; + border-color: rgba(191, 73, 73, 0.18); + background: linear-gradient(180deg, #fffdf8 0%, #fff5f2 100%); +} + +.delete-shell { + display: flex; + align-items: flex-start; + gap: 18rpx; +} + +.delete-icon, +.delete-confirm-icon { display: flex; align-items: center; - justify-content: space-between; - gap: 20rpx; - margin-top: 24rpx; - padding: 24rpx; + justify-content: center; + flex: 0 0 auto; + width: 54rpx; + height: 54rpx; + border: 1rpx solid rgba(191, 73, 73, 0.2); + border-radius: 50%; + background: #fff0f0; + color: #bf4949; + font-size: 32rpx; + font-weight: 900; + line-height: 1; +} + +.delete-copy { + flex: 1; + min-width: 0; +} + +.delete-title-row { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 12rpx; } .delete-title, -.delete-desc { +.delete-desc, +.delete-fact-label, +.delete-fact-value, +.delete-confirm-title, +.delete-confirm-desc, +.delete-confirm-fact text { display: block; } @@ -105,20 +143,211 @@ } .delete-desc { + margin-top: 10rpx; + color: #7b6f66; + font-size: 24rpx; + line-height: 1.55; +} + +.delete-badge { + display: inline-flex; + align-items: center; + min-height: 36rpx; + padding: 0 14rpx; + border-radius: 999rpx; + background: rgba(191, 73, 73, 0.1); + color: #bf4949; + font-size: 20rpx; + font-weight: 900; +} + +.delete-facts { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 12rpx; + margin: 22rpx 0; +} + +.delete-fact { + min-width: 0; + padding: 16rpx; + border: 1rpx solid rgba(191, 73, 73, 0.1); + border-radius: 16rpx; + background: rgba(255, 253, 248, 0.78); +} + +.delete-fact-label { + color: #8e8077; + font-size: 21rpx; + font-weight: 700; +} + +.delete-fact-value { margin-top: 8rpx; - color: #91897f; - font-size: 22rpx; - line-height: 1.5; + color: #bf4949; + font-size: 26rpx; + font-weight: 900; } .delete-btn { - flex: 0 0 auto; - min-width: 172rpx; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + width: 100%; + min-width: 0; + max-width: 100%; + min-height: 78rpx; margin: 0; - border: 0; - border-radius: 999rpx; + border-radius: 14px; background: #BF4949; color: #fff; + font-size: 26rpx; + font-weight: 900; + box-shadow: 0 12rpx 24rpx rgba(191, 73, 73, 0.22); +} + +.delete-btn[disabled], +.delete-confirm-submit[disabled], +.delete-confirm-cancel[disabled] { + opacity: 0.72; +} + +.delete-btn::after { + border: 0; +} + +.delete-confirm-mask { + position: fixed; + inset: 0; + z-index: 90; + display: flex; + align-items: center; + justify-content: center; + padding: 40rpx; + background: rgba(18, 15, 12, 0.48); + animation: deleteMaskIn 180ms ease both; +} + +.delete-confirm-panel { + box-sizing: border-box; + width: 100%; + max-width: 632rpx; + padding: 36rpx 30rpx 30rpx; + border: 1rpx solid rgba(191, 73, 73, 0.14); + border-radius: 28rpx; + background: #fffdf8; + box-shadow: 0 24rpx 56rpx rgba(41, 31, 23, 0.2); + animation: deleteConfirmIn 200ms ease both; +} + +.delete-confirm-icon { + width: 66rpx; + height: 66rpx; + margin: 0 auto 20rpx; + font-size: 38rpx; +} + +.delete-confirm-title { + color: #302c27; + text-align: center; + font-size: 34rpx; + font-weight: 900; +} + +.delete-confirm-desc { + margin-top: 14rpx; + color: #756a62; + text-align: center; font-size: 24rpx; - font-weight: 800; + line-height: 1.6; +} + +.delete-confirm-facts { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 12rpx; + margin-top: 26rpx; +} + +.delete-confirm-fact { + padding: 16rpx; + border-radius: 16rpx; + background: #f8f1ea; +} + +.delete-confirm-fact text:first-child { + color: #8f8278; + font-size: 21rpx; + font-weight: 700; +} + +.delete-confirm-fact text:last-child { + margin-top: 8rpx; + color: #bf4949; + font-size: 26rpx; + font-weight: 900; +} + +.delete-confirm-actions { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); + gap: 14rpx; + margin-top: 28rpx; + min-width: 0; + overflow: hidden; +} + +.delete-confirm-cancel, +.delete-confirm-submit { + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + width: 100%; + min-width: 0; + max-width: 100%; + min-height: 76rpx; + margin: 0; + padding: 0 12rpx; + border-radius: 14px; + font-size: 26rpx; + font-weight: 900; +} + +.delete-confirm-cancel::after, +.delete-confirm-submit::after { + border: 0; +} + +.delete-confirm-cancel { + border: 1rpx solid #e1d8ce; + background: #fffdf8; + color: #514b44; +} + +.delete-confirm-submit { + background: #BF4949; + color: #fff; + box-shadow: 0 12rpx 24rpx rgba(191, 73, 73, 0.2); +} + +@keyframes deleteMaskIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +@keyframes deleteConfirmIn { + from { + opacity: 0; + transform: translateY(20rpx) scale(0.98); + } + to { + opacity: 1; + transform: translateY(0) scale(1); + } } diff --git a/JY-Salon-WeChat/pages/planning/index.js b/JY-Salon-WeChat/pages/planning/index.js index bf52cd17..449add82 100644 --- a/JY-Salon-WeChat/pages/planning/index.js +++ b/JY-Salon-WeChat/pages/planning/index.js @@ -394,8 +394,8 @@ Page({ hours, timelineHeight: timelineHeight + laneHeaderHeight, laneHeaderHeight, - laneItemWidth: 248, - laneWidth: Math.max(720, lanes.length * 248), + laneItemWidth: 268, + laneWidth: Math.max(760, lanes.length * 268), dayTotal: dayAppointments.length, freeArtistCount: lanes.filter(item => item.blocks.length === 0).length, pendingCount diff --git a/JY-Salon-WeChat/pages/planning/index.wxss b/JY-Salon-WeChat/pages/planning/index.wxss index d3353a7e..0057fa79 100644 --- a/JY-Salon-WeChat/pages/planning/index.wxss +++ b/JY-Salon-WeChat/pages/planning/index.wxss @@ -288,9 +288,9 @@ left: 12rpx; display: flex; flex-direction: column; - gap: 4rpx; + gap: 3rpx; overflow: hidden; - padding: 12rpx 12rpx; + padding: 11rpx 12rpx; border-left: 8rpx solid #7ba7c7; border-radius: 10px; background: #fff7ee; @@ -343,33 +343,43 @@ } .block-title { + overflow: hidden; color: #2c2823; font-size: 24rpx; font-weight: 800; + line-height: 1.2; + text-overflow: ellipsis; + white-space: nowrap; } .block-meta, .block-status { + overflow: hidden; color: #7e756b; font-size: 20rpx; line-height: 1.25; + text-overflow: ellipsis; + white-space: nowrap; } .block-badges { display: flex; - flex-wrap: wrap; - gap: 6rpx; + flex-wrap: nowrap; + gap: 5rpx; + max-width: 100%; + overflow: hidden; } .block-badge { display: inline-flex; align-items: center; - height: 24rpx; - padding: 0 8rpx; + flex: 0 0 auto; + height: 25rpx; + padding: 0 7rpx; border-radius: 999rpx; background: rgba(255, 255, 255, 0.82); color: #7b5b46; - font-size: 18rpx; + font-size: 17rpx; font-weight: 800; line-height: 1; } diff --git a/JY-Salon-WeChat/utils/upload.js b/JY-Salon-WeChat/utils/upload.js index 94264928..357bc361 100644 --- a/JY-Salon-WeChat/utils/upload.js +++ b/JY-Salon-WeChat/utils/upload.js @@ -67,21 +67,24 @@ function uploadFile(options) { }) } -function chooseImageFilePath() { +function chooseImageFilePaths(count) { + if (!Number.isInteger(count) || count < 1 || count > 9) { + throw new RangeError(`选择图片数量必须是 1-9,当前值:${count}`) + } return new Promise((resolve, reject) => { wx.chooseMedia({ - count: 1, + count, mediaType: ['image'], sourceType: ['album', 'camera'], sizeType: ['compressed'], success(result) { - const filePath = result.tempFiles && result.tempFiles[0] ? result.tempFiles[0].tempFilePath : '' - resolve(filePath) + const filePaths = (result.tempFiles || []).map(file => file.tempFilePath).filter(Boolean) + resolve(filePaths) }, fail(error) { const message = error && error.errMsg ? error.errMsg : '' if (message.includes('cancel')) { - resolve('') + resolve([]) return } reject(new Error(`选择图片失败:${message || '未知错误'}`)) @@ -90,6 +93,11 @@ function chooseImageFilePath() { }) } +async function chooseImageFilePath() { + const filePaths = await chooseImageFilePaths(1) + return filePaths[0] || '' +} + function uploadObjectFile(filePath) { return uploadFile({ url: '/object-storage-file/upload', @@ -120,6 +128,7 @@ function uploadAvatar(filePath) { } module.exports = { + chooseImageFilePaths, chooseImageFilePath, uploadObjectFile, uploadAvatar, diff --git a/memory/bugs.md b/memory/bugs.md index 0f6fb491..d2b01d62 100644 --- a/memory/bugs.md +++ b/memory/bugs.md @@ -160,3 +160,19 @@ - 处理方式:父组件通过 `panel-class` 定制 `BaseModal` 内部结构时,使用 `:global(.employee-delete-confirm-modal ...)`;父组件 slot 内容自身仍使用普通 scoped class。 - 以后避免:新增居中确认弹窗或隐藏 `BaseModal` 头尾区域时,先参考 `AppointmentDetailView.vue` 的 `:global(.appointment-status-confirm-modal ...)` 写法,不要用普通 scoped 选择器打子组件内部节点。 - 验证方式:运行 `vue-tsc` 和 `vite build` 后,在 `dist/assets` 中搜索目标 `panel-class`,确认面板选择器未被追加父组件 `data-v-*`;再用浏览器截图确认弹窗居中和头部隐藏生效。 + +## 2026-07-21 店务小程序页面逻辑避免使用 for...of + +- 问题:店务小程序预约表单热更新后,页面报 `module '@babel/runtime/helpers/createForOfIteratorHelper.js' is not defined`,新增作品图片上传逻辑无法正常运行。 +- 原因:微信开发者工具的小程序转译会把 `for...of` 编译成 Babel runtime helper,但当前小程序运行包里没有对应 helper 模块。 +- 处理方式:把页面和工具函数中的 `for...of` 改为普通下标 `for` 循环,避免引入缺失 helper。 +- 以后避免:修改 `JY-Salon-WeChat` 页面、组件或 utils 时,不使用 `for...of` 遍历数组;需要顺序异步处理时用下标循环。 +- 验证方式:使用 Node 24 做 JS 语法检查,并在微信开发者工具控制台确认不再出现 `createForOfIteratorHelper` 缺失错误。 + +## 2026-07-21 手动新增作品二级弹窗遮罩不能关闭弹窗 + +- 问题:预约表单的新增作品二级弹窗绑定遮罩点击关闭,用户误触弹窗外区域会丢失正在填写的作品信息。 +- 原因:外层 `.manual-mask` 使用 `catchtap="closeManualProductPanel"`,遮罩点击被当成主动关闭。 +- 处理方式:把 `.manual-mask` 改为 `catchtap="stopTap"`,只吞掉点击;关闭只由右上角关闭按钮或确认新增后的业务逻辑触发。 +- 以后避免:有输入内容的二级弹窗、表单弹窗、图片上传弹窗默认禁止遮罩关闭;遮罩只负责阻止事件穿透。 +- 验证方式:打开新增作品二级弹窗后点击遮罩外区域,`manualProductPanelVisible` 应保持 `true`;点击右上角关闭按钮才变为 `false`。 diff --git a/memory/progress.md b/memory/progress.md index d197e0d5..50e4ae2a 100644 --- a/memory/progress.md +++ b/memory/progress.md @@ -2,19 +2,21 @@ ## 当前任务 -新增/编辑用户、美甲师、店长等管理账号时支持手机号选填。 +优化店务小程序端员工删除确认、预约新增作品二级弹窗、备注标签居中和排班日视图标签展示。 ## 已完成 -- 后端用户创建/编辑已支持手机号为空;填写手机号时仍校验格式和唯一性。 -- 后端服务人员未填微信号时按手机号、账号顺序兜底,避免无手机号但有账号时创建失败。 -- 设计师后台、设计师小程序、店务 Web、店务小程序的用户/美甲师/员工表单已改为手机号选填,账号仍必填。 -- 已补充后端控制器和用户服务测试,并更新设计师后台用户弹窗测试。 -- 已完成定向后端测试、设计师后台单测、两个 Web 项目类型检查和构建、小程序 JS 语法检查。 +- 已重构店务小程序员工详情删除区域和二次确认弹窗,替换原生确认框。 +- 已调整预约表单备注标签垂直居中。 +- 已把预约手动新增作品改为二级弹窗入口,默认隐藏,入口文案为“新增为作品”。 +- 已补充作品图片说明“作品图片,支持上传多张图片”,并支持多图上传、删除和草稿恢复。 +- 已扩宽排班日视图列宽,并让卡片标签尽量单行展示。 +- 已修复员工删除确认弹窗右侧按钮溢出。 +- 已禁止手动新增作品二级弹窗通过点击遮罩关闭。 ## 下一步 -- 暂存本次任务相关文件并提交。 +- 运行最终语法、diff、GitNexus 校验后提交。 ## 当前阻塞点 @@ -22,4 +24,4 @@ ## 最近一次重要操作结果 -2026-07-21 执行 `gitnexus detect-changes -r JayuCloud -s compare -b master` 成功,显示 18 个文件、42 个符号、33 条流程,风险等级为 critical;实际验证已覆盖用户创建/编辑手机号选填和员工保存链路。 +2026-07-21 已连接 `JY-Salon-WeChat` 到 `ws://127.0.0.1:9420`,健康检查显示 `connected`,当前路由为 `pages/employee-detail/index`。