From 45fb4b11ad51bb38306765b11a6747402e382cee Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 20 Feb 2021 17:37:33 +0800
Subject: [PATCH] fix

---
 hive-app/pages/manager/employeeReport.vue |  200 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 132 insertions(+), 68 deletions(-)

diff --git a/hive-app/pages/manager/employeeReport.vue b/hive-app/pages/manager/employeeReport.vue
index 71b9631..1d0910f 100644
--- a/hive-app/pages/manager/employeeReport.vue
+++ b/hive-app/pages/manager/employeeReport.vue
@@ -1,6 +1,6 @@
 <template>
 	<!-- 员工业绩报表 -->
-	<view class="container" @click="hideFilter">
+	<view class="container">
 		<h-tabs
 			class="tab"
 			:tabData="tabs" 
@@ -14,57 +14,56 @@
 				underLineWidth: 60,
 			}"
 		/>
-		<view v-if="tabIndex==0 || tabIndex==1">
-			<view class="list-item">
+		<view v-if="tabIndex==1 || tabIndex==2">
+			<view class="list-item" v-for="item in list">
 				<view class="list-header">
-					<text>2020年12月24日</text>
+					<text>{{item.time}}</text>
 				</view>
 				<view class="list-content">
 					<view class="list-row">
 						<text>订单业绩</text>
-						<text>¥12,122</text>
+						<text>¥{{item.orderAmount | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>现金业绩</text>
-						<text>¥12,122</text>
-					</view>
-					<view class="list-row">
-						<text>售卡业绩</text>
-						<text>¥12,122</text>
-					</view>
-					<view class="list-row">
-						<text>产品业绩</text>
-						<text>¥12,122</text>
+						<text>¥{{item.cashAmount | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>划扣业绩</text>
-						<text>¥12,122</text>
+						<text>¥{{item.cardUseAmount | formatNum}}</text>
+					</view>
+					<view class="list-row">
+						<text>订单提成</text>
+						<text>¥{{item.goodsAmount | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>本金消耗</text>
-						<text>¥12,122</text>
+						<text>¥{{item.hisConsume | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>赠送消耗</text>
-						<text>¥12,122</text>
+						<text>¥{{item.freeConsume | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>服务提成</text>
-						<text>¥12,122</text>
+						<text>¥{{item.commission | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>人头数</text>
-						<text>12,122</text>
+						<text>{{item.peopleNum}}人</text>
 					</view>
 					<view class="list-row">
 						<text>项目数</text>
-						<text>12,122</text>
+						<text>{{item.projNum}}个</text>
 					</view>
 					<view class="list-row">
 						<text>服务时长</text>
-						<text>12,122</text>
+						<text>{{item.serviceTime}}分钟</text>
 					</view>
 				</view>
+			</view>
+			<view v-if="list.length">
+				<uni-load-more :status="loadStatus" color="#a5abaf"></uni-load-more>
 			</view>
 		</view>
 		<view v-else>
@@ -73,70 +72,63 @@
 					<text class="font-bold">专项数据</text>
 				</view>
 				<view class="list-content-bordered">
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('订单业绩', 1)">
 						<text>订单业绩</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('现金业绩', 2)">
 						<text>现金业绩</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
-						<text>售卡业绩</text>
-						<text class="iconfont iconarrow-backimg"></text>
-					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
-						<text>产品业绩</text>
-						<text class="iconfont iconarrow-backimg"></text>
-					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('划扣业绩', 5)">
 						<text>划扣业绩</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('订单提成', 3)">
+						<text>订单提成</text>
+						<text class="iconfont iconarrow-backimg"></text>
+					</view>
+					<view class="list-row-bordered" @click="toAnalyse('本金消耗', 6)">
 						<text>本金消耗</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('赠送消耗', 7)">
 						<text>赠送消耗</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('服务提成', 8)">
 						<text>服务提成</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('人头数', 9)">
 						<text>人头数</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('项目数', 10)">
 						<text>项目数</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('服务时长', 11)">
 						<text>服务时长</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
 				</view>
 			</view>
 		</view>
-		<view class="drop-down" v-show="isShowFilter">
-			<view class="drop-down-row" v-for="item in timeList">
-				<text @click="employeeChange(item)">{{item.label}}</text>
-			</view>
-		</view>
 	</view>
 </template>
 
 <script>
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 	import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
 	export default {
 		components: {
-		    HTabs
+		    HTabs,
+			uniLoadMore
 		},
 		data() {
 		  return {
-			tabIndex: 0,
+			tabIndex: 1,
 		    tabs:[
 				{
 					state: 1,
@@ -151,21 +143,27 @@
 					name: '专项'
 				}
 			],
-			isShowFilter:false,
-			timeList: [{
-				label: '张三',
-				value: 3
-			},{
-				label: '李四',
-				value: 2
-			},{
-				label: '王麻子',
-				value: 1
-			}]
+			list: [],
+			staffId: '',
+			loadStatus: 'more',
+			pageNum: 1
 		  }  
 		},
 		onLoad(options) {
-			
+			this.initTitle();
+			this.loadEmloyeeList();
+			this.loadList()
+		},
+		onPullDownRefresh(){
+			this.reloadData();
+			let timer = setTimeout(function () {
+				uni.stopPullDownRefresh();
+				clearTimeout(timer);
+				timer = null;
+			}, 800);
+		},
+		onReachBottom(){
+			this.loadList()
 		},
 		onNavigationBarButtonTap(e){
 			if(e.index==0){
@@ -174,23 +172,88 @@
 				})
 			}
 			if(e.width && e.index==1){
-				this.isShowFilter=!this.isShowFilter
+				uni.navigateTo({
+					url: './selectEmployee?selectId='+this.staffId
+				})
 			}
 		},
-		onHide() {
-			this.hideFilter()
-		},
 		methods:{
+			reloadData(){
+				this.list = [];
+				this.pageNum = 1;
+				this.loadStatus = 'more';
+				this.loadList();
+			},
+			initTitle(){
+				let roleInfo = this.$httpUtils.getRoleInfo();
+				if(roleInfo){
+					this.staffId = roleInfo.id;
+					uni.setNavigationBarTitle({
+						title: roleInfo.name+'的业绩报表'
+					})
+				}
+			},
 			tabChange(index){
-				this.tabIndex = index;
+				let val = index + 1;
+				if(val == this.tabIndex){
+					return
+				}
+				this.tabIndex = val;
+				if(val != 3){
+					this.reloadData()
+				}
 			},
-			hideFilter(){
-				this.isShowFilter = false
-			},
-			toAnalyse(){
+			toAnalyse(title, type){
 				uni.navigateTo({
-					url: './analyse'
+					url: './analyse/index?staffId='+this.staffId+'&title='+title+'&type='+type+'&page=2'
 				})
+			},
+			loadEmloyeeList(){
+				this.$httpUtils.request('/api/user/findAllUsers', {}, 'POST').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						if(!result.length){
+							// #ifdef APP-PLUS
+							let webView = this.$mp.page.$getAppWebview();
+							webView.setTitleNViewButtonStyle(1, {
+							    width: 0,  
+							});
+							// #endif
+						}
+					}
+				})
+			},
+			loadList(){
+				if(this.loadStatus!=='more'){
+					return;
+				}
+				this.$httpUtils.request('/api/statistics/findVipAchieve', {
+					"pageNum": this.pageNum,
+					"pageSize": 10,
+					"staffId": this.staffId,
+					"type": this.tabIndex
+				}, 'POST').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						if(result.length < 10){
+							this.loadStatus = 'noMore';
+						} else {
+							this.pageNum ++ ;
+							this.loadStatus = 'more';
+						}
+						this.list = this.list.concat(result);
+					}
+				})
+			},
+			setData(selectItem){
+				let item = selectItem[0];
+				this.staffId = item.id;
+				this.reloadData();
+				setTimeout(() => {
+					uni.setNavigationBarTitle({
+						title: item.name+'的业绩报表'
+					});
+				}, 500)
 			}
 		}
 	}
@@ -253,7 +316,8 @@
 		color: #a5abaf
 	}
 	.drop-down{
-		min-width: 56px;
+		height: 200px;
+		width: 60px;
 		background: #FFFFFF;
 		border: 1px solid #EDEAF4;
 		border-radius: 4px;

--
Gitblit v1.9.1