jiayubo пре 3 месеци
родитељ
комит
314f201058

+ 17 - 0
components/its-calendar/its-calendar.vue

@@ -127,6 +127,23 @@ export default {
   computed: {
     // 计算选中区域
     selectRange() {
+
+      // console.log(this.selectedTimeSlots, '.>>>selectedTimeSlots');
+
+      // let newTimeHostArr = this.timeHostArr
+
+      // console.log(newTimeHostArr, '>>>>newTimeHostArr');
+      
+      // let fArr = []
+      // Object.keys(this.selectedTimeSlots).forEach(key => {
+      //   fArr.push(newTimeHostArr.filter(subArr =>
+      //     subArr.some(item => item.date === key)
+      //   ));
+      // })
+
+      // console.log(fArr, '>>>>fArr');
+
+
       const reservations = this.timeHostArr[this.day_index]
       // return current
       const result = []

+ 24 - 9
pages/common/orderList/userItem.vue

@@ -1,7 +1,6 @@
 <template>
   <view class="item">
     <view class="item-img">
-      <!-- <up-image :show-loading="true" :src="data.volunteerPicture"></up-image> -->
       <image :show-loading="true" :src="data.volunteerPicture"></image>
     </view>
     <view class="item-info">
@@ -46,6 +45,7 @@
 <script setup>
 import { inject } from 'vue';
 import DictTag from '@/components/DictTag/index.vue'
+import { userdictOrderInfo } from '@/api/userList.js'
 
 const props = defineProps({
   data: {
@@ -91,11 +91,23 @@ const btns = [
 ]
 
 //申请退款 
-const handleRefund = (item) => {
+const handleRefund = async (item) => {
   const mainOrderId = item.mainOrderId; // 获取详情id
-  uni.navigateTo({
-    url: `/pages_classify/pages/requestaRefund/requestaRefund?mainOrderId=${mainOrderId}`
-  });
+    const res = await userdictOrderInfo(mainOrderId);
+    if (res.code === 200) {
+      // 成功直接跳转
+      uni.navigateTo({
+        url: `/pages_classify/pages/requestaRefund/requestaRefund?mainOrderId=${mainOrderId}`
+      });
+    } else if (res.code === 500) {
+      // 显示后端返回的错误信息
+      uni.showToast({
+        title: res.msg,
+        icon: 'none',
+        duration: 2000
+      });
+    }
+ 
 };
 // 取消订单
 const handleCancel = (item) => {
@@ -111,6 +123,8 @@ const handlClick = (item) => {
     url: `/pages_classify/pages/orderItem/orderdetails?mainOrderId=${mainOrderId}`
   });
 }
+
+
 </script>
 
 <style lang="scss" scoped>
@@ -128,12 +142,13 @@ const handlClick = (item) => {
   margin-bottom: 25rpx;
 
   .item-img {
-    width: 122rpx;
+    width: 130rpx;
     height: 122rpx;
     display: flex;
     justify-content: center;
     align-items: center;
-
+    margin-left: 10rpx;
+    
     image {
       width: 100%;
       height: 100%;
@@ -154,7 +169,7 @@ const handlClick = (item) => {
     .item-serviceTotalPrice {
       position: absolute;
       top: 20rpx;
-      right: 20rpx;
+      right: 61rpx;
       width: 96rpx;
       height: 42rpx;
       font-family: PingFang SC;
@@ -219,7 +234,7 @@ const handlClick = (item) => {
       // width: 130rpx;
       height: 47rpx;
       position: absolute;
-      left: -130rpx;
+      left: -134rpx;
       top: 2rpx;
       border-top-left-radius: 16rpx;
       border-bottom-right-radius: 16rpx;

+ 81 - 101
pages_classify/pages/orderItem/orderdetails.vue

@@ -23,36 +23,19 @@
     </view>
 
     <view>
-      <up-card
-        title="服务信息"
-        :head-style="{ height: '80rpx', padding: '20rpx' }"
-      >
+      <up-card title="服务信息" :head-style="{ height: '80rpx', padding: '20rpx' }">
         <template #body>
           <view class="card-container">
-            <image
-              class="card-image"
-              :src="listData.volunteerPicture"
-              mode="aspectFill"
-            >
+            <image class="card-image" :src="listData.volunteerPicture" mode="aspectFill">
             </image>
 
             <view class="card-info">
-              <view class="info-item"
-                >服务类别:{{ listData.businessManagementName }}</view
-              >
-              <view class="info-item"
-                >服务时长:{{ listData.serviceDuration }}分钟</view
-              >
-              <view class="info-item"
-                >服务价格:{{ listData.serviceOnePrice }}</view
-              >
-              <view class="info-item"
-                >服务数量:{{ listData.singleQuantity
-                }}{{ listData.businessUnit }}</view
-              >
-              <view class="info-item"
-                >服务类别:{{ listData.businessDescribe }}</view
-              >
+              <view class="info-item">服务类别:{{ listData.businessManagementName }}</view>
+              <view class="info-item">服务时长:{{ listData.serviceDuration }}分钟</view>
+              <view class="info-item">服务价格:{{ listData.serviceOnePrice }}</view>
+              <view class="info-item">服务数量:{{ listData.singleQuantity
+                }}{{ listData.businessUnit }}</view>
+              <view class="info-itemIform">服务描述:{{ listData.businessDescribe }}</view>
             </view>
 
             <view class="card-rating">4.5 评分</view>
@@ -60,17 +43,10 @@
         </template>
       </up-card>
 
-      <up-card
-        title="志愿者介绍"
-        :head-style="{ height: '80rpx', padding: '20rpx' }"
-      >
+      <up-card title="志愿者介绍" :head-style="{ height: '80rpx', padding: '20rpx' }">
         <template #body>
           <view class="card-container">
-            <image
-              class="card-image"
-              :src="listData.volunteerPicture"
-              mode="aspectFill"
-            >
+            <image class="card-image" :src="listData.volunteerPicture" mode="aspectFill">
             </image>
 
             <view class="card-info">
@@ -84,81 +60,62 @@
           </view>
         </template>
       </up-card>
-      <up-card
-        title="技能介绍"
-        :head-style="{ height: '80rpx', padding: '20rpx' }"
-      >
+      <up-card title="技能介绍" :head-style="{ height: '80rpx', padding: '20rpx' }">
         <template #body>
           {{ listData.skillDescribe }}
         </template>
       </up-card>
       <up-card title="证书" :head-style="{ height: '80rpx', padding: '20rpx' }">
         <template #body>
-          <view
-            class="certificate-container"
-            v-if="certificationPictures.length > 0"
-          >
-            <image
-              v-for="(image, index) in certificationPictures"
-              :key="index"
-              :src="image"
-              mode="widthFix"
-              class="certificate-img"
-              @click="previewImage(image, certificationPictures)"
-            ></image>
+          <view class="certificate-container" v-if="certificationPictures.length > 0">
+            <image v-for="(image, index) in certificationPictures" :key="index" :src="image" mode="widthFix"
+              class="certificate-img" @click="previewImage(image, certificationPictures)"></image>
           </view>
           <view v-else class="no-certificate">暂无证书</view>
         </template>
       </up-card>
     </view>
 
-      <up-card
-        v-for="(item, index) in listData.secondOrderList"
-        :key="index"
-        :title="'订单号'"
-      >
-        <template #head>
-          <view class="custom-order-title">
-            <text>订单号:</text>
-            <text class="order-number">{{ item.secondOutTradeNo }}</text>
-          </view>
-        </template>
-        <template #body>
-          <view class="list-item">
-            <image
-              :src="listData.volunteerPicture"
-              mode="aspectFill"
-              class="item-image"
-            >
-            </image>
-            <view class="item-info">
-              <view class="info-line">
-                服务类别:{{ listData.businessManagementName }}
-              </view>
-              <text>服务价格:{{ item.serviceTotalPrice }}</text>
-               <view class="info-item"
-                >服务数量:{{ listData.singleQuantity
-                }}{{ listData.businessUnit }}</view
-              >
-              <text
-                >服务状态:{{
-                  dictSortMap[item.orderStatus] || item.orderStatus
-                }}</text
-              >
+    <up-card v-for="(item, index) in listData.secondOrderList" :key="index" :title="'订单号'">
+      <template #head>
+        <view class="custom-order-title">
+          <text>订单号:</text>
+          <text class="order-number">{{ item.secondOutTradeNo }}</text>
+        </view>
+      </template>
+      <template #body>
+        <view class="list-item">
+          <image :src="listData.volunteerPicture" mode="aspectFill" class="item-image">
+          </image>
+          <view class="item-info">
+            <view class="info-line">
+              服务类别:{{ listData.businessManagementName }}
             </view>
-            <view class="right-corner-container" v-if="item.orderStatus !== '1'">
-              <up-button
-                type="error"
-                text="评论"
-                size="mini"
-                @click="handlButClick(item)"
-                :customStyle="hadlClickError"
-              ></up-button>
+            <text>服务价格:<text style="color: red">¥{{ item.serviceTotalPrice }}</text></text>
+            <view class="info-item">服务数量:{{ listData.singleQuantity
+              }}{{ listData.businessUnit }}</view>
+            <text>服务状态:{{
+              dictSortMap[item.orderStatus] || item.orderStatus
+              }}</text>
+            <view class="info-line">
+              预计开始服务日期:{{ item.workDate }}
             </view>
+            <view class="info-line">
+              预计开始服务时间:{{ item.workStartTime }}
+            </view>
+            <view class="info-line">
+              预计结束服务时间:{{ item.workEndTime }}
+            </view>
+
           </view>
-        </template>
-      </up-card>
-    </view>
+          <view class="right-corner-container" v-if="item.orderStatus !== '1'">
+            <up-button type="error" text="评论" size="mini" @click="handlButClick(item)"
+              :customStyle="hadlClickError"></up-button>
+          </view>
+        </view>
+      </template>
+    </up-card>
+  </view>
 </template>
 
 <script setup>
@@ -202,13 +159,25 @@ async function getData() {
 }
 
 const handlButClick = (item) => {
+  // 直接跳转到userComment页面并传递必要数据
   uni.navigateTo({
-    url: `/pages_classify/pages/orderItem/userComment?mainOrderId=${
-      mainOrderId.value
-    }&secondOrderId=${item.secondOrderId}&data=${encodeURIComponent(
-      JSON.stringify(listData.value)
-    )}`,
-  })
+    url: `/pages_classify/pages/orderItem/userComment?secondOrderId=${item.secondOrderId}`
+  });
+  
+  // 在跳转前存储必要数据
+  uni.setStorage({
+    key: 'orderDetailsData',
+    data: {
+      volunteerPicture: listData.value.volunteerPicture,
+      businessManagementName: listData.value.businessManagementName,
+      volunteerName: listData.value.volunteerName,
+      volunteerInfoId: listData.value.volunteerInfoId,
+      secondOrderId: item.secondOrderId
+    },
+    fail: (err) => {
+      console.error('保存订单数据失败', err);
+    }
+  });
 }
 
 // 获取传递的参数
@@ -308,12 +277,23 @@ onMounted(() => {
 }
 
 .info-item {
-  margin-bottom: 24rpx;
+  margin-bottom: 15rpx;
   font-size: 28rpx;
   line-height: 1.6;
   color: #333;
 }
 
+.info-itemIform{
+  display: -webkit-box;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  margin-bottom: 15rpx;
+  font-size: 28rpx;
+  line-height: 1.6;
+  color: #333;
+}
 /* 右上角评分 */
 .card-rating {
   position: absolute;

+ 0 - 1
pages_classify/pages/orderItem/userComment.vue

@@ -140,7 +140,6 @@
 	}
 
 	onLoad(async (options) => {
-		// 使用 uni.getStorage 获取存储的数据,而不是从 URL 参数解析
 		uni.getStorage({
 			key: 'orderDetailsData',
 			success: function(res) {

+ 27 - 20
pages_home/components/setupUserCopy/Add.vue

@@ -10,13 +10,13 @@
           <up-icon name="arrow-right"></up-icon>
         </template>
       </up-form-item>
-      <up-form-item label="关系" prop="label" borderBottom @click="() => (labelFlag = true)" labelWidth="70">
+      <!-- <up-form-item label="关系" prop="label" borderBottom @click="() => (labelFlag = true)" labelWidth="70">
         <up-input v-model="modelForm.label" disabled disabledColor="#ffffff" placeholder="请选择关系"
           border="none"></up-input>
         <template #right>
           <up-icon name="arrow-right"></up-icon>
         </template>
-      </up-form-item>
+      </up-form-item> -->
       <up-form-item label="年龄" prop="age" borderBottom labelWidth="70">
         <up-input v-model="modelForm.age" border="none" placeholder="请输入年龄"></up-input>
       </up-form-item>
@@ -48,7 +48,7 @@
       <up-form-item label="地址" prop="address" borderBottom labelWidth="70">
         <up-input v-model="modelForm.address" border="none" placeholder="请输入地址"></up-input>
       </up-form-item>
-      <up-form-item label="地址" prop="detailAddress" borderBottom labelWidth="70">
+      <up-form-item label="门牌号" prop="detailAddress" borderBottom labelWidth="70">
         <up-input v-model="modelForm.detailAddress" border="none" placeholder="请输入地址"></up-input>
       </up-form-item>
     </up-form>
@@ -69,10 +69,12 @@ const formRef = ref(null)
 const modelForm = ref({
   name: '',
   sex: '',
-  label: '',
+  // label: '',
   age: '',
   telephone: '',
-  detailAddress:'',
+  detailAddress: '',
+  address: '',
+
 
   provinceName: '', // 省
   provinceCode: '',
@@ -86,7 +88,6 @@ const modelForm = ref({
   districtCode: '',
   districtInd: 0,
 
-  address: '',
 })
 
 const rulesForm = ref({
@@ -96,30 +97,36 @@ const rulesForm = ref({
     message: '请填写姓名',
     trigger: ['blur', 'change'],
   },
-  sex: {
-    type: 'string',
-    required: true,
-    message: '请选择性别',
-    trigger: ['change'],
-  },
-  label: {
+  // sex: {
+  //   type: 'string',
+  //   required: true,
+  //   message: '请选择性别',
+  //   trigger: ['change'],
+  // },
+  // userInfo: {
+  //   type: 'string',
+  //   required: true,
+  //   message: '请填写年龄',
+  //   trigger: ['blur', 'change'],
+  // },
+  telephone: {
     type: 'string',
     required: true,
-    message: '请选择关系',
-    trigger: ['change'],
+    message: '请填写手机号',
+    trigger: ['blur', 'change'],
   },
-  userInfo: {
+  address: {
     type: 'string',
     required: true,
-    message: '请填写年龄',
+    message: '请填写地址',
     trigger: ['blur', 'change'],
   },
-  telephone: {
+  detailAddress: {
     type: 'string',
     required: true,
-    message: '请填写手机号',
+    message: '请填写门牌号',
     trigger: ['blur', 'change'],
-  },
+  }
 })
 
 let sexFlag = ref(false)

+ 34 - 6
pages_home/pages/Volunteerside/goodsDetails.vue

@@ -122,16 +122,18 @@
             <text class="service-price">¥{{ businessPrice }}</text>
           </view>
           <view class="service-info-item">
-            <text class="service-label">服务类别:</text>
-            <up-text type="info" class="service-value" text="家庭教育"></up-text>
+            <text class="service-label1">服务类别:{{ listData.businessTierName }}</text>
+            <!-- <up-text type="info" class="service-value" text="家庭教育"></up-text> -->
           </view>
           <view class="service-info-item">
             <text class="service-label">上门服务次数:</text>
             <up-number-box
-              :modelValue="singleQuantity"
+              v-model="singleQuantity"
               :min="listData.minQuantity"
               :max="minQuantityMax"
               class="service-number-box"
+              :disabled="isChanging"
+              :longPress="false"
               @change="valChange"
             ></up-number-box>
             <view class="service-values">{{ listData.minQuantity + listData.businessUnit }}</view>
@@ -263,7 +265,7 @@
         <up-line></up-line>
 
         <!-- 钱包支付选项 -->
-        <view class="payment-option">
+        <!-- <view class="payment-option">
           <view class="option-left">
             <image src="/static/钱包.png" class="payment-icon"></image>
             <text class="option-text">钱包</text>
@@ -282,7 +284,7 @@
             ></up-radio>
           </up-radio-group>
         </view>
-        <up-line></up-line>
+        <up-line></up-line> -->
 
         <!-- 微信支付选项 -->
         <view class="payment-option">
@@ -369,6 +371,7 @@ import Detiles from './detiles.vue'
 // )
 const itsCalendarRef = ref(null)
 const businessPrice = ref() //价格
+const isChanging = ref(false) // 步进器防抖
 const singleQuantity = ref(1) // 购买次数,默认为1,不可为0
 const volunteerId = ref('') // 存储志愿者ID
 const serviceCategory = ref('') //存储大类别
@@ -552,6 +555,7 @@ onLoad(async (options) => {
 
 // 添加步进器值变化处理函数
 const valChange = (obj) => {
+  
   // const durationMs = listData.value.businessDuration * obj.value * 60
   const durationMs = businessDurationComputed.value * obj.value * 60
 
@@ -559,6 +563,25 @@ const valChange = (obj) => {
   const b = itsCalendarRef.value.timeHostArr
   const c = itsCalendarRef.value.day_index
 
+  
+  let selectLength = [] // 所有日期選擇數組匯總
+  const disFlag = false // 是否多选参数 / 备用禁用步进器
+
+  Object.keys(itsCalendarRef.value.selectedTimeSlots).forEach(i => {
+    selectLength.push(...itsCalendarRef.value.selectedTimeSlots[i])
+  })
+
+  
+
+  if (selectLength.length > 1) {
+    setTimeout(() => {
+      singleQuantity.value = obj.value - 1
+    }, 100)
+    
+    uni.showToast({ title: '请选择单个时间进行调整服务次数', icon: 'none' })
+    return false
+  }
+
   // const seconds = listData.value.businessDuration * obj.value * 60
   const seconds = businessDurationComputed.value * obj.value * 60
   const endTimestamp = a.timeStamp + durationMs
@@ -1286,7 +1309,12 @@ onMounted(async () => {
   color: #666;
   flex-shrink: 0;
 }
-
+.service-label1{
+  width: 400rpx;
+    font-size: 28rpx;
+    color: #666;
+    flex-shrink: 0;
+}
 .service-value {
   font-size: 28rpx;
   color: #333;

+ 65 - 39
pages_home/pages/setupUser/Address.vue

@@ -1,23 +1,11 @@
 <template>
   <view>
-    <template v-for="(item, index) in addInfoArr" :key="index">
-      <add-component ref="addComponentRef"></add-component>
-    </template>
+    <add-component v-for="(item, index) in addInfoArr" :key="index"
+      :ref="el => { if (el) addComponentRef[index] = el }"></add-component>
     <view class="Wrapper-Btn">
-      <up-button
-        @click="handleQux"
-        type="error"
-        :plain="true"
-        :hairline="true"
-        text="取消"
-        :customStyle="hadlClickEdit"
-      ></up-button>
-      <up-button
-        type="error"
-        text="确定"
-        @click="handlOk"
-        :customStyle="hadlClickEdit"
-      ></up-button>
+      <up-button @click="handleQux" type="error" :plain="true" :hairline="true" text="取消"
+        :customStyle="hadlClickEdit"></up-button>
+      <up-button type="error" text="确定" @click="handlOk" :customStyle="hadlClickEdit"></up-button>
     </view>
   </view>
 </template>
@@ -28,7 +16,7 @@ import { useraDdressData } from '@/api/userSettings.js'
 import pickerAddress from '@/pages_home/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
 import addComponent from '@/pages_home/components/setupUserCopy/Add.vue'
 
-const addComponentRef = ref(null)
+const addComponentRef = ref([])
 
 const addInfoArr = ref([{}])
 
@@ -37,34 +25,73 @@ function handleAdd() {
 }
 
 const handlOk = async () => {
-  const params = []
-  addInfoArr.value.forEach((item, index) => {
-    params.push(addComponentRef.value[index].modelForm)
-  })
+  // 验证所有表单是否填写完整
+  let isValid = true
+
+  // 遍历所有地址组件,验证每个表单
+  for (let i = 0; i < addComponentRef.value.length; i++) {
+    const formRef = addComponentRef.value[i].$refs.formRef
+    if (formRef) {
+      try {
+        // 触发表单验证,返回验证结果
+        await formRef.validate().catch(error => {
+          console.error('验证错误:', error)
+          isValid = false
+        })
+      } catch (error) {
+        console.error('验证出错:', error)
+        isValid = false
+      }
+    }
+  }
+
+  // 只有全部验证通过才调用接口
+  if (isValid) {
+    const params = []
+    addComponentRef.value.forEach((item) => {
+      params.push(item.modelForm)
+    })
 
-  params.forEach(async (obj) => {
-    const res = await useraDdressData(obj)
-    if (res.code == 200) {
+    // 提交数据
+    let success = true
+    for (let i = 0; i < params.length; i++) {
+      try {
+        const res = await useraDdressData(params[i])
+        if (res.code != 200) {
+          success = false
+        }
+      } catch (error) {
+        console.error('提交数据失败:', error)
+        success = false
+      }
+    }
+    
+    if (success) {
       uni.showToast({
         title: '新增成功',
-        icon: 'success', // 或者 'none'
-        duration: 1500, // 显示时间,单位毫秒,默认1500
-        mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
+        icon: 'success',
+        duration: 1500,
+        mask: true,
       })
+      
+      // 成功后延迟返回上一页
       setTimeout(() => {
-        uni.navigateTo({
-          url: `/pages_home/components/volunteerSide/adresss`
+        uni.navigateBack({
+          delta: 1
         })
       }, 1500)
+    } else {
+      uni.showToast({
+        title: '新增失败',
+        icon: 'none'
+      })
     }
-  })
-  
-  
-  setTimeout(() => {
-	  uni.navigateBack({
-	  	delta: 1
-	  })
-  })
+  } else {
+    uni.showToast({
+      title: '请填写完整信息',
+      icon: 'none'
+    })
+  }
 }
 
 const handleQux = () => {
@@ -88,4 +115,3 @@ const hadlClickEdit = {
   align-items: center;
 }
 </style>
-

+ 15 - 8
pages_mine/components/setupUser/Add.vue

@@ -82,7 +82,9 @@ const modelForm = ref({
   label: '',
   age: '',
   telephone: '',
-  detailAddress:'',
+  detailAddress: '',
+  address: '',
+
 
   provinceName: '', // 省
   provinceCode: '',
@@ -96,7 +98,6 @@ const modelForm = ref({
   districtCode: '',
   districtInd: 0,
 
-  address: '',
 })
 
 const rulesForm = ref({
@@ -106,12 +107,12 @@ const rulesForm = ref({
     message: '请填写姓名',
     trigger: ['blur', 'change'],
   },
-  sex: {
-    type: 'string',
-    required: true,
-    message: '请选择性别',
-    trigger: ['change'],
-  },
+  // sex: {
+  //   type: 'number',
+  //   required: true,
+  //   message: '请选择性别',
+  //   trigger: ['change', 'blur'],
+  // },
   label: {
     type: 'string',
     required: true,
@@ -136,6 +137,12 @@ const rulesForm = ref({
     message: '请填写门牌号',
     trigger: ['blur', 'change'],
   },
+  address: {
+    type: 'string',
+    required: true,
+    message: '请填写地址',
+    trigger: ['blur', 'change'],
+  },
 })
 
 let sexFlag = ref(false)

+ 48 - 26
pages_mine/pages/setupUser/Address.vue

@@ -1,8 +1,10 @@
 <template>
   <view>
-    <template v-for="(item, index) in addInfoArr" :key="index">
-      <add-component ref="addComponentRef"></add-component>
-    </template>
+    <add-component 
+      v-for="(item, index) in addInfoArr" 
+      :key="index" 
+      :ref="el => { if(el) addComponentRef[index] = el }"
+    ></add-component>
     <view class="Wrapper-Btn">
       <up-button
         @click="handleQux"
@@ -28,7 +30,7 @@ import { useraDdressData } from '@/api/userSettings.js'
 import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
 import addComponent from '@/pages_mine/components/setupUser/Add.vue'
 
-const addComponentRef = ref(null)
+const addComponentRef = ref([])
 
 const addInfoArr = ref([{}])
 
@@ -37,30 +39,50 @@ function handleAdd() {
 }
 
 const handlOk = async () => {
-  const params = []
-  addInfoArr.value.forEach((item, index) => {
-    params.push(addComponentRef.value[index].modelForm)
-  })
+  // 验证所有表单是否填写完整
+  let isValid = true
+  
+  // 遍历所有地址组件,验证每个表单
+  for (let i = 0; i < addComponentRef.value.length; i++) {
+    const formRef = addComponentRef.value[i].$refs.formRef
+    if (formRef) {
+      try {
+        // 直接触发表单验证,会自动显示错误提示
+        const valid = await formRef.validate()
+        if (!valid) {
+          isValid = false
+        }
+      } catch (error) {
+        isValid = false
+      }
+    }
+  }
+
+  // 只有全部验证通过才调用接口
+  if (isValid) {
+    const params = []
+    addComponentRef.value.forEach((item) => {
+      params.push(item.modelForm)
+    })
 
-  params.forEach(async (obj) => {
-    const res = await useraDdressData(obj)
-    if (res.code == 200) {
-      uni.showToast({
-        title: '新增成功',
-        icon: 'success', // 或者 'none'
-        duration: 1500, // 显示时间,单位毫秒,默认1500
-        mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
-      })
-      setTimeout(() => {
-        // uni.navigateBack({
-        // 	delta: 2
-        // })
-        uni.navigateTo({
-          url: '/pages_mine/pages/selectAddress/index',
+    // 提交数据
+    params.forEach(async (obj) => {
+      const res = await useraDdressData(obj)
+      if (res.code == 200) {
+        uni.showToast({
+          title: '新增成功',
+          icon: 'success',
+          duration: 1500,
+          mask: true,
         })
-      }, 1500)
-    }
-  })
+        setTimeout(() => {
+          uni.navigateTo({
+            url: '/pages_mine/pages/selectAddress/index',
+          })
+        }, 1500)
+      }
+    })
+  }
 }
 
 const handleQux = () => {