shish 4 лет назад
Родитель
Сommit
5b7616bbad

+ 258 - 0
ghsApp/src/admin/expend/addExpend.vue

@@ -0,0 +1,258 @@
+<template>
+  <div class="app-content">
+    <div v-show="showStaffArea">
+      <form @submit="formSubmit">
+        <div class="module-com input-line-wrap">
+
+          <tui-list-cell class="line-cell" :hover="false">
+              <div class="tui-title required">昵称</div>
+              <input v-model="form.name" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="name" placeholder="员工昵称" />
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :arrow="true">
+            <div class="tui-title required">角色</div>
+            <picker mode="selector" :value="form.roleId" :range="roleList" range-key="roleName" @change="changeRoleFn" class="tui-input" >
+              <input v-model="form.roleId" name="roleId" type="text" hidden />
+              <div v-if="form.roleId">{{ roleSelData.roleName }}</div>
+              <div class="tui-placeholder" v-else>请选择</div>
+            </picker>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false">
+            <div class="tui-title">超管权限</div>
+            <view><switch style="transform:scale(0.7,0.7)" :checked="form.super == 0 ? false : true" @change="superChangeFn" /></view>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false">
+            <div class="tui-title">动态通知</div>
+            <view><switch style="transform:scale(0.7,0.7)" :checked="form.remind == 0 ? false : true" @change="remindChangeFn" /></view>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false">
+              <div class="tui-title required">手机号</div>
+              <input v-model="form.mobile" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="mobile" placeholder="员工手机号" />
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false">
+              <div class="tui-title required">验证码</div>
+              <input v-model="form.authCode" type="number" style="width:330upx;" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="authCode" placeholder="员工收到的验证码" />
+              <button v-if="hasGet == false" class="admin-button-com blue middle" @click="requestAuthCode()">获取</button>
+              <button v-else class="admin-button-com default middle" >{{count}}</button>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell remark-wrap" :hover="false">
+            <div class="tui-title">备注信息</div>
+            <div class="tui-input">
+              <textarea v-model="form.remark" style="height:80upx;" class="tui-textarea remark" placeholder-class="phcolor" placeholder="选填" />
+            </div>
+          </tui-list-cell>
+
+        </div>
+        <div class="confirm-btn">
+          <button class="admin-button-com big blue" formType="submit">添加</button>
+        </div>
+      </form>
+    </div>
+    <div v-show="showMiniCodeArea">
+      <view style="text-align:center;">
+          <image style="width:400upx;height:400upx;margin:0 auto;" :src="miniCodeSrc"></image>
+          <view style="text-align:center;margin-top:20upx;margin-bottom:20upx;font-size:30upx;">请让员工扫描上方太阳码完成添加</view>
+          <button class="admin-button-com big blue" @click="complete" style="padding-left:40upx;padding-right:40upx;">完成</button>
+      </view>
+    </div>
+  </div>
+</template>
+<script>
+import TuiListCell from "@/components/plugin/list-cell";
+import AppAvatarModule from "@/components/module/app-avatar";
+const form = require("@/utils/formValidation.js");
+import { getRoleList, getStaffDet as getDet } from "@/api/staff";
+import { getDet as getMemberDet } from "@/api/member";
+import { getStaffAuthCode,createStaff } from "@/api/staff";
+export default {
+  name: "staff-add",
+  components: {
+    TuiListCell,
+    AppAvatarModule
+  },
+  data() {
+    return {
+      form: {
+        roleId: "",
+        remind: 1,
+        password: "",
+        status: 1,
+        remark: "",
+        name:'',
+        mobile:'',
+        super:0
+      },
+      roleList: [],
+      roleSelData: {},
+      showStaffArea: true,
+      showMiniCodeArea: false,
+      miniCodeSrc:'',
+      memberData: {},
+      hasGet:false,
+      INT:null,
+      count:0
+    };
+  },
+  onLoad() {},
+  onShow() {
+  },
+  methods: {
+    superChangeFn(e){
+      this.form.super = e.detail.value ? 1 : 0;
+    },
+    requestAuthCode(){
+      let that = this
+      let mobile = this.form.mobile
+      if(this.$util.checkMobile(mobile) == false){
+        this.$msg('请输入正确手机号')
+        return
+      }
+      getStaffAuthCode({mobile}).then(res=>{
+        if(res.code == 1){
+          that.hasGet = true
+          that.count = 120
+          that.INT = setInterval(function(){
+            if(that.count <= 0){
+              clearInterval(that.INT)
+              that.hasGet = false
+              that.count = 120
+              return
+            }
+            that.count--
+          },1000)
+        }
+      })
+    },
+    init() {
+      let data = uni.getStorageSync("addStaffData");
+      if (data) {
+        uni.removeStorageSync("addStaffData");
+        this.form = data.form;
+        this.roleList = data.roleList;
+        this.roleSelData = data.roleSelData;
+      }
+      let memberData = uni.getStorageSync("addSelMember");
+      if (memberData) {
+        uni.removeStorageSync("addSelMember");
+        this.memberData = memberData;
+        this.form.userId = memberData.id;
+      }
+      if (data){
+        return false;
+      } 
+      this._getRoleList().then(res => {
+        if (this.option.id) {
+          this._getDet();
+        }
+      });
+    },
+    async _getRoleList() {
+      await getRoleList().then(res => {
+        if (this.$util.isEmpty(res.data)) return false;
+        this.roleList = res.data.list;
+      });
+    },
+    _getDet() {
+      getDet({ id: this.option.id }).then(res => {
+        if (this.$util.isEmpty(res.data)) return;
+        Object.keys(this.form).forEach((i, index) => {
+          this.form[i] = res.data[i];
+        });
+        this.roleSelData = this.roleList.filter(
+          e => this.form.roleId == e.id
+        )[0];
+
+        if (this.form.userId && this.form.userId != "0") {
+          this._getMemberDet();
+        }
+      });
+    },
+    _getMemberDet() {
+      getMemberDet({ userId: this.form.userId }).then(res => {
+        if (this.$util.isEmpty(res.data)) return;
+        this.memberData = res.data;
+      });
+    },
+    selMemberFn() {
+      let data = {
+        form: this.form,
+        roleList: this.roleList,
+        roleSelData: this.roleSelData
+      };
+      uni.setStorageSync("addStaffData", data);
+      this.$util.pageTo(1);
+    },
+    changeRoleFn(e) {
+      this.roleSelData = this.roleList[e.detail.value];
+      this.form.roleId = this.roleSelData.id;
+    },
+    remindChangeFn(e) {
+      this.form.remind = e.detail.value ? 1 : 0;
+    },
+    statusChangeFn(e) {
+      this.form.status = e.detail.value ? 1 : 0;
+    },
+    complete(){
+      this.$util.pageTo(1)
+    },
+    formSubmit(e) {
+      let that = this
+      let rules = [{ name: "roleId", rule: ["required"], msg: ["请选择角色"] }]
+      let formData = e.detail.value;
+      let checkRes = form.validation(formData, rules);
+      if (!checkRes) {
+        uni.showLoading({mask:true});
+        createStaff(that.form).then(res => {
+          uni.hideLoading()
+          if(res.code == 1){
+            that.$msg('添加成功')
+            setTimeout(() => {
+              uni.navigateBack()
+            }, 1000)
+          }
+        })
+      } else {
+        this.$msg(checkRes);
+      }
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.app-content {
+  min-height: calc(100vh - 20upx);
+  padding-top: 20upx;
+}
+.prompt-text {
+  color: $fontColor3;
+  padding-left: 30upx;
+  margin-bottom: 30upx;
+}
+.module-com {
+  margin-bottom: 20upx;
+  .member-wrap {
+    .member-det {
+      font-size: 24upx;
+      margin-left: 20upx;
+    }
+  }
+  .remark-wrap {
+    align-items: flex-start;
+    .remark {
+      height: 240upx;
+    }
+  }
+}
+.confirm-btn {
+  width: calc(100% - 60upx);
+  margin: 60upx 30upx 20upx;
+  .admin-button-com {
+    width: 100%;
+  }
+}
+</style>

+ 211 - 0
ghsApp/src/admin/expend/addSalary.vue

@@ -0,0 +1,211 @@
+<template>
+	<view class="app-main app-content">
+		<view class="list-wrap staff-list">
+			<block v-if="!$util.isEmpty(list.data)">
+				<view class="list" v-for="(item, index) in list.data" :key="index">
+					<view>
+						<image :src="item.avatar" mode="aspectFit" style="width:100upx;height:100upx;border-radius: 50%"></image>
+					</view>
+					<view class="list-det">
+						<view class="list-det-left">
+							<view>
+								<span class="staff-name">{{ item.name }}</span>
+								<span>{{ item.mobile }}</span>
+							</view>
+						</view>
+						<view class="list-det-right">
+							<input type="digit" v-model="item.amount" style="border:1upx solid #cccccc;height:60upx;" placeholder="请填写工资"/>
+						</view>
+					</view>
+				</view>
+				<view style="text-align:center;"> <button class="admin-button-com blue big" style="width:500upx;" @click="sendAmount">提交</button> </view>
+			</block>
+			<block v-else>
+				<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+			</block>
+		</view>
+	</view>
+</template>
+<script>
+import AppAvatarModule from '@/components/module/app-avatar'
+import TimeAxis from '@/admin/home/components/plugin/time-axis'
+import TimeaxisItem from '@/admin/home/components/plugin/timeaxis-item'
+import AppWrapperEmpty from '@/components/app-wrapper-empty'
+import ModalModule from '@/components/plugin/modal'
+import AppSearchModule from "@/components/module/app-search";
+import { list } from '@/mixins'
+import { mapGetters } from "vuex"
+import { getStaffList} from '@/api/staff'
+import { addSalary} from '@/api/expend'
+export default {
+	name: 'addSalary',
+	components: {
+		AppAvatarModule,
+		TimeAxis,
+		TimeaxisItem,
+		AppWrapperEmpty,
+		ModalModule,
+		AppSearchModule
+	},
+	mixins: [list],
+	data() {
+		return {
+
+		}
+	},
+	onPullDownRefresh() {
+		this.resetList()
+		this.getStaffData().then(res => {
+			uni.stopPullDownRefresh()
+		})
+	},
+	computed: {
+		...mapGetters({ loginInfo: "getLoginInfo" }),
+	},
+	onReachBottom() {
+		if (!this.list.finished) {
+			this.getStaffData().then(res => {
+				uni.stopPullDownRefresh()
+			})
+		} else {
+			uni.stopPullDownRefresh()
+		}
+	},
+	onLoad: function() {
+	},
+	methods: {
+		async init() {
+			this.getStaffData()
+		},
+		sendAmount(){
+			if(this.$util.isEmpty(this.list.data)){
+				this.$msg('请填写工资哦')
+				return false
+			}
+			let params = []
+			this.list.data.forEach((item,idx,arr) => {
+				if(Number(item.amount)>0){
+					params.push({staffId:item.id,amount:item.amount})
+				}
+			})
+			if(this.$util.isEmpty(params)){
+				this.$msg('请填写工资')
+				return false
+			}
+			this.$util.confirmModal({content:'确认提交?'},() => {
+				addSalary({data:JSON.stringify(params)}).then(res=>{
+					if(res.code == 1){
+						this.$msg("提交成功");
+						setTimeout(function(){
+							uni.navigateBack({ delta: 1 })
+						},1500)
+					}
+				})
+			})
+		},
+		getStaffData() {
+			return getStaffList({pageSize:100}).then(res => {
+				if(!this.$util.isEmpty(res.data.list)){
+					const newList = res.data.list.map(ele => { 
+						return {...ele,amount:''}
+					})
+					res.data.list = newList
+				}
+				this.completes(res)
+			})
+		}
+	}
+}
+</script>
+<style lang="scss" scoped>
+.app-content {
+	padding-bottom: 20upx;
+}
+.app-tabs {
+	position: fixed;
+	@media screen and (max-width: 1100px) {
+		width: 100%;
+	}
+	z-index: 9;
+}
+.input-wrap_box {
+	background-color: #fff;
+	position: fixed;
+	top: 0;
+	z-index: 10;
+	@media screen and (max-width: 1100px) {
+		width: 100%;
+	}
+	height: 100upx;
+	display: flex;
+	align-items: center;
+	padding: 0 30upx;
+	& > view:nth-child(1) {
+	flex: 1;
+	}
+}
+.list-wrap {
+	background-color: #fff;
+	.list {
+		@include disFlex(center, flex-start);
+		margin: 0 30upx;
+		padding: 30upx 0;
+		border-bottom: 2upx solid $borderColor;
+	}
+}
+.staff-list {
+	.list-det {
+		width: calc(100% - 110upx);
+		color: $fontColor3;
+		margin-left: 20upx;
+		@include disFlex(center, space-between);
+		.list-det-left {
+			.staff-name {
+				color: #333;
+				font-size: 30upx;
+				font-weight: 600;
+				margin-right: 10upx;
+				display: inline-block;
+				overflow: hidden;
+				text-overflow:ellipsis;
+				white-space: nowrap;
+				width:150upx;
+			}
+			.flex-center {
+				margin-top: 10upx;
+			}
+			.status-list {
+				margin-left: 25upx;
+				&:first-child {
+					margin-left: 0;
+				}
+				.iconfont {
+					// color: $fontColor3;
+					font-size: 24upx;
+					margin-right: 10upx;
+				}
+			}
+		}
+		.list-det-right {
+			@include disFlex(center, flex-start);
+			& > div {
+				margin-left: 50upx;
+				&:first-child {
+					margin-left: 0;
+				}
+			}
+			.iconfont {
+				font-size: 36upx;
+				color: $fontColor3;
+			}
+		}
+	}
+}
+.app-footer {
+	justify-content: flex-end;
+	.admin-button-com {
+		width: 160upx;
+		margin-right: 30upx;
+	}
+}
+</style>

+ 83 - 0
ghsApp/src/admin/expend/list.vue

@@ -0,0 +1,83 @@
+<template>
+<view class="app-content">
+		<block v-if="!$util.isEmpty(list.data)">
+			<t-table :headerBackgroundColor="'#F0F2F6'">
+				<t-tr header>
+					<t-th><view style="width:150upx;">来源</view></t-th>
+					<t-th><view style="width:200upx;">事项</view></t-th>
+					<t-th>金额</t-th>
+					<t-th>余额</t-th>
+					<t-th>可提现</t-th>
+				</t-tr>
+				<view v-for="(item, index) in list.data" :key="index" @click="goDetail(item)">
+					<t-tr>
+						<t-td align="center" color="info">
+							<view style="width:150upx;">
+								<view>{{ item.addTime.substr(5,11) }}</view>
+								<view>{{item.ptStyle==1?'零售':'批发'}}-{{ item.fromType ==1 ? '门店' : item.fromType == 2 ? '商城' : item.fromType ==3 ? '朋友圈' : '其它' }}</view>
+							</view>
+						</t-td>
+						<t-td align="center" color="info"><view style="width:200upx;">{{ item.event }}</view></t-td>
+						<t-td align="center" color="info"><view >{{ parseFloat(item.amount) }}</view></t-td>
+						<t-td align="center" color="info"><view >{{ parseFloat(item.balance) }}</view></t-td>
+						<t-td align="center" color="info"><view >{{ parseFloat(item.txBalance) }}</view></t-td>
+					</t-tr>
+				</view>
+			</t-table>
+		</block>
+		<block v-else>
+			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+		</block>
+	</view>
+</template>
+
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { changeList } from '@/api/shop-ye-change'
+import list from '@/mixins/list'
+export default {
+	name: "cashList",
+	components: {
+		AppWrapperEmpty
+	},
+	mixins:[list],
+	data() {
+		return {
+		};
+	},
+	methods: {
+		async init(){
+			const res = await changeList({
+				page:this.list.page,tx:0
+			})
+			if (this.$util.isEmpty(res.data.list)){
+				this.completes(res)
+				return
+			}
+			let currentList = res.data.list
+			currentList.forEach(function(item,index,array){
+				array[index].amount = item.io ==0 ? '-'+item.amount : '+'+item.amount
+			});
+			res.data.list = currentList
+			this.completes(res)
+		},
+		goDetail(item){
+		}
+	},
+	async onPullDownRefresh() {
+		this.resetList();
+		await this.init()
+		uni.stopPullDownRefresh();
+	},
+	async onReachBottom() {
+		if (!this.list.finished) {
+			await this.init()
+			uni.stopPullDownRefresh();;
+		} else {
+			uni.stopPullDownRefresh();
+		}
+	},
+	
+};
+</script>
+<style lang="scss" scoped></style>

+ 75 - 0
ghsApp/src/admin/expend/salary.vue

@@ -0,0 +1,75 @@
+<template>
+	<view class="app-content">
+		<block v-if="!$util.isEmpty(list.data)">
+			<t-table :headerBackgroundColor="'#F0F2F6'">
+				<t-tr header>
+					<t-th>时间</t-th>
+					<t-th>姓名</t-th>
+					<t-th><view style="width:200upx;">手机</view></t-th>
+					<t-th>工资</t-th>
+					<t-th>备注</t-th>
+				</t-tr>
+				<view v-for="(item, index) in list.data" :key="index">
+					<t-tr>
+						<t-td align="center" color="info"><view >{{ item.addTime.substr(5,5) }}</view></t-td>
+						<t-td align="center" color="info"><view >{{ item.name }}</view></t-td>
+						<t-td align="center" color="info"><view style="width:200upx;">{{ item.mobile }}</view></t-td>
+						<t-td align="center" color="info"><view >{{ item.amount?parseFloat(item.amount):0 }}</view></t-td>
+						<t-td align="center" color="info"><view ></view></t-td>
+					</t-tr>
+				</view>
+			</t-table>
+		</block>
+		<block v-else>
+			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+		</block>
+
+		<view class="app-footer open_btn">
+			<view @click="sendSalary" class="admin-button-com big blue" style="width:230upx;">发工资</view>
+		</view>
+
+	</view>
+</template>
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { getSalaryList } from '@/api/expend'
+import list from '@/mixins/list'
+export default {
+	name: "salary",
+	components: {
+		AppWrapperEmpty
+	},
+	mixins:[list],
+	data() {
+		return {
+		};
+	},
+	methods: {
+		sendSalary(){
+			this.$util.pageTo({url: '/admin/expend/addSalary'})
+		},
+		async init(){
+			const res = await getSalaryList({ page:this.list.page })
+			if (this.$util.isEmpty(res.data.list)){
+				this.completes(res)
+				return
+			}
+			this.completes(res)
+		}
+	},
+	async onPullDownRefresh() {
+		this.resetList();
+		await this.init()
+		uni.stopPullDownRefresh();
+	},
+	async onReachBottom() {
+		if (!this.list.finished) {
+			await this.init()
+			uni.stopPullDownRefresh();;
+		} else {
+			uni.stopPullDownRefresh();
+		}
+	}
+};
+</script>
+<style lang="scss" scoped></style>

+ 7 - 7
ghsApp/src/admin/home/apply.vue

@@ -40,6 +40,13 @@ export default {
                         {name: "停用花材",img: `${this.$constant.imgUrl}/ghs/home/hcgl.png`,url: "/admin/item/list?delStatus=1"},
                     ]
                 },
+                {
+                    title:'支出',
+                    list:[
+                        {name: "工资",img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,url: "/admin/expend/salary"},
+                        {name: "店租水电伙食",img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,url: "/admin/expend/list"},
+                    ]
+                },
                 {
                     title:'统计',
                     list:[
@@ -58,13 +65,6 @@ export default {
                         {name: "预订单设置",img: `${this.$constant.imgUrl}/ghs/home/shop.png`,url: "/admin/order/bookSet"},
                     ]
                 },
-                {
-                    title:'支出',
-                    list:[
-                        {name: "员工工资",img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,url: "/admin/staff/salary"},
-                        {name: "房租水电",img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,url: "/admin/shop/rent"},
-                    ]
-                },
                 {
                     title:'门店与员工',
                     list:[

+ 10 - 0
ghsApp/src/api/expend/index.js

@@ -0,0 +1,10 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+
+export const getSalaryList = data => {
+	return https.get('/salary/list', data)
+}
+
+export const addSalary = data => {
+	return https.post('/salary/add-salary', data)
+}

+ 9 - 0
ghsApp/src/pages.json

@@ -381,6 +381,15 @@
 				{"path": "index","style": {"navigationBarTitleText": "使用教程"}},
 				{"path": "detail","style": {"navigationBarTitleText": ""}}
 			]
+		},
+		{
+			"root": "admin/expend",
+			"pages": [
+				{"path": "addExpend","style": {"navigationBarTitleText": "登记支出"}},
+				{"path": "addSalary","style": {"navigationBarTitleText": "发工资"}},
+				{"path": "salary","style": {"navigationBarTitleText": "发工资记录"}},
+				{"path": "list","style": {"navigationBarTitleText": "支出记录"}}
+			]
 		}
 	],
 	"globalStyle": {