优化预约款式录入表单

This commit is contained in:
2026-10-28 17:55:42 +08:00
parent 6fbcf9896e
commit 976ca68687
7 changed files with 303 additions and 223 deletions
+2
View File
@@ -45,6 +45,8 @@ This project is indexed by GitNexus as **JayuCloud** (36096 symbols, 76216 relat
## Project Workflow Rules ## Project Workflow Rules
- 用户未明确要求设计文档或方案确认时,实施类请求直接基于现有代码修改,不额外编写设计文档,也不以设计确认流程阻塞实现。
- 修改前如工作区已有未提交改动,先创建中文 Git 回溯提交,再开始本次任务;提交后只暂存和提交本次任务涉及的文件,保留其他新产生或并行改动。
- 每次任务中发现的问题、原因和处理方式都需要记录下来,并在后续相关任务中回顾,避免重复发生。 - 每次任务中发现的问题、原因和处理方式都需要记录下来,并在后续相关任务中回顾,避免重复发生。
- 后端修改如果涉及 SQL,默认新增版本变更 SQL;只有负责人明确要求重整初始化基线时,才将已存在的变更合并到初始化 SQL。 - 后端修改如果涉及 SQL,默认新增版本变更 SQL;只有负责人明确要求重整初始化基线时,才将已存在的变更合并到初始化 SQL。
- 版本变更 SQL 文件名必须使用中文,体现功能和日期,并且 SQL 内容必须是完整可执行脚本。 - 版本变更 SQL 文件名必须使用中文,体现功能和日期,并且 SQL 内容必须是完整可执行脚本。
+5
View File
@@ -42,3 +42,8 @@ This project is indexed by GitNexus as **JayuCloud** (36096 symbols, 76216 relat
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus-cli/SKILL.md` | | Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus-cli/SKILL.md` |
<!-- gitnexus:end --> <!-- gitnexus:end -->
## Project Workflow Rules
- 用户未明确要求设计文档或方案确认时,实施类请求直接基于现有代码修改,不额外编写设计文档,也不以设计确认流程阻塞实现。
- 修改前如工作区已有未提交改动,先创建中文 Git 回溯提交,再开始本次任务;提交后只暂存和提交本次任务涉及的文件,保留其他新产生或并行改动。
+76 -16
View File
@@ -483,6 +483,7 @@ Page({
createCustomerRecord: false, createCustomerRecord: false,
remark: '' remark: ''
}, },
unifiedStyleDescription: '',
customerOptions: [], customerOptions: [],
customerDirectory: [], customerDirectory: [],
customerSheetVisible: false, customerSheetVisible: false,
@@ -501,6 +502,7 @@ Page({
artistError: '', artistError: '',
selectedProduct: {}, selectedProduct: {},
selectedProductPriceText: '', selectedProductPriceText: '',
manualProductTitleLength: 0,
selectedArtist: {}, selectedArtist: {},
productModalVisible: false, productModalVisible: false,
manualProductSheetVisible: false, manualProductSheetVisible: false,
@@ -552,6 +554,8 @@ Page({
appointmentDate, appointmentDate,
artistId: options.artistId || baseForm.artistId || '' artistId: options.artistId || baseForm.artistId || ''
}, },
manualProductTitleLength: String(baseForm.manualProductTitle || '').length,
unifiedStyleDescription: String(baseForm.remark || baseForm.manualProductDescription || ''),
draftSavedAtText: draftForm ? '已恢复本机草稿' : '', draftSavedAtText: draftForm ? '已恢复本机草稿' : '',
appointmentDayLabel: dateLabels.day, appointmentDayLabel: dateLabels.day,
appointmentDateBadge: dateLabels.badge, appointmentDateBadge: dateLabels.badge,
@@ -584,7 +588,11 @@ Page({
const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(this.data.form.productId)) || {} const selectedProduct = this.data.filteredProducts.find(item => String(item.id) === String(this.data.form.productId)) || {}
const selectedProductPatch = { const selectedProductPatch = {
selectedProduct, selectedProduct,
selectedProductPriceText: selectedProduct.priceText || '' selectedProductPriceText: selectedProduct.priceText || '',
unifiedStyleDescription: this.data.unifiedStyleDescription || this.data.form.remark || this.data.form.manualProductDescription || '',
manualProductTitleLength: this.data.form.manualProductTitle
? String(this.data.form.manualProductTitle).length
: String(selectedProduct.title || '').length
} }
if (selectedProduct.id && (this.data.form.amount === '' || this.data.form.amount === undefined)) { if (selectedProduct.id && (this.data.form.amount === '' || this.data.form.amount === undefined)) {
selectedProductPatch['form.amount'] = selectedProduct.price === undefined || selectedProduct.price === null ? '' : String(selectedProduct.price) selectedProductPatch['form.amount'] = selectedProduct.price === undefined || selectedProduct.price === null ? '' : String(selectedProduct.price)
@@ -685,16 +693,32 @@ Page({
}, },
onStyleTitleInput(event) { onStyleTitleInput(event) {
const patch = { 'form.manualProductTitle': event.detail.value } const patch = {
'form.manualProductTitle': event.detail.value,
manualProductTitleLength: String(event.detail.value || '').length
}
if (this.data.form.productId) { if (this.data.form.productId) {
patch['form.productId'] = '' patch['form.productId'] = ''
patch.selectedProduct = {} patch.selectedProduct = {}
patch.selectedProductPriceText = '' patch.selectedProductPriceText = ''
patch['form.manualProductDescription'] = this.data.unifiedStyleDescription || ''
Object.assign(patch, buildManualProductImagePatch([])) Object.assign(patch, buildManualProductImagePatch([]))
} }
this.setData(patch) this.setData(patch)
}, },
onUnifiedStyleDescriptionInput(event) {
const description = event.detail.value || ''
const patch = {
unifiedStyleDescription: description,
'form.remark': description
}
if (!this.data.form.productId) {
patch['form.manualProductDescription'] = description
}
this.setData(patch)
},
onCustomerInput(event) { onCustomerInput(event) {
const field = event.currentTarget.dataset.field const field = event.currentTarget.dataset.field
const patch = { const patch = {
@@ -891,10 +915,33 @@ Page({
this.setData({ this.setData({
productModalVisible: false, productModalVisible: false,
manualProductSheetVisible: true, manualProductSheetVisible: true,
manualProductMoreVisible: false manualProductMoreVisible: false,
unifiedStyleDescription: this.data.form.remark || this.data.form.manualProductDescription || this.data.unifiedStyleDescription || '',
manualProductTitleLength: this.data.form.productId
? String(this.data.selectedProduct.title || '').length
: String(this.data.form.manualProductTitle || '').length
}) })
}, },
openManualProductFromLibrary() {
const patch = {
'form.productId': '',
selectedProduct: {},
selectedProductPriceText: '',
unifiedStyleDescription: this.data.form.remark || this.data.form.manualProductDescription || this.data.unifiedStyleDescription || '',
manualProductTitleLength: String(this.data.form.manualProductTitle || '').length,
productModalVisible: false,
manualProductSheetVisible: true,
manualProductMoreVisible: false
}
if (this.data.form.productId) {
patch['form.manualProductTitle'] = ''
patch['form.manualProductDescription'] = this.data.unifiedStyleDescription || ''
patch.manualProductTitleLength = 0
}
this.setData(patch)
},
closeManualProduct() { closeManualProduct() {
this.setData({ manualProductSheetVisible: false }) this.setData({ manualProductSheetVisible: false })
}, },
@@ -904,23 +951,34 @@ Page({
}, },
confirmManualProduct() { confirmManualProduct() {
const hasTitle = Boolean(String(this.data.form.manualProductTitle || '').trim()) if (!this.data.form.productId) {
const hasImage = (this.data.form.manualProductImages || []).length > 0 || Boolean(String(this.data.form.manualProductImageFileIds || '').trim()) const hasTitle = Boolean(String(this.data.form.manualProductTitle || '').trim())
const hasFallbackName = Boolean(String(this.data.form.customerName || '').trim()) const hasImage = (this.data.form.manualProductImages || []).length > 0 || Boolean(String(this.data.form.manualProductImageFileIds || '').trim())
if (this.data.form.productId && !hasTitle && !hasImage) { const hasFallbackName = Boolean(String(this.data.form.customerName || '').trim())
this.closeManualProduct() if (!hasTitle && !hasImage && !hasFallbackName) {
wx.showToast({ title: '请填写款式名称或添加图片', icon: 'none' })
return
}
}
const amountText = String(this.data.form.amount === undefined || this.data.form.amount === null ? '' : this.data.form.amount).trim()
const amount = Number(amountText)
if (!amountText || !Number.isFinite(amount) || amount < 0) {
wx.showToast({ title: '请输入不小于0的预约金额', icon: 'none' })
return return
} }
if (!hasTitle && !hasImage && !hasFallbackName) { if (!normalizeDuration(this.data.form.durationMinutes)) {
wx.showToast({ title: '请填写款式名称或添加图片', icon: 'none' }) wx.showToast({ title: '请输入大于0分钟的预计时长', icon: 'none' })
return return
} }
this.setData({ if (this.data.form.productId) {
'form.productId': '', this.setData({ manualProductSheetVisible: false })
selectedProduct: {}, this.refreshAvailableTimes()
selectedProductPriceText: '', this.checkAvailability()
manualProductSheetVisible: false return
}) }
this.setData({ 'form.productId': '', selectedProduct: {}, selectedProductPriceText: '', manualProductSheetVisible: false })
this.refreshAvailableTimes()
this.checkAvailability()
}, },
stopTap() { stopTap() {
@@ -940,6 +998,8 @@ Page({
this.setData({ this.setData({
selectedProduct, selectedProduct,
selectedProductPriceText: selectedProduct.priceText || '', selectedProductPriceText: selectedProduct.priceText || '',
unifiedStyleDescription: this.data.form.remark || '',
manualProductTitleLength: String(selectedProduct.title || '').length,
'form.productId': selectedProduct.id, 'form.productId': selectedProduct.id,
'form.manualProductTitle': '', 'form.manualProductTitle': '',
'form.manualProductPrice': '', 'form.manualProductPrice': '',
@@ -21,21 +21,17 @@
<text wx:if="{{form.manualProductTitle}}" class="field-value">{{form.manualProductTitle}}</text> <text wx:if="{{form.manualProductTitle}}" class="field-value">{{form.manualProductTitle}}</text>
<text wx:elif="{{form.manualProductImages.length}}" class="field-value">已添加 {{form.manualProductImages.length}} 张款式图片</text> <text wx:elif="{{form.manualProductImages.length}}" class="field-value">已添加 {{form.manualProductImages.length}} 张款式图片</text>
<text wx:else class="field-value placeholder">填写款式名称或添加图片</text> <text wx:else class="field-value placeholder">填写款式名称或添加图片</text>
<text wx:if="{{form.amount || form.durationMinutes}}" class="field-meta">{{form.amount || '待填'}} 元 · 预计 {{form.durationMinutes || '60'}} 分钟</text>
<text class="field-label">{{form.manualProductImages.length ? '已添加 ' + form.manualProductImages.length + ' 张图片 · 点击可编辑' : '点击可手动录入,提交预约后自动加入款式库'}}</text> <text class="field-label">{{form.manualProductImages.length ? '已添加 ' + form.manualProductImages.length + ' 张图片 · 点击可编辑' : '点击可手动录入,提交预约后自动加入款式库'}}</text>
</view> </view>
<text class="chevron">›</text> <text class="chevron">›</text>
</button> </button>
<view wx:else class="selected-style-card"> <view wx:else class="selected-style-card" bindtap="openManualProduct">
<image wx:if="{{selectedProduct.coverImage}}" class="selected-style-image" src="{{selectedProduct.coverImage}}" mode="aspectFill"></image> <image wx:if="{{selectedProduct.coverImage}}" class="selected-style-image" src="{{selectedProduct.coverImage}}" mode="aspectFill"></image>
<view wx:else class="field-icon">✦</view> <view wx:else class="field-icon">✦</view>
<view class="selected-style-copy"><text class="selected-style-title">{{selectedProduct.title}}</text><text class="selected-style-meta">参考价 {{selectedProductPriceText || '待定'}} · {{selectedProduct.durationText || '时长待定'}}</text></view> <view class="selected-style-copy"><text class="selected-style-title">{{selectedProduct.title}}</text><text class="selected-style-meta">参考价 {{selectedProductPriceText || '待定'}} · 本次 {{form.amount || '待填'}} 元 · {{form.durationMinutes || '60'}} 分钟</text></view>
<button class="switch-manual-action" catchtap="openManualProduct">手动录入</button> <button class="switch-manual-action" catchtap="openManualProduct">调整</button>
</view> </view>
<view class="style-number-row">
<label wx:if="{{form.productId}}" class="number-field"><text class="field-label required">成交金额(元)</text><view class="number-input-wrap"><input type="digit" value="{{form.amount}}" data-field="amount" bindinput="onInput" placeholder="例如 268" /><text class="number-unit">元</text></view></label>
<label class="number-field"><text class="field-label required">预计时长(分钟)</text><view class="number-input-wrap"><input type="number" value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" placeholder="60" /><text class="number-unit">分钟</text></view></label>
</view>
<view class="style-remark-field"><text class="field-label">款式备注</text><textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="可填写颜色、工艺、特殊要求等(可选)" /></view>
<text class="style-hint">名称和图片至少填写一项;名称为空时会使用客户姓名或“散客款式”。</text> <text class="style-hint">名称和图片至少填写一项;名称为空时会使用客户姓名或“散客款式”。</text>
</view> </view>
@@ -82,15 +78,29 @@
<entity-selector-sheet visible="{{customerSheetVisible}}" title="选择客户" keyword="{{customerKeyword}}" placeholder="搜索客户姓名或手机号" items="{{customerOptions}}" selected-id="{{form.customerUserId}}" loading="{{customerLoading}}" error-text="{{customerError}}" empty-text="暂无匹配客户" show-view-switch="{{true}}" view-mode="{{customerViewMode}}" sort-label="{{customerNewestFirst ? '最新添加' : '最早添加'}}" bind:search="onCustomerSearch" bind:select="selectCustomer" bind:retry="retryCustomerSearch" bind:changeview="changeCustomerView" bind:sort="toggleCustomerSort" bind:close="closeCustomerSheet" /> <entity-selector-sheet visible="{{customerSheetVisible}}" title="选择客户" keyword="{{customerKeyword}}" placeholder="搜索客户姓名或手机号" items="{{customerOptions}}" selected-id="{{form.customerUserId}}" loading="{{customerLoading}}" error-text="{{customerError}}" empty-text="暂无匹配客户" show-view-switch="{{true}}" view-mode="{{customerViewMode}}" sort-label="{{customerNewestFirst ? '最新添加' : '最早添加'}}" bind:search="onCustomerSearch" bind:select="selectCustomer" bind:retry="retryCustomerSearch" bind:changeview="changeCustomerView" bind:sort="toggleCustomerSort" bind:close="closeCustomerSheet" />
<entity-selector-sheet visible="{{artistSheetVisible}}" title="选择美甲师" keyword="{{artistKeyword}}" placeholder="搜索美甲师姓名" items="{{artistSelectorItems}}" selected-id="{{form.artistId}}" loading="{{false}}" error-text="{{artistError}}" empty-text="暂无匹配美甲师" action-text="快速新增美甲师" bind:search="onArtistSearch" bind:select="selectArtist" bind:retry="retryArtists" bind:action="addEmployeeFromSelector" bind:close="closeArtistSheet" /> <entity-selector-sheet visible="{{artistSheetVisible}}" title="选择美甲师" keyword="{{artistKeyword}}" placeholder="搜索美甲师姓名" items="{{artistSelectorItems}}" selected-id="{{form.artistId}}" loading="{{false}}" error-text="{{artistError}}" empty-text="暂无匹配美甲师" action-text="快速新增美甲师" bind:search="onArtistSearch" bind:select="selectArtist" bind:retry="retryArtists" bind:action="addEmployeeFromSelector" bind:close="closeArtistSheet" />
<product-selector-sheet visible="{{productModalVisible}}" mode="list" title="选择已有款式" keyword="{{productKeyword}}" placeholder="搜索款式、标签、美甲师" items="{{filteredProducts}}" selected-id="{{form.productId}}" loading="{{loadingProducts}}" error-text="{{productError}}" empty-text="暂无匹配款式" show-manual-action="{{true}}" bind:search="onProductSearch" bind:select="selectProduct" bind:openmanual="openManualProduct" bind:retry="loadOptions" bind:close="closeProductModal" /> <product-selector-sheet visible="{{productModalVisible}}" mode="list" title="选择已有款式" keyword="{{productKeyword}}" placeholder="搜索款式、标签、美甲师" items="{{filteredProducts}}" selected-id="{{form.productId}}" loading="{{loadingProducts}}" error-text="{{productError}}" empty-text="暂无匹配款式" show-manual-action="{{true}}" bind:search="onProductSearch" bind:select="selectProduct" bind:openmanual="openManualProductFromLibrary" bind:retry="loadOptions" bind:close="closeProductModal" />
<view wx:if="{{manualProductSheetVisible}}" class="modal-mask manual-product-mask" bindtap="closeManualProduct" catchtouchmove="stopTouchMove"> <view wx:if="{{manualProductSheetVisible}}" class="modal-mask manual-product-mask" bindtap="closeManualProduct" catchtouchmove="stopTouchMove">
<view class="manual-style-sheet" catchtap="stopTap" catchtouchmove="stopTouchMove"> <view class="manual-style-sheet" catchtap="stopTap" catchtouchmove="stopTouchMove">
<view class="modal-head"><view><text class="modal-title">录入本次美甲款式</text><text class="modal-subtitle">名称或图片至少填写一项 · 可添加多张图片</text></view><view class="modal-close" bindtap="closeManualProduct" aria-label="关闭款式录入"></view></view> <view class="modal-head"><view><text class="modal-title">{{form.productId ? '调整预约款式' : '录入本次美甲款式'}}</text><text class="modal-subtitle">{{form.productId ? '可调整本次价格和预计时长' : '名称或图片至少填写一项 · 可添加多张图片'}}</text></view><view class="modal-close" bindtap="closeManualProduct" aria-label="关闭款式录入"></view></view>
<scroll-view class="manual-style-content" scroll-y enhanced show-scrollbar="{{false}}"> <scroll-view class="manual-style-content" scroll-y enhanced show-scrollbar="{{false}}">
<view class="style-name-row"> <view class="manual-style-name-field">
<input class="style-name-input" value="{{form.manualProductTitle}}" bindinput="onStyleTitleInput" placeholder="留空时默认使用客户姓名" /> <view class="manual-style-field-heading"><text>名称</text><text class="manual-style-character-count">{{manualProductTitleLength}} / 100</text></view>
<input class="style-price-input" type="digit" value="{{form.amount}}" data-field="amount" bindinput="onInput" placeholder="金额" /> <input class="manual-style-title-input" value="{{form.productId ? selectedProduct.title : form.manualProductTitle}}" maxlength="100" disabled="{{form.productId}}" bindinput="onStyleTitleInput" placeholder="留空时默认使用客户姓名" />
</view>
<view class="manual-style-price-duration-row">
<view class="manual-style-compact-field">
<text class="manual-style-field-label">价格</text>
<view class="manual-style-input-wrap"><input type="digit" value="{{form.amount}}" data-field="amount" bindinput="onInput" placeholder="例如 268" /><text>元</text></view>
</view>
<view class="manual-style-compact-field">
<text class="manual-style-field-label">预计时长</text>
<view class="manual-style-input-wrap"><input type="number" value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" placeholder="60" /><text>分钟</text></view>
</view>
</view>
<view class="manual-style-description-field">
<text class="manual-style-field-label">款式描述 / 备注</text>
<textarea value="{{unifiedStyleDescription}}" bindinput="onUnifiedStyleDescriptionInput" placeholder="可填写颜色、工艺、特殊要求等(选填)" maxlength="500" />
</view> </view>
<view class="manual-style-images"> <view class="manual-style-images">
<view class="manual-style-image-heading"><text>款式图片</text><text class="manual-style-image-count">{{form.manualProductImages.length}} / 9</text></view> <view class="manual-style-image-heading"><text>款式图片</text><text class="manual-style-image-count">{{form.manualProductImages.length}} / 9</text></view>
@@ -105,9 +115,8 @@
<text class="manual-style-image-tip">第一张图片会作为款式封面,后续图片可展示细节或顾客实拍。</text> <text class="manual-style-image-tip">第一张图片会作为款式封面,后续图片可展示细节或顾客实拍。</text>
</view> </view>
<view class="manual-style-more"> <view class="manual-style-more">
<view class="manual-style-more-toggle" bindtap="toggleManualProductMore"><text>补充更多信息(选填)</text><text class="manual-style-more-arrow">{{manualProductMoreVisible ? '⌃' : '⌄'}}</text></view> <view class="manual-style-more-toggle" bindtap="toggleManualProductMore"><text>更多款式信息(选填)</text><text class="manual-style-more-arrow">{{manualProductMoreVisible ? '⌃' : '⌄'}}</text></view>
<view wx:if="{{manualProductMoreVisible}}" class="manual-style-more-fields"> <view wx:if="{{manualProductMoreVisible}}" class="manual-style-more-fields">
<textarea value="{{form.manualProductDescription}}" data-field="manualProductDescription" bindinput="onInput" placeholder="款式描述" />
<input value="{{form.manualProductTags}}" data-field="manualProductTags" bindinput="onInput" placeholder="标签,多个用逗号分隔" /> <input value="{{form.manualProductTags}}" data-field="manualProductTags" bindinput="onInput" placeholder="标签,多个用逗号分隔" />
<input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群" /> <input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群" />
<input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项" /> <input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项" />
+119 -185
View File
@@ -478,102 +478,6 @@ button.link-action {
width:auto; width:auto;
} }
.style-name-row {
display: flex;
align-items: center;
gap: 14rpx;
}
.style-name-input {
min-width: 0;
height: 78rpx;
flex: 1;
padding: 0 18rpx;
border: 1rpx solid #e7ece9;
border-radius: 15rpx;
background: #fff;
color: #17211f;
font-size: 26rpx;
}
.style-price-input {
box-sizing: border-box;
width: 164rpx;
height: 78rpx;
flex: 0 0 164rpx;
padding: 0 18rpx;
border: 1rpx solid #e7ece9;
border-radius: 15rpx;
background: #fff;
color: #17211f;
font-size: 26rpx;
text-align: right;
}
.selected-style-note {
margin-top: 12rpx;
color: #247b63;
font-size: 23rpx;
line-height: 1.45;
}
.style-number-row {
display: flex;
gap: 18rpx;
margin-top: 18rpx;
}
.number-field {
display: flex;
min-width: 0;
height: 88rpx;
flex: 1;
align-items: center;
gap: 8rpx;
border-bottom: 1rpx solid #e7ece9;
}
.number-field .field-label {
width: auto;
flex: 0 0 auto;
font-size: 22rpx;
}
.number-field input {
min-width: 0;
flex: 1;
color: #17211f;
font-size: 27rpx;
text-align: right;
}
.number-unit {
flex: 0 0 auto;
color: #9a9288;
font-size: 22rpx;
}
.style-remark-field {
display: flex;
align-items: flex-start;
gap: 14rpx;
padding: 18rpx 0 8rpx;
border-bottom: 1rpx solid #e7ece9;
}
.style-remark-field .field-label {
width: 124rpx;
flex: 0 0 auto;
}
.style-remark-field textarea {
min-height: 86rpx;
flex: 1;
padding: 0;
color: #17211f;
font-size: 25rpx;
}
.style-hint { .style-hint {
display: block; display: block;
padding: 12rpx 0 16rpx; padding: 12rpx 0 16rpx;
@@ -970,83 +874,6 @@ button.full{
min-height: 122rpx; min-height: 122rpx;
} }
.style-number-row {
gap: 18rpx;
margin-top: 22rpx;
}
.number-field {
display: flex;
min-width: 0;
height: auto;
flex: 1;
flex-direction: column;
align-items: stretch;
gap: 8rpx;
border: 0;
color: #52645d;
font-size: 21rpx;
}
.number-field .field-label {
width: auto;
flex: 0 0 auto;
color: #52645d;
font-size: 21rpx;
font-weight: 700;
}
.number-input-wrap {
display: flex;
height: 82rpx;
align-items: center;
gap: 8rpx;
padding: 0 18rpx;
border: 2rpx solid #dce6e1;
border-radius: 24rpx;
background: #fbfdfc;
}
.number-input-wrap input {
min-width: 0;
height: 78rpx;
flex: 1;
color: #17211f;
font-size: 25rpx;
font-weight: 700;
text-align: left;
}
.number-unit {
color: #71807a;
font-size: 20rpx;
}
.style-remark-field {
display: flex;
flex-direction: column;
gap: 10rpx;
padding: 20rpx 0 0;
border-bottom: 0;
}
.style-remark-field .field-label {
width: auto;
}
.style-remark-field textarea {
box-sizing: border-box;
width: 100%;
min-height: 144rpx;
padding: 16rpx 20rpx;
border: 2rpx solid #dce6e1;
border-radius: 24rpx;
background: #fbfdfc;
color: #17211f;
font-size: 23rpx;
line-height: 1.5;
}
.style-hint { .style-hint {
padding: 20rpx 0 0; padding: 20rpx 0 0;
color: #82928a; color: #82928a;
@@ -1239,12 +1066,105 @@ button.full{
padding: 8rpx 0 20rpx; padding: 8rpx 0 20rpx;
} }
.manual-style-content .style-name-input { .manual-style-name-field {
min-width: 0;
}
.manual-style-field-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
color: #52645d;
font-size: 22rpx;
font-weight: 700;
}
.manual-style-character-count {
color: #82928a;
font-size: 20rpx;
font-weight: 500;
font-variant-numeric: tabular-nums;
}
.manual-style-title-input {
box-sizing: border-box; box-sizing: border-box;
display: block;
width: 100%;
height: 82rpx; height: 82rpx;
border-color: #dce6e1; padding: 0 20rpx;
border-radius: 24rpx; overflow: hidden;
border: 2rpx solid #dce6e1;
border-radius: 22rpx;
background: #fbfdfc; background: #fbfdfc;
color: #17211f;
font-size: 24rpx;
line-height: 82rpx;
white-space: nowrap;
}
.manual-style-price-duration-row {
display: flex;
gap: 16rpx;
margin-top: 20rpx;
}
.manual-style-compact-field {
min-width: 0;
flex: 1;
}
.manual-style-field-label {
display: block;
margin-bottom: 10rpx;
color: #52645d;
font-size: 22rpx;
font-weight: 700;
}
.manual-style-input-wrap {
box-sizing: border-box;
display: flex;
height: 82rpx;
align-items: center;
gap: 10rpx;
padding: 0 18rpx;
border: 2rpx solid #dce6e1;
border-radius: 22rpx;
background: #fbfdfc;
}
.manual-style-input-wrap input {
box-sizing: border-box;
width: 0;
min-width: 0;
height: 78rpx;
flex: 1;
color: #17211f;
font-size: 24rpx;
}
.manual-style-input-wrap text {
flex: 0 0 auto;
color: #71807a;
font-size: 21rpx;
}
.manual-style-description-field {
margin-top: 20rpx;
}
.manual-style-description-field textarea {
box-sizing: border-box;
width: 100%;
min-height: 124rpx;
padding: 16rpx 18rpx;
border: 2rpx solid #dce6e1;
border-radius: 22rpx;
background: #fbfdfc;
color: #17211f;
font-size: 22rpx;
line-height: 1.5;
} }
.manual-style-images { .manual-style-images {
@@ -1406,28 +1326,42 @@ button.manual-style-add-image {
} }
.manual-style-footer { .manual-style-footer {
display: flex;
gap: 14rpx;
flex: 0 0 auto; flex: 0 0 auto;
padding-top: 16rpx; padding-top: 16rpx;
border-top: 2rpx solid #e7ece9; border-top: 2rpx solid #e7ece9;
} }
.manual-style-confirm { .manual-style-confirm {
width: 100%; width: 0;
height: 84rpx; min-width: 0;
border-radius: 24rpx; height: 78rpx;
flex: 1;
margin: 0;
padding: 0 10rpx;
border-radius: 22rpx;
background: #17211f; background: #17211f;
color: #fff; color: #fff;
font-size: 26rpx; font-size: 22rpx;
font-weight: 800; font-weight: 800;
line-height: 84rpx; line-height: 78rpx;
} }
.manual-style-library-link { .manual-style-library-link {
height: 64rpx; width: 0;
margin: 10rpx auto 0; min-width: 0;
height: 78rpx;
flex: 1;
margin: 0;
padding: 0 10rpx;
border: 2rpx solid #9ccdbb;
border-radius: 22rpx;
background: #e5f4ed;
color: #247b63; color: #247b63;
font-size: 22rpx; font-size: 21rpx;
line-height: 64rpx; font-weight: 700;
line-height: 74rpx;
} }
@media (max-width: 360px) { @media (max-width: 360px) {
@@ -51,41 +51,86 @@ page.openProductModal()
assert.strictEqual(page.data.productModalVisible, true) assert.strictEqual(page.data.productModalVisible, true)
page.refreshAvailableTimes = () => {} page.refreshAvailableTimes = () => {}
page.checkAvailability = () => {} page.checkAvailability = () => {}
page.selectProduct({ detail: { item: { id: 8, title: '法式', price: 238, priceText: '¥238', approximateDuration: '90' } } }) page.data.form.amount = '238'
page.selectProduct({ detail: { item: { id: 8, title: '法式', price: 238, priceText: '¥238', approximateDuration: '90', description: '作品库描述' } } })
assert.strictEqual(page.data.form.productId, 8) assert.strictEqual(page.data.form.productId, 8)
assert.strictEqual(page.data.selectedProduct.title, '法式') assert.strictEqual(page.data.selectedProduct.title, '法式')
assert.strictEqual(page.data.selectedProductPriceText, '¥238') assert.strictEqual(page.data.selectedProductPriceText, '¥238')
assert.strictEqual(page.data.form.amount, '238') assert.strictEqual(page.data.form.amount, '238')
assert.strictEqual(page.data.form.manualProductTitle, '') assert.strictEqual(page.data.form.manualProductTitle, '')
assert.strictEqual(page.data.form.durationMinutes, '90') assert.strictEqual(page.data.form.durationMinutes, '90')
assert.strictEqual(page.data.unifiedStyleDescription, '')
page.openManualProduct() page.openManualProduct()
page.data.form.amount = '238'
page.data.form.durationMinutes = '90'
assert.strictEqual(page.data.manualProductSheetVisible, true) assert.strictEqual(page.data.manualProductSheetVisible, true)
assert.strictEqual(page.data.manualProductMoreVisible, false) assert.strictEqual(page.data.manualProductMoreVisible, false)
page.onUnifiedStyleDescriptionInput({ detail: { value: '预约服务说明' } })
assert.strictEqual(page.data.form.remark, '预约服务说明')
assert.strictEqual(page.data.form.manualProductDescription, '')
page.onUnifiedStyleDescriptionInput({ detail: { value: '' } })
assert.strictEqual(page.data.unifiedStyleDescription, '')
assert.strictEqual(page.data.form.remark, '')
page.onUnifiedStyleDescriptionInput({ detail: { value: '预约服务说明' } })
page.toggleManualProductMore() page.toggleManualProductMore()
assert.strictEqual(page.data.manualProductMoreVisible, true) assert.strictEqual(page.data.manualProductMoreVisible, true)
page.toggleManualProductMore() page.toggleManualProductMore()
assert.strictEqual(page.data.manualProductMoreVisible, false) assert.strictEqual(page.data.manualProductMoreVisible, false)
page.data.form.amount = '218'
page.data.form.durationMinutes = '75'
page.confirmManualProduct() page.confirmManualProduct()
assert.strictEqual(page.data.form.productId, 8) assert.strictEqual(page.data.form.productId, 8)
assert.strictEqual(page.data.manualProductSheetVisible, false) assert.strictEqual(page.data.manualProductSheetVisible, false)
assert.strictEqual(page.data.form.amount, '218')
assert.strictEqual(page.data.form.durationMinutes, '75')
page.onStyleTitleInput({ detail: { value: '手绘款' } }) page.onStyleTitleInput({ detail: { value: '手绘款' } })
assert.strictEqual(page.data.form.productId, '') assert.strictEqual(page.data.form.productId, '')
assert.strictEqual(page.data.form.manualProductTitle, '手绘款') assert.strictEqual(page.data.form.manualProductTitle, '手绘款')
assert.strictEqual(page.data.form.amount, '238') assert.strictEqual(page.data.manualProductTitleLength, 3)
assert.strictEqual(page.data.form.amount, '218')
assert.strictEqual(page.data.selectedProductPriceText, '') assert.strictEqual(page.data.selectedProductPriceText, '')
assert.strictEqual(page.data.form.manualProductDescription, '预约服务说明')
page.onUnifiedStyleDescriptionInput({ detail: { value: '浅粉色,短甲' } })
assert.strictEqual(page.data.unifiedStyleDescription, '浅粉色,短甲')
assert.strictEqual(page.data.form.remark, '浅粉色,短甲')
assert.strictEqual(page.data.form.manualProductDescription, '浅粉色,短甲')
page.data.form.manualProductImages = [{ fileId: 'draft-1', fileUrl: 'https://img.example/draft-1.jpg' }]
page.openProductModal()
page.openManualProductFromLibrary()
assert.strictEqual(page.data.form.manualProductTitle, '手绘款')
assert.strictEqual(page.data.manualProductTitleLength, 3)
assert.strictEqual(page.data.unifiedStyleDescription, '浅粉色,短甲')
assert.strictEqual(page.data.form.manualProductImages.length, 1)
page.openManualProduct() page.openManualProduct()
page.confirmManualProduct() page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, false) assert.strictEqual(page.data.manualProductSheetVisible, false)
assert.strictEqual(page.data.form.productId, '') assert.strictEqual(page.data.form.productId, '')
page.data.form.manualProductTitle = '' page.data.form.manualProductTitle = ''
page.data.form.manualProductImages = []
page.data.form.manualProductImageFileIds = ''
page.openManualProduct() page.openManualProduct()
page.confirmManualProduct() page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, true) assert.strictEqual(page.data.manualProductSheetVisible, true)
assert.strictEqual(toastMessages.pop(), '请填写款式名称或添加图片') assert.strictEqual(toastMessages.pop(), '请填写款式名称或添加图片')
page.data.form.manualProductTitle = '手绘款'
page.data.form.amount = ''
page.openManualProduct()
page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, true)
assert.strictEqual(toastMessages.pop(), '请输入不小于0的预约金额')
page.data.form.amount = '128'
page.data.form.durationMinutes = '0'
page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, true)
assert.strictEqual(toastMessages.pop(), '请输入大于0分钟的预计时长')
page.data.form.durationMinutes = '45'
page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, false)
const wxml = require('fs').readFileSync(require('path').join(__dirname, 'index.wxml'), 'utf8') const wxml = require('fs').readFileSync(require('path').join(__dirname, 'index.wxml'), 'utf8')
assert.ok(wxml.indexOf('美甲款式') < wxml.indexOf('预约信息')) assert.ok(wxml.indexOf('美甲款式') < wxml.indexOf('预约信息'))
assert.ok(wxml.indexOf('预约信息') < wxml.indexOf('>客户</text>')) assert.ok(wxml.indexOf('预约信息') < wxml.indexOf('>客户</text>'))
@@ -94,13 +139,24 @@ assert.match(wxml, /placeholder="留空时默认使用客户姓名"/)
assert.match(wxml, /appointmentDateBadge/) assert.match(wxml, /appointmentDateBadge/)
assert.match(wxml, /class="customer-fields"/) assert.match(wxml, /class="customer-fields"/)
assert.match(wxml, /class="manual-style-sheet"/) assert.match(wxml, /class="manual-style-sheet"/)
assert.match(wxml, /class="style-price-input"[^>]*data-field="amount"/) assert.match(wxml, /名称<\/text><text class="manual-style-character-count">\{\{manualProductTitleLength\}\} \/ 100/)
assert.match(wxml, /wx:if="\{\{form\.productId\}\}" class="number-field"/) assert.match(wxml, /maxlength="100"[^>]*bindinput="onStyleTitleInput"/)
assert.match(wxml, /disabled="\{\{form\.productId\}\}" bindinput="onStyleTitleInput"/)
assert.match(wxml, /class="manual-style-price-duration-row"/)
assert.match(wxml, /data-field="amount" bindinput="onInput" placeholder="例如 268" \/><text>元/)
assert.match(wxml, /data-field="durationMinutes" bindinput="onInput" placeholder="60" \/><text>分钟/)
assert.match(wxml, /class="manual-style-description-field"/)
assert.match(wxml, /value="\{\{unifiedStyleDescription\}\}" bindinput="onUnifiedStyleDescriptionInput"/)
assert.doesNotMatch(wxml, /selectedProduct\.description/)
assert.match(wxml, /bindinput="onUnifiedStyleDescriptionInput"/)
assert.doesNotMatch(wxml, /class="style-remark-field"/)
assert.doesNotMatch(wxml, /class="style-number-row"/)
assert.match(wxml, /class="manual-style-footer"><button class="manual-style-confirm"[^>]*>用于本次预约<\/button><button class="manual-style-library-link"[^>]*>从款式库中选择/)
assert.match(wxml, /class="manual-style-more-toggle" bindtap="toggleManualProductMore"/) assert.match(wxml, /class="manual-style-more-toggle" bindtap="toggleManualProductMore"/)
assert.match(wxml, /data-field="manualProductDescription" bindinput="onInput"/) assert.match(wxml, /更多款式信息(选填)/)
assert.match(wxml, /bind:openmanual="openManualProduct"/) assert.match(wxml, /bind:openmanual="openManualProductFromLibrary"/)
assert.match(wxml, /show-manual-action="\{\{true\}\}"/) assert.match(wxml, /show-manual-action="\{\{true\}\}"/)
assert.match(wxml, /成交金额/) assert.match(wxml, /本次 \{\{form\.amount \|\| '待填'\}\} 元/)
assert.match(wxml, /wx:for="\{\{form\.manualProductImages\}\}"/) assert.match(wxml, /wx:for="\{\{form\.manualProductImages\}\}"/)
assert.match(wxml, /manualProductImages\.length < 9/) assert.match(wxml, /manualProductImages\.length < 9/)
assert.match(wxml, /data-index="\{\{index\}\}"[^>]*catchtap="removeManualProductImage"/) assert.match(wxml, /data-index="\{\{index\}\}"[^>]*catchtap="removeManualProductImage"/)
@@ -162,6 +218,13 @@ async function testManualProductImages() {
assert.strictEqual(legacyDraftPage.data.form.manualProductImageFileIds, '44') assert.strictEqual(legacyDraftPage.data.form.manualProductImageFileIds, '44')
} }
page.openProductModal()
page.openManualProductFromLibrary()
assert.strictEqual(page.data.form.productId, '')
assert.strictEqual(page.data.form.manualProductTitle, '手绘款')
assert.strictEqual(page.data.productModalVisible, false)
assert.strictEqual(page.data.manualProductSheetVisible, true)
testManualProductImages().catch(error => { testManualProductImages().catch(error => {
console.error(error) console.error(error)
process.exitCode = 1 process.exitCode = 1
+7
View File
@@ -394,3 +394,10 @@
- 小程序 `/user/info` 改为调用服务层的当前用户资料方法,响应中包含当前门店的有效期、过期状态和剩余天数。 - 小程序 `/user/info` 改为调用服务层的当前用户资料方法,响应中包含当前门店的有效期、过期状态和剩余天数。
- 账号设置页将空剩余天数识别为未设置,避免显示“剩余 null 天”。 - 账号设置页将空剩余天数识别为未设置,避免显示“剩余 null 天”。
- 原因是资料接口绕过了已有的门店有效期补充逻辑,只返回基础用户资料;后台门店列表使用独立接口,因此此前仍能显示有效期。 - 原因是资料接口绕过了已有的门店有效期补充逻辑,只返回基础用户资料;后台门店列表使用独立接口,因此此前仍能显示有效期。
## 2026-10-28 Salon 新增预约款式录入微调
- 手动款式弹层将名称单独一行显示并提供 100 字计数,价格与预计时长并列,显示“元”和“分钟”单位;长名称保持固定输入框尺寸。
- 将款式描述与预约备注合并到弹层默认展示的“款式描述 / 备注”,删除主表单上重复的备注和时长输入。
- “用于本次预约”和“从款式库中选择”调整为并排异色按钮;库内选择后仍可在弹层调整本次价格与时长。
- 修改预约页交互前先对已有工作区改动建立独立回溯提交;以后未被明确要求时不额外编写设计文档。