MS-IOHQJGHXZHQD\Administrator 1 hónapja
szülő
commit
a3b9b79f9d

+ 4 - 4
src/App.vue

@@ -42,7 +42,7 @@ export default {
 
 				let params = {
 					//code: this.$utils.('code') //guo
-					code: '041Gaa100q6IDW1BH6100Wgpvv4Gaa1K'
+					code: '011LBRkl235w1i4eyeol2MJsgP0LBRkR'
 				}
 				getTechnicianToken(params).then(res => {
 					console.log(res,'77777')
@@ -90,9 +90,9 @@ export default {
 				}
 				if (merchantInfo.fileGroups.length) {//已有入驻信息
 					if (!this.$utils.checkLogin({ type: 'navigate' })) return;
-					uni.switchTab({
-						url: '/pages/index/index?merchantInfo=' + encodeURIComponent(JSON.stringify(merchantInfo))
-					})
+					// uni.switchTab({
+					// 	url: '/pages/index/index?merchantInfo=' + encodeURIComponent(JSON.stringify(merchantInfo))
+					// })
 
 				} else {//无入驻信息
 					if (merchantInfo.auditStatus == 1 || merchantInfo.auditStatus == 3) {

+ 8 - 0
src/api/index.js

@@ -1,4 +1,12 @@
 import request from "@/utils/request.js";
+// ip定位
+export function getCity(data) {
+  return request({
+    method: 'get',
+    url: '/customer/home/current/city',
+    data
+  })
+}
 //区域根据name获取code接口
 export function getCityCode(data) {
     return request({

+ 9 - 5
src/api/order.js

@@ -36,11 +36,12 @@ export function delOrder(data) {
     });
 }
 
-// 接受订
+//滑动接
 export function takeOrder(data) {
     return request({
         method: 'post',
-        url: '/api/order/v1/wx/takingOrders',
+         url: '/technician/technician/accept',
+        //url: '/api/order/v1/wx/takingOrders',
         data
     });
 }
@@ -49,7 +50,8 @@ export function takeOrder(data) {
 export function refuseOrder(data) {
     return request({
         method: 'post',
-        url: '/api/order/v1/wx/jujue',
+        url: '/technician/technician/refuse',
+        //url: '/api/order/v1/wx/jujue',
         data
     });
 }
@@ -58,7 +60,8 @@ export function refuseOrder(data) {
 export function confirmOrder(data) {
     return request({
         method: 'post',
-        url: '/api/order/v1/wx/confirm',
+        url: '/technician/technician/rest/confirm',
+        //url: '/api/order/v1/wx/confirm',
         data
     });
 }
@@ -66,7 +69,7 @@ export function confirmOrder(data) {
 // 加单
 export function speedOrder(data) {
     return request({
-        method: 'post',
+        method: 'get',
         url: '/api/order/v1/wx/add',
         data
     });
@@ -82,6 +85,7 @@ export function getStaffServiceTime(data) {
 }
 //郭
 
+
 // 查询订单
 export function queryOrder(data) {
     return request({

+ 11 - 0
src/api/workbench.js

@@ -146,3 +146,14 @@ export function getCommentList(data) {
 		}
     });
 }
+// 查询商户的综合评分
+export function getCommentScore(data) {
+    return request({
+        method: 'get',
+        url: '/order/comment/merchant/my/score',
+        data,
+		header: {
+		    'Authorization': `tf:${uni.getStorageSync('access-token')}`
+		}
+    });
+}

+ 2 - 2
src/components/cl-upload/cl-upload/cl-upload.vue

@@ -625,7 +625,7 @@ export default {
 				
 				const audioList = await that.FileList.filter(item => {
 					const fileUrl = item?.url ?? item
-					return AUDIO_REGEXP.test(fileExtension)
+					return AUDIO_REGEXP.test(fileUrl)
 				})
 				console.log(audioList,'that.audioList')
 
@@ -1168,7 +1168,7 @@ export default {
 				position: absolute;
 				top: 0;
 				right: 0;
-				background-color: #373737;
+				background-color: #373737!important;
 				height: 50rpx;
 				width: 50rpx;
 				border-bottom-left-radius: 200rpx;

+ 10 - 1
src/manifest.json

@@ -113,7 +113,16 @@
         },
         "devServer" : {
             "port" : 80,
-            "https" : false
+            "https" : false,
+            "proxy" : {
+                "/getIp" : {
+                    "target" : "https://ip9.com.cn",
+                    "changeOrigin": true,
+                    "pathRewrite" : {
+                        "^/getIp" : ""
+                    }
+                }
+            }
         },
         "sdkConfigs" : {
             "maps" : {

+ 14 - 14
src/pages/discover/discover.vue

@@ -88,7 +88,7 @@
 </template>
 
 <script>
-import { discoverList } from '@/api/dynamic.js'
+// import { discoverList } from '@/api/dynamic.js'
 
 export default {
   data() {
@@ -125,19 +125,19 @@ export default {
         longitude: uni.getStorageSync('longitude'),
         latitude: uni.getStorageSync('latitude'),
       }
-      discoverList(params).then(res => {
-        if (res.data.code === 200 && res.data.data) {
-          let data = res.data.data
-          data.forEach(item => {
-            item.publishTime = item.publishTime
-              .replace('T', ' ')
-              .substring(0, 16)
-          })
-          this.$refs.paging.complete(data)
-        } else {
-          this.$refs.paging.complete([])
-        }
-      })
+      // discoverList(params).then(res => {
+      //   if (res.data.code === 200 && res.data.data) {
+      //     let data = res.data.data
+      //     data.forEach(item => {
+      //       item.publishTime = item.publishTime
+      //         .replace('T', ' ')
+      //         .substring(0, 16)
+      //     })
+      //     this.$refs.paging.complete(data)
+      //   } else {
+      //     this.$refs.paging.complete([])
+      //   }
+      // })
     },
     onTabChange(index) {
       this.current = index + 1

+ 165 - 321
src/pages/index/index.vue

@@ -79,7 +79,7 @@
 			</view>
 
 			<!-- 新订单 -->
-			<view class="order-section" v-if="pendingOrder">
+			<view class="order-section" v-if="pendingOrder && pendingOrderObj">
 				<view class="order-header">
 					<view class="order-header-bg">
 						<image src="/static/workbench/orderTop.png" mode="scaleToFill" />
@@ -91,17 +91,17 @@
 				</view>
 				<view class="order-card">
 					<view class="order-title-row">
-						<text class="order-title one-line-text">{{ orderTitle }}</text>
+						<text class="order-title one-line-text">{{ pendingOrderObj.projectName || '' }}</text>
 						<!-- v-if="isNewCustomer" -->
-						<text class="tag-new">{{ customerType }}</text>
+						<text class="tag-new">{{ pendingOrderObj.customerType || '' }}</text>
 					</view>
 					<view class="order-time">
 						<image class="order-icon" src="/static/workbench/orderTime.png" mode="aspectFit" />
-						<text>{{ orderServiceTime }}</text>
+						<text>{{ pendingOrderObj.orderCreateTime || '' }}</text>
 					</view>
 					<view class="order-address">
 						<image class="order-icon1" src="/static/workbench/orderAddress.png" mode="aspectFit" />
-						<text>{{ orderAddress }}</text>
+						<text>{{ pendingOrderObj.targetAddress || '' + '(' + pendingOrderObj.distanceDesc + ')' || '' }}</text>
 					</view>
 					<view class="order-actions">
 						<view class="reject-btn" @click="onRejectOrder">拒绝</view>
@@ -183,17 +183,20 @@
 					<image class="address-tip" src="/static/workbench/skillTip.png" mode="aspectFit" />
 				</view>
 				<view class="address-row">
-					<image class="address-icon" src="/static/workbench/address.png" mode="aspectFit" />
+					<view class="address-icon-box">
+						<image class="address-icon" src="/static/workbench/address.png" mode="aspectFit" />
+
+					</view>
 					<!-- 根据授权状态显示不同内容 -->
-					<text class="address-text" :class="{ 'auth-error': locationAuthStatus === 'denied' }">
-						{{ locationAuthStatus === 'denied' ? '未授权,无法获取地理位置信息~' : (currentAddress || '暂无地址') }}
+					<text class="address-text" :class="{ 'auth-error': !isLocationPermi }">
+						{{ isLocationPermi ? '未授权,无法获取地理位置信息~' : (currentAddress || '暂无地址') }}
 					</text>
 				</view>
 				<view class="address-actions">
 					<view class="addr-btn" @click="goSwitchAddress">切换地址</view>
 					<view class="addr-divider" />
 					<view class="addr-btn" @click="handleUpdateAddress">
-						{{ locationAuthStatus === 'denied' ? '去授权' : '更新地址' }}
+						{{ isLocationPermi ? '去授权' : '更新地址' }}
 					</view>
 				</view>
 			</view>
@@ -215,16 +218,25 @@
 		</view>
 
 		<!-- 拒绝接单弹窗 -->
-		<view class="popup-mask" v-if="showRejectPopup" @click="closeRejectPopup">
-			<view class="popup-box" @click.stop>
-				<view class="popup-title">请输入拒绝接单原因</view>
-				<input class="popup-input" v-model="rejectReason" maxlength="10" placeholder="请输入拒绝原因,最多10个字" />
-				<view class="popup-btns">
-					<view class="popup-btn" @click="closeRejectPopup">取消</view>
-					<view class="popup-btn confirm" @click="submitReject">提交</view>
+		<u-popup :show="showRejectPopup" mode="center" :round="16" :mask-close-able="false">
+			<view class="modal-wrap">
+				<!-- 标题居中 -->
+				<view class="title">提示</view>
+				<!-- 正文 -->
+				<view class="content">
+					请输入拒绝接单原因
+					<u--textarea class="popup-input" v-model="rejectReason" maxlength="30" placeholder="请输入拒绝原因" />
+
+				</view>
+
+				<!-- 底部双按钮(必显示) -->
+				<view class="btn-box">
+					<view class="btn left " @click="submitReject">确认</view>
+					<view class="btn right" @click="closeRejectPopup">我在想想</view>
+
 				</view>
 			</view>
-		</view>
+		</u-popup>
 
 		<!-- 接单状态底部弹窗 -->
 		<view class="popup-mask bottom" v-if="showStatusPopup" @click="showStatusPopup = false">
@@ -300,7 +312,7 @@
 						完善你的<text style="color: #45FFD7;">服务技能</text>标签,用户能快速找到你、下单更多!</text>
 					<!-- 手势图标指向管理按钮 -->
 					<image src="/static/workbench/handIcon.png" mode="aspectFit"
-						style="width: 68rpx;height: 62rpx;position: absolute;right: -102rpx;bottom: -220rpx;" />
+						style="width: 68rpx;height: 62rpx;position: absolute;right: -102rpx;bottom: -200rpx;" />
 				</view>
 			</view>
 
@@ -311,33 +323,27 @@
 
 <script>
 import {
-	getMerchantData,
-	getInfo,
 	myIncome,
-	getStaffWorkData,
-	getWaitOrder,
-	myBank,
 	getProjectByJsId,
-	netStaffWork,
 	logout,
-	getJsLocation,
 } from '@/api/index';
 import {
-	orderDeatails,
-	takeOrder,
-	refuseOrder
+	acceptOrder,rejectOrder,
 } from '@/api/order.js';
 
 import {
 	switchToOffline,
-	getSkillList, getWaitList
+	getSkillList, getWaitList,getCommentScore
 } from '@/api/workbench.js';
 import { normalizeStorageValue } from '@/utils/technicianProfile.js';
-import locationService from '@/utils/location.js';
+import locationService from '@/utils/location';
+// 推荐使用统一的 addressService
+import addressService from '@/utils/address.js';
 
 export default {
 	data() {
 		return {
+			pendingOrderObj: {},
 			// 开启定位提示
 			isLocationPermi: false,
 			currentAddress: '',
@@ -364,7 +370,6 @@ export default {
 				deductAmount: '12341.56',
 			},
 			pendingOrder: false,
-			currentAddress: '',
 			showRejectPopup: false,
 			rejectReason: '',
 			showStatusPopup: false,
@@ -392,100 +397,77 @@ export default {
 			customerType: '',
 			orderTitle: '',
 			orderServiceTime: '',
-			orderAddress: '',
+			locationLoaded: false, // 定位加载完成标记
 		}
 	},
 	computed: {
-		// orderTitle() {
-		// 	if (!this.pendingOrder) return ''
-		// 	const goods = this.pendingOrder.cGoods || []
-		// 	return goods[0]?.cTitle || '服务项目'
-		// },
-		// orderServiceTime() {
-		// 	if (!this.pendingOrder) return ''
-		// 	return this.formatOrderTime(
-		// 		this.pendingOrder.reachTime || this.pendingOrder.dtCreateTime || ''
-		// 	)
-		// },
-		// deductionAmount() {
-		// 	return (
-		// 		this.myIncome.kAmount ??
-		// 		this.myIncome.deductAmount ??
-		// 		this.myIncome.dAmount ??
-		// 		0
-		// 	)
-		// },
-		// orderAddress() {
-		// 	if (!this.pendingOrder) return ''
-		// 	return this.pendingOrder.address || this.pendingOrder.atlasAdd || ''
-		// },
+		
 		isNewCustomer() {
 			return this.pendingOrder?.nB2 == 1
 		},
 	},
 	async onShow() {
-		// 调用定位初始化
-		locationService.initLocation().then(location => {
-			console.log('定位成功:', location);
-			// 更新页面地址显示
-			this.currentAddress = location.formattedAddress || location.cityName || '暂无地址';
-		}).catch(err => {
-			console.error('定位失败:', err);
-		});
-		// // 定位逻辑
-		// const locationData = await LocationService.LocationService();
-		// console.log(locationData)
-		// // #ifndef H5
-		// if (locationData) this.isLocationPermi = locationData.isRefuse == 1;
-		// // #endif
-
-		this.getWaitList()
-		await this.checkMerchantStatus()
-		this.getSkillList();
-		setTimeout(() => {
-			if (!this.auditStatus) return
-			if (this.auditStatus == 0 || this.auditStatus == 3) {
-				this.showModal = true
-				return
-			}
-			if (this.auditStatus == 1) {
-				uni.showToast({
-					title: '入驻审核中,暂无操作权限',
-					icon: 'none'
-				})
-
-			}
-			this.loadPageData()
+		// 首次加载由onLoad主动调用,避免重复执行
+		if (!this.locationLoaded) return
+		await this.initData()
 
-			// 新增:判断是否需要展示技能引导
-			const guideFlag = uni.getStorageSync('merchant_skill_manage_guide')
-			if (!guideFlag && this.auditStatus === 2) { // 仅审核通过正式商户展示
-				this.$nextTick(() => this.getManageBtnRect())
-			}
-		}, 300)
 
 	},
-	onLoad() {
-
-		console.log('onLoad')
+	async onLoad() {
+		uni.setStorageSync('cityCode', '')
+		const locationData = await locationService.initLocation();
+		if (locationData.address) {
+			this.currentAddress = locationData.address.province + locationData.address.city + locationData.address.district + locationData.address.street + locationData.name
+		}
+		if (locationData) this.isLocationPermi = locationData.isRefuse == 1;
+		this.locationLoaded = true // 标记定位完成
+		await this.initData()
 
 	},
 	methods: {
+		async initData() {
+			// 查询待接单列表
+			await this.getWaitList()
+			// 查询商户状态
+			await this.checkMerchantStatus()
+			// 查询技能列表
+			await this.getSkillList();
+			// 查询商户的综合评分
+			this.getCommentScore()
+			setTimeout(() => {
+				if (!this.auditStatus) return
+				if (this.auditStatus == 0 || this.auditStatus == 3) {
+					this.showModal = true
+					return
+				}
+				if (this.auditStatus == 1) {
+					uni.showToast({
+						title: '入驻审核中,暂无操作权限',
+						icon: 'none'
+					})
+
+				}
+
+				// 新增:判断是否需要展示技能引导
+				const guideFlag = uni.getStorageSync('merchant_skill_manage_guide')
+				if (!guideFlag && this.auditStatus === 2) { // 仅审核通过正式商户展示
+					this.$nextTick(() => this.getManageBtnRect())
+				}
+			}, 300)
+
+		},
 
 		// 查询待接单列表
 		getWaitList() {
 			let params = {
-				"techLat": 10.3,
-				"techLng": 50.3
+				"techLat": uni.getStorageSync('positioning').latitude,
+				"techLng": uni.getStorageSync('positioning').longitude,
 			}
 			getWaitList(params).then(res => {
 				if (res.data.code == 200) {
 					if (!res.data.data) return
 					this.pendingOrder = true
-					this.customerType = res.data.data[0].customerType || ''
-					this.orderTitle = res.data.data[0].projectName || ''
-					this.orderServiceTime = res.data.data[0].orderCreateTime || ''
-					this.orderAddress = res.data.data[0].targetAddress + '(' + res.data.data[0].distanceDesc + ')' || ''
+					this.pendingOrderObj = res.data.data[0] || null
 
 				}
 			})
@@ -513,6 +495,10 @@ export default {
 			return merchantInfo.auditStatus//用户状态
 
 
+		},
+		// 更新地址
+		handleUpdateAddress() {
+			locationService.openSystemSettings();
 		},
 		// 我在想想:关闭弹窗
 		cancel() {
@@ -525,13 +511,6 @@ export default {
 				url: '/pages/join/applyJoin' // 替换你的入驻页面路径
 			})
 		},
-		loadPageData() {
-			// this.fetchMerchantInfo()
-			// this.fetchWalletInfo()
-			// this.fetchIncome()
-			// this.fetchWorkData()
-			// this.fetchBankCards()
-		},
 
 		async getSkillList() {
 			let params = {
@@ -545,96 +524,7 @@ export default {
 				}
 			})
 		},
-		// fetchMerchantInfo() {
-		// 	const params = {
-		// 		cOpenId: uni.getStorageSync('wx_copenid')
-		// 	}
-		// 	getMerchantData(params).then(res => {
-		// 		if (res.data.code != 200 || !res.data.data) return
-		// 		const data = res.data.data
-		// 		this.merchantInfo = data
-		// 		this.cJsId = data.id
-		// 		this.isWorking = data.nStatus2 == '0'
-		// 		this.ratingScore = data.nStar != null ? Number(data.nStar).toFixed(1) : '0.0'
-		// 		this.workStartTime = data.dtWorkStart || data.dtOnlineStart || null
-		// 		this.restStartTime = data.dtRestStart || data.restStartTime || null
-		// 		//this.syncCurrentAddress(data)
-		// 		//this.fetchTodayOrders()
-		// 		//this.fetchPendingOrder()
-		// 		//this.fetchSkills()
-		// 	})
-		// },
-		// fetchWalletInfo() {
-		// 	getInfo().then(res => {
-		// 		if (res.data.code == 200 && res.data.data) {
-		// 			this.cJsId = res.data.data.id;
-		// 		}
-		// 	})
-		// },
-		// fetchIncome() {
-		// 	myIncome().then(res => {
-		// 		if (res.data.code == 200 && res.data.data) {
-		// 			this.myIncome = res.data.data
-		// 		}
-		// 	})
-		// },
-		// fetchWorkData() {
-		// 	getStaffWorkData({
-		// 		openId: uni.getStorageSync('wx_copenid')
-		// 	}).then(res => {
-		// 		if (res.data.code == 200 && res.data.data) {
-		// 			const minutes = res.data.data.onLine || 0
-		// 			// this.onlineHours = (minutes / 60).toFixed(1).replace(/\.0$/, '')
-		// 		}
-		// 	})
-		// },
-		// fetchBankCards() {
-		// 	myBank().then(res => {
-		// 		if (res.data.code == 200 && Array.isArray(res.data.data)) {
-		// 			// this.bankCardCount = res.data.data.length
-		// 		}
-		// 	})
-		// },
-		// fetchTodayOrders() {
-		// 	if (!this.cJsId) return
-		// 	getWaitOrder({
-		// 		cJsId: this.cJsId
-		// 	}).then(res => {
-		// 		if (res.data.code == 200) {
-		// 			this.todayOrderCount = res.data.data || 0
-		// 		}
-		// 	})
-		// },
-		fetchSkills() {
-			// TODO: 接口联调后开启,当前使用假数据展示
-			return
-			const openId = uni.getStorageSync('wx_copenid')
-			if (!openId) return
-			getProjectByJsId({
-				openId
-			}).then(res => {
-				if (res.data.code == 200 && Array.isArray(res.data.data)) {
-					this.skillList = res.data.data
-				}
-			})
-		},
-		// fetchPendingOrder() {
-		// 	if (!this.cJsId) return
-		// 	orderDeatails({
-		// 		cJsId: this.cJsId,
-		// 		nStatus: 0,
-		// 		current: 1,
-		// 		size: 1,
-		// 	}).then(res => {
-		// 		if (res.data.code == 200 && res.data.data?.records?.length) {
-		// 			this.pendingOrder = res.data.data.records[0]
-		// 			this.slideX = 0
-		// 			this.initSlideRange()
-		// 		} else {
-		// 			this.pendingOrder = null
-		// 		}
-		// 	})
-		// },
+		// 格式化金额
 		formatMoney(amount) {
 			const num = parseFloat(amount)
 			if (isNaN(num)) return '0.00'
@@ -645,6 +535,7 @@ export default {
 			if (item.nMinute) return '/小时'
 			return ''
 		},
+		// 格式化订单时间
 		formatOrderTime(timeStr) {
 			if (!timeStr) return ''
 			const str = String(timeStr)
@@ -672,6 +563,7 @@ export default {
 			if (Number.isNaN(start)) return 0
 			return Math.max(0, Math.floor((Date.now() - start) / 3600000))
 		},
+		// 格式化状态描述
 		getStatusDesc(type) {
 			const isCurrent =
 				type === 'working' ? this.isWorking : !this.isWorking
@@ -687,10 +579,23 @@ export default {
 			}
 			return '今日辛苦啦,早点下线休息,注意劳逸结合!'
 		},
+		// 查询商户的综合评分
+		getCommentScore() {
+			getCommentScore({
+				merchantId: uni.getStorageSync('merchantId'),
+			}).then(res => {
+				if (res.data.code == 200) {
+					this.ratingScore = res.data.data.comprehensiveScore || 0
+					this.todayOrderCount = res.data.data.orderCount || 0
+				}
+			})
+		},
+		// 打开状态变更弹窗
 		openStatusPopup() {
 			this.statusDraft = this.isWorking ? 'working' : 'rest'
 			this.showStatusPopup = true
 		},
+		// 确认状态变更
 		confirmStatusChange() {
 			const wantWorking = this.statusDraft === 'working'
 			this.showStatusPopup = false
@@ -730,6 +635,7 @@ export default {
 				}
 			})
 		},
+		// 拒绝接单
 		async onRejectOrder() {
 			if (this.auditStatus == 0 || this.auditStatus == 3) {
 				this.showModal = true
@@ -746,10 +652,12 @@ export default {
 			this.showRejectPopup = true
 			this.rejectReason = ''
 		},
+		// 关闭拒绝接单弹窗
 		closeRejectPopup() {
 			this.showRejectPopup = false
 			this.rejectReason = ''
 		},
+		// 提交拒绝接单
 		submitReject() {
 			const reason = this.rejectReason.trim()
 			if (!reason) {
@@ -759,18 +667,20 @@ export default {
 				})
 				return
 			}
-			refuseOrder({
-				cId: this.pendingOrder.cId,
+
+			rejectOrder({
+				id: this.pendingOrderObj.orderId,
 				reasonRefusal: reason,
 			}).then(res => {
 				if (res.data.code == 200) {
 					uni.showToast({
-						title: '已拒绝',
+						title: res.data.msg || '已拒绝',
 						icon: 'none'
 					})
+					// 刷新待接单列表
+					this.getWaitList()
 					this.closeRejectPopup()
 					this.pendingOrder = null
-					this.fetchTodayOrders()
 				} else {
 					uni.showToast({
 						title: res.data.msg || '操作失败',
@@ -793,6 +703,7 @@ export default {
 				})
 			})
 		},
+		
 		async onSlideStart(e) {
 			if (this.auditStatus == 0 || this.auditStatus == 3) {
 				this.showModal = true
@@ -810,6 +721,7 @@ export default {
 			this.slideStartX = e.touches[0].clientX - this.slideX
 			this.initSlideRange()
 		},
+		//
 		onSlideMove(e) {
 			if (!this.isSliding) return
 			let x = e.touches[0].clientX - this.slideStartX
@@ -825,30 +737,29 @@ export default {
 			}
 			this.slideX = 0
 		},
+		// 滑动接单
 		acceptOrder() {
 			if (!this.pendingOrder) return
 			uni.showToast({
 				title: '接单失败',
 				icon: 'none'
 			})
-			return;
-			takeOrder({
-				cId: this.pendingOrder.cId
+			acceptOrder({
+				id: this.pendingOrderObj.orderId,
 			}).then(res => {
-				if (res.data.code == 200) {
-					uni.showToast({
-						title: '已接单',
-						icon: 'none'
-					})
-					this.pendingOrder = null
-					this.fetchTodayOrders()
-				} else {
+				console.log(res)
+				if (res.data.code === 200) {
+					// 刷新待接单列表
+					this.getWaitList()
+					uni.showToast({ title: res.data.msg, icon: 'none' });
+				}else {
 					uni.showToast({
 						title: res.data.msg || '接单失败',
 						icon: 'none'
 					})
 				}
 			})
+			
 		},
 		goProfile() {
 			uni.navigateTo({
@@ -914,58 +825,25 @@ export default {
 		// 	const data = merchantData || this.merchantInfo
 		// 	this.currentAddress = data?.address || data?.name || ''
 		// },
-		goSwitchAddress() {
-			uni.chooseLocation({
-				success: (res) => {
-					console.log('切换地址', res)
 
-				}
+
+		// 切换地址
+		async goSwitchAddress() {
+			// if (this.isLocationPermi) {
+			// 	uni.showToast({ title: '未授权,无法获取地理位置信息', icon: 'none' })
+			// 	return
+			// }
+			const res = await addressService.chooseLocation();
+			await locationService.updateData({
+				latitude: res.latitude,
+				longitude: res.longitude
 			});
+			// 使用经纬度进行逆地理编码
+			await locationService.updateGeocode();
+			this.currentAddress = uni.getStorageSync("city") + uni.getStorageSync("addressName") + res.address + res.name;
+			await this.initData()
 		},
-		async goUpdateAddress() {
-			if (!this.cJsId) {
-				uni.showToast({ title: '请先登录', icon: 'none' })
-				return
-			}
-			try {
-				const res = await this.$utils.addressService.chooseLocation()
-				console.log('选择地址', res)
-				const params = {
-					id: this.cJsId,
-					cPhone: this.merchantInfo.cPhone,
-					name: res.name,
-					address: res.address,
-					latitude: res.latitude,
-					longitude: res.longitude,
-					cOpenId: uni.getStorageSync('wx_copenid'),
-				}
-				const apiRes = await getJsLocation(params)
-				if (apiRes.data.code == 200) {
-					uni.setStorageSync('staffLocation', {
-						name: res.name,
-						address: res.address,
-						latitude: res.latitude,
-						longitude: res.longitude,
-					})
-					this.syncCurrentAddress()
-					uni.showToast({
-						title: '地址已更新',
-						icon: 'none'
-					})
-				} else {
-					uni.showToast({
-						title: apiRes.data.msg || '更新失败',
-						icon: 'none'
-					})
-				}
-			} catch (err) {
-				if (err?.cancelled) return
-				uni.showToast({
-					title: err?.message || '获取位置失败',
-					icon: 'none'
-				})
-			}
-		},
+		// 更多功能
 		onMoreFeature(item) {
 			if (item.label == '退出登录') {
 				this.showModal2 = true
@@ -1675,10 +1553,16 @@ $page-bg: #f6f7f9;
 .address-row {
 	display: flex;
 	align-items: flex-start;
-	align-items: center;
 	margin-bottom: 32rpx;
 }
 
+.address-icon-box {
+	height: 40rpx;
+	display: flex;
+	align-items: center;
+
+}
+
 .address-icon {
 	width: 24rpx;
 	height: 28rpx;
@@ -1690,7 +1574,6 @@ $page-bg: #f6f7f9;
 	flex: 1;
 	font-size: 26rpx;
 	color: #666666;
-	line-height: 1.6;
 
 	&.auth-error {
 		color: #F53F3F; // 错误提示红色
@@ -1772,70 +1655,31 @@ $page-bg: #f6f7f9;
 	line-height: 1.4;
 }
 
-/* 弹窗 */
-.popup-mask {
-	position: fixed;
-	left: 0;
-	top: 0;
-	right: 0;
-	bottom: 0;
-	background: rgba(0, 0, 0, 0.4);
-	z-index: 999;
-	display: flex;
-	align-items: center;
-	justify-content: center;
-}
 
-.popup-box {
-	width: 600rpx;
-	background: #fff;
-	border-radius: 8rpx;
-	padding: 32rpx;
-}
+::v-deep .popup-input {
+	margin-top: 8rpx;
+	padding: 8rpx;
+	height: 124rpx;
+	background: #F7F8FA;
+	border-radius: 6rpx 6rpx 6rpx 6rpx;
+	border: none;
 
-.popup-title {
-	font-size: 28rpx;
-	color: #333;
-	text-align: center;
-	margin-bottom: 24rpx;
-}
 
-.popup-input {
-	width: 100%;
-	height: 72rpx;
-	border: 1rpx solid #ddd;
-	border-radius: 6rpx;
-	padding: 0 20rpx;
-	font-size: 26rpx;
-	box-sizing: border-box;
-}
-
-.popup-btns {
-	display: flex;
-	gap: 24rpx;
-	margin-top: 32rpx;
-}
+	.uni-textarea-placeholder {
+		font-weight: 400;
+		font-size: 28rpx;
+		color: #86909C !important;
 
-.popup-btn {
-	flex: 1;
-	height: 72rpx;
-	line-height: 72rpx;
-	text-align: center;
-	border: 1rpx solid #ccc;
-	border-radius: 6rpx;
-	font-size: 28rpx;
-	color: #666;
+	}
 
-	&.confirm {
-		background: linear-gradient(90deg, #3dd9cf 0%, #1ecbc3 100%);
-		border-color: #1ecbc3;
-		color: #fff;
+	.u-textarea__field {
+		font-weight: 400;
+		font-size: 26rpx;
+		color: #4E5969!important;
 	}
 }
 
-.popup-mask.bottom {
-	align-items: flex-end;
-}
+
 
 .status-panel {
 	width: 100%;

+ 0 - 1
src/pages/join/commitDocumentEdit.vue

@@ -459,7 +459,6 @@ export default {
         position: absolute;
         right: 0;
         top: 0;
-        color: #f80000 !important;
         z-index: 999;
         border-bottom-left-radius: 12rpx;
         border-top-right-radius: 12rpx;

+ 92 - 69
src/pages/my/dynamic/add_dynamic.vue

@@ -2,15 +2,15 @@
   <view class="publish-container">
     <view class="content-body">
       <view class="text-area">
-        <u--textarea class="textareaDef" v-model="formData.title" placeholder="请输入标题..." maxLength="30" border="none"
-          height="20"></u--textarea>
+        <u--textarea class="textareaDef" v-model="formData.title" placeholder="请输入标题..." maxlength="30" border="none"
+          autoHeight></u--textarea>
         <view class="line"></view>
       </view>
       <view class="content-area">
         <u--textarea class="textareaDef" v-model="formData.content" placeholder="
-此刻你想要分享" maxLength="500" border="none" height="150" count></u--textarea>
+此刻你想要分享" maxlength="500" border="none" height="150" count></u--textarea>
       </view>
-      <view class="media-area" :style="{width: formData.videoUrl ? '340rpx' : '100%' }">
+      <view class="media-area" :style="{ width: formData.videoUrl ? '340rpx' : '100%' }">
         <view v-if="formData.videoUrl">
           <view class="icon iconfont icon-cuo">
             <image src="/static/login/close2.png" mode="" style="width: 32rpx;height: 32rpx;" @tap="delectVideo">
@@ -19,19 +19,21 @@
 
           <video ref="myVideo" :src="formData.videoUrl" class="video-container" controls></video>
         </view>
+
+
         <clUpload v-else v-model="fileList" :action="uploadApi" :headers="headers" :count="maxCount" :listStyle="{
           columnGap: '20rpx',
           rowGap: '20rpx',
           width: '130rpx',
           radius: '12rpx',
         }" :imageFormData="{
-                          count: 9,
-                          size: 2,
-                        }" :videoFromData="{
-                          count: 1,
-                          size: 50,
-                        }" :maxVideo="1" :fileType="mediaType" addImg="/static/login/cameraIcon.png"
-          deleteImg="/static/login/cameraIcon.png" @onSuccess="onSuccess" @onMediaTypeSelect="selectMediaType"
+          count: 9,
+          size: 2,
+        }" :videoFromData="{
+          count: 1,
+          size: 50,
+        }" :maxVideo="1" :fileType="mediaType" addImg="/static/login/cameraIcon.png"
+          deleteImg="/static/login/close2.png" @onSuccess="onSuccess" @onMediaTypeSelect="selectMediaType"
           @onError="onCancel">
 
 
@@ -229,9 +231,9 @@ export default {
           reslut.url.endsWith('.mkv') ||
           reslut.url.endsWith('.wmv')
         console.log(isVideo, 'isVideo')
-           console.log(reslut, 'reslut')
+        console.log(reslut, 'reslut')
         if (isVideo) {
-       
+          this.fileList = []
           this.formData.videoUrl = baseUrl + reslut.url
           this.formData.videoCoverUrl = baseUrl + reslut.coverUrl
         } else {
@@ -277,7 +279,7 @@ export default {
     selectLocation() {
       uni.chooseLocation({
         success: res => {
-          // console.log('选择的位置信息:', res)
+          console.log('选择的位置信息:', res)
           const locationData = {
             location: res.name,
             address: res.address,
@@ -367,19 +369,19 @@ export default {
     },
     // 提交动态
     async submit(type) {
-      console.log(type)
-      if (
-        type == 'publish' &&
-        (!this.formData.title ||
-          !this.formData.content ||
-          !this.formData.location 
-        )//!this.formData.visibleRange
-      
-          // ||(this.mediaType == 1 && this.fileList.length === 0) ||
-         // (this.mediaType == 2 && !this.formData.videoUrl)
-      ) {
-        uni.showToast({ title: '请完善动态内容', icon: 'none' })
-        return
+      if (type == 'publish') {
+        if (!this.formData.title) {
+          uni.showToast({ title: '动态标题不能为空', icon: 'none' })
+          return
+        }
+        if (!this.formData.content) {
+          uni.showToast({ title: '动态内容不能为空', icon: 'none' })
+          return
+        }
+        if (!this.formData.location) {
+          uni.showToast({ title: '请选择动态发布地', icon: 'none' })
+          return
+        }
       } else if (type == 'draft') {
         if (!this.formData.title) {
           uni.showToast({ title: '动态标题不能为空', icon: 'none' })
@@ -395,20 +397,28 @@ export default {
         uni.showToast({ title: '文件上传中,请稍候', icon: 'none' })
         return
       }
-
       this.loading = true
-
       try {
         // 提交数据
         const postData = {
-          ...this.formData,
+          title: this.formData.title.trim(),
+          content: this.formData.content.trim(),
+          location: this.formData.location.trim(),
+          address: this.formData.address.trim(),
+          latitude: this.formData.latitude || '',
+          longitude: this.formData.longitude || '',
+          cityCode: uni.getStorageSync("cityCode"),
+          mediaType: 3,
           isDraft: type == 'draft' ? 1 : 0,
-          mediaType: this.formData.videoUrl ? 2 : this.fileList.length > 0 ? 1 : 3,
-          imageUrls: this.fileList,
         }
-
-        console.log('提交数据:', postData)
-
+        if (this.formData.videoUrl) {
+          postData.mediaType = 2
+          postData.videoUrl = this.formData.videoUrl
+          postData.videoCoverUrl = this.formData.videoCoverUrl
+        } else if (this.fileList.length > 0) {
+          postData.mediaType = 1
+          postData.imageUrls = this.fileList
+        }
         // 调用发布接口
         let api = dynamicPublish
         if (this.formData.momentId) {
@@ -424,9 +434,7 @@ export default {
           })
 
           setTimeout(() => {
-            uni.navigateBack({
-              delta: 1,
-            })
+            uni.navigateBack()
           }, 800)
         } else {
           uni.showToast({
@@ -449,38 +457,40 @@ export default {
 
 <style lang="scss" scoped>
 .media-area {
-  
-    margin: 20rpx 0 0 0;
-    justify-content: space-between;
-    position: relative;
-    .add-image{
-      border: 1px solid #f80000;
-    }
 
-    .icon-cuo {
-        background-color: #0000009c;
-        width: 40rpx;
-        height: 40rpx;
-        position: absolute;
-        right: 0;
-        top: 0;
-        z-index: 999;
-        border-bottom-left-radius: 12rpx;
-        border-top-right-radius: 12rpx;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        
-    }
+  margin: 20rpx 0 0 0;
+  justify-content: space-between;
+  position: relative;
+
+  .add-image {
+    border: 1px solid #f80000;
+  }
+
+  .icon-cuo {
+    background-color: #0000009c;
+    width: 40rpx;
+    height: 40rpx;
+    position: absolute;
+    right: 0;
+    top: 0;
+    z-index: 999;
+    border-bottom-left-radius: 12rpx;
+    border-top-right-radius: 12rpx;
+    display: flex;
+    justify-content: center;
+    align-items: center;
 
+  }
 
 
-    .video-container {
-        width: 340upx;
-        height: 240upx;
-        border-radius: 12rpx;
-    }
+
+  .video-container {
+    width: 340upx;
+    height: 240upx;
+    border-radius: 12rpx;
+  }
 }
+
 .text-area {
   .textareaDef {
     padding: 24rpx 0 !important;
@@ -618,15 +628,28 @@ export default {
     }
 
     .file-list-row .remove {
-      background-color: transparent !important;
+      background-color:  rgba(0,0,0,0.5)!important;
+      width: 40rpx;
+      height: 40rpx;
+      position: absolute;
+      right: 0;
+      top: 0;
+      z-index: 999;
+      border-bottom-left-radius: 12rpx;
+      border-top-right-radius: 12rpx;
+      display: flex;
+      justify-content: center;
+      align-items: center;
 
-      .image[data-v-0b7ccd9e] {
+      .image {
         width: 24rpx;
         height: 24rpx;
         position: absolute;
-        right: 4rpx;
-        top: 4rpx;
+        right: 10rpx;
+        top: 10rpx;
       }
+
+      
     }
   }
 }

+ 13 - 4
src/pages/my/dynamic/components/my_list.vue

@@ -25,9 +25,12 @@
           </view>
         </view>
         <view class="contentText">{{ item.content }}</view>
-        <view class="item-image">
-          <image :src="item.coverUrl" mode="aspectFill"></image>
+        <view class="image-box">
+          <view class="item-image" v-for="(img, index) in item.mediaUrlList">
+          <image :key="index" :src="img" mode="aspectFill"></image>
         </view>
+        </view>
+        
 
 
       </view>
@@ -131,7 +134,6 @@ export default {
       dynamicDelete({
         momentId: this.currentObj.id,
       }).then(res => {
-        console.log(res)
         if (res.data.code == 200) {
           uni.showToast({
             title: res.data.msg,
@@ -167,7 +169,7 @@ export default {
       if (item.name === '编辑') {
         if (this.currentAuditStatus == 1 || this.currentAuditStatus == 2) {
           uni.showToast({
-            title: this.currentAuditStatus == 1 ? '审核中' : '已发布' + '的动态不支持编辑',
+            title: this.currentAuditStatus == 1 ? '审核中的动态不支持编辑' : '已发布的动态不支持编辑',
             icon: 'none'
           })
           return
@@ -280,6 +282,13 @@ export default {
       }
     }
 
+    .image-box {
+      display: flex;
+      flex-wrap: wrap;
+      gap: 20rpx;
+      
+    }
+
     .item-image {
       width: 200rpx;
       height: 200rpx;

+ 2 - 2
src/pages/my/dynamic/index.vue

@@ -2,8 +2,8 @@
   <view class="page-container">
     <z-paging ref="paging" v-model="dynamicList" @query="queryList">
 
-      <!-- 我的动态 @refreshList="queryList"-->
-      <my-dynamic-list :data-list="dynamicList"></my-dynamic-list>
+      <!-- 我的动态 -->
+      <my-dynamic-list :data-list="dynamicList" @refreshList="queryList"></my-dynamic-list>
 
 
       <template v-slot:empty>

+ 10 - 10
src/pages/my/feedback.vue

@@ -66,7 +66,7 @@
 <script>
 	import {
 		complain,
-		getCityList,complaintEnum
+		complaintEnum
 	} from '@/api/index'
 	import Upload from '@/components/upload/index.vue';
   import { baseUrl } from '@/common/config.js';
@@ -165,15 +165,15 @@
 				})
 			},
 			getCity() {
-				getCityList().then(res => {
-					this.cityList = res.data.data.map(({
-						deptId,
-						deptName
-					}) => ({
-						value: deptId,
-						label: deptName
-					}))
-				});
+				// getCityList().then(res => {
+				// 	this.cityList = res.data.data.map(({
+				// 		deptId,
+				// 		deptName
+				// 	}) => ({
+				// 		value: deptId,
+				// 		label: deptName
+				// 	}))
+				// });
 			}
 		}
 	}

+ 1 - 1
src/pages/my/free_fare.vue

@@ -36,7 +36,7 @@
 
 <script>
 	import {
-		freeFare,
+		// freeFare,
 		getMerchantData
 	} from '../../api/index.js'
 	export default {

+ 9 - 10
src/pages/my/indent.vue

@@ -135,7 +135,6 @@
 
 <script>
 	import {
-		getCityList,
 		getProjectList,
 		getMerchantData,
 	} from '@/api/index';
@@ -374,15 +373,15 @@
 				})
 			},
 			getCity() {
-				getCityList().then(res => {
-					this.cityList = res.data.data.map(({
-						deptId,
-						deptName
-					}) => ({
-						value: deptId,
-						label: deptName
-					}))
-				});
+				// getCityList().then(res => {
+				// 	this.cityList = res.data.data.map(({
+				// 		deptId,
+				// 		deptName
+				// 	}) => ({
+				// 		value: deptId,
+				// 		label: deptName
+				// 	}))
+				// });
 			},
 			selectCity() {
 				this.show = true

+ 3 - 4
src/pages/my/pay.vue

@@ -145,7 +145,6 @@
 	import {
 		pay,
 		getSignature,
-		getCityList,
 		engineer,
 		getInfo
 	} from '../../api/index.js'
@@ -228,9 +227,9 @@
 				// data.city = uni.getStorageSync('selectCity')
 				data.city = '太原'
 				data.search = this.search
-				getCityList().then(res => {
-					this.cityList = res.data.data
-				})
+				// getCityList().then(res => {
+				// 	this.cityList = res.data.data
+				// })
 			},
 			getJsList() {
 				let data = {}

+ 188 - 185
src/utils/location.js

@@ -6,260 +6,263 @@ if (process.env.NODE_ENV == 'development') {
 }
 
 class LocationService {
-    /**
-     * 初始化定位 (主入口)
-     * 策略:优先 GPS -> 失败则 IP兜底 -> 统一逆地理编码
-     * @returns {Promise<Object>} 返回最终的定位数据
-     */
-    async initLocation() {
+  /**
+   * 初始化定位 (主入口)
+   * 策略:优先 GPS -> 失败则 IP兜底 -> 统一逆地理编码
+   * @returns {Promise<Object>} 返回最终的定位数据
+   */
+  async initLocation() {
         console.log('--- 开始初始化定位 ---');
-        
-        try {
+
+    try {
             if (uni.getSystemInfoSync().uniPlatform === 'web') {
 
-            }
-            // Step 1: 优先尝试 GPS 精准定位, 竞速机制避免超时
+      }
+      // Step 1: 优先尝试 GPS 精准定位, 竞速机制避免超时
             const gpsResult = await Promise.race([this.getGPSLocation(), this.timePromise()]);
-            
-            // Step 2: 如果 GPS 定位失败(如用户拒绝权限或超时),则降级使用 IP 定位
+
+      // Step 2: 如果 GPS 定位失败(如用户拒绝权限或超时),则降级使用 IP 定位
             if (gpsResult.status !== 'success') {
                 console.log('GPS定位失败或被拒绝,降级使用 IP 定位');
-                await this.getIPLocation();
-            }
-            
-            // 等待逆地理编码完成(获取城市名),没有cityCode才去查
+        await this.getIPLocation();
+      }
+
+      // 等待逆地理编码完成(获取城市名),没有cityCode才去查
             if (!uni.getStorageSync('cityCode')) {
-                await this.updateGeocode();
-            }
+        await this.updateGeocode();
+      }
 
-            // Step 3: 确保数据已更新到 Storage,返回最新数据
+      // Step 3: 确保数据已更新到 Storage,返回最新数据
             const finalLocation = uni.getStorageSync('positioning');
-            return finalLocation;
+      return finalLocation;
 
-        } catch (error) {
+    } catch (error) {
             console.error('定位流程异常:', error);
-            // 即使报错,也尝试返回缓存中的旧数据,避免页面崩溃
+      // 即使报错,也尝试返回缓存中的旧数据,避免页面崩溃
             return uni.getStorageSync('positioning') || {};
-        }
     }
-    // 获取 IP 定位
-    getIPLocation() {
-        return new Promise(async (resolve) => {
+  }
+  // 获取 IP 定位
+  getIPLocation() {
+    return new Promise(async (resolve) => {
             if (process.env.NODE_ENV === 'development') {
                 let url = 'https://ip9.com.cn/get';
-                // #ifdef H5
-                // 正则匹配规则:覆盖 localhost、127.0.0.1、192.168.x.x、::1(IPv6回环)
+        // #ifdef H5
+        // 正则匹配规则:覆盖 localhost、127.0.0.1、192.168.x.x、::1(IPv6回环)
                 const localReg = /^(localhost|::1|127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})|192\.168\.(\d{1,3})\.(\d{1,3}))$/;
-                if (localReg.test(window.location.hostname.toLowerCase())) {
-                    url = '/getIp/get';
-                }
-                // #endif
-                uni.request({
-                    url: url,   
+        if (localReg.test(window.location.hostname.toLowerCase())) {
+          url = "/getIp/get";
+        }
+        // #endif
+        uni.request({
+          url: url,
                     method: 'GET',
-                    success: (res) => {
-                        if (res.data.ret == 200) {
-                            this.updateData({
-                                latitude: res.data.data.lat,
-                                longitude: res.data.data.lng,
+          success: (res) => {
+            if (res.data.ret == 200) {
+              this.updateData({
+                latitude: res.data.data.lat,
+                longitude: res.data.data.lng,
                                 source: 'ip'
-                            });
-                        }
-                        resolve();
-                    },
+              });
+            }
+            resolve();
+          },
                     fail: () => resolve() // 失败也 resolve,不阻断流程
-                });
-            } else {
-                try {
-                    const res = await getCity();
-                    if (res.code === 200 && res.result.lat !== 0) {
+        });
+      } else {
+        try {
+          const res = await getCity();
+          if (res.code === 200 && res.result.lat !== 0) {
                         if (!uni.getStorageSync('cityCode')) {
                             uni.setStorageSync('city', res.result.areaCname);
                             uni.setStorageSync('cityCode', res.result.areaCode);
-                        }
+            }
 
-                        this.updateData({
-                            latitude: res.result.lat,
-                            longitude: res.result.lng,
+            this.updateData({
+              latitude: res.result.lat,
+              longitude: res.result.lng,
                             source: 'ip'
-                        });
-                    }
-                    resolve();
-                } catch (e) {
-                    resolve();
-                }
-            }
-        });
-    }
-    // 获取 GPS 原生定位
-    getGPSLocation() {
-        return new Promise((resolve) => {
-            uni.getLocation({
-                // #ifdef H5
+            });
+          }
+          resolve();
+        } catch (e) {
+          resolve();
+        }
+      }
+    });
+  }
+  // 获取 GPS 原生定位
+  getGPSLocation() {
+    return new Promise((resolve) => {
+      uni.getLocation({
+        // #ifdef H5
                 type: 'wgs84',
-                // #endif
-                // #ifndef H5
+        // #endif
+        // #ifndef H5
                 type: 'gcj02',
-                // #endif
-                geocode: true,
-                isHighAccuracy: true,
-                success: async (res) => {
+        // #endif
+        geocode: true,
+        isHighAccuracy: true,
+        success: async (res) => {
                     console.log('GPS 定位成功', res);
-                    this.updateData({
-                        latitude: res.latitude,
-                        longitude: res.longitude,
-                        source: 'gps',
-                        isRefuse: ''
-                    });
-                    
+          this.updateData({
+            latitude: res.latitude,
+            longitude: res.longitude,
+            address: res.address,
+            name: res.name,
+            source: "gps",
+            isRefuse: "",
+          });
+
                     resolve({ status: 'success', data: res });
-                },
-                fail: (err) => {
+        },
+        fail: (err) => {
                     console.log('GPS 定位失败或拒绝', err);
-                    // 记录拒绝状态
-                    this.updateData({
+          // 记录拒绝状态
+          this.updateData({
                         isRefuse: 1
-                    });
-                    
+          });
+
                     resolve({ status: 'fail', error: err });
                 }
-            });
-        });
-    }
-    // 超时Promise
-    timePromise(wait = 1000) {
-        return new Promise((resolve) => {
-            // 2秒超时阈值
-            setTimeout(() => {
-                // 超时后返回「超时标识」,方便后续区分
+      });
+    });
+  }
+  // 超时Promise
+  timePromise(wait = 1000) {
+    return new Promise((resolve) => {
+      // 2秒超时阈值
+      setTimeout(() => {
+        // 超时后返回「超时标识」,方便后续区分
                 resolve({ status: 'fail', error: 'GPS定位超时' });
-            }, wait); 
+      }, wait);
         })
-    } 
-    // 更新storage
-    updateData(data) {
+  }
+  // 更新storage
+  updateData(data) {
         const current = uni.getStorageSync('positioning') || {};
         uni.setStorageSync('positioning', {
-            ...current,
+      ...current,
             ...data
-        });
-    }
-    // 天地图逆地理编码 (经纬度 -> 城市信息),e为搜索时传值
-    updateGeocode(e) {
-        return new Promise((resolve) => {
+    });
+  }
+  // 天地图逆地理编码 (经纬度 -> 城市信息),e为搜索时传值
+  updateGeocode(e) {
+    return new Promise((resolve) => {
             let location = e || uni.getStorageSync('positioning');
-            if (!location || !location.longitude || !location.latitude) {
-                return resolve();
-            }
+      if (!location || !location.longitude || !location.latitude) {
+        return resolve();
+      }
 
             let postStr = { 'lon': location.longitude, 'lat': location.latitude };
-            uni.request({
+      uni.request({
                 url: `https://api.tianditu.gov.cn/geocoder?postStr=${encodeURIComponent(JSON.stringify(postStr))}&type=geocode&tk=${TIANDITU_KEY}`,
-                success: (res) => {
-                    if (res.statusCode == 200 && res.data.status == 0) {
-                        let obj = res.data.result.addressComponent;
-                        uni.setStorageSync('city', obj.city);
-                        uni.setStorageSync('cityCode', obj.city_code.slice(3));
-                        uni.setStorageSync('addressName', obj.county);
-                        uni.setStorageSync('addressCode', obj.county_code.slice(3));
-                        // 经纬度所属城市,没有e说明是上面定位流程过来的
+        success: (res) => {
+          if (res.statusCode == 200 && res.data.status == 0) {
+            let obj = res.data.result.addressComponent;
+            uni.setStorageSync("city", obj.city || obj.province);
+            uni.setStorageSync("cityCode", obj.city_code.slice(3) || obj.province_code.slice(3));
+            uni.setStorageSync("addressName", obj.county);
+            uni.setStorageSync("addressCode", obj.county_code.slice(3));
+
+            // 经纬度所属城市,没有e说明是上面定位流程过来的
                         if (!e) this.updateData({
                             cityName: obj.city
-                        });
+              });
                         console.log('逆地理编码更新成功:', obj.city);
-                    }
-                    resolve();
-                },
+          }
+          resolve();
+        },
                 fail: () => resolve()
-            });
-        });
-    }
-    // 天地图地理编码 (城市信息 -> 经纬度)
-    searchGeocode(e) {
-        return new Promise((resolve) => {
-            if (!e) {
-                return resolve();
-            }
+      });
+    });
+  }
+  // 天地图地理编码 (城市信息 -> 经纬度)
+  searchGeocode(e) {
+    return new Promise((resolve) => {
+      if (!e) {
+        return resolve();
+      }
 
             let postStr = { 'keyWord': e };
-            uni.request({
+      uni.request({
                 url: `https://api.tianditu.gov.cn/geocoder?ds=${encodeURIComponent(JSON.stringify(postStr))}&tk=${TIANDITU_KEY}`,
-                success: (res) => {
-                    if (res.statusCode == 200 && res.data.status == 0) {
-                        let obj = res.data.location;
-                        this.updateGeocode({
-                            latitude: obj.lat,
-                            longitude: obj.lon,
-                        });
+        success: (res) => {
+          if (res.statusCode == 200 && res.data.status == 0) {
+            let obj = res.data.location;
+            this.updateGeocode({
+              latitude: obj.lat,
+              longitude: obj.lon,
+            });
                         console.log('地理编码更新成功:', obj.keyWord);
-                    }
-                    resolve();
-                },
+          }
+          resolve();
+        },
                 fail: () => resolve()
-            });
-        });
-    }
-    // 跳转到对应平台的系统设置页面
-    openSystemSettings() {
+      });
+    });
+  }
+  // 跳转到对应平台的系统设置页面
+  openSystemSettings() {
         console.log('--- 尝试打开系统设置,准备重新定位 ---');
-        
-        // #ifdef APP-PLUS
-        // App 端:直接调用 uni.openAppAuthorizeSetting
-        uni.openAppAuthorizeSetting({
-            success(res) {
+
+    // #ifdef APP-PLUS
+    // App 端:直接调用 uni.openAppAuthorizeSetting
+    uni.openAppAuthorizeSetting({
+      success(res) {
                 console.log('App: 成功打开授权设置界面', res);
-            },
-            fail(err) {
+      },
+      fail(err) {
                 console.error('App: 打开授权设置界面失败', err);
-            },
-            complete: async () => {
-                // 确保 App 重新获得焦点且系统状态已更新
+      },
+      complete: async () => {
+        // 确保 App 重新获得焦点且系统状态已更新
                 await new Promise(r => setTimeout(r, 500)); 
-                
-                // 重新执行完整的定位流程
+
+        // 重新执行完整的定位流程
                 console.log('App: 从系统设置返回,重新执行 initLocation');
-                await this.initLocation();
+        await this.initLocation();
             }
-        });
-        // #endif
+    });
+    // #endif
 
-        // #ifdef MP
-        // 小程序端:提示用户进入设置页。实际的小程序权限设置需要用户在页面内点击 open-type="openSetting" 按钮触发。
-        uni.showModal({
+    // #ifdef MP
+    // 小程序端:提示用户进入设置页。实际的小程序权限设置需要用户在页面内点击 open-type="openSetting" 按钮触发。
+    uni.showModal({
             title: '授权提示',
             content: '请在小程序设置页中手动开启“位置信息”权限。',
             confirmText: '去设置',
-            success: (res) => {
-                if (res.confirm) {
-                    // 注意:uni.openSetting 在部分小程序平台可能已被废弃,且需要在用户交互后才能调用。
-                    // 最佳实践是引导用户去一个包含 <button open-type="openSetting"></button> 的页面。
-                    uni.openSetting({
-                        success: async (settingRes) => {
+      success: (res) => {
+        if (res.confirm) {
+          // 注意:uni.openSetting 在部分小程序平台可能已被废弃,且需要在用户交互后才能调用。
+          // 最佳实践是引导用户去一个包含 <button open-type="openSetting"></button> 的页面。
+          uni.openSetting({
+            success: async (settingRes) => {
                             console.log('MP: 用户完成设置', settingRes);
                             if (settingRes.authSetting['scope.userLocation']) {
-                                // 权限开启,重新定位
-                                await this.initLocation();
-                            }
-                        },
-                        fail: () => {
+                // 权限开启,重新定位
+                await this.initLocation();
+              }
+            },
+            fail: () => {
                             console.log('MP: 打开设置页失败');
                         }
-                    });
-                }
+          });
+        }
             }
-        });
-        // #endif
+    });
+    // #endif
 
-        // #ifdef H5
-        // H5 端:通常无法直接打开系统设置,只能提示用户手动操作
-        uni.showModal({
+    // #ifdef H5
+    // H5 端:通常无法直接打开系统设置,只能提示用户手动操作
+    uni.showModal({
             title: '授权提示',
             content: '请在浏览器或系统设置中手动开启定位权限。',
-            showCancel: false,
+      showCancel: false,
             confirmText: '知道了'
-        });
-        // #endif
-    }
+    });
+    // #endif
+  }
 }
 
 export default new LocationService();

+ 2 - 2
src/utils/request.js

@@ -18,8 +18,8 @@ export default (params) => {
                     // 401
                     if (res.data.code == 401) {
 						console.log(res.data,'401')
-						// uni.clearStorage();
-						// uni.removeStorageSync('access-token');
+						uni.clearStorage();
+						uni.removeStorageSync('access-token');
 						
                     }
 					resolve(res);