Procházet zdrojové kódy

fix: 排班去重

chenjj před 1 měsícem
rodič
revize
cf456fffd2

+ 244 - 227
pages/Client/new_file.vue

@@ -45,252 +45,269 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-	import {
-		ref,
-		onMounted,
-		watch,
-		computed
-	} from 'vue';
-	// import {
-	// 	typeOptionSelect
-	// } from "@/api/volunteerDetailsApi/details.js"
-	import {
-		workDate,
-		getDataTime
-	} from '@/api/volunteer.js'
-	import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
-
-
-	// Toast 控制宫格
-	const uToastRef = ref(null);
-	const userType = uni.getStorageSync('userType') //读取本地存储
-	// 用户/志愿者 识别标识
-	const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
-
-	const calendar = ref(null)
-	const info = ref({
-		lunar: true,
-		range: true,
-		insert: false,
-	})
-	const selected = ref([])
-
-
-
-
-	// 普通用户
-	const serviceList1 = ref([{
-			icon: '/static/img/统一知识平台-营运@1x.png',
-			name: '家庭辅导',
-			key:1,
-		},
-		{
-			icon: '/static/img/编组.png',
-			name: '陪伴陪聊',
-			key:2,
-		},
-		{
-			icon: '/static/img/清空.png',
-			name: '家庭助理',
-			key:3,
-		},
-		{
-			icon: '/static/img/构建.png',
-			name: '健康管理',
-			key:4,
-		},
-		{
-			icon: '/static/img/报事报修@6x.png',
-			name: '家庭清洁',
-			key:5,
-		},
-		{
-			icon: '/static/img/报事报修@6x.png',
-			name: '家务帮手',
-			key:6,
-		},
-		{
-			icon: '/static/img/报事报修@6x.png',
-			name: '资讯与服务',
-			key:7,
-		},
-	]);
-	//志愿者
-	const serviceList2 = ref([{
-			icon: '/static/img/统一知识平台-营运@1x.png',
-			name: '家庭辅导注册',
-			key: 2,
-		},
-		{
-			icon: '/static/img/编组.png',
-			name: '陪伴陪聊注册',
-			key: 1,
-		},
-		{
-			icon: '/static/img/清空.png',
-			name: '家庭助理注册',
-			key: 3,
-		},
-		{
-			icon: '/static/img/构建.png',
-			name: '健康管理注册',
-			key: 4
-		},
-		{
-			icon: '/static/img/报事报修@6x.png',
-			name: '家庭清洁注册',
-			key: 5
-		},
-		{
-			icon: '/static/img/报事报修@6x.png',
-			name: '家务帮手注册',
-			key: 6
-		},
-		{
-			icon: '/static/img/清空.png',
-			name: '排班管理',
-			key: 7
-		},
-	]);
-	
-	 
-	
-
-	// 宫格点击事件
-	const handleGridClick = async (index) => {
-		 const service = serviceList1.value[index]; // 获取点击的服务条目
-		// 用户
-		if (userType == 1) {
-			// 只有第一条和第二条可以跳转
-			if (index === 0 || index === 1) {
-				uni.navigateTo({
-					url: `/pages_home/pages/client/details?name=${encodeURIComponent(service.name)}`
-				});
-			} else {
-				// 其他条目提示“敬请期待”
-				uni.showToast({
-					title: '敬请期待',
-					icon: 'none'
-				});
-			}
-		}
-		// 志愿者
-		if (userType == 2 && uToastRef.value) {
-			const data = serviceList2.value[index]
-			if (data.key !== 7) {
-				data.key === 1 || data.key === 2 ? uni.navigateTo({
-					url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data))}`
-				}) : uni.showToast({
-					title: '敬请期待',
-					icon: 'none'
-				})
-				return;
-			}
-			init();
-			calendar.value.open();
+import {
+	ref,
+	onMounted,
+	watch,
+	computed
+} from 'vue';
+// import {
+// 	typeOptionSelect
+// } from "@/api/volunteerDetailsApi/details.js"
+import {
+	workDate,
+	getDataTime
+} from '@/api/volunteer.js'
+import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
+
+
+// Toast 控制宫格
+const uToastRef = ref(null);
+const userType = uni.getStorageSync('userType') //读取本地存储
+// 用户/志愿者 识别标识
+const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
+
+const calendar = ref(null)
+const info = ref({
+	lunar: true,
+	range: true,
+	insert: false,
+})
+const selected = ref([])
+
+
+
+
+// 普通用户
+const serviceList1 = ref([{
+	icon: '/static/img/统一知识平台-营运@1x.png',
+	name: '家庭辅导',
+	key: 1,
+},
+{
+	icon: '/static/img/编组.png',
+	name: '陪伴陪聊',
+	key: 2,
+},
+{
+	icon: '/static/img/清空.png',
+	name: '家庭助理',
+	key: 3,
+},
+{
+	icon: '/static/img/构建.png',
+	name: '健康管理',
+	key: 4,
+},
+{
+	icon: '/static/img/报事报修@6x.png',
+	name: '家庭清洁',
+	key: 5,
+},
+{
+	icon: '/static/img/报事报修@6x.png',
+	name: '家务帮手',
+	key: 6,
+},
+{
+	icon: '/static/img/报事报修@6x.png',
+	name: '资讯与服务',
+	key: 7,
+},
+]);
+//志愿者
+const serviceList2 = ref([{
+	icon: '/static/img/统一知识平台-营运@1x.png',
+	name: '家庭辅导注册',
+	key: 2,
+},
+{
+	icon: '/static/img/编组.png',
+	name: '陪伴陪聊注册',
+	key: 1,
+},
+{
+	icon: '/static/img/清空.png',
+	name: '家庭助理注册',
+	key: 3,
+},
+{
+	icon: '/static/img/构建.png',
+	name: '健康管理注册',
+	key: 4
+},
+{
+	icon: '/static/img/报事报修@6x.png',
+	name: '家庭清洁注册',
+	key: 5
+},
+{
+	icon: '/static/img/报事报修@6x.png',
+	name: '家务帮手注册',
+	key: 6
+},
+{
+	icon: '/static/img/清空.png',
+	name: '排班管理',
+	key: 7
+},
+]);
+
+
+
+
+// 宫格点击事件
+const handleGridClick = async (index) => {
+	const service = serviceList1.value[index]; // 获取点击的服务条目
+	// 用户
+	if (userType == 1) {
+		// 只有第一条和第二条可以跳转
+		if (index === 0 || index === 1) {
+			uni.navigateTo({
+				url: `/pages_home/pages/client/details?name=${encodeURIComponent(service.name)}`
+			});
+		} else {
+			// 其他条目提示“敬请期待”
+			uni.showToast({
+				title: '敬请期待',
+				icon: 'none'
+			});
 		}
 		}
-	};
-
-
-	const change = (e) => {
-		console.log('change', e);
-		let dates = [{
-			date: e.fulldate,
-			info: `${e.time.startTime}~${e.time.endTime}`,
-			time: e.time
-		}]
-		if (e.range.before && e.range.after) {
-			dates = e.range.data.map(item => {
-				return {
-					date: item,
-					info: `${e.time.startTime}~${e.time.endTime}`,
-					time: e.time
-				}
+	}
+	// 志愿者
+	if (userType == 2 && uToastRef.value) {
+		const data = serviceList2.value[index]
+		if (data.key !== 7) {
+			data.key === 1 || data.key === 2 ? uni.navigateTo({
+				url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data))}`
+			}) : uni.showToast({
+				title: '敬请期待',
+				icon: 'none'
 			})
 			})
+			return;
 		}
 		}
-		selected.value = [...selected.value, ...dates]
+		init();
+		calendar.value.open();
 	}
 	}
+};
 
 
-	const onDelete = (e) => {
-		selected.value = selected.value.filter(item => {
-			console.log('item.fulldate !== e.date', item.date, e.fulldate);
 
 
-			return item.date !== e.fulldate
-		})
-		console.log(e, selected.value);
-	}
-	const confirm = (e) => {
-		const parmas = selected.value.map(item => {
+const change = (e) => {
+	console.log('change', e);
+	let dates = [{
+		date: e.fulldate,
+		info: `${e.time.startTime}~${e.time.endTime}`,
+		time: e.time
+	}]
+	if (e.range.before && e.range.after) {
+		dates = e.range.data.map(item => {
 			return {
 			return {
-				workDate: item.date,
-				workStartTime: item.time.startTime,
-				workEndTime: item.time.endTime
+				date: item,
+				info: `${e.time.startTime}~${e.time.endTime}`,
+				time: e.time
 			}
 			}
 		})
 		})
-		console.log('确定', parmas);
-		workDate(parmas).then(res => {
-			if (res.code == 200) {
-				uni.showToast({
-					title: '修改成功',
-					icon: 'none'
-				})
-				close();
-				return;
-			}
-			uni.showToast({
-				title: res.msg,
-				icon: 'none'
-			})
-		})
-	};
-	const close = () => {
-		calendar.value.close();
 	}
 	}
+	selected.value = [...selected.value, ...dates]
+}
+
+const onDelete = (e) => {
+	selected.value = selected.value.filter(item => {
+		console.log('item.fulldate !== e.date', item.date, e.fulldate);
+
+		return item.date !== e.fulldate
+	})
+	console.log(e, selected.value);
+}
+
 
 
-	const init = () => {
-		if(userType === "2"){
-			getDataTime().then(res => {
-				console.log('res', res);
-				selected.value = res.data.map(item => {
-					return {
-						date: item.workDate,
-						info: `${item.workStartTime}~${item.workEndTime}`,
-						time: {
-							startTime: item.workStartTime,
-							endTime: item.workEndTime
-						}
-					}
-				})
-			
+//排班时间去重处理
+const handleDates = computed(() => {
+	const parmas = selected.value.map(item => {
+		return {
+			workDate: item.date,
+			workStartTime: item.time.startTime,
+			workEndTime: item.time.endTime
+		}
+	})
+    return parmas.reduce((acc, current) => {
+        const existing = acc.find(item => item.workDate === current.workDate);
+        if (existing) {
+            Object.assign(existing, current);
+        } else {
+            acc.push(current);
+        }
+        return acc;
+    }, []);
+});
+const confirm = (e) => {
+	const parmas = handleDates.value;
+	console.log('确定', parmas);
+	workDate(parmas).then(res => {
+		if (res.code == 200) {
+			uni.showToast({
+				title: '修改成功',
+				icon: 'success',
+				success: () => {
+					setTimeout(() => {
+						close();
+					}, 1000)
+				}
 			})
 			})
-			return
+
+			return;
 		}
 		}
-	}
+		uni.showToast({
+			title: res.msg,
+			icon: 'none'
+		})
+	})
+};
+const close = () => {
+	calendar.value.close();
+}
+
+const init = () => {
+	getDataTime().then(res => {
+		console.log('res', res);
+		selected.value = res.data.map(item => {
+			return {
+				date: item.workDate,
+				info: `${item.workStartTime}~${item.workEndTime}`,
+				time: {
+					startTime: item.workStartTime,
+					endTime: item.workEndTime
+				}
+			}
+		})
+
+	})
+}
 
 
 
 
 
 
-	onMounted(() => {
-		// init();
-	});
+onMounted(() => {
+	// init();
+});
 </script>
 </script>
 
 
 <style scoped>
 <style scoped>
-	.Wrapper-grid {
-		margin-top: 170rpx;
-	}
+.Wrapper-grid {
+	margin-top: 170rpx;
+}
 
 
-	/* 图标样式 */
-	.service-img {
-		width: 80rpx;
-		height: 80rpx;
-		margin-bottom: 15rpx;
-	}
+/* 图标样式 */
+.service-img {
+	width: 80rpx;
+	height: 80rpx;
+	margin-bottom: 15rpx;
+}
 
 
-	/* 文本样式 */
-	.grid-text {
-		font-size: 24rpx;
-		color: #333;
-		text-align: center;
-		margin-top: 10rpx;
-	}
+/* 文本样式 */
+.grid-text {
+	font-size: 24rpx;
+	color: #333;
+	text-align: center;
+	margin-top: 10rpx;
+}
 </style>
 </style>

+ 195 - 193
pages/classify.vue

@@ -1,223 +1,225 @@
 <template>
 <template>
-	<!-- 志愿者 -->
-	<view class="classify-main" v-if="userType == '2'">
-		<up-tabs :list="column" :scrollable="false" @change="onChange" :activeStyle="{
-			color: 'rgba(255, 87, 4, 1)',
-			fontWeight: 'bold',
-			transform: 'scale(1.05)'
-		}" lineColor="rgba(255, 87, 4, 1)" :current="tabKey">
-		</up-tabs>
-		<view class="list">
-			<List :data="data" v-if="data.length > 0" />
-			<view v-else class="empty-null">
-				<img src="/static/empty/订单为空.png" alt="">
+	<view>
+		<!-- 志愿者 -->
+		<view class="classify-main" v-if="userType == '2'">
+			<up-tabs :list="column" :scrollable="false" @change="onChange" :activeStyle="{
+				color: 'rgba(255, 87, 4, 1)',
+				fontWeight: 'bold',
+				transform: 'scale(1.05)'
+			}" lineColor="rgba(255, 87, 4, 1)" v-model:current="tabKey">
+			</up-tabs>
+			<view class="list">
+				<List :data="data" v-if="data.length > 0" />
+				<view v-else class="empty-null">
+					<img src="/static/empty/订单为空.png" alt="">
+				</view>
 			</view>
 			</view>
 		</view>
 		</view>
+		<!-- 用户 -->
+		<OrderList :dataList="dataList" @fetchData="getListData" />
 	</view>
 	</view>
-	<!-- 用户 -->
-	<OrderList :dataList="dataList" @fetchData="getListData"/>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-	import {
-		ref
-	} from 'vue';
-	import List from '@/pages_classify/components/orderList/index.vue';
-	import {
-		provide
-	} from 'vue';
-	import {
-		getVolunteerOrderList
-	} from '@/api/volunteer.js'
-	import {
-		onMounted
-	} from 'vue';
-	import {
-		useDict
-	} from '@/utils/dict.js';
-	import {
-		onLoad,
-		onShow
-	} from '@dcloudio/uni-app';
-	import OrderList from '@/components/pages/classify/orderlist.vue'
-	import {
-		userMainOrderList
-	} from "@/api/userList.js"
-
-	const {
-		order_status,
-		lrr_service_status
-	} = useDict('order_status','lrr_service_status');
-
-	provide('order_status', order_status); //订单/服务状态
-	provide('lrr_service_status', lrr_service_status); //订单/服务状态
-
-
-	const userType = uni.getStorageSync('userType') //读取本地存储
-
-	// 用户/志愿者 识别标识
-	const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
-
-	const tab = ref('');
-	const tabKey = ref(0);
-	const dataList = ref([]) //用户
-	const data = ref([]); //志愿者
-
-	/**
-	 * 	0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款 8 待确认
-	 */
-	const column = [{
-			name: "全部",
-			value: "",
-		},
-		{
-			name: "待服务",
-			value: "0",
-		},
-		{
-			name: "进行中",
-			value: "1",
-		},
-		{
-			name: "已完成",
-			value: "2",
-		},
-		{
-			name: "已取消",
-			value: "3",
-		}
-	]
-
-	const column2 = [{
-			name: "全部",
-			value: "",
-		},
-		{
-			name: "待支付",
-			value: "1",
-		},
-		{
-			name: "待服务",
-			value: "2",
-		},
-		{
-			name: "进行中",
-			value: "3",
-		},
-		{
-			name: "已完成",
-			value: "4",
-		},
-		{
-			name: "已取消",
-			value: "5",
-		}
-	]
-
-
-	async function getList() {
-		console.log(userType, '>>>>>>userType');
-		try {
-			uni.hideLoading();
-			uni.showLoading({
-				title: '数据加载中...'
-			});
+import {
+	ref
+} from 'vue';
+import List from '@/pages_classify/components/orderList/index.vue';
+import {
+	provide
+} from 'vue';
+import {
+	getVolunteerOrderList
+} from '@/api/volunteer.js'
+import {
+	onMounted
+} from 'vue';
+import {
+	useDict
+} from '@/utils/dict.js';
+import {
+	onLoad,
+	onShow
+} from '@dcloudio/uni-app';
+import OrderList from '@/components/pages/classify/orderlist.vue'
+import {
+	userMainOrderList
+} from "@/api/userList.js"
+
+const {
+	order_status,
+	lrr_service_status
+} = useDict('order_status', 'lrr_service_status');
+
+provide('order_status', order_status); //订单/服务状态
+provide('lrr_service_status', lrr_service_status); //订单/服务状态
+
+
+const userType = uni.getStorageSync('userType') //读取本地存储
+
+// 用户/志愿者 识别标识
+const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
+
+const tab = ref('');
+const tabKey = ref(0);
+const dataList = ref([]) //用户
+const data = ref([]); //志愿者
+
+/**
+ * 	0待支付 1已支付 2支付超时或取消 3进行中 4已完成 5申请退款中 6已退款 7部分退款 8 待确认
+ */
+const column = [{
+	name: "全部",
+	value: "",
+},
+{
+	name: "待服务",
+	value: "0",
+},
+{
+	name: "进行中",
+	value: "1",
+},
+{
+	name: "已完成",
+	value: "2",
+},
+{
+	name: "已取消",
+	value: "3",
+}
+]
+
+const column2 = [{
+	name: "全部",
+	value: "",
+},
+{
+	name: "待支付",
+	value: "1",
+},
+{
+	name: "待服务",
+	value: "2",
+},
+{
+	name: "进行中",
+	value: "3",
+},
+{
+	name: "已完成",
+	value: "4",
+},
+{
+	name: "已取消",
+	value: "5",
+}
+]
+
+
+async function getList() {
+	console.log(userType, '>>>>>>userType');
+	try {
+		uni.hideLoading();
+		uni.showLoading({
+			title: '数据加载中...'
+		});
 
 
-			// 判断 userType 来决定调用哪个接口
-			let res;
-			if (userType === 1) {
-				// 如果 userType 是 1,调用 userMainOrderList 接口
-				res = await getListData();
-			} else if (userType === 2) {
-				// 如果 userType 是 2,调用 getVolunteerOrderList 接口
-				res = await getVolunteerOrderList({
-					orderStatus: tab.value
-				});
-				data.value = res.data;
-			}
-
-		} catch (error) {
-			console.log('error', error);
-			uni.showToast({
-				title: error.msg,
-				icon: 'error',
+		// 判断 userType 来决定调用哪个接口
+		let res;
+		if (userType === 1) {
+			// 如果 userType 是 1,调用 userMainOrderList 接口
+			res = await getListData();
+		} else if (userType === 2) {
+			// 如果 userType 是 2,调用 getVolunteerOrderList 接口
+			res = await getVolunteerOrderList({
+				orderStatus: tab.value
 			});
 			});
-		} finally {
-			uni.hideLoading();
+			data.value = res.data;
 		}
 		}
+
+	} catch (error) {
+		console.log('error', error);
+		uni.showToast({
+			title: error.msg,
+			icon: 'error',
+		});
+	} finally {
+		uni.hideLoading();
 	}
 	}
-	const getListData = async (orderStatus = tab.value) => {
-		const res = await userMainOrderList({
-			orderStatus: orderStatus
+}
+const getListData = async (orderStatus = tab.value) => {
+	const res = await userMainOrderList({
+		orderStatus: orderStatus
+	});
+	dataList.value = res.data
+}
+/**
+ * 1: 查看
+ * 2:沟通
+ * 3:上传照片
+ */
+function btnClick(row, type) {
+	console.log('btnClick', type, row, row.orderStatus);
+	if (type === 1 && row.orderStatus === 2) {
+		uni.navigateTo({
+			url: `/pages_classify/pages/order/index?orderId=${row.secondOrderId}`
 		});
 		});
-		dataList.value = res.data
+		return;
 	}
 	}
-	/**
-	 * 1: 查看
-	 * 2:沟通
-	 * 3:上传照片
-	 */
-	function btnClick(row, type) {
-		console.log('btnClick', type, row, row.orderStatus);
-		if (type === 1 && row.orderStatus === 2) {
-			uni.navigateTo({
-				url: `/pages_classify/pages/order/index?orderId=${row.secondOrderId}`
-			});
-			return;
-		}
-		if (type === 1) {
+	if (type === 1) {
 
 
-			uni.navigateTo({
-				url: `/pages_classify/pages/handle/index?orderId=${row.secondOrderId}`
-			});
-			return
-		}
-		
-		//前往沟通
 		uni.navigateTo({
 		uni.navigateTo({
-			url: `/pages_orderuser/pages/talk/pages/index/index?orderId=${row.secondOrderId}`
+			url: `/pages_classify/pages/handle/index?orderId=${row.secondOrderId}`
 		});
 		});
-
+		return
 	}
 	}
-	provide('onClick', btnClick);
 
 
+	//前往沟通
+	uni.navigateTo({
+		url: `/pages_orderuser/pages/talk/pages/index/index?orderId=${row.secondOrderId}`
+	});
+
+}
+provide('onClick', btnClick);
 
 
-	function onChange(tabItem) {
-		console.log('onChange called with tabItem:', tabItem); // 确认是否进入 onChange
-		tab.value = tabItem.value;
-		getList();
-		console.log('change', tabItem, tab.value);
-	}
 
 
+function onChange(tabItem) {
+	console.log('onChange called with tabItem:', tabItem); // 确认是否进入 onChange
+	tab.value = tabItem.value;
+	getList();
+	console.log('change', tabItem, tab.value);
+}
 
 
 
 
-	onMounted(() => {
-		getList()
-		getListData()
-	})
 
 
+onMounted(() => {
+	getList()
+	getListData()
+})
 
 
-	onShow(() => {
-		const params = getApp().globalData.switchTabParams || {};
-		tabKey.value = params.tabKey || 0;
-		console.log(params);
-		onChange(column[tabKey.value])
-		// 使用后建议清除参数,避免重复读取 
-		getApp().globalData.switchTabParams = null;
 
 
-	})
+onShow(() => {
+	const params = getApp().globalData.switchTabParams || {};
+	tabKey.value = params.tabKey || 0;
+	console.log('cc', params, tabKey.value);
+	onChange(column[tabKey.value])
+	// 使用后建议清除参数,避免重复读取 
+	getApp().globalData.switchTabParams = null;
+
+})
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
-	.classify-main {
-		height: 100vh;
-
-		.list {
-			position: fixed;
-			top: 50px;
-			bottom: 0px;
-			left: 0px;
-			right: 0px;
-		}
+.classify-main {
+	height: 100vh;
+
+	.list {
+		position: fixed;
+		top: 50px;
+		bottom: 0px;
+		left: 0px;
+		right: 0px;
 	}
 	}
+}
 </style>
 </style>

+ 35 - 14
pages_classify/pages/handle/index.vue

@@ -8,9 +8,11 @@
             <view class="user-box">
             <view class="user-box">
                 <view class="info-list">
                 <view class="info-list">
                     <view>被服务人员:{{ detaile.name }}</view>
                     <view>被服务人员:{{ detaile.name }}</view>
+                    <view style="display: flex;">服务类别: <dict-tag :options="lrr_service_category"
+                            :value="detaile.serviceCategory" /></view>
                     <view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
                     <view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
                     <view>地址:{{ detaile.address }}</view>
                     <view>地址:{{ detaile.address }}</view>
-                    <view>是否有传染疾病:{{ detaile.isContagion=== 1 ?'是':'否' }}</view>
+                    <view>是否有传染疾病:{{ detaile.isContagion === 1 ? '是' : '否' }}</view>
                     <view v-if="detaile.isContagion === 1">疾病备注:{{ detaile.haveContagion }}</view>
                     <view v-if="detaile.isContagion === 1">疾病备注:{{ detaile.haveContagion }}</view>
                     <view>备注信息:{{ detaile.remark }}</view>
                     <view>备注信息:{{ detaile.remark }}</view>
 
 
@@ -27,11 +29,12 @@
 <script setup>
 <script setup>
 import { ref } from 'vue';
 import { ref } from 'vue';
 import { onLoad } from '@dcloudio/uni-app';
 import { onLoad } from '@dcloudio/uni-app';
-import { getVolunteerOrderInfo,getTimesByDate, } from '@/api/volunteer.js'
+import { getVolunteerOrderInfo, getTimesByDate, } from '@/api/volunteer.js'
 import { getAddress } from '@/api/address.js'
 import { getAddress } from '@/api/address.js'
 import PositioningMap from '@/components/PositioningMap/index.vue'
 import PositioningMap from '@/components/PositioningMap/index.vue'
 import Slide from '@/components/Slide/index.vue'
 import Slide from '@/components/Slide/index.vue'
-
+import { useDict } from '@/utils/dict.js';
+import DictTag from '@/components/DictTag/index.vue'
 import { wxMakePhoneCall } from '@/utils/wxRequest.js'
 import { wxMakePhoneCall } from '@/utils/wxRequest.js'
 import { computed } from 'vue';
 import { computed } from 'vue';
 
 
@@ -40,6 +43,9 @@ const orderId = ref('');
 const detaile = ref({});
 const detaile = ref({});
 const verify = ref(null);
 const verify = ref(null);
 
 
+const {
+    lrr_service_category
+} = useDict('lrr_service_category');
 
 
 const orderStatus = ref(false);//false:未开始服务 true:服务已开始,待上传图片
 const orderStatus = ref(false);//false:未开始服务 true:服务已开始,待上传图片
 const onPhone = (phone) => {
 const onPhone = (phone) => {
@@ -69,14 +75,14 @@ const getOrderDetail = async () => {
                 address: ad_res.data.address,
                 address: ad_res.data.address,
                 name: ad_res.data.name,
                 name: ad_res.data.name,
                 telephone: ad_res.data.telephone,
                 telephone: ad_res.data.telephone,
-                isContagion:ad_res.data.isContagion,
-                haveContagion:ad_res.data.haveContagion,
+                isContagion: ad_res.data.isContagion,
+                haveContagion: ad_res.data.haveContagion,
 
 
             }
             }
         }
         }
         detaile.value = data;
         detaile.value = data;
-        if(data.orderStatus === 1){
-            
+        if (data.orderStatus === 1) {
+
             orderStatus.value = true;
             orderStatus.value = true;
         }
         }
 
 
@@ -99,18 +105,33 @@ const change = (e) => {
     console.log('验证次数:' + e.verification)
     console.log('验证次数:' + e.verification)
     if (e.state && !orderStatus.value) {
     if (e.state && !orderStatus.value) {
 
 
-        getTimesByDate(orderId.value).then(res =>{
-            if(res.code === 200){
-                verify.value.initialization();
-                // 验证成功
-                orderStatus.value = true;
+        getTimesByDate(orderId.value).then(res => {
+            if (res.code === 200) {
+                uni.showToast({
+                    title: '已开始服务',
+                    icon: 'success',
+                    success: () => {
+                        verify.value.initialization();
+                        // 验证成功
+                        orderStatus.value = true;
+                    }
+                })
+
             }
             }
         })
         })
 
 
     }
     }
     if (e.state && orderStatus.value) {
     if (e.state && orderStatus.value) {
-        console.log('完成任务')
-        uni.redirectTo({ url: `/pages_classify/pages/order/index?orderId=${orderId.value}` });
+        uni.showToast({
+            title: '操作成功',
+            icon: 'success',
+            success: () => {
+               setTimeout(()=>{
+                uni.redirectTo({ url: `/pages_classify/pages/order/index?orderId=${orderId.value}` });
+               },800)
+            }
+        })
+
     }
     }
 }
 }
 
 

+ 35 - 16
pages_classify/pages/order/index.vue

@@ -6,6 +6,8 @@
 			<view class="user-box">
 			<view class="user-box">
 				<view class="info-list">
 				<view class="info-list">
 					<view>被服务人员:{{ detaile.name }}</view>
 					<view>被服务人员:{{ detaile.name }}</view>
+					<view style="display: flex;">服务类别: <dict-tag :options="lrr_service_category"
+							:value="detaile.serviceCategory" /></view>
 					<view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
 					<view @click="onPhone">电话号码:<label class="phone">{{ detaile.telephone }}</label></view>
 					<view>地址:{{ detaile.address }}</view>
 					<view>地址:{{ detaile.address }}</view>
 				</view>
 				</view>
@@ -23,15 +25,15 @@
 			<view class="upload-box">
 			<view class="upload-box">
 				<view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
 				<view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
 					<view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
 					<view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
-							color="#f64a1f" size="18" v-if="detaile.orderStatus === 1 "></up-icon></view>
+							color="#f64a1f" size="18" v-if="detaile.orderStatus === 1"></up-icon></view>
 					<img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
 					<img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
 				</view>
 				</view>
 				<img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
 				<img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
-					v-if="fileList.length < 10 && detaile.orderStatus === 1 ">
+					v-if="fileList.length < 10 && detaile.orderStatus === 1">
 			</view>
 			</view>
 		</view>
 		</view>
 
 
-		<view class=" footer-g" v-if="detaile.orderStatus === 1 ">
+		<view class=" footer-g" v-if="detaile.orderStatus === 1">
 			<up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
 			<up-button type="primary" text="确定结束" @click="onSubmit"></up-button>
 		</view>
 		</view>
 	</view>
 	</view>
@@ -42,12 +44,15 @@ import { ref, toRaw } from 'vue';
 import { onLoad } from '@dcloudio/uni-app';
 import { onLoad } from '@dcloudio/uni-app';
 import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
 import { getVolunteerOrderInfo, getVolunteerFinishSecondOrder } from '@/api/volunteer.js'
 import { getAddress } from '@/api/address.js'
 import { getAddress } from '@/api/address.js'
-
 import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
 import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
-
+import { useDict } from '@/utils/dict.js';
+import DictTag from '@/components/DictTag/index.vue'
 const fileList = ref([]);
 const fileList = ref([]);
 const orderId = ref('');
 const orderId = ref('');
 const detaile = ref({});
 const detaile = ref({});
+const {
+	lrr_service_category
+} = useDict('lrr_service_category');
 
 
 // 删除图片
 // 删除图片
 const deletePic = (index) => {
 const deletePic = (index) => {
@@ -80,9 +85,9 @@ const getOrderDetail = async () => {
 				telephone: ad_res.data.telephone
 				telephone: ad_res.data.telephone
 			}
 			}
 		}
 		}
-		if(data.serviceLog) {
+		if (data.serviceLog) {
 			fileList.value = data.serviceLog.split(',').map(item => {
 			fileList.value = data.serviceLog.split(',').map(item => {
-				return {url: item}
+				return { url: item }
 			});
 			});
 		}
 		}
 		detaile.value = data;
 		detaile.value = data;
@@ -100,18 +105,32 @@ const getOrderDetail = async () => {
 }
 }
 
 
 const onSubmit = () => {
 const onSubmit = () => {
-	const  img_urls = fileList.value.map(item => item.url).join(',');
-	console.log('submit', fileList.value,img_urls);
+	const img_urls = fileList.value.map(item => item.url).join(',');
+	console.log('submit', fileList.value, img_urls);
 
 
 	getVolunteerFinishSecondOrder({
 	getVolunteerFinishSecondOrder({
-		secondOrderId:orderId.value,
-		serviceLog:img_urls,
+		secondOrderId: orderId.value,
+		serviceLog: img_urls,
 		volunteerId: detaile.value.volunteerId
 		volunteerId: detaile.value.volunteerId
-	}).then(res=> {
-		if(res.code === 200){
-			uni.switchTab({
-			url: '/pages/classify'
-		});	
+	}).then(res => {
+		if (res.code === 200) {
+			uni.showToast({
+				title: '服务结束',
+				icon: 'success',
+				success: () => {
+					setTimeout(() => {
+						uni.switchTab({
+							url: '/pages/classify'
+						});
+					}, 800)
+				}
+			})
+
+		}else{
+			uni.showToast({
+				title: res.data,
+				icon: 'error',
+			})
 		}
 		}
 
 
 	})
 	})

+ 56 - 8
pages_home/pages/register/data.js

@@ -44,10 +44,46 @@ const rules = {
             trigger: ['blur', 'change']
             trigger: ['blur', 'change']
         }
         }
     ],
     ],
-    age: [],
-    idCard: [],
-    city: [],
-    address: []
+    age: [
+        {
+            type: 'string',
+            required: true,
+            message: '请填写年龄',
+            trigger: ['blur', 'change']
+        }
+    ],
+    idCard: [
+        {
+            type: 'string',
+            required: true,
+            message: '请填写证件号',
+            trigger: ['blur', 'change']
+        }
+    ],
+    city: [
+        {
+            type: 'string',
+            required: true,
+            message: '请选择地区',
+            trigger: ['blur', 'change']
+        }
+    ],
+    address: [
+        {
+            type: 'string',
+            required: true,
+            message: '请填写地址',
+            trigger: ['blur', 'change']
+        }
+    ],
+    skillDescribe:[
+        {
+            type: 'string',
+            required: true,
+            message: '请填写技能简介',
+            trigger: ['blur', 'change']
+        }
+    ]
 }
 }
 
 
 //陪伴陪聊注册 1
 //陪伴陪聊注册 1
@@ -72,6 +108,7 @@ const chatting = [
         key: "age",
         key: "age",
         type: "input",
         type: "input",
         rules: rules.age,
         rules: rules.age,
+        required:true
     },
     },
     {
     {
         label: "手机号",
         label: "手机号",
@@ -91,17 +128,21 @@ const chatting = [
         type: "city",
         type: "city",
         option: city_option,
         option: city_option,
         rules: rules.city,
         rules: rules.city,
+        required:true
     },
     },
     {
     {
         label: "详细地址",
         label: "详细地址",
         key: "address",
         key: "address",
         type: "input",
         type: "input",
-        rules: rules.address
+        rules: rules.address,
+        required:true
     },
     },
     {
     {
         label: "技能简介",
         label: "技能简介",
         key: "skillDescribe",
         key: "skillDescribe",
         type: "textarea",
         type: "textarea",
+        rules: rules.skillDescribe,
+        required:true
     },
     },
 ]
 ]
 
 
@@ -126,7 +167,8 @@ const education = [
         label: "年龄",
         label: "年龄",
         key: "age",
         key: "age",
         type: "input",
         type: "input",
-        rules: rules.age
+        rules: rules.age,
+        required:true
     },
     },
     {
     {
         label: "手机号",
         label: "手机号",
@@ -137,25 +179,31 @@ const education = [
         label: "证件号",
         label: "证件号",
         key: "idCard",
         key: "idCard",
         type: "input",
         type: "input",
+        rules: rules.idCard,
+        required:true
     },
     },
     {
     {
         label: "地区",
         label: "地区",
         key: "city",
         key: "city",
         type: "city",
         type: "city",
         option: city_option,
         option: city_option,
-        rules: rules.city
+        rules: rules.city,
+        required:true
 
 
     },
     },
     {
     {
         label: "地址",
         label: "地址",
         key: "address",
         key: "address",
         type: "input",
         type: "input",
-        rules: rules.address
+        rules: rules.address,
+        required:true
     },
     },
     {
     {
         label: "技能简介",
         label: "技能简介",
         key: "skillDescribe",
         key: "skillDescribe",
         type: "textarea",
         type: "textarea",
+        rules: rules.skillDescribe,
+        required:true
     },
     },
 ]
 ]
 //家庭清洁5
 //家庭清洁5