优化:统一小程序业务引用选择交互

This commit is contained in:
2026-10-12 22:24:24 +08:00
parent fa1fed006e
commit 3b98e4746a
31 changed files with 1378 additions and 504 deletions
@@ -1,27 +1,14 @@
<view class="page no-tab">
<view class="card form-card">
<view class="customer-select">
<view class="field">
<text class="field-label required">客户姓名</text>
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" />
</view>
<view class="field">
<text class="field-label required">手机号</text>
<input value="{{form.phone}}" data-field="phone" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" maxlength="11" type="number" placeholder="搜索或输入手机号" />
</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 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">
@@ -44,9 +31,10 @@
</view>
<view class="field">
<text class="field-label required">指定员工</text>
<picker range="{{artists}}" range-key="name" bindchange="onArtistChange">
<view class="field-value">{{selectedArtist.name || '请选择美甲师'}}</view>
</picker>
<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>
@@ -79,6 +67,65 @@
<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">