lalala 6 years ago
parent
commit
1936e256d4

+ 49 - 14
admin-code/src/mock/userInfo.js

@@ -380,7 +380,7 @@ let menu = {
 		{
 			id: '901',
 			parentId: '9',
-			name: '员工管理',
+			name: '员工列表',
 			type: 1,
 			icon: 'iconkehuguanli',
 			orderNum: 2,
@@ -388,6 +388,28 @@ let menu = {
 			viewPath: 'views/staff/list.vue',
 			keepAlive: 1
 		},
+		{
+			id: '902',
+			parentId: '9',
+			name: '角色列表',
+			type: 1,
+			icon: 'iconkehuguanli',
+			orderNum: 2,
+			router: '/role/list',
+			viewPath: 'views/staff/role-list.vue',
+			keepAlive: 1
+		},
+		{
+			id: '903',
+			parentId: '9',
+			name: '操作记录',
+			type: 1,
+			icon: 'iconkehuguanli',
+			orderNum: 2,
+			router: '/operate/list',
+			viewPath: 'views/staff/operate.vue',
+			keepAlive: 1
+		},
 		// 设置
 		{
 			id: '10',
@@ -400,6 +422,28 @@ let menu = {
 			viewPath: 'views/goods/goods-list.vue',
 			keepAlive: 1
 		},
+		{
+			id: '101',
+			parentId: '10',
+			name: '微信菜单设置',
+			type: 1,
+			icon: 'iconkehuguanli',
+			orderNum: 2,
+			router: '/setting/wx-menu',
+			viewPath: 'views/setting/wx-menu.vue',
+			keepAlive: 1
+		},
+		{
+			id: '11',
+			parentId: null,
+			name: '我的代理',
+			type: 1,
+			icon: 'iconkehuguanli',
+			orderNum: 2,
+			router: '/pages/interest/admin/my-invite',
+			viewPath: 'views/my-invite/index.vue',
+			keepAlive: 1
+		},
 		// ========================================================
 		{
 			id: '12',
@@ -712,24 +756,15 @@ let menu = {
 	]
 };
 
-// Mock.mock(RegExp('/auth/login' + '.*'), 'get', req => {
-// 	console.table(req);
+// Mock.mock(RegExp('/comm/person' + '.*'), 'get', req => {
+// 	// console.table(req);
 // 	return {
-// 		code: 1000,
-// 		data: token,
+// 		code: 1,
+// 		data: userInfo,
 // 		message: 'success'
 // 	};
 // });
 
-Mock.mock(RegExp('/comm/person' + '.*'), 'get', req => {
-	// console.table(req);
-	return {
-		code: 1,
-		data: userInfo,
-		message: 'success'
-	};
-});
-
 Mock.mock(RegExp('/comm/permmenu' + '.*'), 'get', req => {
 	// console.table(req);
 	return {

+ 17 - 1
admin-code/src/pages/layout/slider/index.vue

@@ -52,8 +52,25 @@ export default {
 	},
 	mounted() {
 		// console.log('menuGroup', this.menuGroup);
+		this.init();
 	},
 	methods: {
+		init() {
+			let path = this.$route.path;
+			for (let i in this.menuGroup) {
+				if (this.menuGroup[i].children.length > 0) {
+					for (let j in this.menuGroup[i].children) {
+						if (path == this.menuGroup[i].children[j].path) {
+							this.mainIndex = i;
+							this.subIndex = j;
+						}
+					}
+				} else if (path == this.menuGroup[i].path) {
+					this.mainIndex = i;
+					this.subIndex = 0;
+				}
+			}
+		},
 		pageMianTo(item, index) {
 			this.mainIndex = index;
 			if (this.$util.isEmpty(item.children)) {
@@ -64,7 +81,6 @@ export default {
 			}
 		},
 		pageSubTo(item, index) {
-			console.log(item);
 			this.subIndex = index;
 			this.$router.push(item.path);
 		}

+ 6 - 0
admin-code/src/pages/login/index.js

@@ -54,9 +54,15 @@ export default {
 				// 登录
 				await this.$store.dispatch('userLogin', this.form);
 
+				// 后台信息
+				// await this.$store.dispatch('adminInfo');
+
 				// 用户信息
 				await this.$store.dispatch('userInfo');
 
+				// 商户信息
+				await this.$store.dispatch('shopInfo');
+
 				// 权限菜单
 				const [first] = await this.$store.dispatch('permMenu');
 

+ 14 - 2
admin-code/src/service/common/index.js

@@ -43,14 +43,26 @@ export class CommonService extends BaseService {
 	}
 
 	/**
-	 * 用户信息
+	 * 员工登录信息
+	 *
+	 * @returns
+	 * @memberof CommonService
+	 */
+	shopInfo() {
+		return this.request({
+			url: '/merchant/detail'
+		});
+	}
+
+	/**
+	 * 员工登录信息
 	 *
 	 * @returns
 	 * @memberof CommonService
 	 */
 	userInfo() {
 		return this.request({
-			url: '/comm/person'
+			url: '/admin/login-detail'
 		});
 	}
 

+ 17 - 0
admin-code/src/service/single/index.js

@@ -1,12 +1,29 @@
 import { BaseService, Service } from '@/cool/index';
 
 export class SingleService extends BaseService {
+	// 操作日志
 	log(data) {
 		return this.request({
 			url: '/admin-log/list',
 			params: data
 		});
 	}
+
+	// 我的代理列表 b
+	applyList(data) {
+		return this.request({
+			url: '/apply/list',
+			params: data
+		});
+	}
+
+	// 我的代理资产 b
+	assetDet(data) {
+		return this.request({
+			url: '/agent-asset/detail',
+			params: data
+		});
+	}
 }
 
 export default new SingleService();

+ 21 - 3
admin-code/src/store/modules/user.js

@@ -5,6 +5,7 @@ import dayjs from 'dayjs';
 export default {
 	state: {
 		token: store.get('token') || null,
+		shopInfo: store.get('shopInfo') || {},
 		info: store.get('userInfo') || {}
 	},
 	actions: {
@@ -26,6 +27,13 @@ export default {
 			// });
 		},
 
+		shopInfo({ commit }) {
+			return service.common.shopInfo().then(res => {
+				commit('SET_SHOPINFO', res);
+				return res;
+			});
+		},
+
 		userInfo({ commit }) {
 			return service.common.userInfo().then(res => {
 				commit('SET_USERINFO', res);
@@ -38,6 +46,11 @@ export default {
 		}
 	},
 	mutations: {
+		SET_SHOPINFO(state, val) {
+			state.info = val;
+			store.set('shopInfo', val);
+		},
+
 		SET_USERINFO(state, val) {
 			state.info = val;
 			store.set('userInfo', val);
@@ -48,14 +61,19 @@ export default {
 			store.set('token', token, expire && dayjs().add(expire, 'second'));
 		},
 
-		CLEAR_TOKEN(state) {
-			state.token = null;
-			store.remove('token');
+		CLEAR_SHOPUSER(state) {
+			state.info = {};
+			store.remove('shopInfo');
 		},
 
 		CLEAR_USER(state) {
 			state.info = {};
 			store.remove('userInfo');
+		},
+
+		CLEAR_TOKEN(state) {
+			state.token = null;
+			store.remove('token');
 		}
 	}
 };

+ 203 - 0
admin-code/src/views/my-invite/index.vue

@@ -0,0 +1,203 @@
+<template>
+	<div class="app-list-content">
+		<cl-crud class="liu-crud-wrap" @load="onLoad">
+			<template #slot-tabs="{ scope }">
+				<el-tabs
+					class="liu-tabs"
+					type="border-card"
+					v-model="tabIndex"
+					@tab-click="handleClick"
+				>
+					<el-tab-pane
+						v-for="(item, index) in tabsData"
+						:key="index"
+						:label="`${item.text}(${item.val})`"
+						:name="item.key"
+					></el-tab-pane>
+				</el-tabs>
+			</template>
+
+			<template #table-column-name="{scope}">
+				<div class="flex-center">
+					<cl-avatar
+						shape="square"
+						:size="40"
+						:src="scope.row.userAvatar | default_avatar"
+					></cl-avatar>
+					<div class="app-margin-left-10">{{ scope.row.name }}</div>
+				</div>
+			</template>
+
+			<template #table-column-address="{scope}">
+				<span>{{
+					scope.row.province +
+						scope.row.city +
+						scope.row.dist +
+						scope.row.address +
+						scope.row.floor
+				}}</span>
+			</template>
+
+			<template #table-column-addTime="{scope}">
+				<span>{{ scope.row.addTime | formatTime }}</span>
+			</template>
+
+			<template #table-column-status="{scope}">
+				<span v-if="scope.row.status == 4">
+					<i class="iconfont icondagou"></i>
+				</span>
+				<span v-else>{{ scope.row.status | constantfilter('PROXY_STATUS') }}</span>
+			</template>
+		</cl-crud>
+	</div>
+</template>
+
+<script>
+export default {
+	name: 'list-ad',
+	components: {},
+	data() {
+		return {
+			app: null,
+			tabIndex: '-1',
+			tabsData: [
+				{
+					text: '全部花店',
+					key: '-1',
+					val: 0
+				},
+				{
+					text: '审核中',
+					key: '0',
+					val: 0
+				},
+				{
+					text: '试用中',
+					key: '1',
+					val: 0
+				},
+				{
+					text: '已付费',
+					key: '3',
+					val: 0
+				},
+				{
+					text: '已到期',
+					key: '4',
+					val: 0
+				}
+			]
+		};
+	},
+	methods: {
+		// api
+		handleClick(tab, e) {
+			this.app.refresh({ type: this.tabIndex });
+		},
+		// cl-crud 组件ad
+		onLoad({ ctx, app }) {
+			this.app = app;
+
+			let applyHost = () => {
+				return this.$service.single.applyList({ type: this.tabIndex });
+			};
+			ctx.service({
+				page: applyHost
+			})
+				.set('table', {
+					columns: [
+						{
+							prop: 'id',
+							label: 'ID',
+							align: 'center'
+						},
+						{
+							prop: 'name',
+							label: '花店名称',
+							align: 'center',
+							'min-width': 120
+						},
+						{
+							prop: 'userName',
+							label: '管理员',
+							align: 'center'
+						},
+						{
+							prop: 'mobile',
+							label: '手机号',
+							align: 'center'
+						},
+						{
+							prop: 'address',
+							label: '地址',
+							align: 'center',
+							'min-width': 240
+						},
+						{
+							prop: 'addTime',
+							label: '申请时间',
+							align: 'center'
+						},
+						{
+							prop: 'fee',
+							label: '付款金额',
+							align: 'center'
+						},
+						{
+							prop: 'income',
+							label: '收益',
+							align: 'center'
+						},
+						{
+							prop: 'status',
+							label: '状态',
+							align: 'center'
+						}
+					],
+					// 操作列
+					op: {
+						visible: false, // 是否显示
+						// 同 element-ui Table-column Attributes
+						props: {
+							width: 160,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						// 布局,请移步 `layout`
+						layout: []
+					}
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['flex1', 'refresh-btn', 'slot-add-ad-btn'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				// .on('refresh', async (params, { next }) => {
+				// 	// 继续执行刷新
+				// 	let { asset } = await next(params);
+				// 	this.tabsData[0].val = asset.totalUser;
+				// 	this.tabsData[1].val = asset.totalMember;
+				// 	this.tabsData[2].val = asset.totalFans;
+				// })
+				.done();
+			app.refresh({ type: this.tabIndex });
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+// module
+.ad-modal-content {
+	.member-wrap {
+		line-height: 1.4;
+		margin-bottom: 10px;
+		.member-det {
+			font-size: 12px;
+			margin-left: 10px;
+		}
+	}
+}
+</style>

+ 11 - 0
admin-code/src/views/setting/wx-menu.vue

@@ -0,0 +1,11 @@
+<template>
+	<div></div>
+</template>
+
+<script>
+export default {
+	name: 'wx-menu'
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 7 - 2
admin-code/src/views/staff/list.vue

@@ -30,6 +30,10 @@
 				></el-switch>
 			</template>
 
+			<!-- 权限设置 -->
+			<template #slot-auth="{scope}">
+				<el-button type="text" @click="authBtnFn(scope.row)">权限设置</el-button>
+			</template>
 			<!-- 编辑 -->
 			<template #slot-modify="{scope}">
 				<el-button type="text" @click="modifyBtnFn(scope.row)">编辑</el-button>
@@ -201,6 +205,7 @@ export default {
 				.catch();
 		},
 		// operate
+		authBtnFn(item) {},
 		modifyBtnFn(item) {
 			this.getRole();
 			this.addOrModify = 2;
@@ -331,13 +336,13 @@ export default {
 						visible: true, // 是否显示
 						// 同 element-ui Table-column Attributes
 						props: {
-							width: 100,
+							width: 160,
 							align: 'center',
 							fixed: 'right',
 							label: '操作'
 						},
 						// 布局,请移步 `layout`
-						layout: ['slot-modify', 'slot-del']
+						layout: ['slot-auth', 'slot-modify', 'slot-del']
 					}
 				})
 				.set('layout', [

+ 166 - 0
admin-code/src/views/staff/operate.vue

@@ -0,0 +1,166 @@
+<template>
+	<div class="app-list-content">
+		<cl-crud class="liu-crud-wrap" @load="onLoad">
+			<template #table-column-addTime="{scope}">
+				<span>{{ scope.row.addTime | formatTime }}</span>
+			</template>
+
+			<!-- search -->
+			<template #slot-sel-serch="{scope}">
+				<el-form :inline="true" :model="form" class="demo-form-inline">
+					<el-form-item label="员工">
+						<el-select
+							v-model="form.adminId"
+							size="mini"
+							placeholder="请选择"
+							style="width: 150px;"
+							:clearable="true"
+						>
+							<el-option
+								v-for="(item, index) in staffList"
+								:key="index"
+								:label="item.adminName"
+								:value="item.id"
+								>{{ item.adminName }}</el-option
+							>
+						</el-select>
+					</el-form-item>
+					<el-form-item label="日期">
+						<el-date-picker
+							type="date"
+							placeholder="选择开始日期"
+							v-model="form.startTime"
+							value-format="yyyy-MM-dd"
+							style="width: 150px;"
+							size="mini"
+						></el-date-picker>
+						<span class="picker-separate">-</span>
+						<el-date-picker
+							type="date"
+							placeholder="选择结束日期"
+							v-model="form.endTime"
+							value-format="yyyy-MM-dd"
+							style="width: 150px;"
+							size="mini"
+						></el-date-picker>
+					</el-form-item>
+					<el-form-item label="">
+						<el-button type="primary" size="mini" @click="serchFn">确认</el-button>
+					</el-form-item>
+				</el-form>
+			</template>
+		</cl-crud>
+	</div>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			// cl-crud
+			app: null,
+			// ======
+			staffList: [],
+			form: {
+				adminId: '',
+				startTime: '',
+				endTime: ''
+			}
+		};
+	},
+	mounted() {
+		this.getStaff();
+	},
+	methods: {
+		// api
+		getStaff() {
+			this.$service.staff.list().then(res => {
+				this.staffList = res.list;
+			});
+		},
+		// operate
+		serchFn() {
+			this.app.refresh(this.form);
+		},
+		// crud
+		onLoad({ ctx, app }) {
+			this.app = app;
+			let logHost = () => {
+				return this.$service.single.log(this.form);
+			};
+			ctx.service({
+				page: logHost
+			})
+				.set('table', {
+					columns: [
+						{
+							prop: 'id',
+							label: 'ID',
+							align: 'center'
+						},
+						{
+							prop: 'adminName',
+							label: '操作者',
+							align: 'center'
+						},
+						{
+							prop: 'addTime',
+							label: '操作日期',
+							align: 'center'
+						},
+						{
+							prop: 'ip',
+							label: 'IP地址',
+							align: 'center'
+						},
+						{
+							prop: 'content',
+							label: '操作记录',
+							align: 'center',
+							emptyText: '无'
+						}
+					],
+					// 操作列
+					op: {
+						visible: false, // 是否显示
+						// 同 element-ui Table-column Attributes
+						props: {
+							width: 150,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						// 布局,请移步 `layout`
+						layout: []
+					}
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['slot-sel-serch', 'flex1', 'refresh-btn'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				.done();
+			app.refresh(this.form);
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.demo-form-inline {
+	.el-form-item {
+		margin-bottom: 0;
+	}
+	/deep/.el-form-item__label {
+		line-height: 28px !important;
+	}
+	/deep/.el-form-item__content {
+		line-height: 28px;
+	}
+	.picker-separate {
+		display: inline-block;
+		margin: 0 10px;
+	}
+}
+</style>

+ 214 - 0
admin-code/src/views/staff/role-list.vue

@@ -0,0 +1,214 @@
+<template>
+	<div class="app-list-content">
+		<cl-crud class="liu-crud-wrap" @load="onLoad">
+			<template #table-column-addTime="{scope}">
+				<div>{{ scope.row.addTime | formatTime }}</div>
+			</template>
+
+			<!-- 权限设置 -->
+			<template #slot-auth="{scope}">
+				<el-button type="text" @click="authBtnFn(scope.row)">权限设置</el-button>
+			</template>
+			<!-- 编辑 -->
+			<template #slot-modify="{scope}">
+				<el-button type="text" @click="modifyBtnFn(scope.row)">编辑</el-button>
+			</template>
+			<!-- 删除 -->
+			<template #slot-del="{scope}">
+				<el-button type="text" @click="delBtnFn(scope.row)">删除</el-button>
+			</template>
+
+			<!-- 添加 -->
+			<template #slot-add-ad-btn="{scope}">
+				<el-button type="primary" size="mini" @click="addBtnFn">添加</el-button>
+			</template>
+		</cl-crud>
+		<!-- 新增弹窗 -->
+		<el-dialog
+			:title="`${addOrModify == 1 ? '添加' : '修改'}角色`"
+			:visible.sync="addDialog"
+			:close-on-click-modal="false"
+			width="600px"
+		>
+			<div class="ad-modal-content">
+				<el-form
+					:model="form"
+					:rules="ruleForm"
+					ref="form"
+					label-width="100px"
+					class="demo-form"
+				>
+					<el-form-item label="角色名称" prop="roleName">
+						<el-input
+							v-model="form.roleName"
+							placeholder="请输入名称"
+							size="small"
+						></el-input>
+					</el-form-item>
+				</el-form>
+			</div>
+			<div slot="footer" class="dialog-footer">
+				<el-button size="small" @click="resetForm">取 消</el-button>
+				<el-button type="primary" size="small" @click="submitForm('form')">确认</el-button>
+			</div>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+export default {
+	name: 'list-ad',
+	components: {},
+	data() {
+		return {
+			app: null,
+			// 修改弹窗
+			modifyData: {},
+			// 新增或者修改弹窗
+			addOrModify: 1,
+			addDialog: false,
+			form: {
+				roleName: ''
+			},
+			ruleForm: {
+				roleName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
+			}
+		};
+	},
+	methods: {
+		// api
+		delBtnFn(item) {
+			this.$confirm('是否删除该角色?', '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			})
+				.then(() => {
+					this.$service.role.delete({ id: item.id }).then(res => {
+						this.$message.success('删除成功!');
+						this.app.refresh({ type: this.tabIndex });
+					});
+				})
+				.catch();
+		},
+		// operate
+		authBtnFn(item) {},
+		modifyBtnFn(item) {
+			this.addOrModify = 2;
+			this.modifyData = item;
+			this.addDialog = true;
+			let data = JSON.parse(JSON.stringify(item));
+			data.addTime = this.$util.$formatDate(data.addTime);
+			this.form.roleName = item.roleName;
+		},
+		addBtnFn() {
+			this.addOrModify = 1;
+			this.addDialog = true;
+		},
+		resetForm() {
+			this.$refs['form'].resetFields();
+			this.addDialog = false;
+		},
+
+		addFn() {
+			let host = null;
+			if (this.addOrModify == 1) {
+				host = () => {
+					return this.$service.role.add(this.form);
+				};
+			} else {
+				host = () => {
+					return this.$service.role.update({
+						id: this.modifyData.id,
+						...this.form
+					});
+				};
+			}
+			host(this.form).then(res => {
+				this.$message.success('操作成功!');
+				this.resetForm();
+				this.app.refresh({ type: this.tabIndex });
+			});
+		},
+		submitForm(formName) {
+			this.$refs[formName].validate(valid => {
+				if (valid) {
+					this.addFn();
+				} else {
+					console.log('error submit!!');
+					return false;
+				}
+			});
+		},
+		// cl-crud 组件ad
+		onLoad({ ctx, app }) {
+			this.app = app;
+			ctx.service(this.$service.role)
+				.set('table', {
+					columns: [
+						{
+							prop: 'roleName',
+							label: '角色名称',
+							align: 'center'
+						},
+						{
+							prop: 'num',
+							label: '成员数量',
+							align: 'center'
+						},
+						{
+							prop: 'addTime',
+							label: '添加时间',
+							align: 'center'
+						}
+					],
+					// 操作列
+					op: {
+						visible: true, // 是否显示
+						// 同 element-ui Table-column Attributes
+						props: {
+							width: 160,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						// 布局,请移步 `layout`
+						layout: ['slot-auth', 'slot-modify', 'slot-del']
+					}
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['flex1', 'refresh-btn', 'slot-add-ad-btn'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				// .on('refresh', async (params, { next, render }) => {
+				// 	// 继续执行刷新
+				// 	let { list } = await next(params);
+				// 	list.map((e, index) => {
+				// 		e.index = index;
+				// 		e.imgUrl = e.smallImgList[0];
+				// 	});
+				// 	this.list = list;
+				// 	render(list);
+				// })
+				.done();
+			app.refresh({ type: this.tabIndex });
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+// module
+.ad-modal-content {
+	.member-wrap {
+		line-height: 1.4;
+		margin-bottom: 10px;
+		.member-det {
+			font-size: 12px;
+			margin-left: 10px;
+		}
+	}
+}
+</style>