This commit is contained in:
那些花儿
2025-09-11 15:05:02 +08:00
parent e480a7b29e
commit 2714b04f07
@@ -138,16 +138,24 @@ const optionSelect = {
<!-- 联系电话输入 --> <!-- 联系电话输入 -->
<div class="confirm-mobile-section"> <div class="confirm-mobile-section">
<div class="confirm-section-title">联系信息</div> <div class="confirm-section-title">联系信息</div>
<el-form :model="contactForm" ref="contactForm" :rules="contactRules"> <el-form :model="contactForm" ref="contactForm" :rules="contactRules" label-width="80px">
<el-form-item prop="mobile"> <el-form-item prop="mobile" label="联系电话">
<el-input <el-input
v-model="contactForm.mobile" v-model="contactForm.mobile"
placeholder="请输入手机号码" placeholder="请输入手机号码"
maxlength="11" maxlength="11"
clearable> clearable>
<template slot="prepend">联系电话</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="projectInfo.provideMode == 3" prop="receiveAddress" label="收货地址" :rules="[{ required: true, message: '请选择收货地址', trigger: 'change' }]">
<el-select v-model="contactForm.receiveAddress" placeholder="请选择收货地址" style="width: 100%">
<el-option v-for="item in addressOptions"
:key="item.id"
:label="item.userName + ' ' + item.tel + ' ' + item.province + ' ' + item.city + ' ' + item.county + ' ' + item.addressDetail"
:value="item.userName + ' ' + item.tel + ' ' + item.province + ' ' + item.city + ' ' + item.county + ' ' + item.addressDetail">
</el-option>
</el-select>
</el-form-item>
</el-form> </el-form>
</div> </div>
@@ -222,7 +230,8 @@ const optionSelect = {
showOptionDetailDialog: false, // 选项详情弹窗 showOptionDetailDialog: false, // 选项详情弹窗
selectedOption: null, // 当前选中的选项 selectedOption: null, // 当前选中的选项
contactForm: { contactForm: {
mobile: "" // 联系电话 mobile: "", // 联系电话,
receiveAddress: ""
}, },
contactRules: { contactRules: {
mobile: [ mobile: [
@@ -316,7 +325,8 @@ const optionSelect = {
this.selectedRadioId = null this.selectedRadioId = null
this.contactForm = { this.contactForm = {
mobile: "" mobile: "",
receiveAddress: ""
} }
this.getProjectInfo() this.getProjectInfo()
@@ -329,6 +339,11 @@ const optionSelect = {
this.projectInfo = res.data this.projectInfo = res.data
this.deadlineTime = this.projectInfo.choiceTimeEnd this.deadlineTime = this.projectInfo.choiceTimeEnd
// 获取收货地址
if (this.projectInfo.provideMode === 3) {
this.getAddress()
}
// 初始化选项的selectNum为0 // 初始化选项的selectNum为0
if (this.projectInfo.options) { if (this.projectInfo.options) {
this.projectInfo.options.forEach((option) => { this.projectInfo.options.forEach((option) => {
@@ -365,6 +380,13 @@ const optionSelect = {
this.contactForm.mobile = this.userSelection[0]?.mobile this.contactForm.mobile = this.userSelection[0]?.mobile
} }
// 地址回显
if (this.projectInfo.provideMode === 3) {
if (this.userSelection && this.userSelection[0].receiveAddress) {
this.contactForm.receiveAddress = this.userSelection[0].receiveAddress
}
}
// 设置已选择的选项 // 设置已选择的选项
if (this.projectInfo.options && this.userSelection.length > 0) { if (this.projectInfo.options && this.userSelection.length > 0) {
// 单选模式 // 单选模式
@@ -411,7 +433,8 @@ const optionSelect = {
{ {
selectOptionId: this.selectedRadioId, selectOptionId: this.selectedRadioId,
selectNum: 1, selectNum: 1,
mobile: this.contactForm.mobile mobile: this.contactForm.mobile,
receiveAddress: this.contactForm.receiveAddress
} }
] ]
} }
@@ -421,7 +444,8 @@ const optionSelect = {
selections = this.selectedOptions.map((option) => ({ selections = this.selectedOptions.map((option) => ({
selectOptionId: option.id, selectOptionId: option.id,
selectNum: option.selectNum, selectNum: option.selectNum,
mobile: this.contactForm.mobile mobile: this.contactForm.mobile,
receiveAddress: this.contactForm.receiveAddress
})) }))
} }
@@ -501,6 +525,14 @@ const optionSelect = {
event.stopPropagation() event.stopPropagation()
this.selectedOption = option this.selectedOption = option
this.showOptionDetailDialog = true this.showOptionDetailDialog = true
},
// 获取收货地址
async getAddress() {
const resp = await this.$axios.post("/platform/welfare/addressManage/selectUserAddress")
if (resp.code === 0) {
this.addressOptions = resp.data
}
} }
}, },
watch: { watch: {