Browse Source

用户端

jiayubo 1 week ago
parent
commit
ab2f7aaa55

+ 8 - 3
api/personaInforMation.js

@@ -1,15 +1,20 @@
 import request from '../utils/request'
 
-// 新增用户
+// 修改
 export function updateUserInfo(data) {
   return request({
     url: `/system/user/updateUserInfo`,
     method: 'post',
-    data: data,
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded'
+    },
+    data: Object.keys(data)
+      .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`)
+      .join('&')
   })
 }
 
-// 编辑个人用户信息
+// 回显
 export function userUserInfoEdit(params) {
   return request({
     url: `/system/user/userInfo`,

+ 6 - 0
pages.json

@@ -123,6 +123,12 @@
 						"navigationBarTitleText": "新增地址"
 					}
 				}
+        // {
+        //   "path": "pages/selectAddress/index",
+        //   "style": {
+        //     "navigationBarTitleText": "地址列表"
+        //   }
+        // }
 			]
 		},
 		{

+ 1 - 1
pages/classify.vue

@@ -141,7 +141,7 @@ const getListData = async (orderStatus = tab.value) => {
   const res = await userMainOrderList({
     orderStatus: orderStatus
   })
-  dataList.value = res.data
+  dataList.value = res.rows
 }
 /**
  * 1: 查看

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

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

+ 355 - 0
pages_home/pages/selectAddress/edit.vue

@@ -0,0 +1,355 @@
+<template>
+	<view>
+		<up-form labelPosition="left" :model="modelForm" :rules="rulesForm" ref="formRef">
+			<up-form-item label="姓名" prop="name" borderBottom labelWidth="70">
+				<up-input v-model="modelForm.name" border="none" placeholder="请输入姓名"></up-input>
+			</up-form-item>
+			<up-form-item label="性别" prop="sex" borderBottom @click="() => (sexFlag = true)" labelWidth="70">
+				<up-input v-model="displaySex" disabled disabledColor="#ffffff" placeholder="请选择性别"
+					border="none"></up-input>
+				<template #right>
+					<up-icon name="arrow-right"></up-icon>
+				</template>
+			</up-form-item>
+			<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 label="年龄" prop="age" borderBottom labelWidth="70">
+				<up-input v-model="modelForm.age" border="none" placeholder="请输入年龄"></up-input>
+			</up-form-item>
+			<up-form-item label="手机号" prop="telephone" borderBottom labelWidth="70">
+				<up-input v-model="modelForm.telephone" border="none" placeholder="请输入手机号"></up-input>
+			</up-form-item>
+			<up-form-item label="地区" prop="area" borderBottom @click="()=> addressShow = true" labelWidth="70">
+				<pickerAddress @change="addressChange"
+					:selectValue="[ modelForm.provinceInd, modelForm.cityInd, modelForm.districtInd ]">
+					<view class="inp"
+						:class="modelForm.provinceName&&modelForm.cityName&&modelForm.districtName?'':'address-inp'">
+						{{modelForm.provinceName ? modelForm.provinceName:'省'}} /
+						{{modelForm.cityName ? modelForm.cityName:'市'}} /
+						{{modelForm.districtName ? modelForm.districtName:'区'}}
+					</view>
+				</pickerAddress>
+				<template #right>
+					<up-icon name="map" size="22" @click="onCityWx"></up-icon>
+				</template>
+			</up-form-item>
+			<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>
+		<up-action-sheet :show="sexFlag" :actions="sexOptions" @select="sexSelect"
+			@close="sexFlag = false"></up-action-sheet>
+		<up-action-sheet :show="labelFlag" :actions="relaTionsHip" @select="sexSelectsHip"
+			@close="labelFlag = false"></up-action-sheet>
+		<view class="Wrapper-Btn">
+			<up-button @click="handleQux" type="error" :plain="true" :hairline="true" text="取消"
+				:customStyle="hadlClickEdit"></up-button>
+			<up-button type="error" @click="handleSubmit" text="编辑" :customStyle="hadlClickEdit" />
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		reactive,
+		computed,
+	} from 'vue';
+
+	import {
+		onLoad
+	} from '@dcloudio/uni-app';
+	import {
+		useraDdress,
+	} from "@/api/userSettings.js"
+	// import pickerAddress from '@/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
+	import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
+	import {
+		splitAddress
+	} from '@/utils/adress'
+	const formRef = ref(null)
+
+
+	// 获取页面传递的参数
+	onLoad((options) => {
+		if (options) {
+			options.cityName = decodeURIComponent(decodeURIComponent(options.cityName || ''));
+			options.districtName = decodeURIComponent(decodeURIComponent(options.districtName || ''));
+			options.label = decodeURIComponent(decodeURIComponent(options.label || ''));
+			options.provinceName = decodeURIComponent(decodeURIComponent(options.provinceName || ''));
+			options.name = decodeURIComponent(decodeURIComponent(options.name || ''));
+			options.address = decodeURIComponent(decodeURIComponent(options.address || ''));
+			modelForm.value = {
+				...modelForm.value,
+				...options,
+				sex: options.sex ? Number(options.sex) : '',
+				age: options.age ? Number(options.age) : '',
+				provinceName: options.provinceName || '',
+				cityName: options.cityName || '',
+				districtName: options.districtName || '',
+				districtCode:options.districtCode,
+				provinceCode:options.provinceCode
+			};
+		}
+	});
+
+	const modelForm = ref({
+		name: '',
+		sex: '',
+		label: '',
+		age: '',
+		telephone: '',
+
+		provinceName: '', // 省
+		provinceCode: '',
+		provinceInd: 0,
+
+		cityName: '', // 市
+		cityCode: '',
+		cityInd: 0,
+
+		districtName: '',
+		districtCode: '',
+		districtInd: 0,
+
+		address: ''
+	})
+	// 回显把provinceName,cityName,districtName字段拼接
+	const rulesForm = ref({
+		name: {
+			type: 'string',
+			required: true,
+			message: '请填写姓名',
+			trigger: ['blur', 'change'],
+		},
+		sex: {
+			type: 'number',
+			required: true,
+			message: '请选择性别',
+			trigger: ['change']
+		},
+		label: {
+			type: 'string',
+			required: true,
+			message: '请选择关系',
+			trigger: ['change'],
+		},
+		userInfo: {
+			type: 'string',
+			required: true,
+			message: '请填写年龄',
+			trigger: ['blur', 'change'],
+		},
+		telephone: {
+			type: 'string',
+			required: true,
+			message: '请填写手机号',
+			trigger: ['blur', 'change'],
+		},
+	})
+
+	let sexFlag = ref(false)
+	let labelFlag = ref(false)
+	let addressShow = ref(false)
+	let index = ref(0)
+
+
+	const sexOptions = ref([{
+		name: '男',
+		value: 0,
+	}, {
+		name: '女',
+		value: 1,
+	}, ]);
+
+	const relaTionsHip = ref([{
+			name: '父母'
+		}, {
+			name: '子女'
+		},
+		{
+			name: '兄弟'
+		},
+		{
+			name: '朋友'
+		},
+		{
+			name: '同学'
+		},
+		{
+			name: '同事'
+		},
+		{
+			name: '配偶'
+		}
+	]);
+
+	const displaySex = computed({
+		get() {
+			const option = sexOptions.value.find(item => item.value === modelForm.value.sex)
+			return option ? option.name : ''
+		},
+		set(newValue) {
+			const option = sexOptions.value.find(item => item.name === newValue)
+			if (option) {
+				modelForm.value.sex = option.value
+			}
+		}
+	})
+	// 性别选择处理
+	function sexSelect(e) {
+		modelForm.value.sex = e.value; // 确保是 0 或 1
+		console.log('Selected sex:', e.value, 'Model sex:', modelForm.value.sex);
+		sexFlag.value = false;
+		// 手动触发验证
+		formRef.value.validateField('sex');
+	}
+
+	function sexSelectsHip(e) {
+		modelForm.value.label = e.name;
+		labelFlag.value = false;
+	}
+
+	function addressChange(info) {
+		console.log('地区选择器返回的完整数据:', info);
+		console.log('地区编码:', info.code);
+		if (!info || !info.data) {
+			console.error('Invalid address change info:', info);
+			return;
+		}
+
+		if (!Array.isArray(info.data) || info.data.length < 3) {
+			console.error('Invalid address data:', info.data);
+			return;
+		}
+
+		const code = Array.isArray(info.code) ? info.code : ['', '', ''];
+
+		let indexArray;
+		if (Array.isArray(info.index)) {
+			indexArray = info.index;
+		} else if (info.index && typeof info.index[Symbol.iterator] === 'function') {
+			indexArray = Array.from(info.index);
+		} else {
+			indexArray = [0, 0, 0];
+		}
+
+		modelForm.value.provinceName = info.data[0] || '';
+		modelForm.value.provinceCode = code[0] || '';
+		modelForm.value.provinceInd = indexArray[0] || 0;
+
+		modelForm.value.cityName = info.data[1] || '';
+		modelForm.value.cityCode = code[1] || '';
+		modelForm.value.cityInd = indexArray[1] || 0;
+
+		modelForm.value.districtName = info.data[2] || '';
+		modelForm.value.districtCode = code[2] || '';
+		modelForm.value.districtInd = indexArray[2] || 0;
+	}
+
+	function onCityWx(row) {
+		console.log('地区选点', row);
+		wx.chooseLocation({
+			success: function(res) {
+				const result = splitAddress(res.address);
+				console.log(res, result);
+				modelForm.value.provinceName = result.province
+				modelForm.value.cityName = result.city
+				modelForm.value.districtName = result.district
+				modelForm.value.address = result.detail
+				modelForm.value.longitude = res.longitude
+				modelForm.value.latitude = res.latitude
+
+
+			},
+			fail: function(err) {
+				console.log(err);
+				uni.showToast({
+					title: '获取地址失败',
+					icon: 'error',
+				});
+			},
+		})
+	}
+
+	// 提交编辑
+	async function handleSubmit() {
+		try {
+			// 1. 验证表单
+			await formRef.value.validate();
+
+			// 2. 准备提交数据
+			const submitData = {
+				...modelForm.value,
+				sex: modelForm.value.sex,
+			};
+
+			// 3. 显示加载中提示(可选)
+			uni.showLoading({
+				title: '提交中...',
+				mask: true
+			});
+
+			// 4. 调用接口
+			const response = await useraDdress(submitData);
+
+			// 5. 隐藏加载中
+			uni.hideLoading();
+
+			// 6. 处理响应
+			if (response.code === 200) {
+				await new Promise((resolve) => {
+					uni.showToast({
+						title: '编辑成功',
+						icon: 'success',
+						duration: 1500, // 默认1500ms
+						mask: true,
+						success: () => {
+							// 等待Toast显示完成
+							setTimeout(() => resolve(), 1500);
+						}
+					});
+				});
+
+				// 7. 跳转页面
+				uni.navigateTo({
+					url: '/pages_mine/pages/selectAddress/index'
+				});
+			} else {
+				uni.showToast({
+					title: response.msg || '编辑失败',
+					icon: 'none'
+				});
+			}
+		} catch (error) {
+			uni.hideLoading();
+			console.error('编辑失败', error);
+			uni.showToast({
+				title: '编辑失败: ' + (error.message || '未知错误'),
+				icon: 'none'
+			});
+		}
+	}
+	const handleQux = () => {
+		uni.navigateBack({
+			delta: -1
+		})
+	}
+	const hadlClickEdit = {
+		width: '240rpx',
+		marginTop: '30rpx'
+	}
+</script>
+
+<style scoped>
+	.Wrapper-Btn {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+</style>

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

@@ -0,0 +1,256 @@
+<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>

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

@@ -15,7 +15,7 @@
       <up-button
         type="error"
         text="确定"
-        @click="handlOk(item)"
+        @click="handlOk"
         :customStyle="hadlClickEdit"
       ></up-button>
     </view>
@@ -36,14 +36,8 @@ function handleAdd() {
   if (addInfoArr.value.length < 4) addInfoArr.value.push({})
 }
 
-const handlOk = async (item) => {
+const handlOk = async () => {
   const params = []
-  const paramsData = {
-    volunteerId: item.volunteerId, // 获取 volunteerId
-    serviceCategory: item.serviceCategory, // 获取 serviceCategory
-    businessManagementId: item.businessManagementId, //获取 businessManagementId
-  }
-  const data = encodeURIComponent(JSON.stringify(paramsData))
   addInfoArr.value.forEach((item, index) => {
     params.push(addComponentRef.value[index].modelForm)
   })
@@ -58,11 +52,8 @@ const handlOk = async (item) => {
         mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
       })
       setTimeout(() => {
-        // uni.navigateBack({
-        // 	delta: 2
-        // })
-        wx.reLaunch({
-          url: `/pages_home/pages/Volunteerside/goodsDetails?paramsData=${data}`,
+        uni.navigateTo({
+          url: `/pages_home/pages/selectAddress/index`
         })
       }, 1500)
     }

+ 74 - 66
pages_mine/pages/setupUser/Address.vue

@@ -1,78 +1,86 @@
 <template>
-	<view>
-		<template v-for="(item, index) in addInfoArr" :key="index">
-			<add-component ref="addComponentRef"></add-component>
-		</template>
-		<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>
-		</view>
-	</view>
+  <view>
+    <template v-for="(item, index) in addInfoArr" :key="index">
+      <add-component ref="addComponentRef"></add-component>
+    </template>
+    <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>
+    </view>
+  </view>
 </template>
 
 <script setup>
-	import {
-		ref,
-		reactive
-	} from 'vue';
-	import {
-		useraDdressData
-	} from "@/api/userSettings.js"
-	import pickerAddress from '@/pages_mine/components/pickerAddress/pickerAddress.vue' // 地区选择器组件
-	import addComponent from '@/pages_mine/components/setupUser/Add.vue'
+import { ref, reactive } from 'vue'
+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(null)
+const addInfoArr = ref([{}])
 
-	const addInfoArr = ref([{}])
+function handleAdd() {
+  if (addInfoArr.value.length < 4) addInfoArr.value.push({})
+}
 
-	function handleAdd() {
-		if (addInfoArr.value.length < 4) addInfoArr.value.push({})
-	}
+const handlOk = async () => {
+  const params = []
+  addInfoArr.value.forEach((item, index) => {
+    params.push(addComponentRef.value[index].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',
+        })
+      }, 1500)
+    }
+  })
+}
 
-	const handlOk = async () => {
-		const params = []
-		addInfoArr.value.forEach((item, index) => {
-			params.push(addComponentRef.value[index].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
-					})
-				}, 1500)
-			}
-		})
-	}
-	
-	const handleQux = () =>{
-		uni.navigateBack({
-			delta:2
-		})
-	}
-	const hadlClickEdit = {
-		width: '240rpx',
-		marginTop: '30rpx'
-	}
+const handleQux = () => {
+  uni.navigateBack({
+    delta: 1,
+  })
+}
+const hadlClickEdit = {
+  width: '240rpx',
+  marginTop: '30rpx',
+}
 </script>
 <style scoped lang="scss">
-	.address-inp {
-		color: #929292;
-	}
-	
-	.Wrapper-Btn{
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-</style>
+.address-inp {
+  color: #929292;
+}
+
+.Wrapper-Btn {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+</style>

+ 3 - 9
pages_mine/pages/setupUser/personalInfo.vue

@@ -26,7 +26,7 @@
 			<view class="Wrapper-Btn">
 				<up-button @click="handleQux" type="error" :plain="true" :hairline="true" text="取消"
 					:customStyle="hadlClickEdit" :disabled="loading"></up-button>
-				<up-button type="error" @click="handleSubmit" :text="isEdit ? '编辑' : '新增'" :customStyle="hadlClickEdit" :loading="loading" :disabled="loading" />
+				<up-button type="error" @click="handleSubmit" text="保存" :customStyle="hadlClickEdit" :loading="loading" :disabled="loading" />
 			</view>
 		</view>
 </template>
@@ -47,7 +47,6 @@ const modelForm = ref({
   age: '',
   phonenumber: ''
 })
-const isEdit = ref(false)
 const loading = ref(false)
 
 const rulesForm = ref({
@@ -88,9 +87,7 @@ onMounted(async () => {
         age: res.data.age || '',
         phonenumber: res.data.phonenumber || ''
       }
-      isEdit.value = true
     } else {
-      isEdit.value = false
       modelForm.value = {
         nickName: '',
         sex: '',
@@ -104,7 +101,6 @@ onMounted(async () => {
       title: '获取用户信息失败',
       icon: 'none'
     })
-    isEdit.value = false
   } finally {
     loading.value = false
   }
@@ -118,12 +114,10 @@ const handleQux = () => {
 
 const handleSubmit = async () => {
   try {
-    // 表单验证
     if (!formRef.value) {
       console.error('表单引用不存在')
       return
     }
-    
     const valid = await formRef.value.validate()
     if (!valid) return
 
@@ -137,13 +131,13 @@ const handleSubmit = async () => {
     const res = await updateUserInfo(params)
     if (res && res.code === 200) {
       uni.showToast({ 
-        title: isEdit.value ? '编辑成功' : '新增成功', 
+        title: '保存成功', 
         icon: 'success' 
       })
       uni.navigateBack({ delta: 1 })
     } else {
       uni.showToast({ 
-        title: res.msg || (isEdit.value ? '编辑失败' : '新增失败'), 
+        title: res.msg || '保存失败', 
         icon: 'none' 
       })
     }