This commit is contained in:
2025-12-17 20:10:08 +08:00
parent 6351aaba48
commit c35bea7cc7
23 changed files with 288 additions and 241 deletions
@@ -686,6 +686,27 @@ layout("/layouts/platform_h5.html"){
<div class="confirm-content-scroll">
<!-- 手机号输入 -->
<div class="mobile-input-section">
<!--收货地址-->
<van-field
v-if="projectInfo.provideMode == 3"
v-model="formData.receiveAddress"
label="收货地址"
rows="2"
type="textarea"
placeholder="请选择收货地址"
readonly
is-link
@click="showAddressSheet = true"
required
></van-field>
<van-field
v-model="formData.userName"
label="收货人"
placeholder="请输入收货人"
:error="userNameError"
@focus="userNameError = false"
required
></van-field>
<van-field
v-model="formData.mobile"
label="联系电话"
@@ -695,19 +716,6 @@ layout("/layouts/platform_h5.html"){
maxlength="11"
required
></van-field>
<!--收货地址-->
<van-field
v-if="projectInfo.provideMode == 3"
v-model="formData.receiveAddress"
label="收货地址"
rows="4"
type="textarea"
placeholder="请选择收货地址"
readonly
is-link
@click="showAddressSheet = true"
required
></van-field>
</div>
<!-- 选择内容 -->
@@ -813,10 +821,12 @@ layout("/layouts/platform_h5.html"){
showOptionDetailDialog: false, // 选项详情弹窗
selectedOption: null, // 当前选中的选项
mobileError: false, // 手机号错误标记
userNameError: false, // 收货人错误标记
formData: {
userSign: "", // 用户签名
mobile: "", // 手机号码
address: "" // 收货地址
address: "",// 收货地址
userName: "",//收货人
},
addressOptions: [],
@@ -941,14 +951,17 @@ layout("/layouts/platform_h5.html"){
// 如果有用户选择数据,从中获取手机号
if (this.userSelection && this.userSelection.length > 0 && this.userSelection[0].mobile) {
this.formData.mobile = this.userSelection[0].mobile
this.formData.userName = this.userSelection[0].userName
// 获取签名信息(如果有)
if (this.userSelection[0].userSign) {
this.formData.userSign = this.userSelection[0].userSign
}
} else if (this.$store.user && this.$store.user.mobile) {
} else if (this.$store.state.user && this.$store.state.user.mobile) {
// 如果没有选择过,使用store中的默认手机号
this.formData.mobile = this.$store.user.mobile
this.formData.mobile = this.$store.state.user.mobile
}else if (this.$store.state.user && this.$store.state.user.username){
this.formData.userName = this.$store.state.user.username
}
// 地址回显
@@ -995,6 +1008,11 @@ layout("/layouts/platform_h5.html"){
return
}
// 验证收货人
if (!this.validateUserName()) {
return;
}
// 验证手机号
if (!this.validateMobile()) {
return
@@ -1030,7 +1048,8 @@ layout("/layouts/platform_h5.html"){
{
selectOptionId: this.selectedRadioId,
selectNum: 1,
mobile: this.formData.mobile
mobile: this.formData.mobile,
userName: this.formData.userName
}
]
}
@@ -1040,7 +1059,8 @@ layout("/layouts/platform_h5.html"){
selections = this.selectedOptions.map((option) => ({
selectOptionId: option.id,
selectNum: option.selectNum,
mobile: this.formData.mobile
mobile: this.formData.mobile,
userName: this.formData.userName
}))
}
@@ -1101,6 +1121,16 @@ layout("/layouts/platform_h5.html"){
return true
},
// 验证收货人
validateUserName() {
if (!this.formData.userName) {
this.userNameError = true;
this.$toast.fail("请输入收货人姓名");
return false;
}
return true;
},
// 格式化时间范围
formatTimeRange(start, end) {
if (!start || !end) return "未设置"
@@ -1198,8 +1228,10 @@ layout("/layouts/platform_h5.html"){
// 选择收货地址
selectAddress(address) {
this.formData.receiveAddress =
"收货人:" + address.userName + ",联系电话:" + address.tel + ",收货地址:" + address.province + address.city + address.county + address.addressDetail
// "收货人:" + address.userName + ",联系电话:" + address.tel + ",收货地址:" +
this.formData.userName = address.userName
this.formData.mobile = address.tel
this.formData.receiveAddress = address.province + address.city + address.county + address.addressDetail
this.showAddressSheet = false
},