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

257 lines
14 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="customer-select">
<view class="field {{customerNameFocused ? 'is-focused' : ''}}">
<text class="field-label required">客户姓名</text>
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" focus="{{customerNameFocused}}" />
</view>
<view wx:if="{{customerDropdownVisible}}" class="customer-dropdown">
<view wx:if="{{customerLoading}}" class="customer-option muted-option">正在搜索客户...</view>
<view wx:elif="{{customerError}}" class="customer-option muted-option">{{customerError}},可继续手动输入</view>
<view wx:else>
<view wx:for="{{customerOptions}}" wx:key="id" class="customer-option" data-id="{{item.id}}" bindtap="selectCustomer">
<view class="customer-copy">
<text class="customer-name">{{item.displayName}}</text>
<text class="customer-phone">{{item.displayPhone}}</text>
</view>
<text class="customer-select-tag">选择</text>
</view>
<view wx:if="{{customerOptions.length === 0}}" class="customer-option muted-option">暂无匹配客户,可继续手动输入</view>
</view>
</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 {{form.customerName ? '' : 'disabled'}}" bindtap="openProductModal">
<text>{{form.customerName ? (form.manualProductTitle || selectedProduct.title || '请选择作品') : '请先填写客户姓名'}}</text>
</view>
</view>
<view wx:if="{{form.productId || form.manualProductTitle}}" class="field price-field">
<text class="field-label">本次价格</text>
<view class="price-control">
<view class="price-input {{form.manualProductPriceUndetermined ? 'disabled' : ''}}">
<input value="{{form.manualProductPrice}}" data-field="manualProductPrice" bindinput="onInput" disabled="{{form.manualProductPriceUndetermined}}" type="digit" placeholder="{{form.manualProductPriceUndetermined ? '未定' : '可按本次预约修改'}}" />
<text>{{form.manualProductPriceUndetermined ? '未定' : '元'}}</text>
</view>
<view class="price-toggle">
<text>价格未定</text>
<switch checked="{{form.manualProductPriceUndetermined}}" color="#6f8f83" bindchange="onPriceUndeterminedChange" />
</view>
</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 artist-value {{selectedArtist.name ? '' : 'placeholder'}}" bindtap="openArtistSheet">
<text>{{selectedArtist.name || '请选择美甲师'}}</text>
<text class="time-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="appointment-flags">
<view class="flag-card {{form.depositPaid ? 'active' : ''}}" data-field="depositPaid" bindtap="toggleFlag">
<view class="flag-check">{{form.depositPaid ? '✓' : ''}}</view>
<text>交定金</text>
</view>
<view class="flag-card {{form.needRemoval ? 'active' : ''}}" data-field="needRemoval" bindtap="toggleFlag">
<view class="flag-check">{{form.needRemoval ? '✓' : ''}}</view>
<text>需卸甲</text>
</view>
<view class="flag-card {{form.fromMeituan ? 'active' : ''}}" data-field="fromMeituan" bindtap="toggleFlag">
<view class="flag-check">{{form.fromMeituan ? '✓' : ''}}</view>
<text>美团</text>
</view>
</view>
<view class="field textarea-field">
<text class="field-label">备注</text>
<textarea value="{{form.remark}}" data-field="remark" bindinput="onInput" auto-height 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>
<view wx:if="{{manualProductPanelVisible}}" class="manual-mask" catchtap="stopTap">
<view class="manual-sheet" catchtap="stopTap">
<view class="manual-sheet-head">
<text class="manual-sheet-title">预约内容填写</text>
<view class="modal-close" bindtap="closeManualProductPanel">×</view>
</view>
<view class="manual-field-row">
<view class="manual-field">
<text class="manual-field-label required-label">名称</text>
<input value="{{form.manualProductTitle}}" data-field="manualProductTitle" bindinput="onInput" placeholder="作品名称" />
</view>
<view class="manual-field manual-price-field">
<text class="manual-field-label">价格</text>
<view class="manual-price-input {{form.manualProductPriceUndetermined ? 'disabled' : ''}}">
<input value="{{form.manualProductPrice}}" data-field="manualProductPrice" bindinput="onInput" disabled="{{form.manualProductPriceUndetermined}}" type="digit" placeholder="{{form.manualProductPriceUndetermined ? '未定' : '价格'}}" />
<text>{{form.manualProductPriceUndetermined ? '未定' : '元'}}</text>
</view>
<view class="manual-price-toggle">
<text>价格未定</text>
<switch checked="{{form.manualProductPriceUndetermined}}" color="#6f8f83" bindchange="onPriceUndeterminedChange" />
</view>
</view>
</view>
<view class="manual-image-section">
<view class="manual-image-head">
<text class="manual-image-title">作品图片</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 class="manual-image-add {{manualImageUploading ? 'disabled' : ''}}" bindtap="chooseManualProductImage">
<text>{{manualImageUploading ? '...' : '+'}}</text>
</view>
</view>
</view>
<view class="manual-field manual-field-full">
<text class="manual-field-label">标签</text>
<picker range="{{tagOptions}}" range-key="name" value="{{tagPickerIndex}}" bindchange="onManualTagChange" disabled="{{tagOptions.length === 0}}">
<view class="manual-picker {{form.manualProductTags ? '' : 'placeholder'}}">
<text>{{form.manualProductTags || (tagOptions.length ? '请选择标签' : '暂无标签')}}</text>
<text class="manual-picker-arrow">›</text>
</view>
</picker>
</view>
<view wx:if="{{tagError}}" class="manual-tag-error">{{tagError}}</view>
<view class="manual-field manual-field-full manual-remark-field">
<text class="manual-field-label">备注</text>
<textarea value="{{form.manualProductPrecautions}}" data-field="manualProductPrecautions" bindinput="onInput" auto-height placeholder="备注(选填)" />
</view>
<view class="manual-action-row">
<button class="secondary-btn template-entry-btn" bindtap="openProductTemplateSheet">作品库</button>
<button class="primary-btn manual-btn" bindtap="useManualProduct">确认</button>
</view>
</view>
</view>
<view wx:if="{{productModalVisible}}" class="modal-mask template-mask" catchtap="stopTap">
<view class="product-modal template-modal" catchtap="stopTap">
<view class="modal-head">
<view class="modal-close" bindtap="closeProductModal">×</view>
<view><text class="modal-title">选择已有作品</text></view>
</view>
<input class="product-search" value="{{productKeyword}}" bindinput="onProductSearch" placeholder="搜索作品、标签、美甲师" />
<scroll-view class="product-list" scroll-y>
<view wx:if="{{productError}}" class="product-empty">{{productError}}</view>
<view wx:for="{{filteredProducts}}" wx:key="id" class="product-option" 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>
</scroll-view>
</view>
</view>
<view wx:if="{{artistSheetVisible}}" class="modal-mask artist-mask" catchtap="stopTap">
<view class="artist-modal" catchtap="stopTap">
<view class="modal-head artist-modal-head">
<text class="artist-modal-action muted" bindtap="closeArtistSheet">取消</text>
<view class="artist-modal-title-block">
<text class="modal-title">选择美甲师</text>
<text class="modal-subtitle">选择后将重新计算可约时间</text>
</view>
<text class="artist-modal-action primary" bindtap="confirmArtistSheet">确定</text>
</view>
<scroll-view class="artist-list" scroll-y>
<view wx:if="{{artists.length === 0}}" class="time-empty">暂无可选美甲师</view>
<view wx:for="{{artists}}" wx:key="id" class="artist-card {{pendingArtistId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectArtistCard">
<view class="artist-card-left">
<view wx:if="{{item.avatar}}" class="artist-avatar image-avatar">
<image src="{{item.avatar}}" mode="aspectFill"></image>
</view>
<view wx:else class="artist-avatar" style="background: {{item.color}};">{{item.shortName}}</view>
<view class="artist-info">
<view class="artist-name-row">
<text class="artist-name">{{item.name}}</text>
<text class="artist-option-status {{item.statusClass}}">{{item.statusText}}</text>
</view>
<text class="artist-schedule">{{item.scheduleSummary}}</text>
<text class="artist-meta">{{item.metaText}}</text>
</view>
</view>
<view class="artist-check {{pendingArtistId == item.id ? 'active' : ''}}">{{pendingArtistId == item.id ? '✓' : ''}}</view>
</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>