155 lines
16 KiB
Plaintext
155 lines
16 KiB
Plaintext
<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 class="section-title-row"><text class="section-title-main">美甲款式</text><text class="required-mark">*</text></view>
|
||
<view class="btn-wrap">
|
||
<button class="link-action" bindtap="openProductModal">款式库</button>
|
||
</view>
|
||
</view>
|
||
<button wx:if="{{!form.productId}}" class="field-card appointment-field-card full" bindtap="openManualProduct">
|
||
<image wx:if="{{form.manualProductImages.length}}" class="field-icon style-entry-image" src="{{form.manualProductImages[0].previewUrl || form.manualProductImages[0].fileUrl}}" mode="aspectFill" data-index="0" binderror="onManualProductImageError"></image>
|
||
<view wx:else class="field-icon">✦</view>
|
||
<view class="field-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: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>
|
||
</view>
|
||
<text class="chevron">›</text>
|
||
</button>
|
||
<view wx:else class="selected-style-card" bindtap="openManualProduct">
|
||
<image wx:if="{{selectedProduct.coverImage}}" class="selected-style-image" src="{{selectedProduct.coverImage}}" mode="aspectFill" binderror="onSelectedProductImageError"></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 || '待定'}} · 本次 {{form.amount || '待填'}} 元 · {{form.durationMinutes || '60'}} 分钟</text></view>
|
||
<button class="switch-manual-action" catchtap="openManualProduct">调整</button>
|
||
</view>
|
||
<text class="style-hint">名称和图片至少填写一项;名称为空时会使用客户姓名或“散客款式”。</text>
|
||
<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>
|
||
<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 wx:if="{{selectedArtist.id === '__unassigned__'}}" class="field-value">已选择暂不分配美甲师</text><text wx:else 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">
|
||
<view class="customer-fields">
|
||
<input class="customer-name-input" value="{{form.customerName}}" data-field="customerName" bindinput="onCustomerInput" placeholder="客户姓名(可选)" />
|
||
<input class="customer-wechat-input" value="{{form.wechatId}}" data-field="wechatId" 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>
|
||
<view wx:if="{{form.customerUserId}}" class="customer-selected-tip">已选择系统客户</view>
|
||
</view>
|
||
|
||
<view class="draft-tip card"><text>{{draftSavedAtText}}</text><button class="text-btn draft-clear" bindtap="resetForm">恢复默认值</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="{{selectedArtist.id}}" 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="openManualProductFromLibrary" 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">{{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}}">
|
||
<view class="manual-style-name-field">
|
||
<view class="manual-style-field-heading"><text>名称</text><text class="manual-style-character-count">
|
||
{{manualProductTitleLength}} / 100</text></view>
|
||
<input class="manual-style-title-input" value="{{form.productId ? selectedProduct.title : form.manualProductTitle}}" maxlength="100" disabled="{{form.productId}}" bindinput="onStyleTitleInput" placeholder="留空时默认使用客户姓名" />
|
||
</view>
|
||
<text class="manual-style-hint">没有填写名称时,会使用客户姓名;没有选择客户时,会采取散客预约模式,名称采用“散客款式”。</text>
|
||
|
||
<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-images">
|
||
<view class="manual-style-image-heading"><text>款式图片</text><text class="manual-style-image-count">{{form.manualProductImages.length}} / 9</text></view>
|
||
<scroll-view class="manual-style-image-scroll" scroll-x="true" enhanced="true" show-scrollbar="false">
|
||
<view class="manual-style-image-grid">
|
||
<view wx:for="{{form.manualProductImages}}" wx:key="fileId" class="manual-style-image-tile">
|
||
<image src="{{item.previewUrl || item.fileUrl}}" mode="aspectFill" data-index="{{index}}" binderror="onManualProductImageError"></image>
|
||
<text wx:if="{{index === 0}}" class="manual-style-image-cover">封面</text>
|
||
<button class="manual-style-image-remove" data-index="{{index}}" disabled="{{manualImageUploading}}" catchtap="removeManualProductImage" aria-label="移除图片">×</button>
|
||
</view>
|
||
<button wx:if="{{form.manualProductImages.length < 9}}" class="manual-style-add-image" bindtap="chooseManualProductImage" loading="{{manualImageUploading}}" disabled="{{manualImageUploading}}"><text class="manual-style-add-icon">+</text><text>点击添加图片</text></button>
|
||
</view>
|
||
</scroll-view>
|
||
<text class="manual-style-image-tip">第一张图片会作为款式封面</text>
|
||
</view>
|
||
<view class="manual-style-description-field">
|
||
<text class="manual-style-field-label">款式描述 / 备注(选填)</text>
|
||
<textarea value="{{unifiedStyleDescription}}" bindinput="onUnifiedStyleDescriptionInput" placeholder="可填写颜色、工艺、特殊要求等备注" maxlength="500" />
|
||
</view>
|
||
<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 wx:if="{{manualProductMoreVisible}}" class="manual-style-more-fields">
|
||
<input value="{{form.manualProductTags}}" data-field="manualProductTags" bindinput="onInput" placeholder="标签,多个用逗号分隔" />
|
||
<input value="{{form.manualProductTargetAudience}}" data-field="manualProductTargetAudience" bindinput="onInput" placeholder="适合人群" />
|
||
<input value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" placeholder="注意事项" />
|
||
</view>
|
||
</view>
|
||
</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">
|
||
<view class="modal-head"><view><text class="modal-title">选择预约时间</text><text class="modal-subtitle">{{form.appointmentDate}} · {{selectedArtist.name || '待分配'}} · {{form.durationMinutes}}分钟</text></view><view class="modal-close" bindtap="closeTimeSheet" aria-label="关闭时间选择"></view></view>
|
||
<view class="time-mode-switch"><button class="{{timePickerMode === 'wheel' ? 'active' : ''}}" data-mode="wheel" bindtap="onTimePickerModeChange">滚轮选择</button><button class="{{timePickerMode === 'grid' ? 'active' : ''}}" data-mode="grid" bindtap="onTimePickerModeChange">逐分钟时段</button></view>
|
||
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
|
||
<view wx:elif="{{timeError}}" class="time-empty"><text>{{businessHoursMissing && !canManageShopSettings ? '门店营业时间尚未设置,请联系店长完成设置' : timeError}}</text><button wx:if="{{businessHoursMissing && canManageShopSettings}}" class="time-empty-action" bindtap="openShopSettings">前往店铺设置</button></view>
|
||
<block wx:elif="{{timePickerMode === 'wheel'}}">
|
||
<picker-view class="time-wheel" indicator-style="height: 76rpx;" value="{{timePickerValue}}" bindchange="onTimePickerChange"><picker-view-column><view wx:for="{{timePickerHours}}" wx:key="value" class="wheel-item {{item.disabled ? 'disabled' : ''}}">{{item.label}}</view></picker-view-column><picker-view-column><view wx:for="{{timePickerMinutes}}" wx:key="value" class="wheel-item {{item.disabled ? 'disabled' : ''}}">{{item.label}}</view></picker-view-column></picker-view>
|
||
<view class="time-wheel-caption">{{selectedTimeCandidate || '请选择时间'}}<text wx:if="{{timePickerCandidateStatus === 'occupied'}}"> · 已被占用</text><text wx:elif="{{timePickerCandidateStatus === 'past'}}"> · 已过时</text><text wx:elif="{{timePickerCandidateStatus === 'off-shift'}}"> · 当前无排班</text></view>
|
||
<button class="time-confirm-btn" bindtap="confirmTimeSelection">确认时间</button>
|
||
</block>
|
||
<block wx:else><scroll-view class="time-list" scroll-y><view wx:for="{{timePickerGroups}}" wx:key="key" class="time-group"><text class="time-group-title">{{item.title}}</text><view class="time-grid"><view wx:for="{{item.times}}" wx:for-item="time" wx:key="value" class="time-chip {{selectedTimeCandidate === time.value ? 'active' : ''}} {{time.status !== 'available' ? 'disabled' : ''}}" data-value="{{time.value}}" bindtap="selectAvailableTime"><text>{{time.value}}</text><text>{{time.statusText || time.rangeText}}</text></view></view></view></scroll-view><button class="time-confirm-btn" bindtap="confirmTimeSelection">确认当前时间</button></block>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="fixed-bottom"><view wx:if="{{canCreateAppointment}}" class="action-row"><button class="secondary-btn draft-btn" bindtap="saveDraft">保存草稿</button><button class="primary-btn submit-btn" loading="{{loading}}" bindtap="submit">提交预约</button></view></view>
|
||
<action-modal id="actionModal" />
|
||
</view>
|