From 01b55d7e82c3b13554a412e9c5be0fc96a4906a3 Mon Sep 17 00:00:00 2001
From: li-guang <153605324@qq.com>
Date: Tue, 05 Jan 2021 18:22:04 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/jyyforjava/hive-app

---
 hive-app/pages/manager/companyReports.vue |  115 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 77 insertions(+), 38 deletions(-)

diff --git a/hive-app/pages/manager/companyReports.vue b/hive-app/pages/manager/companyReports.vue
index 1e33eec..0fdf98a 100644
--- a/hive-app/pages/manager/companyReports.vue
+++ b/hive-app/pages/manager/companyReports.vue
@@ -14,43 +14,43 @@
 				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.dataTime}}</text>
 				</view>
 				<view class="list-content">
 					<view class="list-row">
 						<text>营业收入</text>
-						<text>¥12,122</text>
+						<text>¥{{item.totalPay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>现金收入</text>
-						<text>¥12,122</text>
+						<text>¥{{item.cashPay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>余额划扣</text>
-						<text>¥12,122</text>
+						<text>¥{{item.cardPay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>本金消耗</text>
-						<text>¥12,122</text>
+						<text>¥{{item.consumePay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>赠送消耗</text>
-						<text>¥12,122</text>
+						<text>¥{{item.freeConsumePay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>现金退款</text>
-						<text>¥12,122</text>
+						<text>¥{{item.refundCashPay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>卡项退款</text>
-						<text>¥12,122</text>
+						<text>¥{{item.refundCardPay | formatNum}}</text>
 					</view>
 					<view class="list-row">
 						<text>欠款</text>
-						<text>¥12,122</text>
+						<text>¥{{item.arrearsPay | formatNum}}</text>
 					</view>
 				</view>
 			</view>
@@ -61,44 +61,44 @@
 					<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">
+					<view class="list-row-bordered" @click="toAnalyse('余额划扣', 3)">
 						<text>余额划扣</text>
 						<text class="iconfont iconarrow-backimg"></text>
 					</view>
-					<view class="list-row-bordered" @click="toAnalyse">
+					<view class="list-row-bordered" @click="toAnalyse('本金消耗', 4)">
 						<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('现金退款', 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>
 			</view>
 		</view>
-		<view class="drop-down" v-show="isShowFilter">
-			<view class="drop-down-row" v-for="item in timeList">
-				<text @click="timeChange(item)">{{item.label}}</text>
+		<view class="drop-down" v-if="isShowFilter">
+			<view class="drop-down-row" v-for="item in storeList">
+				<text :class="item.id == shopId?'blue':''" @click="storeChange(item)">{{item.shopShortName}}</text>
 			</view>
 		</view>
 	</view>
@@ -113,7 +113,7 @@
 		data() {
 		  return {
 			type: 1, //1 公司经营报表 2 门店经营报表
-			tabIndex: 0,
+			tabIndex: 1,
 		    tabs:[
 				{
 					state: 1,
@@ -129,16 +129,9 @@
 				}
 			],
 			isShowFilter:false,
-			timeList: [{
-				label: '广州天河店',
-				value: 3
-			},{
-				label: '长沙五一店',
-				value: 2
-			},{
-				label: '深圳南山店',
-				value: 1
-			}]
+			storeList: [],
+			shopId: '',//门店id
+			list: []
 		  }  
 		},
 		onLoad(options) {
@@ -152,12 +145,13 @@
 				    width: 0,  
 				});
 				// #endif
+				this.loadList();
 			}else{
 				uni.setNavigationBarTitle({
 					title: '门店经营报表'
-				})
+				});
+				this.loadShopList();;
 			}
-			
 		},
 		onNavigationBarButtonTap(e){
 			if(e.index==0){
@@ -174,14 +168,59 @@
 		},
 		methods:{
 			tabChange(index){
-				this.tabIndex = index;
+				let val = index + 1;
+				if(val == this.tabIndex){
+					return
+				}
+				this.tabIndex = val;
+				if(val != 3){
+					this.loadList()
+				}
 			},
 			hideFilter(){
 				this.isShowFilter = false
 			},
-			toAnalyse(){
+			toAnalyse(title, type){
 				uni.navigateTo({
-					url: './analyse'
+					url: './analyse/index?shopId='+this.shopId+'&title='+title+'&type='+type
+				})
+			},
+			// 切换门店
+			storeChange(item){
+				if(item.id == this.shopId){
+					return;
+				}
+				this.shopId = item.id;
+				uni.setNavigationBarTitle({
+					title: item.shopShortName + '经营报表'
+				});
+				this.loadList();
+			},
+			loadShopList(){
+				this.$httpUtils.request('/api/shop/findAllShopList').then((res) => {
+					if(res.status == 200){
+						let result = res.rows;
+						this.storeList = result;
+						if(result.length){
+							this.shopId = result[0].id;
+							uni.setNavigationBarTitle({
+								title: result[0].shopShortName + '经营报表'
+							});
+						}
+						this.loadList();
+					}
+				})
+			},
+			loadList(){
+				this.$httpUtils.request('/api/statistics/findShopBusinessesData', {
+					"pageNum": 1,
+					"pageSize": 100,
+					"shopId": this.shopId,
+					"type": this.tabIndex
+				}, 'POST').then((res) => {
+					if(res.status == 200){
+						this.list = res.rows;
+					}
 				})
 			}
 		}

--
Gitblit v1.9.1