zhengkaixin 2 年之前
父節點
當前提交
05e0d51f6c
共有 1 個文件被更改,包括 135 次插入167 次删除
  1. 135 167
      pagesFinance/statistics/index.vue

+ 135 - 167
pagesFinance/statistics/index.vue

@@ -43,110 +43,11 @@
 				</view>
 			</view>
 		</view>
-		<u-popup v-model="popupShow" mode="top" height="30%">
-			<view class="popup-screen">
-				<view class="screen">
-					<view class="screen-item">
-						<view class="screen-head">查询日期</view>
-						<view class="screen-main2">
-
-
-							<u-input :value="startTime?startTime+'至'+endTime:'选择时间筛选'" :type="type" :border="border"
-								@click="showdate = true,popupShow=false" />
-							<!-- 	
-							<u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
-						 -->
-						</view>
-					</view>
-					<view class="screen-item" v-if="false">
-						<view class="screen-head">充电桩类型</view>
-						<view class="screen-main">
-							<view :class="{
-								active:selecttype==''
-							}" @click="selecttype=''" class="screen-entry ">全部</view>
-							<view :class="{
-								active:selecttype=='0'
-							}" @click="selecttype='0'" class="screen-entry type1">自行车充电</view>
-							<view :class="{
-								active:selecttype=='2'
-							}" @click="selecttype='2'" class="screen-entry type3">交流慢充</view>
-							<view :class="{
-								active:selecttype=='1'
-							}" @click="selecttype='1'" class="screen-entry type2">直流快充</view>
-						</view>
-					</view>
-					<view class="screen-item" v-if="false">
-						<view class="screen-head">站点</view>
-						<view class="screen-main">
-							<view class="screen-entry  " :class="{
-								active:selectstationId==''
-							}" @click="selectstationId=''">全部</view>
-							<view v-for="(item,i) in stationList" :key="i" :class="{
-								active:selectstationId==item.id
-							}" @click="selectstationId=item.id,selectdeviceNo=''" class="screen-entry">{{item.name}}</view>
-
-						</view>
-					</view>
-					<view class="screen-item" v-if="false">
-						<view class="screen-head">桩号</view>
-						<view class="screen-main">
-
-							<view class="screen-entry  " :class="{
-								active:selectdeviceNo==''
-							}" @click="selectdeviceNo=''">全部</view>
-							<view v-for="(item,i) in stationListSon" :key="i"
-								v-show="selectstationId?(selectstationId==item.stationId):true" :class="{
-								active:selectdeviceNo==item.deviceNo
-							}" @click="selectdeviceNo=item.deviceNo" class="screen-entry">{{item.name}}</view>
-						</view>
-					</view>
-				</view>
-				<view class="screen-foot">
-					<view class="screen-btn-l" @click="resetBtn">重置</view>
-					<view class="screen-btn-r" @click="okbtn">确定</view>
-				</view>
-			</view>
-		</u-popup>
-		<u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
-
-		<u-calendar v-model="showdate2" mode="range" @change="changedate2"></u-calendar>
-
-		<u-popup v-model="popupShow2" mode="top" height="50%">
-			<view class="popup-screen">
-				<view class="screen">
-					<view class="screen-item">
-						<view class="screen-head">查询日期</view>
-						<view class="screen-main2">
-
-
-							<u-input :value="startTime2?startTime2+'至'+endTime2:'选择时间筛选'" :type="type" :border="border"
-								@click="showdate2 = true,popupShow2=false" />
-							<!-- 	
-							<u-action-sheet :list="actionSheetList" v-model="show" @click="actionSheetCallback"></u-action-sheet>
-						 -->
-						</view>
-					</view>
-
-					<view class="screen-item">
-						<view class="screen-head">站点</view>
-						<view class="screen-main">
-							<view class="screen-entry  " :class="{
-								active:selectstationId2==''
-							}" @click="selectstationId2=''">全部</view>
-							<view v-for="(item,i) in stationList" :key="i" :class="{
-								active:selectstationId2==item.id
-							}" @click="selectstationId2=item.id,selectdeviceNo=''" class="screen-entry">{{item.name}}</view>
-
-						</view>
-					</view>
+	 
+		<u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime" :params="params"></u-picker>
+		<u-picker mode="time" v-model="popupShow2" @confirm="changedate2" :default-time="queryTime2"  :params="params"></u-picker>
+		<u-picker mode="selector" v-model="popupShow3" @confirm="changedate3" :range="stationList" range-key="name" :default-selector="[selectstationIndex]"></u-picker>
 
-				</view>
-				<view class="screen-foot">
-					<view class="screen-btn-l" @click="resetBtn2">重置</view>
-					<view class="screen-btn-r" @click="okbtn2">确定</view>
-				</view>
-			</view>
-		</u-popup>
 
 		<view class="statisticsChart">
 
@@ -156,14 +57,18 @@
 				<!-- <view class="navbar-screen" >
 					 {{startTime}}至{{endTime}}
 				 </view> -->
-							 <view class="navbar-screen" @click="popupShow = true"><span>筛选</span><u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon></view>
+							 <view class="navbar-screen" @click="popupShow = true">
+								 <span>{{showTime(queryTime)}}</span>
+							 <u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow"></u-icon>
+							 <u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow"></u-icon>
+							 
+							 </view>
 
 
 			</view>
 
 			<view class="details detailstable">
-				<p style="text-align: center; margin-bottom: 5px;">{{startTime}}至{{endTime}} </p>
-					<u-collapse  :headStyle="{
+ 					<u-collapse  :headStyle="{
 								color:'#101010',
 								 fontWeight: 'bold',
 								 padding:'12px 0',
@@ -207,13 +112,13 @@
 							 			
 							 			
 							 			<view class="span1">快充枪平均充电量</view>
-							 			<view class="span2" v-if="item.fastNum">{{(item.eqFast/nowTime/item.fastNum/10000).toFixed(1)}}<span>度/枪/天</span></view>
+							 			<view class="span2" v-if="item.fastNum">{{(item.averageFast/10000).toFixed(1)}}<span>度/枪/天</span></view>
 										<view class="span2" v-else>0<span>度/枪/天</span></view>
 									</view>
 							 		<view class="details-row">
 							 			
 							 			<view class="span1">慢充枪平均充电量</view>
-							 			<view class="span2"  v-if="item.slowNum" >{{(item.eqSlow/nowTime/item.slowNum/10000).toFixed(1)}}<span>度/枪/天</span></view>
+							 			<view class="span2"  v-if="item.slowNum" >{{(item.averageSlow/10000).toFixed(1)}}<span>度/枪/天</span></view>
 							 			<view class="span2" v-else>0<span>度/枪/天</span></view>
 									</view>
 							 	</view>
@@ -227,54 +132,32 @@
 
 			</view>
 
-
-			<view class="statisticsChart-head" v-if="false">
-				<h4>流水占比</h4>
-				<view class="navbar-screen" @click="popupShow = true"><span>筛选</span>
-					<u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
-				</view>
-
-
-			</view>
-			<view class="statisticsChart-main" v-if="false">
-				<!-- 				<u-calendar v-model="showdate" mode="range" @change="changedate"></u-calendar>
- -->
-				<view class="statisticsChart-time" style="
-    text-align: center; margin-bottom: 5px;
-">
-					<p>{{startTime}} 至 {{endTime}} </p>
-
-				</view>
-				<u-subsection :list="subsection" @change="changesub" :current="current" button-color="#2E7Dff"
-					active-color="#fff"></u-subsection>
-
-				<p v-if="step==0" style="text-align: center;">双击饼图进入详情</p>
-				<p v-if="step==1" style="text-align: center;">
-					<span v-if="step==1" style="position: absolute;left: 30px;" @click="step=0,getPie()">
-						<u-icon name="arrow-left-double"></u-icon>
-						返回
-					</span>{{stepname}}
-				</p>
-
-				<cover-view id="pieEcharts" style="min-height:250px;">
-
-				</cover-view>
-
-			</view>
 			<view class="statisticsChart-head" style="margin-top: 20px;">
 				<h4>收益统计</h4>
 				<!-- <view class="navbar-screen" >
 					 {{startTime}}至{{endTime}}
 				 </view> -->
-				<view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span>
+				<!-- <view class="navbar-screen" @click="popupShow2 = true"><span>筛选</span>
 					<u-icon name="filter-2-fill" custom-prefix="custom-icon" color="#b0b8c8" size="32"></u-icon>
-				</view>
+				</view> -->
 
 
 			</view>
 
 			<view class="details" v-if="indexData2&&indexData2.incomeMap">
-				<p style="text-align: center; margin-bottom: 5px;">{{startTime2}}至{{endTime2}} </p>
+				
+				<view class="details-row2">
+					<p  @click="popupShow3 = true">{{selectstationName}}
+						<u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow3"></u-icon>
+						<u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow3"></u-icon>
+					</p>
+					<p  @click="popupShow2 = true">
+						{{showTime(queryTime2)}}
+						<u-icon name="arrow-down" color="#b0b8c8" size="32" v-show="!popupShow2"></u-icon>
+						<u-icon name="arrow-up" color="#b0b8c8" size="32" v-show="popupShow2"></u-icon>
+					</p>
+				</view>
+				
 				<view class="details-row">
 					<p>投资人收入</p>
 					<span>{{indexData2.incomeMap.incomeAmount.toFixed(2)}}元</span>
@@ -290,6 +173,10 @@
 				<view class="details-row">
 					<p>服务费收益</p>
 					<span><b>{{indexData2.incomeMap.serviceAmount.toFixed(2)}}元</b></span>
+				</view>
+				<view class="details-row">
+					<p>月卡收益</p>
+					<span>{{indexData2.incomeMap.cardIncomeAmount.toFixed(2)}}元</span>
 				</view>
 			</view>
 
@@ -314,7 +201,16 @@
 	} from '@/utils'
 	export default {
 		data() {
-			return {
+			return {
+				popupShow3:false,
+				params: {
+									year: true,
+									month: true,
+									day: false,
+									hour: false,
+									minute: false,
+									second: false
+								},
 				isinit: true,
 				form: {},
 				form2: {},
@@ -324,19 +220,21 @@
 				popupShow2: false,
 				popupShow: false,
 				nowTime:0,
-				selectstationId2: "",
+				selectstationId2: "",
+				selectstationIndex:0,
+				selectstationName: "",
 				info: {},
 				title: "",
 				showdate: false,
 				showdate2: false,
-
-				startTime: "",
+				
+				queryTime:"",
+				queryTime2:"",
+				
 				indexData: {},
-				endTime: "",
-
-				startTime2: "",
+			
 				indexData2: null,
-				endTime2: "",
+			
 
 				myChart: null,
 				myChartReady: false,
@@ -375,7 +273,10 @@
 						isDot: false,
 						customIcon: true,
 					},
-				],
+				],
+				endTime:'',
+				endTime2:'',
+				
 				current: 0,
 				background: {
 					background: 'none'
@@ -386,7 +287,8 @@
 				border: true,
 				step: 0,
 			 stepname: '',
-				stepid: 0,
+				stepid: 0,
+				
 			}
 		},
 		onShow() {
@@ -406,20 +308,46 @@
 		onReady() {
 			var date=new Date();
 			this.nowTime=7
-		
-			this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
+			
+			
+			this.queryTime=parseUnixTime(currentTimeStamp(), '{y}-{m}');
+			this.queryTime2=parseUnixTime(currentTimeStamp(), '{y}-{m}'),
+			
+			console.log(this.queryTime);
+			
+			//this.startTime = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
 			this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
-			this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
+			//this.startTime2 = parseUnixTime(beforeTimeStamp(6), '{y}-{m}-{d}')
 			this.endTime2 = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
 
 			this.getStation()
+		},computed:{
+		
+			startTime(){
+				return this.queryTime+'-1'
+			},
+			startTime2(){
+				return this.queryTime2+'-1'
+			},
+			
 		},
-		methods: {
+		methods: {
+			showTime(name){
+				if(!name){
+					return ''
+				}
+				return name.replace('-','年')+'月';
+			},
 			getStation(bl) {
 
 				API.stationList().then((res) => {
 
-					this.stationList = res.data.stationList
+					this.stationList = res.data.stationList
+					this.stationList.unshift({
+						id:'',name:"全部站点"
+					})
+					this.selectstationName="全部站点"
+					
 					this.stationListSon = res.data.deviceList
 					this.getDataHome()
 					this.getData()
@@ -552,17 +480,45 @@
 
 				this.current = e
 				this.getPie()
+			},
+			changedate3(e) {
+					console.log(e)
+					var index=e[0];
+					var obj=this.stationList[index];
+					this.selectstationId2=obj.id;
+					this.selectstationIndex=index;
+					this.selectstationName=obj.name;
+					this.okbtn2()
 			},
-			changedate(e) {
-				this.startTime = e.startDate
-				this.endTime = e.endDate
-				this.popupShow = true
+			changedate(e) {
+				console.log(e)
+				this.queryTime=e.year+'-'+e.month;
+				
+				if(e.month=='12'){
+					this.endTime=(e.year)+"/12/31"
+				}else{
+					var b=e.year+'/'+(parseInt(e.month)+1)+'/1';
+					var a=beforeTimeStamp(1,b);
+					this.endTime= parseUnixTime(a, '{y}-{m}-{d}')
+					
+				}
+				
 				this.okbtn()
 			},
 			changedate2(e) {
-				this.startTime2 = e.startDate
-				this.endTime2 = e.endDate
-				this.popupShow2 = true
+				console.log(e)
+				this.queryTime2=e.year+'-'+e.month;
+				
+				if(e.month=='12'){
+					this.endTime2=(e.year)+"/12/31"
+				}else{
+					var b=e.year+'/'+(parseInt(e.month)+1)+'/1';
+					var a=beforeTimeStamp(1,b);
+					this.endTime2= parseUnixTime(a, '{y}-{m}-{d}')
+					
+				}
+				
+				this.okbtn2()
 
 			},
 			getPie1(list) {
@@ -791,6 +747,7 @@
 <style lang="scss" scoped>
 	.detailstable {
 		font-size: 16px;
+		padding: 20px 15px !important;
 		p{
 			font-size: 14px;
 		}
@@ -873,6 +830,17 @@
 			color: #37393c;
 			font-weight: bold;
 		}
+	}
+	.details-row2 {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		margin-top: 15px;
+	
+		p {
+			// color: #37393c;
+			// font-weight: bold;
+		}
 	}
 
 	.popup-screen {