fix(escort): 收货地址改为选填并去掉下单必填校验

This commit is contained in:
lik
2026-11-05 20:15:39 +08:00
parent f45f2f4be3
commit 1de3f0cde6
4 changed files with 50 additions and 6 deletions
+23 -1
View File
@@ -195,7 +195,19 @@ Page({
sex: item.profile?.sex || '', sex: item.profile?.sex || '',
birth: item.profile?.birth || '' birth: item.profile?.birth || ''
})) }))
// 默认选中第一个就诊人,信息随档案一键带入
const first = profiles[0]
if (first && !this.data.selectedProfileId) {
this.setData({
profiles,
selectedProfileId: first._id,
patientName: first.name,
patientPhone: first.mobile,
selectedPatient: first
})
} else {
this.setData({ profiles }) this.setData({ profiles })
}
}) })
.catch((err) => { .catch((err) => {
console.log('获取就诊人列表失败', err) console.log('获取就诊人列表失败', err)
@@ -299,7 +311,7 @@ Page({
} }
if (!data.appointmentDate) return '请选择预约日期' if (!data.appointmentDate) return '请选择预约日期'
if (!data.appointmentTime) return '请选择预约时间' if (!data.appointmentTime) return '请选择预约时间'
if (data.requiresAddress && !data.shippingAddress.trim()) return '请填写完整收货地址' // 收货地址选填:跑腿/买药未填地址时由客服线下确认
if (!/^1[3-9]\d{9}$/.test(data.selectedPatient.mobile.trim())) { if (!/^1[3-9]\d{9}$/.test(data.selectedPatient.mobile.trim())) {
return '就诊人手机号有误,请到就诊人档案修改' return '就诊人手机号有误,请到就诊人档案修改'
} }
@@ -372,6 +384,16 @@ Page({
remark: '', remark: '',
shippingAddress: '' shippingAddress: ''
}, () => this.refreshHospitalOptions(provinces[0] || '')) }, () => this.refreshHospitalOptions(provinces[0] || ''))
// 重置后仍默认选中第一个就诊人,方便连续预约
const first = this.data.profiles[0]
if (first) {
this.setData({
selectedProfileId: first._id,
patientName: first.name,
patientPhone: first.mobile,
selectedPatient: first
})
}
this.idempotencyKey = '' this.idempotencyKey = ''
}, },
+1 -1
View File
@@ -197,7 +197,7 @@
<!-- 收货地址仅对快递/跑腿服务展示,随订单保存快照 --> <!-- 收货地址仅对快递/跑腿服务展示,随订单保存快照 -->
<view class="order-row column" wx:if="{{requiresAddress}}"> <view class="order-row column" wx:if="{{requiresAddress}}">
<text class="order-label">收货地址</text> <text class="order-label">收货地址(选填)</text>
<textarea class="order-textarea" value="{{shippingAddress}}" placeholder="请输入省市区、街道门牌等完整收货地址" maxlength="200" placeholder-class="input-placeholder" bindinput="onShippingAddressChange" /> <textarea class="order-textarea" value="{{shippingAddress}}" placeholder="请输入省市区、街道门牌等完整收货地址" maxlength="200" placeholder-class="input-placeholder" bindinput="onShippingAddressChange" />
<text class="address-tip">收货人与联系电话使用所选就诊人信息</text> <text class="address-tip">收货人与联系电话使用所选就诊人信息</text>
</view> </view>
+23 -1
View File
@@ -176,7 +176,19 @@ Page({
sex: item.profile?.sex || '', sex: item.profile?.sex || '',
birth: item.profile?.birth || '' birth: item.profile?.birth || ''
})) }))
// 默认选中第一个就诊人,信息随档案一键带入
const first = profiles[0]
if (first && !this.data.selectedProfileId) {
this.setData({
profiles,
selectedProfileId: first._id,
patientName: first.name,
patientPhone: first.mobile,
selectedPatient: first
})
} else {
this.setData({ profiles }) this.setData({ profiles })
}
}) })
.catch((err) => { .catch((err) => {
console.log('获取就诊人列表失败', err) console.log('获取就诊人列表失败', err)
@@ -283,7 +295,7 @@ Page({
} }
if (!data.appointmentDate) return '请选择预约日期' if (!data.appointmentDate) return '请选择预约日期'
if (!data.appointmentTime) return '请选择预约时间' if (!data.appointmentTime) return '请选择预约时间'
if (data.requiresAddress && !data.shippingAddress.trim()) return '请填写完整收货地址' // 收货地址选填:跑腿/买药未填地址时由客服线下确认
if (!/^1[3-9]\d{9}$/.test(data.selectedPatient.mobile.trim())) { if (!/^1[3-9]\d{9}$/.test(data.selectedPatient.mobile.trim())) {
return '就诊人手机号有误,请到就诊人档案修改' return '就诊人手机号有误,请到就诊人档案修改'
} }
@@ -446,6 +458,16 @@ Page({
remark: '', remark: '',
shippingAddress: '' shippingAddress: ''
}, () => this.refreshHospitalOptions(provinces[0] || '')) }, () => this.refreshHospitalOptions(provinces[0] || ''))
// 重置后仍默认选中第一个就诊人,方便连续预约
const first = this.data.profiles[0]
if (first) {
this.setData({
selectedProfileId: first._id,
patientName: first.name,
patientPhone: first.mobile,
selectedPatient: first
})
}
this.idempotencyKey = this.createIdempotencyKey() this.idempotencyKey = this.createIdempotencyKey()
} }
}) })
+1 -1
View File
@@ -105,7 +105,7 @@
<!-- 收货地址仅对快递/跑腿服务展示,随订单保存快照 --> <!-- 收货地址仅对快递/跑腿服务展示,随订单保存快照 -->
<view class="order-row column" wx:if="{{requiresAddress}}"> <view class="order-row column" wx:if="{{requiresAddress}}">
<text class="order-label">收货地址</text> <text class="order-label">收货地址(选填)</text>
<textarea class="order-textarea" value="{{shippingAddress}}" placeholder="请输入省市区、街道门牌等完整收货地址" maxlength="200" placeholder-class="input-placeholder" bindinput="onShippingAddressChange" /> <textarea class="order-textarea" value="{{shippingAddress}}" placeholder="请输入省市区、街道门牌等完整收货地址" maxlength="200" placeholder-class="input-placeholder" bindinput="onShippingAddressChange" />
<text class="address-tip">收货人与联系电话使用所选就诊人信息</text> <text class="address-tip">收货人与联系电话使用所选就诊人信息</text>
</view> </view>