优化店务小程序预约作品交互

This commit is contained in:
2026-07-21 12:09:28 +08:00
parent 75d38dc352
commit 7f9f9e74a6
11 changed files with 627 additions and 88 deletions
+85 -16
View File
@@ -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
})
},
@@ -126,7 +126,23 @@
</view>
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
</scroll-view>
<view class="manual-panel">
<view class="manual-entry-card">
<view>
<text class="manual-entry-title">没有合适作品?</text>
<text class="manual-entry-desc">临时新增一个预约作品,提交时会一并保存到预约信息。</text>
</view>
<button class="secondary-btn manual-entry-btn" bindtap="openManualProductPanel">新增作品</button>
</view>
</view>
<view wx:if="{{manualProductPanelVisible}}" class="manual-mask" catchtap="stopTap">
<view class="manual-sheet" catchtap="stopTap">
<view class="manual-sheet-head">
<view>
<text class="manual-sheet-title">新增预约作品</text>
<text class="manual-sheet-subtitle">填写本次预约使用的作品信息</text>
</view>
<view class="modal-close" bindtap="closeManualProductPanel">×</view>
</view>
<text class="manual-title required-label">手动新增预约作品</text>
<view class="manual-grid">
<input value="{{form.manualProductTitle}}" data-field="manualProductTitle" bindinput="onInput" placeholder="作品名称" />
@@ -138,13 +154,21 @@
<input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群(选填)" />
<input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项(选填)" />
</view>
<view class="manual-image-row">
<image wx:if="{{form.manualProductImageUrl}}" class="manual-image" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
<view wx:else class="manual-image placeholder">图</view>
<button class="secondary-btn image-btn" loading="{{manualImageUploading}}" bindtap="chooseManualProductImage">上传图片</button>
<button wx:if="{{form.manualProductImageUrl}}" class="text-btn image-remove" bindtap="removeManualProductImage">移除</button>
<view class="manual-image-section">
<view class="manual-image-head">
<text class="manual-image-title">作品图片</text>
<text class="manual-image-desc">支持上传多张图片</text>
</view>
<view class="manual-image-list">
<view wx:for="{{manualProductImageUrls}}" wx:for-item="imageUrl" wx:key="*this" class="manual-image-item">
<image class="manual-image" src="{{imageUrl}}" mode="aspectFill"></image>
<view class="manual-image-remove" data-index="{{index}}" catchtap="removeManualProductImage">×</view>
</view>
<view wx:if="{{manualProductImageUrls.length === 0}}" class="manual-image-empty">图</view>
</view>
<button class="secondary-btn image-btn" loading="{{manualImageUploading}}" disabled="{{manualImageUploading}}" bindtap="chooseManualProductImage">上传图片</button>
</view>
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
<button class="secondary-btn manual-btn" bindtap="useManualProduct">确认新增</button>
</view>
</view>
</view>
+151 -15
View File
@@ -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 {
+17 -11
View File
@@ -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()
@@ -40,10 +40,48 @@
</view>
<view wx:if="{{!loadError}}" class="card delete-card">
<view>
<text class="delete-title">删除员工</text>
<text class="delete-desc">删除后该员工会从当前店铺员工列表移除,登录账号仍会保留。</text>
<view class="delete-shell">
<view class="delete-icon">!</view>
<view class="delete-copy">
<view class="delete-title-row">
<text class="delete-title">删除员工</text>
<text class="delete-badge">危险操作</text>
</view>
<text class="delete-desc">只会解除该员工与当前店铺的关系,登录账号和历史订单会继续保留。</text>
</view>
</view>
<view class="delete-facts">
<view class="delete-fact">
<text class="delete-fact-label">员工列表</text>
<text class="delete-fact-value">移除</text>
</view>
<view class="delete-fact">
<text class="delete-fact-label">登录账号</text>
<text class="delete-fact-value">保留</text>
</view>
</view>
<button class="delete-btn" loading="{{deletingEmployee}}" disabled="{{deletingEmployee}}" bindtap="requestDeleteEmployee">删除员工</button>
</view>
<view wx:if="{{deleteConfirmVisible}}" class="delete-confirm-mask" bindtap="closeDeleteConfirm">
<view class="delete-confirm-panel" catchtap="stopTap">
<view class="delete-confirm-icon">!</view>
<text class="delete-confirm-title">确认删除员工</text>
<text class="delete-confirm-desc">删除后该员工会从当前店铺员工列表移除,但登录账号不会被删除。</text>
<view class="delete-confirm-facts">
<view class="delete-confirm-fact">
<text>员工列表</text>
<text>移除</text>
</view>
<view class="delete-confirm-fact">
<text>登录账号</text>
<text>保留</text>
</view>
</view>
<view class="delete-confirm-actions">
<button class="delete-confirm-cancel" disabled="{{deletingEmployee}}" bindtap="closeDeleteConfirm">取消</button>
<button class="delete-confirm-submit" loading="{{deletingEmployee}}" disabled="{{deletingEmployee}}" bindtap="confirmDeleteEmployee">确认删除</button>
</view>
</view>
<button class="delete-btn" loading="{{deletingEmployee}}" bindtap="requestDeleteEmployee">删除员工</button>
</view>
</view>
+242 -13
View File
@@ -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);
}
}
+2 -2
View File
@@ -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
+17 -7
View File
@@ -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;
}
+14 -5
View File
@@ -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,
+16
View File
@@ -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`。
+10 -8
View File
@@ -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`。