Browse Source

feat: 首页定位

chenjj 1 week ago
parent
commit
9dca7b4ba2
7 changed files with 1622 additions and 383 deletions
  1. 9 0
      api/home.js
  2. 3 28
      components/Client/new_file.vue
  3. 1 1
      manifest.json
  4. 277 227
      pages/index.vue
  5. 114 89
      pages/mine.vue
  6. 95 38
      utils/adress.js
  7. 1123 0
      utils/qqmap-wx-jssdk.js

+ 9 - 0
api/home.js

@@ -5,4 +5,13 @@ export function slideshow(slideshowId) {
         url: `/web/core/slideshow/${slideshowId}`,
         method: 'get',
     })
+}
+
+//设置当前地址
+export function settingHomeAddress(data) {
+    return request({
+        url: `/setUserLocation`,
+        method: 'post',
+        data
+    })
 }

+ 3 - 28
components/Client/new_file.vue

@@ -3,10 +3,8 @@
 		<template>
 			<view class="Wrapper-grid">
 				<view class="serve-title client-title" v-if="userType == 2">注册专区</view>
-				<!-- <swiper :indicator-dots="true" class="swiper" v-if="serveiceList && serveiceList.length > 0"> -->
-				<!-- <swiper-item> -->
 				<up-grid :border="false" col="4">
-					<up-grid-item v-for="(item, index) in serveiceList.slice(0,12)" :key="index"
+					<up-grid-item v-for="(item, index) in serveiceList" :key="index"
 						:custom-style="custmoStyle" @click="handleGridClick(item)">
 						<view class="grid-box">
 							<view class="grid-icon">
@@ -16,23 +14,6 @@
 						</view>
 					</up-grid-item>
 				</up-grid>
-				<!-- </swiper-item> -->
-				<!-- <swiper-item> -->
-				<up-grid :border="false" col="4">
-					<up-grid-item v-for="(item, index) in serveiceList.slice(12,serveiceList.length)" :key="index"
-						:custom-style="custmoStyle" @click="handleGridClick(item)">
-						<view class="grid-box">
-							<view class="grid-icon">
-								<image :src="item.icon" class="service-img" mode="aspectFit" />
-							</view>
-
-							<text class="grid-text">{{ item.name }}</text>
-						</view>
-					</up-grid-item>
-				</up-grid>
-				<!-- </swiper-item> -->
-				<!-- </swiper> -->
-
 				<up-toast ref="uToastRef" />
 			</view>
 		</template>
@@ -206,7 +187,7 @@
 		{
 			icon: '/static/serverImg/home/icon/icon8.png',
 			name: '排班管理',
-			key: 7
+			key: 13
 		},
 	]
 
@@ -248,7 +229,7 @@
 		}
 		// 志愿者
 		if (userType == 2) {
-			if (service.key !== 7) {
+			if (service.key !== 13) {
 				const res = await getVolunteerInfo({
 					serviceCategory: service.key
 				});
@@ -259,12 +240,6 @@
 					})
 					return
 				}
-				// [1, 2].includes(service.key) ? uni.navigateTo({
-				// 	url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(service))}`
-				// }) : uni.showToast({
-				// 	title: '敬请期待',
-				// 	icon: 'none'
-				// })
 
 				uni.navigateTo({
 					url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(service))}`

+ 1 - 1
manifest.json

@@ -61,7 +61,7 @@
             "subPackages" : true
         },
         "lazyCodeLoading" : "requiredComponents",
-        "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ],
+        "requiredPrivateInfos" : [ "chooseLocation","choosePoi","getFuzzyLocation"],
         "permission" : {
             "scope.userLocation" : {
                 "desc" : "你的位置信息将用于小程序定位"

+ 277 - 227
pages/index.vue

@@ -3,7 +3,7 @@
 		<view class="home-banner" :style="`height: ${globalData.navBarHeight}px `">
 			<view class="home-banner-left" @click="cityClick">
 				<up-icon name="map" color="#fff" size="25"></up-icon>
-				<text>{{ data.address }}</text>
+				<text class="address-text">{{ data.address.name }}</text>
 			</view>
 			<view class="home-banner-cente">金邻助家</view>
 			<view class="home-banner-rigth">
@@ -48,287 +48,337 @@
 
 		</view>
 
-		<custom-tab-bar  :page="0"/>
+		<custom-tab-bar :page="0" />
 	</view>
 </template>
 
 <script setup>
-	import {
-		ref,
-		reactive,
-		onMounted
-	} from 'vue';
-	import {
-		provide
-	} from 'vue';
-	import {
-		onLoad,
-		onShow,
-		onReachBottom,
-		onUnload
-	} from "@dcloudio/uni-app";
-	import RankingList from '@/pages/common/rankingList/index.vue';
-	import ServIces from "@/components/Services/services.vue"
-	import {
-		Client
-	} from "@/components/Client/new_file.vue"
-	import {
-		volunteerinfolist,
-	} from "@/api/volunteerDetailsApi/details.js"
-	import {
-		slideshow
-	} from '@/api/home.js'
-	import {
-		useDict
-	} from '@/utils/dict.js';
-	import { citySelectorNavigateTo } from '@/utils/adress'
-	import CustomTabBar from '@/components/CustomTabBar/index.vue'
-
-	const total = ref(0)
-	const listData = ref([])
-	const rightList = ref([])
-	const leftList = ref([])
-	const list3 = ref([]);
-	const ValueZone = ref([]);
-	const hotList = ref([])
-	const userType = uni.getStorageSync('userType') //读取本地存储
-	const citySelector = requirePlugin('citySelector');
-	const {
-		lrr_service_category
-	} = useDict('lrr_service_category');
-
-	const globalData = ref({
-		statusBarHeight: 47,
-		navBarHeight: 91
-	});
-	const data = reactive({
-		address: '重庆市',
-		queryValue: ''
-	})
-
-	// 分页
-	const pages = ref({
-		current: 1,
-		pageSize: 10,
-		total: 0,
-		serviceCategory: '',
-		// appStatus:"2",
-	})
-
+import {
+	ref,
+	reactive,
+	onMounted
+} from 'vue';
+import {
+	provide
+} from 'vue';
+import {
+	onLoad,
+	onShow,
+	onReachBottom,
+	onUnload
+} from "@dcloudio/uni-app";
+import RankingList from '@/pages/common/rankingList/index.vue';
+import ServIces from "@/components/Services/services.vue"
+import {
+	Client
+} from "@/components/Client/new_file.vue"
+import {
+	volunteerinfolist,
+} from "@/api/volunteerDetailsApi/details.js"
+import {
+	slideshow,
+	settingHomeAddress
+} from '@/api/home.js'
+import {
+	useDict
+} from '@/utils/dict.js';
+import { chooseLocationInit,locateTheCurrentAddress } from '@/utils/adress'
+import CustomTabBar from '@/components/CustomTabBar/index.vue'
+
+
+
+
+const rightList = ref([])
+const leftList = ref([])
+const list3 = ref([]);
+const ValueZone = ref([]);
+const hotList = ref([])
+const userType = uni.getStorageSync('userType') //读取本地存储
+
+
+const globalData = ref({
+	statusBarHeight: 47,
+	navBarHeight: 91
+});
+const data = reactive({
+	address: {
+		name: '重庆市',
+		latitude: 29.333000000000002,
+		longitude: 105.94909000000001,
+		cityCode:{
+			code:[500000, 500100, 500118],
+			data:["重庆市", "重庆市", "永川区"],
+			index: [21, 0, 17]
+		}
+	},
+	queryValue: ''
+})
+
+// 分页
+const pages = ref({
+	current: 1,
+	pageSize: 10,
+	total: 0,
+	serviceCategory: '',
+	// appStatus:"2",
+})
+
+
+
+const cityClick = async () => {
+	const {latitude,longitude} = data.address;
+	const address = await chooseLocationInit({latitude,longitude});
+	data.address = address;
+	settingAddress();
+	console.log('address', address);
+}
+
+
+const loadmoreInfo = ref({
+	status: 'loadmore',
+	loadingText: '努力加载中...',
+	loadmoreText: '点击加载更多~',
+	nomoreText: '已经到底啦~'
+})
+
+// 加载更多
+async function handleLoadmore(e) {
+	if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
+		pages.value.current += 1;
+		loadmoreInfo.value.status = 'loading';
+		await getList();
+	} else {
+		loadmoreInfo.value.status = 'nomore';
+	}
+}
 
 
-	const cityClick = () => {
-		citySelectorNavigateTo(data.address)
-	}
+const getList = async () => {
+	try {
+		loadmoreInfo.value.status = 'loading';
 
+		const params = {
+			pageNum: pages.value.current,
+			pageSize: pages.value.pageSize,
+			serviceCategory: pages.value.serviceCategory || '',
+			businessManagementId: 0,
+			// appStatus:pages.value.appStatus,
+		};
+		const res = await volunteerinfolist(params);
 
-	const loadmoreInfo = ref({
-		status: 'loadmore',
-		loadingText: '努力加载中...',
-		loadmoreText: '点击加载更多~',
-		nomoreText: '已经到底啦~'
-	})
+		if (!res || !res.rows) {
+			return;
+		}
 
-	// 加载更多
-	async function handleLoadmore(e) {
-		if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
-			pages.value.current += 1;
-			loadmoreInfo.value.status = 'loading';
-			await getList();
-		} else {
+		// 判断是否已经到了最后一页
+		if (pages.value.current >= Math.ceil(res.total / pages.value.pageSize)) {
 			loadmoreInfo.value.status = 'nomore';
+		} else {
+			loadmoreInfo.value.status = 'loadmore';
 		}
-	}
 
+		// 将数据分成左右两列
+		res.rows.forEach((item, index) => {
+			index % 2 !== 0 ? leftList.value.push(item) : rightList.value.push(item);
+		});
 
-	const getList = async () => {
-		try {
-			loadmoreInfo.value.status = 'loading';
-
-			const params = {
-				pageNum: pages.value.current,
-				pageSize: pages.value.pageSize,
-				serviceCategory: pages.value.serviceCategory || '',
-				businessManagementId: 0,
-				// appStatus:pages.value.appStatus,
-			};
-			const res = await volunteerinfolist(params);
-
-			if (!res || !res.rows) {
-				return;
-			}
-
-			// 判断是否已经到了最后一页
-			if (pages.value.current >= Math.ceil(res.total / pages.value.pageSize)) {
-				loadmoreInfo.value.status = 'nomore';
-			} else {
-				loadmoreInfo.value.status = 'loadmore';
-			}
-
-			// 将数据分成左右两列
-			res.rows.forEach((item, index) => {
-				index % 2 !== 0 ? leftList.value.push(item) : rightList.value.push(item);
-			});
-
-			pages.value.total = res.total;
-		} catch (error) {
-			leftList.value = [];
-			rightList.value = [];
-			loadmoreInfo.value.status = 'loadmore';
-			pages.value.total = 0;
-			console.error('Error fetching data:', error);
-		}
-	};
+		pages.value.total = res.total;
+	} catch (error) {
+		leftList.value = [];
+		rightList.value = [];
+		loadmoreInfo.value.status = 'loadmore';
+		pages.value.total = 0;
+		console.error('Error fetching data:', error);
+	}
+};
 
 
-	onReachBottom(() => {
-		if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
-			pages.value.current = pages.value.current + 1
-			loadmoreInfo.value.status = 'nomore'
-			getList()
-		}
-	})
+onReachBottom(() => {
+	if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
+		pages.value.current = pages.value.current + 1
+		loadmoreInfo.value.status = 'nomore'
+		getList()
+	}
+})
 
 
 
-	const getBanners = async () => {
-		try {
-			const res = await slideshow(7);
-			if (res.code === 200 && res.data.picture) {
-				list3.value = res.data.picture.split(',');
-			}
+const getBanners = async () => {
+	try {
+		const res = await slideshow(7);
+		if (res.code === 200 && res.data.picture) {
+			list3.value = res.data.picture.split(',');
+		}
 
-			const value_res = await slideshow(8);
-			if (value_res.code === 200 && value_res.data.picture) {
-				ValueZone.value = value_res.data.picture.split(',');
-			}
+		const value_res = await slideshow(8);
+		if (value_res.code === 200 && value_res.data.picture) {
+			ValueZone.value = value_res.data.picture.split(',');
+		}
 
-			const hot_res = await slideshow(11);
-			if (hot_res.code === 200 && hot_res.data.picture) {
-				hotList.value = hot_res.data.picture.split(',');
-			}
-		} catch (error) {
-			console.log('error', error);
+		const hot_res = await slideshow(11);
+		if (hot_res.code === 200 && hot_res.data.picture) {
+			hotList.value = hot_res.data.picture.split(',');
+		}
+	} catch (error) {
+		console.log('error', error);
 
+	}
+}
+
+const settingAddress = async() => {
+	try {
+		const {address}=data;
+		const {cityCode,latitude,longitude} = address;
+		const parmas = {
+			provinceName: cityCode.data[0], // 省
+			provinceCode: cityCode.code[0],
+			provinceInd:  cityCode.index[0],
+			cityName: cityCode.data[1], // 市
+			cityCode: cityCode.code[1],
+			cityInd: cityCode.index[1],
+			districtName: cityCode.data[2],
+			districtCode: cityCode.code[2],
+			districtInd: cityCode.index[2],
+			address: address.name,
+			latitude,
+			longitude
 		}
+		const res = await settingHomeAddress(parmas);
+		console.log('res',res);
+		
+	} catch (error) {
+		console.log('设置地址失败',error);
 	}
+}
 
-	onShow(() => {
-		getBanners();
+onShow(() => {
+	getBanners();
 
 	// 在 App.vue  中初始化 
 	uni.getSystemInfo({
 		success: (res) => {
 			const statusBarHeight = res.statusBarHeight;
-			console.log('res',res);
-			
+			console.log('res', res);
+
 			const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
 			globalData.value = { statusBarHeight, navBarHeight };
 
-			}
-		});
-
-		if (citySelector) {
-			const selectedCity = citySelector.getCity(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null
-			data.address = selectedCity.name;
 		}
+	});
 
-	})
+	
 
-	onMounted(() => {
-		getList()
+})
+
+onMounted(() => {
+	getList()
+	locateTheCurrentAddress().then(res => {
+		console.log('locateTheCurrentAddress',res);
+		data.address = res;
+		settingAddress();
+	}).catch(error => {
+		console.log('获取地址失败!',error);
+		
 	})
 
-	onUnload(() => {
-		if (citySelector) {
-			// 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
-			citySelector.setLocation(null);
-		}
+})
 
-	})
+onUnload(() => {
+
+})
 </script>
 
 <style scoped lang="scss">
-	.main-content {
-		background: rgba(255, 255, 255, 1);
-
-		.home-banner {
-			display: flex;
-			align-items: flex-end;
-			justify-content: space-between;
-			// background: rgba(255, 255, 255, 1);
-			// background-color: #ED806A;
-			background-color: rgba(221, 60, 62, 1);
-			box-shadow: 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 2.08rpx 4.17rpx rgba(0, 0, 0, 0.05);
-			padding: 20rpx 16rpx;
-			color: #fff;
-			position: fixed;
-			top: 0px;
-			left: 0px;
-			right: 0;
-			z-index: 99;
-			bottom: 150rpx;
-		}
-		.home-box {
-			padding-bottom: 150rpx;
-		}
-
-		.home-banner-left {
-			display: flex;
-			align-items: center;
-			width: 30%;
-		}
+.main-content {
+	background: rgba(255, 255, 255, 1);
+
+	.home-banner {
+		display: flex;
+		align-items: flex-end;
+		justify-content: space-between;
+		// background: rgba(255, 255, 255, 1);
+		// background-color: #ED806A;
+		background-color: rgba(221, 60, 62, 1);
+		box-shadow: 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 2.08rpx 4.17rpx rgba(0, 0, 0, 0.05);
+		padding: 20rpx 16rpx;
+		color: #fff;
+		position: fixed;
+		top: 0px;
+		left: 0px;
+		right: 0;
+		z-index: 99;
+		bottom: 150rpx;
+	}
 
-		.home-banner-center {
-			flex: 1;
-			font-size: 38rpx;
-		}
+	.home-box {
+		padding-bottom: 150rpx;
+	}
 
-		.home-banner-rigth {
-			width: 30%;
-		}
+	.home-banner-left {
+		display: flex;
+		align-items: center;
+		width: 30%;
+	}
 
-		.home-main {
-			padding: 12px 16px 0;
+	.home-banner-center {
+		flex: 1;
+		font-size: 38rpx;
+	}
 
+	.home-banner-rigth {
+		width: 30%;
+	}
 
-		}
+	.home-main {
+		padding: 12px 16px 0;
 
-		.home-ranking {
-			padding: 24rpx 16px;
-		}
-	}
 
-	.hot-box-title {
-		padding: 0 32rpx;
 	}
 
-	.hot-swiper {
-		padding: 24rpx 32rpx 0;
+	.home-ranking {
+		padding: 24rpx 16px;
 	}
+}
 
-	.hot-box {
-		padding: 24rpx 32rpx;
-		display: grid;
-		grid-template-columns: repeat(2, 1fr);
-		gap: 8rpx;
+.hot-box-title {
+	padding: 0 32rpx;
+}
 
+.hot-swiper {
+	padding: 24rpx 32rpx 0;
+}
 
-		.hot-item {
-			// padding: 32rpx 16rpx;
-			// border-radius: 10rpx;
-		}
-	}
+.hot-box {
+	padding: 24rpx 32rpx;
+	display: grid;
+	grid-template-columns: repeat(2, 1fr);
+	gap: 8rpx;
 
-	.home-grid2 {
-		margin-bottom: 32rpx;
-		background: #fff;
-		padding: 12px 0;
-		border-radius: 8px;
-	}
 
-	.home-g-bgc {
-		background: #f7f7f7;
-		padding: 24rpx;
+	.hot-item {
+		// padding: 32rpx 16rpx;
+		// border-radius: 10rpx;
 	}
+}
+
+.home-grid2 {
+	margin-bottom: 32rpx;
+	background: #fff;
+	padding: 12px 0;
+	border-radius: 8px;
+}
+
+.home-g-bgc {
+	background: #f7f7f7;
+	padding: 24rpx;
+}
+
+.address-text {
+	white-space: nowrap;
+	/* 禁止换行 */
+	overflow: hidden;
+	/* 隐藏溢出内容 */
+	text-overflow: ellipsis;
+	/* 超出部分显示省略号 */
+}
 </style>

+ 114 - 89
pages/mine.vue

@@ -2,39 +2,55 @@
 	<view class="mine-container">
 
 		<view class="mine-header">
-			<up-image width="136rpx" height="136rpx"  :show-loading="true" :src="userInfo.avatar" ></up-image>
+			<up-image width="136rpx" height="136rpx" :show-loading="true" :src="userInfo.avatar"></up-image>
 			<view class="header-info">
 				<text class="info-name">{{ userInfo.nickName }}</text>
-				<text class="info-id">ID: {{ data.volunteerId }}</text>
-				<text class="info-edit" @click="handLsetTing"  v-if="userType == 1">设置> </text>
+				<up-icon name="setting-fill" size="25" @click="handLsetTing" v-if="userType == 1"></up-icon>
+				<!-- <text class="info-edit" @click="handLsetTing" v-if="userType == 1">设置></text> -->
 			</view>
 		</view>
 
-		<view class="list-box">
-			<view class="mine-card price-card" v-if="userType == 2">
+		<view class="status-card2" v-if="userType == 1">
+				<view  v-for="(listItem, listIndex) in userList" :key="listIndex"
+					@click="onClick(listItem)">
+					<view class="status-card-item2">
+						<view class="status-card2-left">
+						<view class="grid-img-box">
+							<up-icon :name="listItem.iconName" :size="22"></up-icon>
+						</view>
+						<text class="grid-text">{{ listItem.name }}</text>
+					</view>
+					<up-icon name="arrow-right"></up-icon>
+					</view>
+					<up-divider v-if="listIndex !== userList.length -1"></up-divider>
+				</view>
+		</view>
+
+		<view class="list-box" v-if="userType == 2">
+			<view class="mine-card price-card" >
 				<view v-for="(item, index) in priceList" :key="item.key" class="price-item"
 					:style="{ alignItems: index === 0 ? 'flex-start' : 'flex-end' }" @click="onClick(item)">
 					<view class="price-name flex-center"> {{ item.name }} </view>
 					<view class="price-data flex-center">
 						{{ index === 0 ? '¥' : '' }}<up-count-to :startVal="0" :endVal="data[item.key]"
-							:decimals="item.decimals" ></up-count-to>
+							:decimals="item.decimals"></up-count-to>
 					</view>
 					<text class="grid-min-price" v-if="item.key === 'balance'">待入账 ¥{{ data[item.balance] }}</text>
 				</view>
 			</view>
 
 			<!-- 志愿者 -->
-			<view class="mine-card status-card" v-if="userType == 2">
+			<view class="mine-card status-card" >
 				<view class="status-card-item" v-for="(listItem, listIndex) in adminList" :key="listIndex"
 					@click="onClick(listItem)">
 					<view class="grid-img-box">
-						<up-icon :name="listItem.iconName" color="rgba(51, 51, 51, 1)" size="25" ></up-icon>
+						<up-icon :name="listItem.iconName" color="rgba(51, 51, 51, 1)" size="25"></up-icon>
 					</view>
 					<text class="grid-text">{{ listItem.name }}</text>
 				</view>
 			</view>
 			<!-- 用户端 -->
-			<view class="mine-card status-card" v-if="userType == 1">
+			<!-- <view class="mine-card status-card" v-if="userType == 1">
 				<view class="status-card-item" v-for="(listItem, listIndex) in userList" :key="listIndex"
 					@click="onClick(listItem)">
 					<view class="grid-img-box">
@@ -42,18 +58,20 @@
 					</view>
 					<text class="grid-text">{{ listItem.name }}</text>
 				</view>
-			</view>
-			<view class="mine-card count-card" v-if="userType == 2">
+			</view> -->
+		
+			<view class="mine-card count-card" >
 				<view class="count-title">订单统计</view>
 				<view class="count-list">
 					<view class="count-item" v-for="(item, index) in orderList" :key="index" @click="onClick(item)">
-						<up-count-to :startVal="0" :endVal="data[item.key]" :color="data[item.key]>0 && 'rgba(221, 94, 69, 1)'" ></up-count-to>
+						<up-count-to :startVal="0" :endVal="data[item.key]"
+							:color="data[item.key] > 0 && 'rgba(221, 94, 69, 1)'"></up-count-to>
 						<text class="count-item-text">{{ item.name }}</text>
 					</view>
 				</view>
 			</view>
 
-			<view class="mine-card rate-card" v-if="userType == 2">
+			<view class="mine-card rate-card" >
 				<view class="count-title">好评率</view>
 				<view class="rate-list">
 					<view class="rate-box">
@@ -66,7 +84,7 @@
 			</view>
 		</view>
 
-		<custom-tab-bar  :page="3"/>
+		<custom-tab-bar :page="3" />
 	</view>
 </template>
 
@@ -77,7 +95,7 @@ import {
 	onShow
 } from '@dcloudio/uni-app';
 import store from "@/store"
-import { getVolunteerAccountInfo,volunteerOrderStatistics } from "@/api/mine";
+import { getVolunteerAccountInfo, volunteerOrderStatistics } from "@/api/mine";
 import CustomTabBar from '@/components/CustomTabBar/index.vue'
 const userInfo = ref({
 	avatar: '/static/serverImg/mine/user.png'
@@ -85,18 +103,18 @@ const userInfo = ref({
 const data = ref({
 	balance: 0.0,
 	reservationCount: 0,
-	doingCount:0,
-	finishedCount:0,
-	cancelCount:0,
-	orderCount:0,
-	orderFrozenBalance:0
+	doingCount: 0,
+	finishedCount: 0,
+	cancelCount: 0,
+	orderCount: 0,
+	orderFrozenBalance: 0
 });
 const rateValue = ref(3)
 const priceList = [{
 	name: '账户余额',
 	key: 'balance',
 	decimals: 2,
-	balance:'orderFrozenBalance',
+	balance: 'orderFrozenBalance',
 	page: '/pages_mine/pages/wallet/index'
 },
 {
@@ -110,29 +128,29 @@ const priceList = [{
 const orderList = ref([{
 	name: '预约单',
 	key: 'reservationCount',
-	switchPage:'/pages/classify',
-	value:1
+	switchPage: '/pages/classify',
+	value: 1
 },
 
 {
 	name: '进行单',
 	key: 'doingCount',
-	switchPage:'/pages/classify',
-	value:2
+	switchPage: '/pages/classify',
+	value: 2
 
 },
 {
 	name: '完成单',
 	key: 'finishedCount',
-	switchPage:'/pages/classify',
-	value:3
+	switchPage: '/pages/classify',
+	value: 3
 
 },
 {
 	name: '取消单',
 	key: 'cancelCount',
-	switchPage:'/pages/classify',
-	value:4
+	switchPage: '/pages/classify',
+	value: 4
 }
 ]);
 
@@ -141,48 +159,26 @@ const userType = uni.getStorageSync('userType') //读取本地存储
 
 const adminList = ref(
 	[
-	{
-		name: '差评申述',
-		iconName: 'chat',
-		page: '/pages_mine/pages/bad/index'
-	},
-	{
-		name: '帮助与客服',
-		iconName: 'kefu-ermai',
-	},
-	{
-		name: '用户端',
-		iconName: 'account',
-		operate:()=>{
-			uni.reLaunch({ 
-				url: '/pages/UserSelection'
-			});
-		}
-	},
+		{
+			name: '差评申述',
+			iconName: 'chat',
+			page: '/pages_mine/pages/bad/index'
+		},
+		{
+			name: '帮助与客服',
+			iconName: 'kefu-ermai',
+		},
+		{
+			name: '用户端',
+			iconName: 'account',
+			operate: () => {
+				uni.reLaunch({
+					url: '/pages/UserSelection'
+				});
+			}
+		},
 	]);
-const userList = ref(
-	[{
-		name: '待服务',
-		iconName: 'clock',
-		page: '/pages/classify',
-		value: 1
-	},
-	{
-		name: '进行中',
-		iconName: 'car',
-		page: '/pages/classify',
-		value: 2
-	},
-	{
-		name: '已完成',
-		iconName: 'car-fill',
-		page: '/pages/classify',
-		value: 3
-	},
-	{
-		name: '评论',
-		iconName: 'edit-pen',
-	},
+const userList = ref([
 	{
 		name: '钱包',
 		iconName: 'rmb-circle',
@@ -197,38 +193,42 @@ const userList = ref(
 		iconName: 'star',
 	},
 	{
-		name: '帮助与客服',
-		iconName: 'kefu-ermai',
+		name: '评论',
+		iconName: 'edit-pen',
 	},
 	{
 		name: '地址',
 		iconName: 'map',
 		page: '/pages_mine/pages/selectAddress/index'
 	},
+	{
+		name: '帮助与客服',
+		iconName: 'kefu-ermai',
+	},
 	{
 		name: '志愿者',
 		iconName: 'account',
-		operate:()=>{
-			uni.reLaunch({ 
+		operate: () => {
+			uni.reLaunch({
 				url: '/pages/UserSelection'
 			});
 		}
-	},
-	]);
+	}
+]);
 
 
 const onClick = (record) => {
 	console.log('record', record, record.page);
-	if(record.page){
+	if (record.page) {
 		uni.navigateTo({
 			url: record.page
 		})
 	}
-	if(record.operate){
+	if (record.operate) {
 		record.operate()
 	}
 
-	if (record.switchPage && record.value ) {
+	if (record.switchPage && record.value) {
 		const app = getApp();
 		app.globalData.switchTabParams = {
 			tabKey: record.value
@@ -255,10 +255,10 @@ const getDetails = async () => {
 }
 
 const handLsetTing = () => {
-		uni.navigateTo({
-			url: '/pages_mine/pages/setupUser/index'
-		})
-	}
+	uni.navigateTo({
+		url: '/pages_mine/pages/setupUser/index'
+	})
+}
 
 
 
@@ -274,21 +274,22 @@ onShow(() => {
 	init();
 })
 
-const init = async() => {
+const init = async () => {
 	try {
+		uni.hideLoading();
 		uni.showLoading({
 			title: '数据加载中...'
 		});
 
-		if(userType === 2){
+		if (userType === 2) {
 			const res1 = await getVolunteerAccountInfo();
 			const res2 = await volunteerOrderStatistics();
 			data.value = {
 				...res1.data,
 				...res2.data
 			}
-			console.log(11,res1,res2,data.value);
-			
+			console.log(11, res1, res2, data.value);
+
 		}
 	} catch (error) {
 		console.log('error', error);
@@ -318,12 +319,15 @@ const init = async() => {
 		padding: 36rpx 44rpx;
 		background: #fff;
 		display: flex;
-		
+
 
 		.header-info {
 			display: flex;
-			flex-direction: column;
+			// flex-direction: column;
+			align-items: center;
+			justify-content: space-between;
 			margin-left: 36rpx;
+			flex: 1;
 
 			.info-name {
 				font-size: 36rpx;
@@ -561,4 +565,25 @@ const init = async() => {
 	color: rgba(51, 51, 51, 1);
 	margin-bottom: 8rpx;
 }
+
+.status-card2 {
+	margin-top: 24rpx;
+	padding: 30rpx 30rpx;
+	background-color: #fff;
+	.status-card-item2{
+		// height: 88rpx;
+		width: 100%;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+
+		.status-card2-left {
+			display: flex;
+			align-items: center;
+			.grid-img-box {
+				margin-right: 12rpx;
+			}
+		}
+	}
+}
 </style>

+ 95 - 38
utils/adress.js

@@ -1,6 +1,8 @@
 import config from '@/config'
 const mapKey = config.mapKey;
 const appName = config.appName;
+// const QQMapWX = require('./qqmap-wx-jssdk.js')
+import QQMapWX from './qqmap-wx-jssdk.js'
 
 import addressData from './address.js';
 
@@ -8,13 +10,28 @@ import addressData from './address.js';
 /**
  * 腾讯位置服务地图选点
  */
-const chooseLocationInit = () => {
-  const key = mapKey; //使用在腾讯位置服务申请的key
-  const referer = appName; //调用插件的app的名称
-  wx.navigateTo({
-    url: `plugin://chooseLocation/index?key=${key}&referer=${referer}`,
-  });
-
+const chooseLocationInit = (data) => {
+  // const key = mapKey; //使用在腾讯位置服务申请的key
+  // const referer = appName; //调用插件的app的名称
+  // wx.navigateTo({
+  //   url: `plugin://chooseLocation/index?key=${key}&referer=${referer}`,
+  // });
+  return new Promise((resolve, reject) => { 
+    
+    wx.chooseLocation({
+      ...data,
+      success: function(res){
+        console.log('111',res);
+        const result = splitAddress(res.address);
+        const handlecityData = getCityCode([result.province,result.city,result.district].join(' '))
+          resolve({...res,cityCode:handlecityData})
+        },
+        fail: function(res){
+          console.log('fail',res);
+          reject();
+        }
+    })
+  })
 }
 
 /**
@@ -26,8 +43,74 @@ const citySelectorNavigateTo = (city) => {
   const referer = appName; // 调用插件的app的名称
   const hotCitys = '重庆'; // 用户自定义的的热门城市
 
-  wx.navigateTo({
-    url: `plugin://citySelector/index?key=${key}&referer=${referer}&hotCitys=${hotCitys}`,
+  // wx.navigateTo({
+  //   url: `plugin://citySelector/index?key=${key}&referer=${referer}&hotCitys=${hotCitys}`,
+  // })
+
+  // wx.choosePoi({
+  //   success: function(res){
+  //   // address: "重庆市永川区文昌西路南"
+  //   // errMsg: "choosePoi:ok"
+  //   // latitude: 0
+  //   // longitude: 0
+  //   // name: "中国人民大学文化科技园"
+  //   // type: 2
+  //     console.log('111',res);
+      
+  //   },
+  //   fail: function(res){
+  //     console.log('fail',res);
+      
+  //   }
+  // })
+
+  // return new Promise((resolve, reject) => { 
+  //   wx.chooseLocation({
+  //     success: function(res){
+  //         console.log('111',res);
+  //         resolve(res)
+  //       },
+  //       fail: function(res){
+  //         console.log('fail',res);
+  //         reject();
+  //       }
+  //   })
+  // })
+
+
+}
+
+function locateTheCurrentAddress(){
+  return new Promise((resolve, reject) => { 
+      wx.getFuzzyLocation({
+        type: 'gcj02',
+        success: function (res) {
+          const { latitude, longitude } =res;
+          const qqmapsdk = new QQMapWX({ key: mapKey });
+          qqmapsdk.reverseGeocoder({ 
+            location: [latitude,longitude].join(','), // GCJ-02经纬度(纬度在前,经度在后)
+            success: (res) => {
+              console.log(res.result);
+              const {address_component,formatted_addresses} =  res.result;
+              const {province,city,district} = address_component;
+              const handlecityData = getCityCode([province,city,district].join(' '))
+              resolve({
+                name:formatted_addresses.standard_address,
+                cityCode:handlecityData,
+                latitude,
+                longitude
+              })
+            },
+            fail: (err) => { console.error(err);reject();  }
+          });
+          console.log('111', res,);
+
+        },
+        fail: function (res) {
+          console.log('fail', res);
+          reject();
+        }
+      })
   })
 }
 
@@ -67,34 +150,7 @@ function normalizeAddress(str) {
  * @returns {Object|null} 包含 data/name、code、index 的对象
  */
 const getCityCode = (address) => {
-  // //address:重庆市永川区人民大道191号
-  // const names = normalizeAddress(address).split(/\s+/);
-  // let result = [];
-
-  // // 查找省份
-  // let province = addressData.find(p => p.name.includes(names[0]));
-  // if (!province) return [];
-
-  // result.push(province.code);
-
-  // if (names.length < 2) return result;
-
-  // // 查找城市
-  // let city = province.children?.find(c => c.name.includes(names[1]));
-  // if (!city) return result;
-
-  // result.push(city.code);
-
-  // if (names.length < 3) return result;
-
-  // // 查找区县
-  // let district = city.children?.find(d => d.name.includes(names[2]));
-  // if (!district) return result;
-
-  // result.push(district.code);
-
-  // return result;
-
+   //address:重庆市永川区人民大道191号
   const names = address.split(/\s+/)
   const result = {
     data: [],
@@ -141,5 +197,6 @@ export {
   chooseLocationInit,
   citySelectorNavigateTo,
   splitAddress,
-  getCityCode
+  getCityCode,
+  locateTheCurrentAddress
 }

File diff suppressed because it is too large
+ 1123 - 0
utils/qqmap-wx-jssdk.js