Files
JayuCloud/JC-Salon-WeChat/pages/appointment-form/index.wxml
T

214 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<view class="page no-tab">
<view class="card form-card">
<view class="field customer-field" bindtap="openCustomerSheet">
<text class="field-label required">客户</text>
<view class="reference-card {{form.customerName ? 'filled' : ''}}">
<view class="reference-copy">
<text class="reference-title">{{form.customerName || '请选择客户'}}</text>
<text class="reference-subtitle">{{form.phone || '搜索已有客户或手动录入'}}</text>
</view>
<text wx:if="{{form.customerUserId}}" class="reference-badge">已有</text>
<text class="reference-arrow">›</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 product-value" bindtap="openProductModal">
<text>{{selectedProduct.title || form.manualProductTitle || '请选择预约作品'}}</text>
<text wx:if="{{form.manualProductTitle && !form.productId}}" class="manual-badge">手动</text>
</view>
</view>
<view class="field">
<text class="field-label required">预计时长</text>
<input value="{{form.durationMinutes}}" data-field="durationMinutes" bindinput="onInput" type="number" placeholder="请输入预约时长" />
<text class="unit">分钟</text>
</view>
<view class="field">
<text class="field-label required">指定员工</text>
<view class="field-value reference-value" bindtap="openArtistSheet">
<text>{{selectedArtist.name || '请选择员工'}}</text>
<text class="reference-arrow">›</text>
</view>
</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 textarea-field">
<text class="field-label">备注</text>
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="客户偏好、款式说明" />
</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="暂无匹配客户,可手动录入"
action-text="手动录入客户"
bind:search="onCustomerSearch"
bind:select="selectCustomer"
bind:retry="retryCustomerSearch"
bind:action="openManualCustomer"
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"
/>
<view wx:if="{{manualCustomerVisible}}" class="modal-mask" bindtap="closeManualCustomer" catchtouchmove="stopTouchMove">
<view class="manual-customer-sheet" catchtap="stopTap">
<view class="modal-head">
<view>
<text class="modal-title">手动录入客户</text>
<text class="modal-subtitle">录入后将直接带回本次预约</text>
</view>
<view class="modal-close" bindtap="closeManualCustomer">×</view>
</view>
<view class="manual-customer-form">
<view class="manual-customer-field">
<text class="required-label">客户姓名</text>
<input value="{{manualCustomerForm.name}}" data-field="name" bindinput="onManualCustomerInput" placeholder="请输入客户姓名" />
</view>
<view class="manual-customer-field">
<text class="required-label">手机号</text>
<input value="{{manualCustomerForm.phone}}" data-field="phone" bindinput="onManualCustomerInput" type="number" maxlength="11" placeholder="请输入手机号" />
</view>
</view>
<button class="primary-btn manual-customer-submit" bindtap="useManualCustomer">使用该客户</button>
</view>
</view>
<view wx:if="{{productModalVisible}}" class="modal-mask" bindtap="closeProductModal" catchtouchmove="stopTouchMove">
<view class="product-modal" catchtap="stopTap">
<view class="modal-head">
<view>
<text class="modal-title">选择预约作品</text>
</view>
<view class="modal-close" bindtap="closeProductModal">×</view>
</view>
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
<scroll-view class="product-modal-scroll" scroll-y enhanced show-scrollbar="{{false}}">
<view class="product-list">
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option {{form.productId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectProduct">
<image wx:if="{{item.coverImage}}" class="product-cover" src="{{item.coverImage}}" mode="aspectFill"></image>
<view wx:else class="product-cover placeholder">图</view>
<view class="product-info">
<view class="product-title-row">
<text class="product-title">{{item.title}}</text>
<text class="product-price">{{item.priceText}}</text>
</view>
<text class="product-meta">{{item.artistText}} · {{item.durationText || '时长待定'}}</text>
<view class="tag-row">
<text wx:for="{{item.tagList}}" wx:for-item="tag" wx:key="*this" class="tag-pill">{{tag}}</text>
</view>
</view>
</view>
<view wx:if="{{!productError && filteredProducts.length === 0}}" class="product-empty">暂无匹配作品</view>
</view>
<view class="manual-panel">
<text class="manual-title required-label">手动新增预约作品</text>
<view class="manual-grid">
<input value="{{form.manualProductTitle}}" data-field="manualProductTitle" bindinput="onInput" placeholder="作品名称" />
<input value="{{form.manualProductPrice}}" data-field="manualProductPrice" bindinput="onInput" type="digit" placeholder="价格" />
</view>
<textarea class="manual-textarea" value="{{form.manualProductDescription}}" data-field="manualProductDescription" bindinput="onInput" placeholder="作品描述(选填)" />
<view class="manual-grid single">
<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 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>
<button class="secondary-btn manual-btn" bindtap="useManualProduct">使用手动预约作品</button>
</view>
</scroll-view>
</view>
</view>
<view wx:if="{{timeSheetVisible}}" class="modal-mask" bindtap="closeTimeSheet">
<view class="time-modal" catchtap="stopTap">
<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">×</view>
</view>
<view wx:if="{{timeLoading}}" class="time-empty">正在计算可约时间...</view>
<view wx:elif="{{timeError}}" class="time-empty">{{timeError}}</view>
<view wx:elif="{{availableTimeGroups.length === 0}}" class="time-empty">当前美甲师当天暂无可约时间</view>
<scroll-view wx:else class="time-list" scroll-y>
<view wx:for="{{availableTimeGroups}}" 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 {{form.appointmentTime === time.value ? 'active' : ''}}" data-value="{{time.value}}" bindtap="selectAvailableTime">
<text>{{time.value}}</text>
<text>{{time.rangeText}}</text>
</view>
</view>
</view>
</scroll-view>
</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>
</view>