Ver código fonte

员工管理

lilei 2 anos atrás
pai
commit
f48df6b774

+ 74 - 0
api/employee.js

@@ -0,0 +1,74 @@
+import request from './request';
+// 员工列表
+export const listEmployee = (param) => {
+  let params = param || {}
+  return request({
+    url: `employee/findAll`,
+    data: {
+      'userType': (params.userType == undefined ? 1 : params.userType),
+      'workFlag': (params.workFlag == undefined ? 1 : params.workFlag)
+    },
+    method: 'post'
+  })
+}
+
+// 删除员工
+export const delEmployee = param => {
+  return request({
+    url: `employee/del/${param.id}`,
+    method: 'get'
+  })
+}
+
+// 员工详细
+export const getEmployee = param => {
+  return request({
+    url: `employee/${param.id}`,
+    method: 'get'
+  })
+}
+
+// 修改完保存
+export const saveEmployee = params => {
+  return request({
+    url: 'employee/save',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 员工信息列表
+export const searchEmployee = params => {
+  let url = `employee/queryLike/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 获取员工信息
+export const getEmployeeInfo = param => {
+  return request({
+    url: `zycar-mgr/employee/findByUserId/${param.id}`,
+    method: 'get'
+  })
+}
+// 设置为负责人setManager
+export const setManager = params => {
+  return request({
+    url: 'employee/setManager',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 重置密码
+export const resetPSD = params => {
+  return request({
+    url: 'employee/restPWD',
+    data: params,
+    method: 'POST'
+  })
+}

+ 150 - 0
components/evan-form-item/evan-form-item.vue

@@ -0,0 +1,150 @@
+<template>
+	<view>
+		<slot name="formItem" v-if="$slots.formItem"></slot>
+		<view v-else class="evan-form-item-container" :class="'evan-form-item-container--'+mLabelPosition" :style="{borderWidth:border?'1rpx':0}">
+			<view v-if="label" class="evan-form-item-container__label" :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
+			 :style="mLabelStyle">{{label}}</view>
+			<view class="evan-form-item-container__main" :style="mContentStyle">
+				<slot></slot>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: 'EvanFormItem',
+		props: {
+			labelStyle: Object,
+			label: String,
+			contentStyle: {
+				type: Object,
+				default: () => {
+					return {}
+				}
+			},
+			prop: String,
+			border: {
+				type: Boolean,
+				default: true
+			},
+			labelPosition: {
+				validator: function(value) {
+					if (!value) {
+						return true
+					}
+					return ['top', 'left'].indexOf(value) !== -1
+				},
+				default: ''
+			}
+		},
+		computed: {
+			mLabelStyle() {
+				const parent = this.getParent()
+				let labelStyle = Object.assign({}, (parent.labelStyle || {}), (this.labelStyle || {}))
+				let arr = Object.keys(labelStyle).map((key) => `${key}:${labelStyle[key]}`)
+				return arr.join(';')
+			},
+			mContentStyle() {
+				let contentStyle = Object.assign({}, this.contentStyle || {})
+				let arr = Object.keys(contentStyle).map((key) => `${key}:${contentStyle[key]}`)
+				return arr.join(';')
+			},
+			mLabelPosition() {
+				if (this.labelPosition) {
+					return this.labelPosition
+				}
+				const parent = this.getParent()
+				if (parent) {
+					return parent.labelPosition
+				}
+				return 'left'
+			},
+			// 整个表单是否有*号
+			hasRequiredAsterisk() {
+				const parent = this.getParent()
+				if (parent) {
+					return parent.hasRequiredAsterisk
+				}
+				return false
+			},
+			// 当前formItem是否显示*号
+			showRequiredAsterisk() {
+				const parent = this.getParent()
+				if (parent && parent.hideRequiredAsterisk) {
+					return false
+				}
+				const rules = this.getRules()
+				if (rules && rules.length > 0) {
+					if (rules.find((rule) => rule.required === true)) {
+						return true
+					}
+				}
+				return false
+			}
+		},
+		methods: {
+			// 获取EvanForm组件
+			getParent() {
+				let parent = this.$parent
+				let parentName = parent.$options.name
+				while (parentName !== 'EvanForm') {
+					parent = parent.$parent
+					parentName = parent.$options.name
+				}
+				return parent
+			},
+			getRules() {
+				let form = this.getParent()
+				let formRules = form.mRules;
+				formRules = formRules ? formRules[this.prop] : [];
+				return [].concat(formRules || []);
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.evan-form-item-container {
+		border-bottom: 1rpx solid #eee;
+
+		&__label {
+			font-size: 28rpx;
+			color: #666;
+			line-height: 40rpx;
+			padding: 25rpx 0;
+			display: inline-block;
+
+			&.showAsteriskRect::before {
+				content: '';
+				color: #F56C6C;
+				width: 30rpx;
+				display: inline-block;
+			}
+
+			&.isRequired::before {
+				content: '*';
+			}
+		}
+
+		&__main {
+			flex: 1;
+			min-height: 90rpx;
+			display: flex;
+			align-items: center;
+			overflow: hidden;
+		}
+
+		&--left {
+			display: flex;
+			flex-direction: row;
+			align-items: flex-start;
+		}
+
+		&--top {
+			.evan-form-item-container__label {
+				padding-bottom: 10rpx;
+			}
+		}
+	}
+</style>

+ 101 - 0
components/evan-form/evan-form.vue

@@ -0,0 +1,101 @@
+<template>
+	<view class="evan-form-container">
+		<slot></slot>
+	</view>
+</template>
+
+<script>
+	import utils from './utils.js'
+	export default {
+		name: 'EvanForm',
+		props: {
+			labelStyle: {
+				type: Object,
+				default: () => {
+					return {}
+				}
+			},
+			model: Object,
+			hideRequiredAsterisk: {
+				type: Boolean,
+				default: false
+			},
+			showMessage: {
+				type: Boolean,
+				default: true
+			},
+			labelPosition: {
+				validator: function(value) {
+					return ['top', 'left'].indexOf(value) !== -1
+				},
+				default: 'left'
+			},
+			rules: {
+				type: Object,
+				default: () => {
+					return {}
+				}
+			}
+		},
+		computed: {
+			// 整个form是否有*号,为了保证label对齐,而不是和*号对齐
+			hasRequiredAsterisk() {
+				if (this.hideRequiredAsterisk) {
+					return false
+				}
+				if (this.mRules) {
+					const values = Object.values(this.mRules)
+					if (values && values.length > 0) {
+						for (let i = 0; i < values.length; i++) {
+							const value = values[i]
+							if (Array.isArray(value) && value.length > 0) {
+								const requiredItem = value.find((v) => v.required === true)
+								if (requiredItem) {
+									return true
+								}
+							} else {
+								if (value && value.required) {
+									return true
+								}
+							}
+						}
+					}
+				}
+				return false
+			}
+		},
+		watch: {
+			rules: {
+				immediate: true,
+				deep: true,
+				handler(value) {
+					this.mRules = value || {}
+				}
+			}
+		},
+		data() {
+			return {
+				mRules: {}
+			}
+		},
+		methods: {
+			setRules(rules) {
+				this.mRules = rules || {}
+			},
+			validate(callback) {
+				utils.validate(this.model, this.mRules, callback, {
+					showMessage: this.showMessage
+				})
+			},
+			validateField(props, callback) {
+				utils.validateField(this.model, this.mRules, props, callback, {
+					showMessage: this.showMessage
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.evan-form-container {}
+</style>

+ 122 - 0
components/evan-form/utils.js

@@ -0,0 +1,122 @@
+import AsyncValidator from 'async-validator'
+const utils = {
+	validate: (model, rules, callback, options) => {
+		const initOptions = {
+			showMessage: true
+		}
+		options = Object.assign({}, initOptions, options || {})
+		// 如果需要验证的fields为空,调用验证时立刻返回callback
+		if ((!rules || rules.length === 0) && callback) {
+			callback(true, null);
+			return true
+		}
+		let errors = []
+		const props = Object.keys(rules)
+		let count = 0
+		for (let i in props) {
+			const prop = props[i]
+			const value = utils.getValueByProp(model, prop)
+			utils.validateItem(rules, prop, value, (err) => {
+				if (err && err.length > 0) {
+					errors = errors.concat(err)
+				}
+				// 处理异步校验,等所有校验都结束时再callback
+				count++
+				if (count === props.length) {
+					if (errors.length > 0) {
+						if (options.showMessage) {
+							utils.showToast(errors[0].message)
+						}
+						callback(false, errors)
+					} else {
+						callback(true, null)
+					}
+				}
+			})
+		}
+	},
+	validateField: (model, rules, props, callback, options) => {
+		const initOptions = {
+			showMessage: true
+		}
+		options = Object.assign({}, initOptions, options || {})
+		props = [].concat(props)
+		if (props.length === 0) {
+			return
+		}
+		let errors = []
+		let count = 0
+		for (let i in props) {
+			const prop = props[i]
+			const value = utils.getValueByProp(model, prop)
+			utils.validateItem(rules, prop, value, (err) => {
+				if (err && err.length > 0) {
+					errors = errors.concat(err)
+				}
+				// 处理异步校验,等所有校验都结束时再callback
+				count++
+				if (count === props.length) {
+					if (errors.length > 0) {
+						if (options.showMessage) {
+							utils.showToast(errors[0].message)
+						}
+						callback(false, errors)
+					} else {
+						callback(true, null)
+					}
+				}
+			})
+		}
+	},
+	validateItem(rules, prop, value, callback) {
+		if (!rules || JSON.stringify(rules) === '{}') {
+			if (callback instanceof Function) {
+				callback();
+			}
+			return true;
+		}
+		const propRules = [].concat(rules[prop] || []);
+		propRules.forEach((rule) => {
+			if (rule.pattern) {
+				rule.pattern = new RegExp(rule.pattern)
+			}
+		})
+		const descriptor = {
+			[prop]: propRules
+		};
+		const validator = new AsyncValidator(descriptor);
+		const model = {
+			[prop]: value
+		};
+		validator.validate(model, {
+			firstFields: true
+		}, (errors) => {
+			callback(errors);
+		});
+	},
+	getValueByProp: (obj, prop) => {
+		let tempObj = obj;
+		prop = prop.replace(/\[(\w+)\]/g, '.$1').replace(/^\./, '');
+		let keyArr = prop.split('.');
+		let i = 0;
+		for (let len = keyArr.length; i < len - 1; ++i) {
+			if (!tempObj) break;
+			let key = keyArr[i];
+			if (key in tempObj) {
+				tempObj = tempObj[key];
+			} else {
+				break;
+			}
+		}
+		return tempObj ? (typeof tempObj[keyArr[i]] === 'string' ? tempObj[keyArr[i]].trim() : tempObj[keyArr[i]]) :
+			null
+	},
+	showToast: (message) => {
+		uni.showToast({
+			title: message,
+			icon: 'none'
+		})
+	}
+}
+
+export default utils

+ 5 - 0
package-lock.json

@@ -4,6 +4,11 @@
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "async-validator": {
+      "version": "3.5.2",
+      "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-3.5.2.tgz",
+      "integrity": "sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ=="
+    },
     "moment": {
       "version": "2.29.3",
       "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",

+ 1 - 0
package.json

@@ -4,6 +4,7 @@
   "description": "",
   "main": "main.js",
   "dependencies": {
+    "async-validator": "^3.5.2",
     "moment": "^2.29.1",
     "uview-ui": "^1.8.4"
   },

+ 17 - 7
pages.json

@@ -11,13 +11,6 @@
 				"enablePullDownRefresh": true
 			}
 		},
-		{
-			"path": "pages/personCenter/personCenter",
-			"style": {
-				"navigationBarTitleText": "我的",
-				"navigationBarBackgroundColor": "#86defa"
-			}
-		},
 		{
 			"path": "pages/login/login",
 			"style": {
@@ -97,6 +90,14 @@
             
         }
         ,{
+            "path" : "pages/storeManage/personnel",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "员工管理",
+                "enablePullDownRefresh": false
+            }
+            
+        },{
             "path" : "pages/stockQuery/stockQuery",
             "style" :                                                                                    
             {
@@ -241,6 +242,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/storeManage/addPerson",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "新增员工",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 1 - 1
pages/about.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="aboutUs-content">
 		<view class="aboutUs-content-info">
-			<u-image src="/static/log.png"  width="144" height="144" class="logo"></u-image>
+			<u-image src="/static/log-s.png"  width="144" height="144" class="logo"></u-image>
 			<view class="content-title">关于修配易码通</view>
 			<view class="content-version">Version 1.0.0</view>
 		</view>

+ 10 - 0
pages/morePage/morePage.vue

@@ -39,6 +39,16 @@
 				</u-cell-item>
 			</u-cell-group>
 		</view>
+		<view class="list-box">
+			<view class="list-title">
+				<u-icon size="32" name="home"></u-icon> <text>门店管理</text>
+			</view>
+			<u-cell-group :border="false">
+				<u-cell-item title="员工管理" @click="toPage('/pages/storeManage/personnel')" :title-style="{fontSize:'1em'}">
+					<text slot="icon"></text>
+				</u-cell-item>
+			</u-cell-group>
+		</view>
 		<view class="list-box" v-if="hasLogin&&dealerPhone">
 			<view class="list-title flex justify_center phone" @click="call">
 				<u-icon size="36" name="phone"></u-icon> <text>联系汽配商</text>

+ 0 - 226
pages/personCenter/personCenter.vue

@@ -1,226 +0,0 @@
-<template>
-    <view class="content">
-        <view class="header">
-        	<view @click="toLoginPage" class="user-head">
-				<view>
-					<u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="120" height="120"></u-image>
-					<open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
-				</view>
-				<view class="user-info">
-					<open-data class="user-info-item" v-if="hasLogin" type="userNickName"></open-data>
-					<view class="user-info-item" v-if="hasLogin">{{userInfo.mobile}}</view>
-					<view v-if="!hasLogin"  class="user-info-item">
-						请点击登录/注册
-					</view>
-				</view>
-				<view>
-					<u-icon class="back-img" name="icon_more_little" color="#424D5E" size="32" custom-prefix="custom-icon"></u-icon>
-				</view>
-        	</view>
-        </view>
-		<view class="list-container">
-			<view class="list-item flex align_center justify_between" @click="callPhone">
-				<view class="flex align_center">
-					<u-icon class="icon" name="personal_icon_serve" custom-prefix="custom-icon" size="48" color="#515151"></u-icon>
-					<text class="container-item">联系客服</text>
-				</view>
-				<u-icon name="icon_more_little" color="#9DA8B5" size="32" custom-prefix="custom-icon"></u-icon>
-			</view>
-			<navigator url="/pages/xieyi/index" class="list-item margin-bot flex align_center justify_between">
-				<view class="flex align_center">
-					<u-icon class="icon" name="personal_icon_agreement" custom-prefix="custom-icon" size="48" color="#515151"></u-icon>
-					<text class="container-item">用户协议</text>
-				</view>
-				<u-icon name="icon_more_little" color="#9DA8B5" size="32" custom-prefix="custom-icon"></u-icon>
-			</navigator>
-			<navigator url="/pages/about" class="list-item margin-bot flex align_center justify_between">
-				<view class="flex align_center">
-					<u-icon class="icon" name="personal_icon_about" custom-prefix="custom-icon" size="48" color="#515151"></u-icon>
-					<text class="container-item">关于我们</text>
-				</view>
-				<u-icon name="icon_more_little" color="#9DA8B5" size="32" custom-prefix="custom-icon"></u-icon>
-			</navigator>
-		</view>
-    </view>
-</template>
-
-<script>
-    import service from '../../service.js';
-	import mIcon from '../../components/m-icon/m-icon.vue'
-    import {
-        mapState,
-        mapMutations
-    } from 'vuex'
-     
-    export default {
-        components: {
-			mIcon
-        },
-        data() {
-            return {
-				userInfo:'',
-            }
-        },
-		onLoad() {
-			let UserInfo = uni.getStorageSync('userInfo');
-			this.userInfo = UserInfo;
-			// 开启分享
-			uni.showShareMenu({
-				withShareTicket: true,
-				menus: ['shareAppMessage', 'shareTimeline']
-			})
-		},
-		onShow() {
-			//检测是否登录
-			if(this.hasLogin) {
-			} 
-		},
-		computed: {
-			...mapState(['hasLogin'])
-		},
-        methods: {
-			// 联系客服
-			callPhone(){
-			  uni.makePhoneCall({
-				phoneNumber: '400-1616-312'
-			  });
-			},
-			toLoginPage(){
-			  let url = this.hasLogin ? '/pages/personData/personData' : '/pages/login/login'
-				uni.navigateTo({
-					url: url
-				})
-			}
-        },
-		
-    }
-</script>
-
-<style lang="scss">
-	.content{
-		padding: 0;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		background: rgb(245,245,245);
-	}
-	// 顶部
-	.header{
-		height: auto;
-		width: 100%;
-		background-image: linear-gradient(#86defa,#ffffff);
-		padding: 0rpx 32rpx;
-		.user-head{
-			display: flex;
-			align-items: center;
-			width: 100%;
-			height: 200rpx;
-			.user-info{
-				flex-grow: 1;
-				padding: 0 20rpx;
-				color: #FFFFFF;
-				.user-info-item{
-					margin: 10rpx 0;
-					color: #666666;
-					font-size: 32upx;
-				}
-				:first-child{
-					color: #000000;
-					font-size: 48upx;
-				}
-			}
-			.user-photo{
-				display: block;
-				width: 120rpx;
-				height: 120rpx;
-				border-radius: 50%;
-				overflow: hidden;
-			}
-		}
-		.check{
-			height: 126rpx;
-			background-color: #29467D;
-			border-radius: 20rpx 20rpx 0rpx 0rpx;
-			color: #FFE196;
-			padding: 0rpx 24rpx;
-			font-size: 32rpx;
-			.padding-9{
-				padding: 0 18rpx;
-			}
-			.check-item{
-				font-size: 24rpx;
-				color: #CCB57C;
-				margin-top: 6rpx;
-			}
-			.color{
-				color: #CCB57C;
-			}
-		}
-	}
-	.tabs-cont{
-		width: 100%;
-		background-color: #fff;
-		padding: 28rpx 0rpx;
-		justify-content: space-around;
-		margin-bottom: 20rpx;
-		text{
-			font-size: 26rpx;
-			color: #222222;
-			margin-top: 10rpx;
-		}
-		.cart-img{
-			position: relative;
-		}
-	}
-	.list-container{
-		width: 100%;
-		.list-item{
-			padding: 32rpx 36rpx;
-			background-color: #fff;
-			.container-item{
-				font-size: 34rpx;
-				color: #191919;
-				margin-left: 30rpx;
-			}
-		}
-		.margin-bot{
-			margin-bottom: 20rpx;
-		}
-		// .user-list{
-		// 	border-radius: 15upx;
-		// 	margin: 20upx;
-		// 	overflow: hidden;
-		// 	box-shadow: 0upx 3upx 6upx #eee;
-		// 	.quit{
-		// 		margin-top: 20upx;
-		// 	}
-		// }
-		// .border-bottom{
-		// 	border-bottom: 1px solid rgb(228,228,228);
-		// }
-		// .list-item{
-		// 	width: 100%;
-		// 	height:110rpx ;
-		// 	padding:0 30rpx;
-		// 	box-sizing:border-box;
-		// 	display: flex;
-		// 	justify-content: space-between;
-		// 	align-items:center;
-		// 	.list-item-left{
-		// 		display:flex;
-		// 		font-size: 36rpx;					
-		// 		color: rgb(40,40,40);				
-		// 		.icon-box{
-		// 			width:40rpx;
-		// 			margin-right: 20rpx;
-					
-		// 		}
-				
-		// 	}
-		// 	.back-img{
-		// 		width: 16rpx;
-		// 		height: 22rpx;
-		// 	}
-		// }
-	}
-</style>

+ 149 - 0
pages/storeManage/addPerson.vue

@@ -0,0 +1,149 @@
+<template>
+	<view class="evan-form-show flex flex_column">
+			<view class="flex_1">
+				<evanForm ref="formData" :rules="ruleValidate" :model="formData">
+					<evanFormItem label="员工姓名" prop="name">
+						<input class="form-input" placeholder-class="form-input-placeholder" :maxlength="30" placeholder="请输入姓名(最多30个字符)" v-model="formData.name" />
+					</evanFormItem>
+					<evanFormItem label="手机号码" prop="mobile">
+						<input type="number" :disabled="formData.isManager==1 && formData.id?true:false" class="form-input" placeholder="请输入您的手机号码" placeholder-class="form-input-placeholder" v-model="formData.mobile" :maxlength="11"/>
+					</evanFormItem>
+					<evanFormItem label="性别" prop="sex">
+						<view style="width: 100%;display:flex;justify-content: flex-end;">
+							<u-radio-group v-model="formData.sex">
+								<u-radio 
+									v-for="(item, index) in sexList" :key="index" 
+									:name="item.value"
+									shape="circle"
+								>
+								{{item.name}}
+								</u-radio>
+							</u-radio-group>
+						</view>
+					</evanFormItem>
+				</evanForm>
+			</view>
+			<view class="form-footer-btn flex align_center justify_between">
+				<u-button shape="circle"  @click="cancel()" :custom-style="{width:'300rpx' }">取消</u-button>
+				<u-button shape="circle" type="info" :custom-style="{ background: '#066cff', color: '#fff',width:'300rpx' }" @click="save('formData')">保存</u-button>
+			</view>
+	</view>
+</template>
+
+<script>
+	import {saveEmployee } from '@/api/employee'
+	import evanForm from '@/components/evan-form/evan-form.vue'
+	import evanFormItem from '@/components/evan-form-item/evan-form-item.vue'
+	export default{
+		components:{
+			evanForm,
+			evanFormItem
+		},
+		data(){
+			return{
+				roleList: [],  //  角色  数据列表
+				roleArr: [],  //  当前所选角色
+				formData:{
+					name: '',
+					sex: '1',
+					mobile: ''
+				},
+				ruleValidate: {
+					name: [{ required: true, message: '请输入员工姓名'}],
+					mobile: [{required: true, pattern:/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/, min:11, message: '请输入正确手机号码'}],
+					sex: [{ required: true, message: '请选择性别' }],
+				},
+				sexList: [
+					{
+						value: 1,
+						name: '男',
+						disabled: false,
+					},
+					{
+						value: 0,
+						name: '女',
+						disabled: false
+					}
+				],
+				isManager: '',
+				isEdit: false
+			}
+		},
+		onLoad() {
+			this.init()
+		},
+		methods:{
+			//  初始化数据
+			init(){
+				let data = this.$store.state.vuex_nowStaffData
+				// 编辑信息
+				if(data){
+					this.isEdit = true
+					this.formData = Object.assign({},this.formData,data)
+					console.log(this.formData)
+				}else{
+					this.isEdit = false
+				}
+				uni.setNavigationBarTitle({
+					title:data ? "编辑员工" : '新增员工'
+				})
+			},
+			//  保存
+			save(name){
+				let data=this.formData
+				console.log(data)
+				this.$refs[name].validate((valid) => {
+				  if (valid) {
+					saveEmployee(data).then(res=>{
+						console.log(res)
+						if(res.status == 200){
+							uni.showToast({icon: 'none', title:'保存成功'})
+							this.cancel()
+						}else{
+							uni.showToast({icon: 'none', title: res.message})
+						}
+					}).catch(err=>{
+						console.log('保存失败')
+					})
+				}
+				})
+			},
+			cancel(){
+			 setTimeout(function(){
+				 uni.navigateBack()
+			 },100)
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.evan-form-show {
+			padding: 0;
+			background-color: #fff;
+			height: 100vh;
+			> view{
+				padding:0.8rem;
+			}
+			.form-footer-btn{
+				padding:0.8rem;
+			}
+			.form-input {
+				font-size: 28rpx;
+				color: #333;
+				text-align: right;
+				width: 95%;
+				box-sizing: border-box;
+				height: 60rpx;
+				&.textarea{
+					height: 240rpx;
+					padding: 24rpx 0;
+					text-align: left;
+				}
+			}
+			.form-input-placeholder {
+				font-size: 28rpx;
+				color: #999;
+			}
+		}
+</style>

+ 157 - 0
pages/storeManage/personnel.vue

@@ -0,0 +1,157 @@
+<template>
+	<view class="page-body flex flex_column">
+		<swiper class="scroll-list" :current="swiperCurrent">
+			<swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
+				<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
+					<view style="height: 20rpx;" ></view>
+					<view  
+					class="check-order-list" 
+					v-for="(item,index) in list" 
+					:key="item.id" 
+					>
+						<view class="flex align_center justify_between">
+							<view class="flex_1">
+								<view class="u-name">
+									<text style="margin-right: 0.5rem;">{{item.name}}</text>
+									<u-icon :name="item.sex | sexFilter" size="28" :color="item.sex==1?'#00aaff':'#ffaaaa'" custom-prefix="custom-icon"></u-icon>
+								</view>
+								<view class="u-mobile">{{item.mobile}}</view>
+							</view>
+							<view @click="editPerson(item)">
+								<u-icon size="34" name="edit-pen"></u-icon>
+							</view>
+						</view>
+					 </view>
+					 <view style="padding:0 30upx 30upx;">
+						 <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+						 <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
+					 </view>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+		<view class="footer">
+			<u-button @click="editPerson()" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
+				新增员工
+			</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {searchEmployee, delEmployee } from '@/api/employee'
+	import moment from 'moment'
+	export default{
+		name:'personnel',
+		data(){
+			return{
+				status: 'loading',
+				noDataText: '暂无数据',
+				current: 0,
+				swiperCurrent: 0,
+				// 查询条件
+				pageNo: 1,
+				pageSize: 10,
+				list: [],
+				total: 0,
+			}
+		},
+		onLoad() {
+			this.getRow()
+		},
+		// 判断员工身份权限
+		filters:{
+			sexFilter(sexFilterVal){
+				if(sexFilterVal == 1){
+					return 'staff_icon_boy'
+				}
+				if(sexFilterVal == 0){
+					return 'staff_icon_girl'
+				}
+			},
+			isManagerFilter(isManagerFilterVal){
+				if(isManagerFilterVal == 1){
+					return '负责人'
+				}
+			}
+		},
+		methods:{
+			// 查询列表
+			getRow (pageNo) {
+			  let _this = this
+			  if (pageNo) {
+			    this.pageNo = pageNo
+			  }
+			  
+			  let params = {
+			    pageNo:this.pageNo,
+			    pageSize:this.pageSize
+			  }
+			  this.status = "loading"
+			  searchEmployee(params).then(res => {
+				if (res.code == 200 || res.status == 204 || res.status == 200) {
+				  if(_this.pageNo>1){
+					  _this.list = _this.list.concat(res.data.list || [])
+				  }else{
+					  _this.list = res.data.list || []
+				  }
+				  _this.total = res.data.count || 0
+				} else {
+				  _this.list = []
+				  _this.total = 0
+				  _this.noDataText = res.message
+				}
+				 
+				_this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
+			  })
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				console.log(this.list.length, this.total)
+				if(this.list.length < this.total){
+					this.pageNo += 1
+					this.getRow()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			// 编辑员工
+			editPerson(row){
+				this.$store.state.vuex_nowStaffData = row;
+				uni.navigateTo({
+					url: "/pages/storeManage/addPerson"
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.page-body{
+		height: 100vh;
+		padding:0;
+		.scroll-list{
+			flex-grow: 1;
+			.check-order-list{
+				background: #ffffff;
+				padding: 10upx 20upx;
+				margin: 0 25rpx 25rpx 25rpx;
+				border-radius: 20upx;
+				box-shadow: 1px 1px 3px #EEEEEE;
+				> view{
+					padding: 0.8rem 0.5rem;
+					.u-name{
+						font-size: 32rpx;
+						margin-bottom: 0.5rem;
+					}
+					.u-mobile{
+						color: #999;
+					}
+				}
+			}
+		}
+		.footer{
+			padding: 0.6rem;
+			background: #ffffff;
+		}
+	}
+</style>

+ 2 - 1
store/index.js

@@ -48,7 +48,8 @@ const store = new Vuex.Store({
 		vuex_allLookUp: [],  //  数据字典
 		vuex_paymentTypeList: [], // 支付方式
 		vuex_userInfo: null,
-		vuex_openid: ""
+		vuex_openid: "",
+		vuex_nowStaffData: null, // 员工临时数据
     },
 	getters:{
 		getOpeid(state){