wangxy 3 недель назад
Родитель
Сommit
f089d35aa8

+ 73 - 0
api/zizhanghao.js

@@ -0,0 +1,73 @@
+import request from '@/utils/request'
+
+export function getUserGuanliAdd(data = {}) {
+  return request({
+    url: '/app/user/guanli/add',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserGuanliDelete(data = {}) {
+  return request({
+    url: '/app/user/guanli/delete',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserGuanliInfo(data = {}) {
+  return request({
+    url: '/app/user/guanli/info',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserGuanliList(data = {}) {
+  return request({
+    url: '/app/user/guanli/list',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserGuanliUpdate(data = {}) {
+  return request({
+    url: '/app/user/guanli/update',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserGuanliReset(data = {}) {
+  return request({
+    url: '/app/user/guanli/reset',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 14 - 0
pages.json

@@ -224,6 +224,20 @@
 			"style": {
 				"navigationStyle": "custom"
 			}
+		},
+		{
+			"path" : "pages/admin/zizhanghao/list",
+			"style" : 
+			{
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path" : "/pages/admin/yishou/yishou",
+			"style" : 
+			{
+				"navigationStyle": "custom"
+			}
 		}
 	],
 	"tabBar": {

+ 1 - 1
pages/admin/ShouYe/shouye.vue

@@ -31,7 +31,7 @@
 		 <view @click="goToPage('jz')" class="card-item-box">
 		 	<icon class="index-icon jz-icon"></icon>
 		 	<text>家政人员</text>
-		 </view> 
+		 </view>
 	  </view>
 	  <view class="card-list-box">  
 		<view class="card-list-title">管理考证人员</view>

+ 119 - 0
pages/admin/zizhanghao/components/addUserDl.vue

@@ -0,0 +1,119 @@
+<template>
+	<uni-popup ref="commonPopup" :animation="false" :is-mask-click="false" mask-background-color="rgba(0, 0, 0, 0.4)">
+		<view class="phone-common-dialog">
+			<view class="common-body-box">
+				<view class="common-title">{{title}}</view>
+				<view class="common-content" :class="dialogContentClass">
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>姓名</view>
+						<input v-model="realName" placeholder="请输入姓名" />
+					</view>
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>手机号</view>
+						<input v-model="userName" placeholder="请输入手机号" />
+					</view>
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>密码</view>
+						<input v-model="password" placeholder="请输入密码" />
+					</view>
+				</view>
+				<view class="common-btn-box">
+					<view class="not-confirm-btn" @click="handleClose">{{notBtn}}</view>
+					<view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
+				</view>
+			</view>
+		</view>
+	</uni-popup>
+</template>
+
+<script setup>
+	import {
+		ref
+	} from 'vue';
+	import {
+		getUserGuanliAdd
+	} from "@/api/zizhanghao.js"
+
+	const props = defineProps({
+		title: {
+			type: String,
+			default: ''
+		},
+		dialogContentClass: {
+			type: String,
+			require: true,
+			default: 'content-center-class'
+		},
+		notBtn: {
+			type: String,
+			require: true,
+			default: '取消'
+		},
+		okBtn: {
+			type: String,
+			require: true,
+			default: '确认'
+		},
+	});
+
+	const realName = ref('');
+	const userName = ref('');
+	const password = ref('');
+	const userId = ref(null)
+
+	const commonPopup = ref(null); // 索引
+	const $emit = defineEmits(['confirm-btn'])
+	// 打开弹窗
+	function handleShow() {
+		commonPopup.value.open();
+	}
+	// 取消
+	function handleClose() {
+		commonPopup.value.close();
+	}
+	// 确认
+	function confirmBtn() {
+		if (!realName.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入用户名'
+			})
+			return;
+		}
+		if (!userName.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入手机号'
+			})
+			return;
+		}
+		if (!password.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入密码'
+			})
+			return;
+		}
+		getUserGuanliAdd({
+			userName: userName.value,
+			realName: realName.value,
+			password: password.value
+		}).then(res => {
+			if (res.data) {
+				uni.showToast({
+					icon: 'none',
+					title: '新增成功'
+				})
+				$emit('confirm-btn');
+				commonPopup.value.close();
+			}
+		})
+	}
+	defineExpose({
+		handleShow,
+		handleClose
+	})
+</script>
+
+<style>
+</style>

+ 120 - 0
pages/admin/zizhanghao/components/editorUserDl.vue

@@ -0,0 +1,120 @@
+<template>
+	<uni-popup ref="commonPopup" :animation="false" :is-mask-click="false" mask-background-color="rgba(0, 0, 0, 0.4)">
+		<view class="phone-common-dialog">
+			<view class="common-body-box">
+				<view class="common-title">{{title}}</view>
+				<view class="common-content" :class="dialogContentClass">
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>姓名</view>
+						<input v-model="realName" placeholder="请输入姓名" />
+					</view>
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>手机号</view>
+						<input v-model="userName" placeholder="请输入手机号" />
+					</view>
+				</view>
+				<view class="common-btn-box">
+					<view class="not-confirm-btn" @click="handleClose">{{notBtn}}</view>
+					<view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
+				</view>
+			</view>
+		</view>
+	</uni-popup>
+</template>
+
+<script setup>
+	import {
+		ref
+	} from 'vue';
+	import {
+		getUserGuanliUpdate,
+		getUserGuanliInfo
+	} from "@/api/zizhanghao.js"
+	const props = defineProps({
+		title: {
+			type: String,
+			default: ''
+		},
+		dialogContentClass: {
+			type: String,
+			require: true,
+			default: 'content-center-class'
+		},
+		notBtn: {
+			type: String,
+			require: true,
+			default: '取消'
+		},
+		okBtn: {
+			type: String,
+			require: true,
+			default: '确认'
+		},
+	});
+
+	const realName = ref('');
+	const userName = ref('');
+	const userId = ref(null)
+
+	const commonPopup = ref(null); // 索引
+	const $emit = defineEmits(['confirm-btn'])
+	// 打开弹窗
+	function handleShow(userIdData) {
+		getUserGuanliInfo({
+			userId: userIdData
+		}).then(res => {
+			realName.value = res.data.realName;
+			userName.value = res.data.userName;
+			userId.value = userIdData;
+			commonPopup.value.open();
+		})
+	}
+	// 取消
+	function handleClose() {
+		commonPopup.value.close();
+		realName.value = '';
+		userName.value = '';
+		userId.value = null;
+	}
+	// 确认
+	function confirmBtn() {
+		if (!realName.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入用户名'
+			})
+			return;
+		}
+		if (!userName.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入手机号'
+			})
+			return;
+		}
+		getUserGuanliUpdate({
+			userId: userId.value,
+			userName: userName.value,
+			realName: realName.value
+		}).then(res => {
+			if (res.data) {
+				uni.showToast({
+					icon: 'none',
+					title: '更新成功'
+				})
+				$emit('confirm-btn');
+				commonPopup.value.close();
+				realName.value = '';
+				userName.value = '';
+				userId.value = null;
+			}
+		})
+	}
+	defineExpose({
+		handleShow,
+		handleClose
+	})
+</script>
+
+<style>
+</style>

+ 99 - 0
pages/admin/zizhanghao/components/resetPassword.vue

@@ -0,0 +1,99 @@
+<template>
+	<uni-popup ref="commonPopup" :animation="false" :is-mask-click="false" mask-background-color="rgba(0, 0, 0, 0.4)">
+		<view class="phone-common-dialog">
+			<view class="common-body-box">
+				<view class="common-title">{{title}}</view>
+				<view class="common-content" :class="dialogContentClass">
+					<view class="form-label-input">
+						<view class="phone-form-label"><text class="form-label-require"></text>密码</view>
+						<input v-model="password" placeholder="请输入密码" />
+					</view>
+				</view>
+				<view class="common-btn-box">
+					<view class="not-confirm-btn" @click="handleClose">{{notBtn}}</view>
+					<view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
+				</view>
+			</view>
+		</view>
+	</uni-popup>
+</template>
+
+<script setup>
+	import {
+		ref
+	} from 'vue';
+	import {
+		getUserGuanliReset
+	} from "@/api/zizhanghao.js"
+
+	const props = defineProps({
+		title: {
+			type: String,
+			default: ''
+		},
+		dialogContentClass: {
+			type: String,
+			require: true,
+			default: 'content-center-class'
+		},
+		notBtn: {
+			type: String,
+			require: true,
+			default: '取消'
+		},
+		okBtn: {
+			type: String,
+			require: true,
+			default: '确认'
+		},
+	});
+
+	const password = ref('');
+	const userId = ref(null)
+
+	const commonPopup = ref(null); // 索引
+	const $emit = defineEmits(['confirm-btn'])
+	// 打开弹窗
+	function handleShow(userIdData) {
+		userId.value = userIdData;
+		commonPopup.value.open();
+	}
+	// 取消
+	function handleClose() {
+		password.value = null;
+		userId.value  = null;
+		commonPopup.value.close();
+	}
+	// 确认
+	function confirmBtn() {
+		if (!password.value) {
+			uni.showToast({
+				icon: 'none',
+				title: '请输入密码'
+			})
+			return;
+		}
+		getUserGuanliReset({
+			userId: userId.value,
+			password: password.value
+		}).then(res => {
+			if (res.data) {
+				uni.showToast({
+					icon: 'none',
+					title: '更新成功'
+				})
+				$emit('confirm-btn');
+				commonPopup.value.close();
+				password.value = null;
+				userId.value  = null;
+			}
+		})
+	}
+	defineExpose({
+		handleShow,
+		handleClose
+	})
+</script>
+
+<style>
+</style>

+ 247 - 0
pages/admin/zizhanghao/list.vue

@@ -0,0 +1,247 @@
+<template>
+	<view class="phone-list-page phone-banzheng-page">
+		<view class="phone-navBar-box">
+			<view @click="goUpPage" class="nav-bar-icon"></view>
+			<text class="nav-bar-title">子账号管理</text>
+			<uni-icons class="nav-bar-right-icon" type="search" size="22" color="#666" @click="searchBtn"></uni-icons>
+		</view>
+		<view class="banzheng-search-box">
+			<view class="select-item-box">
+
+			</view>
+			<view class="filter-btn" @click="handleAddZizhanghao">新增</view>
+		</view>
+		<!-- 课程列表 -->
+		<scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
+			:refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
+			class="phone-scroll-saixuan-view">
+			<uni-list>
+				<uni-list-item v-for="item in data.list" class="banzheng-list-item-box">
+					<template v-slot:body>
+						<view>
+							<view class="banzheng-list-card-box">
+								<view>家政公司: {{item.jzName}}</view>
+								<view>姓名:{{item.realName}}</view>
+								<view>手机:{{item.userName}}</view>
+							</view>
+							<view>
+								<button @click="handleEditor(item)">编辑</button>
+								<button @click="handleDelete(item)">删除</button>
+								<button @click="handleReset(item)">重置密码</button>
+							</view>
+						</view>
+					</template>
+				</uni-list-item>
+				<uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
+			</uni-list>
+		</scroll-view>
+
+		<!-- 页面底端 -->
+		<customTabbarClientVue :current-tab="0"></customTabbarClientVue>
+		<!-- 搜索 -->
+		<search-dialog ref="searchDialogRef" @search-btn="dialogSearchBtn"
+			@reset-search="dialogSearchReset"></search-dialog>
+		<!-- 删除子账号 -->
+		<common-dialog ref="commonDialogRef" :title="deleteTitle" :content="deleteConcent"
+			@confirm-btn="deleteQuerenBtn"></common-dialog>
+		<!-- 新增子账号 -->
+		<addUserDlVue ref="addUserRef" title="新增" @confirm-btn="onAddSuccess"></addUserDlVue>
+		<!-- 更新子账号 -->
+		<editorUserDlVue ref="editorUserRef" title="编辑" @confirm-btn="onUpdateSuccess"></editorUserDlVue>
+		<!-- 更新密码 -->
+		<resetPasswordVue ref="resetPasswordRef"></resetPasswordVue>
+	</view>
+</template>
+
+<script setup>
+	import searchDialog from "@/pages/admin/banzheng/search.vue";
+	import commonDialog from '@/components/dialog/commonDialog.vue';
+	import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
+	import addUserDlVue from "./components/addUserDl.vue";
+	import editorUserDlVue from "./components/editorUserDl.vue";
+	import resetPasswordVue from "./components/resetPassword.vue";
+	import {
+		reactive,
+		ref
+	} from "vue";
+
+	import {
+		onLoad
+	} from "@dcloudio/uni-app"
+	import {
+		getUserGuanliList,
+		getUserGuanliDelete
+	} from "@/api/zizhanghao.js"
+
+	const data = reactive({
+		list: [], // 办证列表
+		loading: false,
+		page: 0,
+		size: 10,
+		state: 'more',
+		contentText: {
+			contentdown: '查看更多',
+			contentrefresh: '加载中',
+			contentnomore: '没有更多'
+		},
+		userName: '', // 手机号
+		realName: '', // 姓名
+	})
+	const deleteTitle = ref('删除')
+	const deleteConcent = ref('你确定要执行这个操作吗')
+	const deletUserId = ref(null)
+	const addUserRef = ref(null)
+	const editorUserRef = ref(null)
+	const commonDialogRef = ref(null)
+	const resetPasswordRef = ref(null)
+	const searchDialogRef = ref(null)
+
+	function goUpPage() {
+		uni.redirectTo({
+			url: '/pages/admin/ShouYe/shouye'
+		})
+	}
+
+	function handleEditor(item) {
+		editorUserRef.value.handleShow(item.userId);
+	}
+
+	function handleDelete(item) {
+		deletUserId.value = item.userId;
+		commonDialogRef.value.handleShow();
+	}
+
+	function handleReset(item) {
+		resetPasswordRef.value.handleShow(item.userId)
+	}
+
+	function onAddSuccess() {
+		data.page = 0;
+		refreshData();
+	}
+
+	function onUpdateSuccess() {
+		data.page = 0;
+		refreshData();
+	}
+
+	function handleAddZizhanghao() {
+		addUserRef.value.handleShow()
+	}
+
+	function searchBtn() {
+		searchDialogRef.value.handleShow();
+	}
+
+	function refreshData() {
+		const opt = {
+			realName: data.realName, // 姓名
+			userName: data.userName, // 手机号
+			page: 1,
+			size: 10, // 固定查询10条
+		}
+		data.list = [];
+		// 数学
+		data.state = 'loading';
+		data.page++;
+		opt.page = data.page;
+
+		getUserGuanliList(opt).then(res => {
+			data.list = data.list.concat(res.data.data);
+			data.loading = false;
+
+			if (res.data.total > data.list.length) {
+				data.state = 'more';
+				data.loading = false;
+			} else {
+				data.state = 'no-more';
+				data.loading = false;
+			}
+		}).catch(err => {
+			data.state = 'more';
+			data.loading = false;
+		})
+	}
+
+	function getMore() {
+		const opt = {
+			realName: data.realName, // 姓名
+			userName: data.userName, // 手机号
+			page: 1,
+			size: 10, // 固定查询10条
+		}
+		if (data.state == 'no-more') return;
+		data.state = 'loading';
+		data.page++;
+		opt.page = data.page;
+		getUserGuanliList(opt).then(res => {
+			data.list = data.list.concat(res.data.data);
+			data.loading = false;
+
+			if (res.data.total > data.list.length) {
+				data.state = 'more';
+				data.loading = false;
+			} else {
+				data.state = 'no-more';
+				data.loading = false;
+			}
+		}).catch(err => {
+			data.state = 'more';
+			data.loading = false;
+		})
+	}
+
+	function onRefresh() {
+		data.page = 0;
+		data.list = [];
+		data.loading = true;
+		refreshData();
+	}
+
+	function dialogSearchBtn(name, searchData) {
+		switch (name) {
+			case '姓名':
+				dialogSearchReset();
+				data.realName = searchData.value;
+				break;
+			case '手机号':
+				data.userName = searchData.value;
+				break;
+		}
+		data.page = 0;
+		refreshData();
+
+	}
+
+	function dialogSearchReset() {
+		data.userName = '';
+		data.realName = '';
+	}
+
+	function deleteQuerenBtn() {
+		getUserGuanliDelete({
+			userId: deletUserId.value
+		}).then(res => {
+			if (res.code == 0) {
+				uni.showToast({
+					title: '成功'
+				})
+				data.page = 0;
+				refreshData();
+			} else {
+				uni.showToast({
+					title: '失败'
+				})
+			}
+
+		})
+	}
+
+	onLoad(() => {
+		getMore()
+	})
+</script>
+
+<style>
+
+</style>