对齐新增预约页面演示稿设计

This commit is contained in:
2026-10-20 15:50:29 +08:00
parent c952a913e8
commit 274c6af30b
9 changed files with 723 additions and 34 deletions
@@ -64,6 +64,8 @@ async function run() {
await page.onDateChange({ detail: { value: '2099-10-11' } })
assert.strictEqual(page.data.form.appointmentDate, '2099-10-11')
assert.strictEqual(page.data.form.appointmentTime, '')
assert.strictEqual(page.data.appointmentDateBadge.includes('10月11日'), true)
assert.strictEqual(page.data.appointmentDateLong.includes('2099年10月11日'), true)
assert.strictEqual(refreshes, 3)
}
@@ -376,6 +376,26 @@ function buildArtistSelectorItem(artist) {
}
}
function buildAppointmentDateLabels(value) {
const dateValue = String(value || dateUtil.formatDate(new Date()))
const date = new Date(dateValue.replace(/-/g, '/'))
if (Number.isNaN(date.getTime())) {
return { day: '', badge: dateValue, long: dateValue }
}
const today = dateUtil.formatDate(new Date())
const tomorrow = dateUtil.formatDate(dateUtil.addDays(new Date(), 1))
const dayLabel = dateValue === today
? '今天'
: dateValue === tomorrow
? '明天'
: `周${'日一二三四五六'[date.getDay()]}`
return {
day: dayLabel,
badge: `${dayLabel} · ${dateUtil.formatCnDate(dateValue)}`,
long: `${dayLabel} · ${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`
}
}
Page({
data: {
form: {
@@ -419,6 +439,7 @@ Page({
selectedProductPriceText: '',
selectedArtist: {},
productModalVisible: false,
manualProductSheetVisible: false,
productKeyword: '',
productError: '',
loadingProducts: false,
@@ -439,6 +460,9 @@ Page({
timeLoading: false,
timeError: '',
timeSelectTip: '请先选择美甲师并填写时长',
appointmentDayLabel: '',
appointmentDateBadge: '',
appointmentDateLong: '',
availableTimeGroups: [],
loading: false
},
@@ -447,6 +471,8 @@ Page({
const creatable = canCreateAppointment()
const draftForm = creatable && !hasPresetOptions(options) ? readDraftForm() : null
const baseForm = draftForm || {}
const appointmentDate = options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date())
const dateLabels = buildAppointmentDateLabels(appointmentDate)
this.setData({
canCreateAppointment: creatable,
form: {
@@ -454,10 +480,13 @@ Page({
...baseForm,
customerName: options.customerName ? decodeURIComponent(options.customerName) : (baseForm.customerName || ''),
phone: options.phone ? decodeURIComponent(options.phone) : (baseForm.phone || ''),
appointmentDate: options.date || baseForm.appointmentDate || dateUtil.formatDate(new Date()),
appointmentDate,
artistId: options.artistId || baseForm.artistId || ''
},
draftSavedAtText: draftForm ? '已恢复本机草稿' : ''
draftSavedAtText: draftForm ? '已恢复本机草稿' : '',
appointmentDayLabel: dateLabels.day,
appointmentDateBadge: dateLabels.badge,
appointmentDateLong: dateLabels.long
})
if (!creatable) {
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
@@ -756,9 +785,13 @@ Page({
}
return
}
const dateLabels = buildAppointmentDateLabels(nextDate)
this.setData({
'form.appointmentDate': nextDate,
'form.appointmentTime': ''
'form.appointmentTime': '',
appointmentDayLabel: dateLabels.day,
appointmentDateBadge: dateLabels.badge,
appointmentDateLong: dateLabels.long
})
await this.loadArtists()
await this.refreshAvailableTimes()
@@ -779,7 +812,7 @@ Page({
openProductModal() {
this.refreshProductCards()
this.setData({ productModalVisible: true })
this.setData({ productModalVisible: true, manualProductSheetVisible: false })
},
closeProductModal() {
@@ -789,9 +822,31 @@ Page({
openManualProduct() {
this.setData({
productModalVisible: false,
manualProductSheetVisible: true
})
},
closeManualProduct() {
this.setData({ manualProductSheetVisible: false })
},
confirmManualProduct() {
const hasTitle = Boolean(String(this.data.form.manualProductTitle || '').trim())
const hasImage = Boolean(String(this.data.form.manualProductImageFileIds || '').trim())
const hasFallbackName = Boolean(String(this.data.form.customerName || '').trim())
if (this.data.form.productId && !hasTitle && !hasImage) {
this.closeManualProduct()
return
}
if (!hasTitle && !hasImage && !hasFallbackName) {
wx.showToast({ title: '请填写款式名称或添加图片', icon: 'none' })
return
}
this.setData({
'form.productId': '',
selectedProduct: {},
selectedProductPriceText: '',
'form.productId': ''
manualProductSheetVisible: false
})
},
@@ -813,6 +868,14 @@ Page({
selectedProduct,
selectedProductPriceText: selectedProduct.priceText || '',
'form.productId': selectedProduct.id,
'form.manualProductTitle': '',
'form.manualProductPrice': '',
'form.manualProductDescription': '',
'form.manualProductTags': '',
'form.manualProductTargetAudience': '',
'form.manualProductPrecautions': '',
'form.manualProductImageFileIds': '',
'form.manualProductImageUrl': '',
'form.amount': selectedProduct.price === undefined || selectedProduct.price === null ? '' : String(selectedProduct.price),
'form.durationMinutes': String(selectedDuration || this.data.form.durationMinutes || '')
})
@@ -1,5 +1,5 @@
{
"navigationBarTitleText": "新建预约",
"navigationBarTitleText": "新增预约",
"usingComponents": {
"entity-selector-sheet": "/components/entity-selector-sheet/index",
"product-selector-sheet": "/components/product-selector-sheet/index"
@@ -1,52 +1,104 @@
<view class="page no-tab appointment-page">
<view class="appointment-hero">
<view class="appointment-hero-copy">
<text class="appointment-eyebrow">NEW APPOINTMENT</text>
<text class="appointment-title">安排一场美甲</text>
</view>
<view class="appointment-date-pill"><text class="date-pill-icon">◷</text><text>{{appointmentDateBadge}}</text></view>
</view>
<view class="card form-card style-section">
<view class="section-heading">
<view><text class="section-title-main">美甲款式</text><text class="section-caption">手动输入为主,也可快速选择已有款式</text></view>
<button class="link-action" bindtap="openProductModal">{{form.productId ? '更换款式' : '选择已有款式'}}</button>
<view class="section-title-row"><text class="section-title-main">美甲款式</text><text class="required-mark">*</text></view>
<button class="link-action" bindtap="openProductModal">{{form.productId ? '更换款式' : '选择已有'}}</button>
</view>
<view wx:if="{{form.productId}}" class="selected-style-card">
<button wx:if="{{!form.productId}}" class="field-card appointment-field-card" bindtap="openManualProduct">
<image wx:if="{{form.manualProductImageUrl}}" class="field-icon style-entry-image" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
<view wx:else class="field-icon">✦</view>
<view class="field-text">
<text class="field-label">手动录入为主,提交预约后自动加入作品库</text>
<text wx:if="{{form.manualProductTitle}}" class="field-value">{{form.manualProductTitle}}</text>
<text wx:elif="{{form.manualProductImageUrl}}" class="field-value">已添加款式图片</text>
<text wx:else class="field-value placeholder">填写款式名称或添加图片</text>
</view>
<text class="chevron">›</text>
</button>
<view wx:else class="selected-style-card">
<image wx:if="{{selectedProduct.coverImage}}" class="selected-style-image" src="{{selectedProduct.coverImage}}" mode="aspectFill"></image>
<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>
<button class="switch-manual-action" bindtap="openManualProduct">手动录入</button>
</view>
<view wx:else class="style-name-row">
<input class="style-name-input" value="{{form.manualProductTitle}}" bindinput="onStyleTitleInput" placeholder="款式名称(选填)" />
<button class="image-action" bindtap="chooseManualProductImage" loading="{{manualImageUploading}}">{{form.manualProductImageUrl ? '更换图片' : '添加图片'}}</button>
</view>
<view wx:if="{{!form.productId && form.manualProductImageUrl}}" class="style-image-preview-row">
<image class="style-image-preview" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
<button class="remove-image-action" bindtap="removeManualProductImage">移除图片</button>
<button class="switch-manual-action" catchtap="openManualProduct">手动录入</button>
</view>
<view class="style-number-row">
<view class="number-field"><text class="field-label required">成交金额</text><input type="digit" value="{{form.amount}}" data-field="amount" bindinput="onInput" placeholder="请输入实际金额" /><text class="number-unit">元</text></view>
<view class="number-field"><text class="field-label required">预计时长</text><input type="number" value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" placeholder="60" /><text class="number-unit">分钟</text></view>
<label 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>
<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>
</view>
<view class="card form-card appointment-info-section">
<view class="section-heading"><view><text class="section-title-main">预约信息</text><text class="section-caption">时间默认使用滚轮选择</text></view></view>
<view class="field"><text class="field-label required">预约日期</text><picker mode="date" value="{{form.appointmentDate}}" bindchange="onDateChange"><view class="field-value">{{form.appointmentDate}}</view></picker></view>
<view class="field"><text class="field-label required">预约时间</text><view class="field-value time-value {{form.appointmentTime ? '' : 'placeholder'}}" bindtap="openTimeSheet"><view><text>{{form.appointmentTime || timeSelectTip}}</text><text wx:if="{{form.appointmentTime}}" class="time-range">{{form.appointmentDate}} · {{selectedArtist.name || '待分配'}} · {{form.durationMinutes}}分钟</text></view><text class="time-arrow">›</text></view></view>
<view class="field"><text class="field-label">员工(可稍后分配)</text><view class="field-value reference-value" bindtap="openArtistSheet"><text>{{selectedArtist.name || '暂不分配'}}</text><text class="reference-arrow">›</text></view></view>
<view class="section-heading">
<view><text class="section-title-main">预约信息</text><text class="section-caption">员工可暂不分配,之后再安排</text></view>
</view>
<picker mode="date" value="{{form.appointmentDate}}" bindchange="onDateChange">
<view class="field-card appointment-field-card">
<view class="field-icon">▣</view>
<view class="field-text"><text class="field-label">预约日期</text><text class="field-value">{{appointmentDateLong}}</text></view>
<text class="chevron">›</text>
</view>
</picker>
<view class="field-card appointment-field-card" bindtap="openTimeSheet">
<view class="field-icon">◷</view>
<view class="field-text"><text class="field-label">预约时间</text><text wx:if="{{form.appointmentTime}}" class="field-value">{{appointmentDayLabel}} {{form.appointmentTime}} · {{form.durationMinutes}}分钟</text><text wx:else class="field-value placeholder">{{timeSelectTip}}</text><text wx:if="{{form.appointmentTime}}" class="field-meta">{{selectedArtist.name || '暂不分配员工'}}</text></view>
<text class="chevron">›</text>
</view>
<view class="field-card appointment-field-card" bindtap="openArtistSheet">
<view class="field-icon">♙</view>
<view class="field-text"><text class="field-label">服务员工</text><text class="field-value {{selectedArtist.name ? '' : 'placeholder'}}">{{selectedArtist.name || '请选择员工或暂不分配'}}</text></view>
<text class="chevron">›</text>
</view>
</view>
<view class="card form-card customer-section">
<view class="section-heading"><view><text class="section-title-main">客户</text><text class="section-caption">可留空,按散客保存</text></view></view>
<view class="customer-entry"><input class="customer-name-input" value="{{form.customerName}}" data-field="customerName" bindinput="onCustomerInput" placeholder="客户姓名(选填)" /><button class="customer-select-btn" catchtap="openCustomerSheet">选择已有客户</button></view>
<input class="customer-phone-input" value="{{form.phone}}" data-field="phone" bindinput="onCustomerInput" type="number" maxlength="11" placeholder="手机号(选填,填写时需同时填写姓名)" />
<view class="section-heading">
<view><text class="section-title-main">客户</text><text class="section-caption">可留空;姓名和手机号都为空时按散客提交</text></view>
</view>
<view class="customer-entry">
<view class="customer-fields">
<input class="customer-name-input" value="{{form.customerName}}" data-field="customerName" bindinput="onCustomerInput" placeholder="客户姓名(可选)" />
<input class="customer-phone-input" value="{{form.phone}}" data-field="phone" bindinput="onCustomerInput" type="number" maxlength="11" placeholder="手机号(可选)" />
</view>
<button class="customer-library-btn" aria-label="选择已有客户" catchtap="openCustomerSheet"><text class="customer-library-icon">⌕</text></button>
</view>
<view wx:if="{{customerSuggestions.length}}" class="customer-suggestion-list"><view wx:for="{{customerSuggestions}}" wx:key="id" class="customer-suggestion" data-index="{{index}}" bindtap="selectCustomerSuggestion"><text>{{item.name}}</text><text>{{item.phone || '未填写手机号'}}</text></view></view>
<text wx:if="{{form.customerUserId}}" class="customer-selected-tip">已关联系统客户</text>
<view wx:if="{{form.customerUserId}}" class="customer-selected-tip">已选择系统客户</view>
</view>
<view class="capacity-tip card"><text class="tip-title">容量校验</text><text class="tip-text">已指定员工时会校验排班和冲突;暂不分配时不校验员工占用,后续分配时再完整校验。</text></view>
<view wx:if="{{draftSavedAtText}}" class="draft-tip card"><text>{{draftSavedAtText}}</text><button class="text-btn draft-clear" bindtap="clearDraft">清空</button></view>
<view wx:if="{{conflictTip}}" class="availability-tip card {{conflictLevel}}"><text class="tip-title">时段检查</text><text class="tip-text">{{conflictTip}}</text></view>
<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" />
<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="{{false}}" bind:search="onProductSearch" bind:select="selectProduct" 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="openManualProduct" bind:retry="loadOptions" bind:close="closeProductModal" />
<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="modal-head"><view><text class="modal-title">录入本次美甲款式</text><text class="modal-subtitle">名称或图片至少填写一项</text></view><view class="modal-close" bindtap="closeManualProduct" aria-label="关闭款式录入"></view></view>
<scroll-view class="manual-style-content" scroll-y enhanced show-scrollbar="{{false}}">
<view class="style-name-row">
<input class="style-name-input" value="{{form.manualProductTitle}}" bindinput="onStyleTitleInput" placeholder="留空时默认使用客户姓名" />
<button class="image-action" bindtap="chooseManualProductImage" loading="{{manualImageUploading}}">{{form.manualProductImageUrl ? '更换图片' : '添加图片'}}</button>
</view>
<view wx:if="{{form.manualProductImageUrl}}" class="style-image-preview-row">
<image class="style-image-preview" src="{{form.manualProductImageUrl}}" mode="aspectFill"></image>
<button class="remove-image-action" bindtap="removeManualProductImage">移除图片</button>
</view>
<text class="manual-style-hint">没有填写名称时,会使用客户姓名;散客预约会使用“散客款式”。</text>
</scroll-view>
<view class="manual-style-footer"><button class="manual-style-confirm" bindtap="confirmManualProduct">用于本次预约</button><button class="manual-style-library-link" bindtap="openProductModal">选择已有作品</button></view>
</view>
</view>
<view wx:if="{{timeSheetVisible}}" class="modal-mask" bindtap="closeTimeSheet" catchtouchmove="stopTouchMove">
<view class="time-modal" catchtap="stopTap" catchtouchmove="stopTouchMove">
@@ -793,3 +793,542 @@
font-size: 21rpx;
line-height: 58rpx;
}
.appointment-page {
padding-top: 24rpx;
background: #f3f7f4;
color: #17211f;
}
.appointment-hero {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 18rpx;
margin: 0 0 30rpx;
}
.appointment-hero-copy {
display: flex;
min-width: 0;
flex-direction: column;
}
.appointment-eyebrow {
color: #247b63;
font-size: 22rpx;
font-weight: 800;
line-height: 1.3;
}
.appointment-title {
margin-top: 6rpx;
color: #17211f;
font-size: 52rpx;
font-weight: 900;
line-height: 1.15;
}
.appointment-date-pill {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 8rpx;
min-height: 58rpx;
padding: 0 16rpx;
border: 2rpx solid #e7ece9;
border-radius: 26rpx;
background: #fff;
color: #52645d;
font-size: 22rpx;
white-space: nowrap;
}
.date-pill-icon {
color: #247b63;
font-size: 25rpx;
}
.appointment-page .form-card {
margin-bottom: 24rpx;
padding: 28rpx 30rpx 24rpx;
border: 2rpx solid #e7ece9;
border-radius: 38rpx;
background: #fff;
box-shadow: 0 8rpx 26rpx rgba(41, 73, 62, 0.04);
}
.section-heading {
align-items: center;
margin: 0 0 20rpx;
}
.section-title-row {
display: flex;
align-items: baseline;
}
.section-title-main {
color: #17211f;
font-size: 28rpx;
font-weight: 800;
}
.section-caption {
color: #71807a;
font-size: 20rpx;
line-height: 1.4;
}
.required-mark {
margin-left: 5rpx;
color: #e98669;
font-size: 24rpx;
font-weight: 800;
}
.link-action {
min-width: 144rpx;
max-width: none;
height: 58rpx;
padding: 0 18rpx;
border: 2rpx solid #cbdcd5;
border-radius: 22rpx;
background: #fbfdfc;
color: #247b63;
font-size: 21rpx;
font-weight: 700;
line-height: 54rpx;
}
.field-card {
display: flex;
width: 100%;
min-height: 124rpx;
align-items: center;
gap: 22rpx;
padding: 20rpx 22rpx;
border: 2rpx dashed #cbdcd5;
border-radius: 30rpx;
background: #fbfdfc;
text-align: left;
line-height: 1.35;
box-sizing: border-box;
}
button.full{
width: 100%;
box-sizing: border-box;
margin: 0; /* 清除小程序button自带左右margin */
}
.field-icon {
display: flex;
width: 76rpx;
height: 76rpx;
flex: 0 0 76rpx;
align-items: center;
justify-content: center;
border-radius: 24rpx;
background: #e5f4ed;
color: #247b63;
font-size: 34rpx;
}
.style-entry-image {
object-fit: cover;
}
.field-text {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
}
.field-label {
width: auto;
color: #71807a;
font-size: 21rpx;
font-weight: 600;
line-height: 1.35;
}
.field-value {
display: block;
min-width: 0;
flex: 0 0 auto;
margin-top: 5rpx;
overflow: hidden;
color: #17211f;
font-size: 27rpx;
font-weight: 800;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
.field-value.placeholder {
color: #9aa9a3;
font-weight: 600;
}
.field-meta {
display: block;
margin-top: 5rpx;
color: #71807a;
font-size: 20rpx;
line-height: 1.35;
}
.chevron {
flex: 0 0 auto;
color: #91a29a;
font-size: 40rpx;
line-height: 1;
}
.style-entry-card {
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 {
padding: 20rpx 0 0;
color: #82928a;
font-size: 19rpx;
line-height: 1.45;
}
.appointment-info-section .section-heading {
margin-bottom: 20rpx;
}
.appointment-field-card {
margin-top: 16rpx;
}
.appointment-field-card:first-of-type {
margin-top: 0;
}
.customer-section {
padding-bottom: 26rpx !important;
}
.customer-section .section-heading {
margin-bottom: 18rpx;
}
.customer-entry {
gap: 14rpx;
align-items: stretch;
}
.customer-fields {
display: grid;
min-width: 0;
flex: 1;
grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
gap: 12rpx;
}
.customer-entry .customer-name-input,
.customer-entry .customer-phone-input {
box-sizing: border-box;
width: 100%;
min-width: 0;
height: 88rpx;
margin: 0;
padding: 0 16rpx;
border: 2rpx solid #dce6e1;
border-radius: 24rpx;
background: #fbfdfc;
color: #17211f;
font-size: 22rpx;
}
.customer-library-btn {
display: flex;
width: 88rpx;
min-width: 88rpx;
max-width: 88rpx;
height: 88rpx;
align-items: center;
justify-content: center;
border-radius: 24rpx;
background: #e1f2eb;
color: #247b63;
}
.customer-library-icon {
font-size: 38rpx;
line-height: 1;
}
.customer-suggestion-list {
border-color: #e7ece9;
border-radius: 22rpx;
}
.customer-suggestion {
min-height: 72rpx;
border-color: #e7ece9;
color: #17211f;
font-size: 22rpx;
}
.customer-suggestion text:last-child {
color: #71807a;
font-size: 21rpx;
}
.customer-selected-tip {
margin-top: 12rpx;
color: #247b63;
font-size: 20rpx;
}
.selected-style-card {
min-height: 112rpx;
border-color: #cbdcd5;
border-radius: 30rpx;
background: #fbfdfc;
}
.selected-style-title {
color: #17211f;
}
.selected-style-meta {
color: #71807a;
}
.switch-manual-action {
border-radius: 18rpx;
background: #e1f2eb;
color: #247b63;
}
.appointment-page .fixed-bottom {
padding-top: 20rpx;
border-top: 2rpx solid #e7ece9;
background: rgba(255, 255, 255, 0.97);
}
.appointment-page .primary-btn {
background: #17211f;
box-shadow: 0 10rpx 22rpx rgba(23, 33, 31, 0.16);
}
.appointment-page .secondary-btn {
border-color: #dce6e1;
background: #f3f7f4;
color: #52645d;
}
.appointment-page .modal-mask {
z-index: 130;
background: rgba(16, 29, 25, 0.44);
}
.appointment-page .time-modal,
.manual-style-sheet {
border-radius: 34rpx 34rpx 0 0;
background: #fff;
box-shadow: 0 -20rpx 48rpx rgba(24, 48, 40, 0.14);
}
.appointment-page .modal-title {
color: #17211f;
}
.appointment-page .modal-subtitle {
color: #71807a;
}
.appointment-page .time-mode-switch {
background: #f1f5f3;
}
.appointment-page .time-mode-switch button.active {
background: #dff1e9;
color: #247b63;
box-shadow: none;
}
.appointment-page .time-chip.active {
border-color: #9ccdbb;
background: #d9f0e6;
color: #247b63;
}
.appointment-page .time-confirm-btn {
background: #17211f;
}
.manual-style-sheet {
display: flex;
width: 100%;
height: 70vh;
max-height: 82vh;
flex-direction: column;
overflow: hidden;
padding: 28rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
}
.manual-style-content {
height: 0;
min-height: 0;
flex: 1;
padding: 8rpx 0 20rpx;
}
.manual-style-content .style-name-input {
box-sizing: border-box;
height: 82rpx;
border-color: #dce6e1;
border-radius: 24rpx;
background: #fbfdfc;
}
.manual-style-content .image-action {
height: 82rpx;
border-radius: 24rpx;
background: #e1f2eb;
color: #247b63;
font-size: 21rpx;
line-height: 82rpx;
}
.manual-style-hint {
display: block;
margin-top: 18rpx;
color: #71807a;
font-size: 21rpx;
line-height: 1.5;
}
.manual-style-footer {
flex: 0 0 auto;
padding-top: 16rpx;
border-top: 2rpx solid #e7ece9;
}
.manual-style-confirm {
width: 100%;
height: 84rpx;
border-radius: 24rpx;
background: #17211f;
color: #fff;
font-size: 26rpx;
font-weight: 800;
line-height: 84rpx;
}
.manual-style-library-link {
height: 64rpx;
margin: 10rpx auto 0;
color: #247b63;
font-size: 22rpx;
line-height: 64rpx;
}
@media (max-width: 360px) {
.appointment-title {
font-size: 44rpx;
}
.appointment-date-pill {
gap: 5rpx;
padding: 0 10rpx;
font-size: 19rpx;
}
.customer-fields {
grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
gap: 8rpx;
}
.customer-name-input,
.customer-phone-input {
padding: 0 12rpx;
font-size: 20rpx;
}
}
@@ -7,7 +7,7 @@ const wxss = fs.readFileSync(path.join(__dirname, 'index.wxss'), 'utf8')
const pageScript = fs.readFileSync(path.join(__dirname, 'index.js'), 'utf8')
assert.match(wxml, /<product-selector-sheet[^>]*bind:close="closeProductModal"/)
assert.match(wxml, /show-manual-action="\{\{false\}\}"/)
assert.match(wxml, /show-manual-action="\{\{true\}\}"/)
assert.match(wxml, /bind:select="selectProduct"/)
const componentWxml = fs.readFileSync(path.join(__dirname, '../../components/product-selector-sheet/index.wxml'), 'utf8')
const componentWxss = fs.readFileSync(path.join(__dirname, '../../components/product-selector-sheet/index.wxss'), 'utf8')
@@ -2,7 +2,8 @@ const assert = require('assert')
let definition
global.Page = value => { definition = value }
global.wx = { showToast: () => {} }
const toastMessages = []
global.wx = { showToast: options => toastMessages.push(options.title) }
global.getApp = () => ({ globalData: { userInfo: { id: 1, shopId: 2, type: 2 } } })
require('./index')
@@ -34,15 +35,37 @@ assert.strictEqual(page.data.form.amount, '238')
assert.strictEqual(page.data.form.manualProductTitle, '')
assert.strictEqual(page.data.form.durationMinutes, '90')
page.openManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, true)
page.confirmManualProduct()
assert.strictEqual(page.data.form.productId, 8)
assert.strictEqual(page.data.manualProductSheetVisible, false)
page.onStyleTitleInput({ detail: { value: '手绘款' } })
assert.strictEqual(page.data.form.productId, '')
assert.strictEqual(page.data.form.manualProductTitle, '手绘款')
assert.strictEqual(page.data.form.amount, '238')
assert.strictEqual(page.data.selectedProductPriceText, '')
page.openManualProduct()
page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, false)
assert.strictEqual(page.data.form.productId, '')
page.data.form.manualProductTitle = ''
page.openManualProduct()
page.confirmManualProduct()
assert.strictEqual(page.data.manualProductSheetVisible, true)
assert.strictEqual(toastMessages.pop(), '请填写款式名称或添加图片')
const wxml = require('fs').readFileSync(require('path').join(__dirname, 'index.wxml'), 'utf8')
assert.ok(wxml.indexOf('美甲款式') < wxml.indexOf('预约信息'))
assert.ok(wxml.indexOf('预约信息') < wxml.indexOf('>客户</text>'))
assert.match(wxml, /placeholder="款式名称(选填)"/)
assert.match(wxml, /class="appointment-hero"/)
assert.match(wxml, /placeholder="留空时默认使用客户姓名"/)
assert.match(wxml, /appointmentDateBadge/)
assert.match(wxml, /class="customer-fields"/)
assert.match(wxml, /class="manual-style-sheet"/)
assert.match(wxml, /bind:openmanual="openManualProduct"/)
assert.match(wxml, /show-manual-action="\{\{true\}\}"/)
assert.match(wxml, /成交金额/)
@@ -8,6 +8,8 @@
页面按“美甲款式、预约信息、客户”排列。
页面视觉以新增预约演示稿为准:原生导航栏下方展示 `NEW APPOINTMENT` 标识、主标题和日期胶囊;内容使用薄荷绿浅底、白色圆角分区卡片。款式入口以带图标的虚线卡片呈现,手动录入通过底部面板完成,已有款式保留快速选择入口;金额和时长并排,日期、时间、员工分别使用独立图标卡,客户姓名和手机号同一行并靠近客户库快捷入口。
- 美甲款式优先手动填写,也可搜索并选择已有作品。选择后带入作品名称、参考价格和时长;金额表示成交价,仍可修改。
- 手动款式名称或图片至少填写一项。名称为空时依次使用客户姓名、“散客款式”作为兜底名称。
- 预约信息包含日期、时间、员工、成交金额和时长。时间默认使用上下滚动的时分选择器,保留 15 分钟时段模式。
+8
View File
@@ -1,5 +1,13 @@
# 项目变更记录
## 2026-10-20 Salon 新增预约页面对齐演示稿
- 问题:新增预约页虽然保留了确认的字段和业务规则,但实际呈现与 demo 差异明显。
- 原因:之前只迁移了表单内容,没有按 demo 的页面骨架重排;旧页面继续使用米棕色表单行,款式名称和图片也平铺在主表单。
- 处理:直接参考演示稿 HTML/CSS,补回主标题和日期胶囊、带图标的款式入口、独立款式录入面板、预约信息入口卡和并排客户输入;统一到浅薄荷绿配色。
- 约束:预约校验、客户去重/建档、员工可暂不分配及时间占用规则不变。
- 验证:Salon 小程序全量 Node 测试 20/20 通过,JavaScript 语法检查和 `git diff --check` 通过;GitNexus 变更检测为低风险。
## 2026-10-20 Salon 新增预约表单与客户身份优化
- 新增预约表单按“美甲款式、预约信息、客户”排列;款式以手动录入为主,也可选择已有作品快速带入参考价格和时长,成交金额仍可修改。