From fa4c7baec36d58b4bdca66159ece743b5a45a9c8 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期四, 11 六月 2026 10:15:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 app/pages/index/index.vue |  183 ++++++++++++++++++++++++++++-----------------
 1 files changed, 112 insertions(+), 71 deletions(-)

diff --git a/app/pages/index/index.vue b/app/pages/index/index.vue
index b9d4f09..a3695b9 100644
--- a/app/pages/index/index.vue
+++ b/app/pages/index/index.vue
@@ -261,6 +261,8 @@
 
 <script>
 	import { mapState } from 'vuex'
+	import { checkLocationPermission } from '@/utils/utils'
+	
 	export default {
 		data() {
 			return {
@@ -339,13 +341,9 @@
 			this.scrollHeight = Math.max(windowHeight - this.headerHeight, 0)
 			if (this.userInfo.auditStatus === 99) return;
 			this.acceptingStatus = this.userInfo.acceptingStatus || 0
-			this.$u.api.centerInfo().then(res => {
-				if (res.code === 200) {
-					this.acceptingStatus = res.data.acceptingStatus
-					if (res.data.acceptingStatus === 1) {
-						this.loadOrdersByTab(this.activeTab)
-					}
-				}
+			this.init()
+			uni.$on('locationPermissionGranted', () => {
+				this.init()
 			})
 			uni.$on('jiedanSuccess', () => {
 				this.loadOrdersByTab(this.activeTab)
@@ -396,6 +394,17 @@
 		},
 
 		methods: {
+			init() {
+				console.log('index-init')
+				this.$u.api.centerInfo().then(res => {
+					if (res.code === 200) {
+						this.acceptingStatus = res.data.acceptingStatus
+						if (res.data.acceptingStatus === 1) {
+							this.loadOrdersByTab(this.activeTab)
+						}
+					}
+				})
+			},
 			handleScrollToLower() {
 				if (this.acceptingStatus === 0) return;
 				this.hallPage++
@@ -504,12 +513,19 @@
 				})
 			},
 			getActiveOrderCount() {
-				this.$u.api.activeOrderCount().then(res => {
-					if (res.code === 200) {
-						this.activeOrderCount = res.data
+				checkLocationPermission().then((granted) => {
+					if (granted) {
+						console.log('宸叉湁浣嶇疆鏉冮檺-璁㈠崟鏁伴噺')
+						this.$u.api.activeOrderCount().then(res => {
+							if (res.code === 200) {
+								this.activeOrderCount = res.data
+							}
+						}).catch((err) => {
+							this.activeOrderCount = null
+						})
+					} else {
+						console.log('杩樻病鏈変綅缃潈闄�-璁㈠崟鏁伴噺')
 					}
-				}).catch((err) => {
-					this.activeOrderCount = null
 				})
 			},
 
@@ -622,14 +638,17 @@
 				if (this.userInfo.auditStatus === 99) return;
 				if (this.acceptingStatus === 0) return;
 				if (tab === 'hall') {
+					console.log('鎶㈠崟澶у巺')
 					this.hallPage = 1
 					this.hallHasMore = true
 					this.orderList = []
 					this.getHallOrders()
 				} else if (tab === 'pickup') {
+					console.log('寰呭彇璐�')
 					this.pickupOrderList = []
 					this.getPickupOrders()
 				} else if (tab === 'delivering') {
+					console.log('閰嶉�佷腑')
 					this.deliveringOrderList = []
 					this.getDeliveringOrders()
 				}
@@ -640,81 +659,103 @@
 				if (this.hallLoading || !this.hallHasMore) {
 					return
 				}
-				this.hallLoading = true
-
-				let distance = null
-				if (this.selectedFilters.distance !== '涓嶉檺') {
-					const distanceText = this.selectedFilters.distance
-					if (distanceText.includes('km')) {
-						distance = parseInt(distanceText) * 1000
+				
+				checkLocationPermission().then((granted) => {
+					if (granted) {
+						console.log('宸叉湁浣嶇疆鏉冮檺')
+						this.hallLoading = true
+						
+						let distance = null
+						if (this.selectedFilters.distance !== '涓嶉檺') {
+							const distanceText = this.selectedFilters.distance
+							if (distanceText.includes('km')) {
+								distance = parseInt(distanceText) * 1000
+							} else {
+								distance = parseInt(distanceText)
+							}
+						}
+						
+						const sortTypeMap = {
+							'缁煎悎鎺掑簭': 1,
+							'璺濈鏈�杩�': 2
+						}
+						const sortType = this.selectedFilters.sort !== '涓嶉檺' ? (sortTypeMap[this.selectedFilters.sort] || null) : null
+						
+						let gradeId = null
+						if (this.selectedFilters.level !== '涓嶉檺') {
+							const selectedCategory = this.categoryList.find(item => item.name === this.selectedFilters.level)
+							if (selectedCategory) {
+								gradeId = selectedCategory.id
+							}
+						}
+						
+						this.$u.api.grabOrderHall({
+							capacity: this.hallPageSize,
+							page: this.hallPage,
+							model: {
+								distance: distance,
+								gradeId: gradeId,
+								sortType: sortType
+							}
+						}).then(res => {
+							this.hallLoading = false
+							if (res.code === 200) {
+								const list = res.data.records || []
+								this.orderList = this.hallPage === 1 ? list : this.orderList.concat(list)
+								this.hallHasMore = list.length >= this.hallPageSize
+							}
+						}).finally(() => {
+							this.hallLoading = false
+						})
 					} else {
-						distance = parseInt(distanceText)
+						console.log('杩樻病鏈変綅缃潈闄�')
 					}
-				}
-
-				const sortTypeMap = {
-					'缁煎悎鎺掑簭': 1,
-					'璺濈鏈�杩�': 2
-				}
-				const sortType = this.selectedFilters.sort !== '涓嶉檺' ? (sortTypeMap[this.selectedFilters.sort] || null) : null
-
-				let gradeId = null
-				if (this.selectedFilters.level !== '涓嶉檺') {
-					const selectedCategory = this.categoryList.find(item => item.name === this.selectedFilters.level)
-					if (selectedCategory) {
-						gradeId = selectedCategory.id
-					}
-				}
-
-				console.log('鎺ュ崟澶у巺:', { distance, gradeId, sortType })
-				this.$u.api.grabOrderHall({
-					capacity: this.hallPageSize,
-					page: this.hallPage,
-					model: {
-						distance: distance,
-						gradeId: gradeId,
-						sortType: sortType
-					}
-				}).then(res => {
-					console.log('鎺ュ崟澶у巺', res)
-					this.hallLoading = false
-					if (res.code === 200) {
-						const list = res.data.records || []
-						this.orderList = this.hallPage === 1 ? list : this.orderList.concat(list)
-						this.hallHasMore = list.length >= this.hallPageSize
-					}
-				}).finally(() => {
-					this.hallLoading = false
 				})
 			},
 
 			getPickupOrders() {
 				if (this.acceptingStatus === 0) return;
 				if (this.pickupLoading) return
-				this.pickupLoading = true
-				this.$u.api.activeOrders({ status: 3 }).then(res => {
-					console.log('寰呭彇璐�:', res)
-					this.pickupLoading = false
-					if (res.code === 200) {
-						this.pickupOrderList = res.data.records || res.data || []
+
+				checkLocationPermission().then((granted) => {
+					if (granted) {
+						console.log('宸叉湁浣嶇疆鏉冮檺')
+						this.pickupLoading = true
+						this.$u.api.activeOrders({ status: 3 }).then(res => {
+							console.log('寰呭彇璐�:', res)
+							this.pickupLoading = false
+							if (res.code === 200) {
+								this.pickupOrderList = res.data.records || res.data || []
+							}
+						}).catch((err) => {
+							this.pickupLoading = false
+						})
+					} else {
+						console.log('杩樻病鏈変綅缃潈闄�')
 					}
-				}).catch((err) => {
-					this.pickupLoading = false
 				})
 			},
 
 			getDeliveringOrders() {
 				if (this.acceptingStatus === 0) return;
 				if (this.deliveringLoading) return
-				this.deliveringLoading = true
-				this.$u.api.activeOrders({ status: 4 }).then(res => {
-					console.log('閰嶉�佷腑:', res)
-					this.deliveringLoading = false
-					if (res.code === 200) {
-						this.deliveringOrderList = res.data || []
+
+				checkLocationPermission().then((granted) => {
+					if (granted) {
+						console.log('宸叉湁浣嶇疆鏉冮檺')
+						this.deliveringLoading = true
+						this.$u.api.activeOrders({ status: 4 }).then(res => {
+							console.log('閰嶉�佷腑:', res)
+							this.deliveringLoading = false
+							if (res.code === 200) {
+								this.deliveringOrderList = res.data || []
+							}
+						}).catch((err) => {
+							this.deliveringLoading = false
+						})
+					} else {
+						console.log('杩樻病鏈変綅缃潈闄�')
 					}
-				}).catch((err) => {
-					this.deliveringLoading = false
 				})
 			},
 

--
Gitblit v1.9.3