Просмотр исходного кода

用户下单选择时间回显

jiayubo 1 неделя назад
Родитель
Сommit
0c824c5595

+ 4 - 1
components/its-calendar/its-calendar.vue

@@ -59,6 +59,7 @@
 		watch: {
 			timeArr: {
 				handler(newVal) {
+					console.log(newVal, '>>>>>>>时间范围');
 					let dateArr = newVal.map(item => {
 						let day = new Date(item)
 						const daysOfWeek = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
@@ -69,10 +70,12 @@
 					})
 					this.dayArr = dateArr
 				},
-				immediate: true
+				immediate: true,
+				deep: true
 			},
 			timeHostArr: {
 				handler(newVal) {
+					console.log(newVal, '>>>>>>>时间更新');
 					// 当timeHostArr更新时,恢复之前的选择状态
 					if (newVal && newVal.length > 0) {
 						this.restoreSelections();

+ 7 - 7
pages.json

@@ -122,13 +122,13 @@
 					"style": {
 						"navigationBarTitleText": "新增地址"
 					}
-				}
-        // {
-        //   "path": "pages/selectAddress/index",
-        //   "style": {
-        //     "navigationBarTitleText": "地址列表"
-        //   }
-        // }
+				},
+        {
+          "path": "components/volunteerSide/adresss",
+          "style": {
+            "navigationBarTitleText": "地址列表"
+          }
+        }
 			]
 		},
 		{

+ 1 - 1
pages_home/components/setupUserCopy/Add.vue

@@ -127,7 +127,7 @@
 
 <script setup>
 import { ref, reactive, computed } from 'vue'
-import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
+import pickerAddress from '@/pages_home/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
 import { splitAddress } from '@/utils/adress'
 import config from '@/config'
 const mapKey = config.mapKey // 从配置文件中直接获取腾讯地图key

+ 1 - 1
pages_home/components/volunteerSide/adresss.vue

@@ -56,7 +56,7 @@
 
   	const handlHeader = () => {
 		uni.navigateTo({
-			url: `/pages_mine/pages/setupUser/Address`
+			url: `/pages_home/pages/setupUser/Address`
 		});
 	}
 

+ 1 - 1
pages_home/pages/Volunteerside/goodsDetails.vue

@@ -415,7 +415,7 @@
 					hours: item.reservationTime,
 					timeStamp: new Date(`${date} ${item.reservationTime}`).getTime() / 1000,
 					date: date,
-					checked: false,
+					// checked: false,  // 每次点击请求时间后,延续之前选中状态,不初始化选中 
 					disabled
 				}
 			});

+ 1 - 1
pages_home/pages/selectAddress/edit.vue

@@ -68,7 +68,7 @@
 		useraDdress,
 	} from "@/api/userSettings.js"
 	// import pickerAddress from '@/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
-	import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
+	import pickerAddress from '@/pages_home/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
 	import {
 		splitAddress
 	} from '@/utils/adress'

+ 0 - 256
pages_home/pages/selectAddress/index.vue

@@ -1,256 +0,0 @@
-<template>
-  <view class="address-list">
-    <!-- 上方区域:图片和"新增"文字在右边 -->
-    <!-- <view class="header">
-			<view class="add-item" @click="handlHeader">
-				<image src="../../../static/img/新增.png" mode=""></image>
-				<text>新增</text>
-			</view>
-		</view> -->
-
-    <up-radio-group v-model="radioValue" @change="handleRadioChange">
-      <view v-for="(item, index) in dataList" :key="index" class="address-item">
-        <!-- 左侧单选框 -->
-        <view class="radio-group">
-          <up-radio
-            shape="circle"
-            activeColor="red"
-            :name="item.addressId"
-          ></up-radio>
-        </view>
-
-        <!-- 中间内容区(自动伸缩) -->
-        <view class="content-wrapper">
-          <view class="address-line">
-            <text class="address-text">
-              {{ item.provinceName }}{{ item.cityName }}{{ item.districtName }}
-            </text>
-          </view>
-          <view class="contact-info">
-            <text class="name">{{ item.name }}</text>
-            <text class="phone">{{ item.telephone }}</text>
-          </view>
-        </view>
-
-        <!-- 右侧编辑图标(固定宽度) -->
-        <view class="edit-icon" @click="hadlClickTo(item)">
-          <up-icon name="edit-pen" size="16"></up-icon>
-        </view>
-        <view class="edit-icon" @click="hadlClickEdit(item)">
-          <up-icon name="trash" size="16"></up-icon>
-        </view>
-      </view>
-    </up-radio-group>
-
-    <!-- 新增底部按钮 -->
-    <view class="add-bottom-btn" @click="handlHeader">
-      <view class="add-bottom-btn-inner">
-        <text class="plus">+</text>
-        <text>新增收货地址</text>
-      </view>
-    </view>
-  </view>
-</template>
-
-<script setup>
-import { onMounted, ref } from 'vue'
-import { addressList, addressAddressIds } from '@/api/userSettings.js'
-
-const radioValue = ref(null)
-const dataList = ref([])
-const total = ref(0)
-const addressId = ref('')
-
-const getListData = async () => {
-  const res = await addressList()
-  dataList.value = res.rows
-  total.value = res.total
-  console.log(dataList.value, '>>>>>dataList.value')
-}
-const onLoadOptions = ref({})
-
-const hadlClickTo = (item) => {
-  console.log(item)
-  const {
-    address,
-    addressId,
-    age,
-    cityName,
-    districtName,
-    label,
-    name,
-    provinceName,
-    sex,
-    telephone,
-    cityCode,
-    districtCode,
-    provinceCode,
-  } = item
-
-  const params = `address=${encodeURIComponent(
-    address
-  )}&addressId=${encodeURIComponent(addressId)}&age=${encodeURIComponent(
-    age
-  )}&cityName=${encodeURIComponent(cityName)}&districtName=${encodeURIComponent(
-    districtName
-  )}&label=${encodeURIComponent(label)}&name=${encodeURIComponent(
-    name
-  )}&provinceName=${encodeURIComponent(provinceName)}&sex=${encodeURIComponent(
-    sex
-  )}&telephone=${encodeURIComponent(telephone)}&cityCode=${encodeURIComponent(
-    cityCode
-  )}&districtCode=${encodeURIComponent(
-    districtCode
-  )}&provinceCode=${encodeURIComponent(provinceCode)}`
-
-  // 使用拼接的查询参数进行页面跳转
-  uni.navigateTo({
-    url: `/pages_mine/pages/selectAddress/edit?${params}`,
-  })
-}
-
-const hadlClickEdit = async (item) => {
-  try {
-    const res = await addressAddressIds(item.addressId) // 使用 addressId
-   if (res.code == 200) {
-      uni.showToast({
-      title: '删除成功',
-      icon: 'success',
-    })
-   }
-    await getListData()
-  } catch (error) {
-    console.error('删除失败', error)
-    uni.showToast({
-      title: '删除失败',
-      icon: 'error',
-    })
-  }
-}
-const handlHeader = () => {
-  uni.navigateTo({
-    url: `/pages_mine/pages/setupUser/Address`,
-  })
-}
-
-const handleRadioChange = (addressId, item) => {
-  console.log('当前选中的 addressId:', addressId)
-  const selectedItem = dataList.value.find(
-    (item) => item.addressId === addressId
-  )
-  console.log('选中项完整数据:', selectedItem)
-}
-
-// onLoad((options) => {
-// 	onLoadOptions.value = JSON.parse(decodeURIComponent(options.onLoadOptions));
-// })
-
-onMounted(() => {
-  getListData()
-})
-</script>
-
-<style scoped>
-.address-list {
-  padding: 20rpx;
-}
-
-.header {
-  display: flex;
-  justify-content: flex-end;
-  align-items: center;
-  margin-bottom: 20rpx;
-}
-
-.add-item {
-  display: flex;
-  align-items: center;
-}
-
-.add-item image {
-  width: 40rpx;
-  height: 40rpx;
-  margin-right: 8rpx;
-}
-
-.add-item text {
-  font-size: 25rpx;
-  color: crimson;
-}
-
-.address-item {
-  display: flex;
-  align-items: center; /* 确保垂直居中 */
-  justify-content: space-between; /* 让内容均匀分布 */
-  padding: 24rpx 0;
-  border-bottom: 1rpx solid #f0f0f0;
-  position: relative; /* 可选:用于绝对定位 */
-  width: 100%;
-}
-.radio-group {
-  flex-shrink: 0;
-  /* 禁止压缩 */
-  margin-right: 20rpx;
-}
-
-.content-wrapper {
-  flex: 1;
-  min-width: 0;
-}
-
-.edit-icon {
-  flex-shrink: 0;
-  padding: 8rpx;
-}
-.address-text {
-  display: inline-block;
-  max-width: 100%;
-  font-size: 32rpx;
-  font-weight: 500;
-  white-space: nowrap;
-  overflow: hidden;
-  text-overflow: ellipsis;
-}
-
-.contact-info {
-  display: flex;
-  gap: 20rpx;
-  margin-top: 8rpx;
-}
-
-.name,
-.phone {
-  font-size: 28rpx;
-  color: #666;
-}
-
-.add-bottom-btn {
-  position: fixed;
-  left: 0;
-  bottom: 0;
-  width: 100vw;
-  background: #fff;
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  padding: 24rpx 0 32rpx 0;
-  z-index: 10;
-  box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.03);
-}
-.add-bottom-btn-inner {
-  display: flex;
-  align-items: center;
-  font-size: 30rpx;
-  color: #222;
-  font-weight: 500;
-  background: #fff;
-  border-radius: 40rpx;
-  padding: 8rpx 32rpx;
-  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
-}
-.add-bottom-btn-inner .plus {
-  font-size: 38rpx;
-  color: #f5b400;
-  margin-right: 12rpx;
-}
-</style>

+ 13 - 5
pages_home/pages/setupUser/Address.vue

@@ -51,13 +51,21 @@ const handlOk = async () => {
         duration: 1500, // 显示时间,单位毫秒,默认1500
         mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
       })
-      setTimeout(() => {
-        uni.navigateTo({
-          url: `/pages_home/pages/selectAddress/index`
-        })
-      }, 1500)
+      // setTimeout(() => {
+        // uni.navigateTo({
+        //   url: `/pages_home/components/volunteerSide/adresss`
+        // })
+      // }, 1500)
+	  
     }
   })
+  
+  
+  setTimeout(() => {
+	  uni.navigateBack({
+	  	delta: 1
+	  })
+  })
 }
 
 const handleQux = () => {