优化店务小程序店铺设置和表单体验

This commit is contained in:
2026-07-22 15:41:12 +08:00
parent 492cbab0fd
commit b9989f8344
14 changed files with 543 additions and 44 deletions
@@ -598,6 +598,7 @@ Page({
},
customerOptions: [],
customerDropdownVisible: false,
customerNameFocused: false,
customerLoading: false,
customerError: '',
products: [],
@@ -651,6 +652,9 @@ Page({
}
this.loadOptions()
this.searchCustomers()
wx.nextTick(() => {
this.setData({ customerNameFocused: true })
})
},
async loadOptions() {
@@ -745,7 +749,10 @@ Page({
onCustomerFocus(event) {
const field = event.currentTarget.dataset.field
this.setData({ customerDropdownVisible: true })
this.setData({
customerDropdownVisible: true,
customerNameFocused: field === 'customerName'
})
this.searchCustomers(field)
},
@@ -794,7 +801,10 @@ Page({
hideCustomerDropdown() {
setTimeout(() => {
this.setData({ customerDropdownVisible: false })
this.setData({
customerDropdownVisible: false,
customerNameFocused: false
})
}, 180)
},
@@ -1,9 +1,9 @@
<view class="page no-tab">
<view class="card form-card">
<view class="customer-select">
<view class="field">
<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="搜索或输入客户姓名" />
<input value="{{form.customerName}}" data-field="customerName" bindinput="onInput" bindfocus="onCustomerFocus" bindblur="hideCustomerDropdown" placeholder="搜索或输入客户姓名" focus="{{customerNameFocused}}" />
</view>
<view class="field">
<text class="field-label">手机号</text>
@@ -1,3 +1,35 @@
.form-card {
padding: 8rpx 0;
overflow: visible;
}
.form-card .field {
min-height: 112rpx;
padding: 12rpx 24rpx;
}
.form-card .field-label {
width: 180rpx;
min-width: 180rpx;
color: #62574d;
font-weight: 800;
}
.form-card .field input,
.form-card .field-value {
min-height: 72rpx;
padding: 0 22rpx;
border: 1rpx solid #eadfd2;
border-radius: 18rpx;
background: #fffdf8;
line-height: 72rpx;
}
.form-card .field.is-focused input {
border-color: #78a78f;
box-shadow: 0 0 0 4rpx rgba(120, 167, 143, 0.12);
}
.unit {
color: #9a9288;
font-size: 24rpx;