zhengkaixin 2 lat temu
rodzic
commit
a4ef37d122
2 zmienionych plików z 154 dodań i 30 usunięć
  1. 2 2
      pages/record/index.vue
  2. 152 28
      pages/user/company-vip.vue

+ 2 - 2
pages/record/index.vue

@@ -4,7 +4,7 @@
 		
 		<view class="record">
 			<view class="recordTime oldTextjp2" oldstyle="font-size: 18px;" @click="show = true">
-				<u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
+				<u-picker mode="time" v-model="show" :params="params" :default-time="endDate" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
 				<p>{{month}}月</p>
 				<u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
 			</view>
@@ -141,7 +141,7 @@
 			},
 			textFontSize() {
 				if(this.elderStatus) {
-						return '20px'
+						return '40rpx'
 				}
 			},
 			confirmTime(params) {

+ 152 - 28
pages/user/company-vip.vue

@@ -10,71 +10,183 @@
 				</view>
 				<view class="user-name">
 					<view class="name">
-						李广宵
+						{{info.realName?info.realName:info.nickName}}
 					</view>
 					<view class="sign">
-						荆鹏软件企业会员
+						{{platformN}}企业会员
 					</view>
 				</view>
 				
 			</view>
 			
 		</view>
+		<u-picker mode="time" v-model="popupShow" @confirm="changedate" :default-time="queryTime+'-1'"  :params="params"></u-picker>
+		
 		<view class="details">
 			  <view class="month-electric">
-			  	  <view class="month">
-			  	  	8月<text class="iconfont">&#xe62b;</text>
+			  	  <view class="month"  @click="popupShow = true" >
+					  {{showTime(queryTime)}}
+					  <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>
+					  
+			  	  	<!-- 8月<text class="iconfont">&#xe62b;</text> -->
 			  	  </view>
 				  <view class="electric">
-				  	本月累计充电 100 度
+				  	本月累计充电 {{(electricQuantity).toFixed(1)}}
 				  </view>
 			  </view>
-		<view class="item">
-			 <view class="infos">
-				 <view class="station-name">
-				 	荆鹏充电站A02
-				 </view>
-				 <view class="time">
-				 	2022-08-08 16:00:38
-				 </view>
-			 	
-			 </view>
-			 <view class="electricity-consumption">
-			 	50度
-			 </view>
-		</view>
-		<view class="item">
+			  
+			  <view class="carNone"  v-show="!list.length">
+			  	<img src="static/img/暂无数据-缺省页.png" alt="">
+			  	<p>暂无充电记录</p>
+			  </view>
+			  
+		<view class="item" v-for="(item,i) in list" :key="i"  >
 			 <view class="infos">
 				 <view class="station-name">
-				 	荆鹏充电站A02
+				 	{{item.stationName}}
 				 </view>
 				 <view class="time">
-				 	2022-08-08 16:00:38
+				 	{{item.endTime}}
 				 </view>
 			 	
 			 </view>
 			 <view class="electricity-consumption">
-			 	50
+			 	{{(item.electricQuantity/10000).toFixed(1)}}
 			 </view>
 		</view>
 		
-		<u-divider color="#a8a8a8"  half-width="200" border-color="#CFD2D5" fontSize="28">已经到底了</u-divider>
+		
+		<u-divider color="#a8a8a8" v-if="list.length"  half-width="200" border-color="#CFD2D5" fontSize="28">已经到底了</u-divider>
 		</view>
 		
 	</view>
 </template>
 
 <script>
-	import * as userApi from '@/apis/user.js'
-	
+	import * as API from '@/apis/user.js'
+	import {
+		daysDistance,
+		beforeTimeStamp,
+		currentTimeStamp,
+		parseUnixTime
+	} from '@/utils'
 	export default {
 		data() {
 			return {
-				
+				params: {
+									year: true,
+									month: true,
+									day: false,
+									hour: false,
+									minute: false,
+									second: false
+				},
+				popupShow:false,
+				queryTime:"",
+				info:{},
+				platformN:'',
+				platform:'',
+				startDate:'',
+				endTime:"",
+				pageIndex:'',
+				list: [],
+				electricQuantity:0,
+				recordsTotal: 0,
+			}
+		},
+		onReachBottom() {
+			if (this.list.length < this.recordsTotal) {			
+				this.myLoadmore();
+			}
+		},
+		
+		onLoad(op) {
+			this.platform=op.id;
+			this.info=this.carhelp.getPersonInfo()
+			var list=this.carhelp.getPersonInfoPlus().businessVipList;
+			if(list){	
+				for(var i in list){
+					if(list[i].platform==this.platform){
+						this.platformN=list[i].platformN
+					}
+				}
 			}
+			this.queryTime=parseUnixTime(currentTimeStamp(), '{y}-{m}'),
+			this.endTime = parseUnixTime(currentTimeStamp(), '{y}-{m}-{d}')
+			
+			this.getList()
+		},computed:{
+		
+		
+			startTime(){
+				return this.queryTime+'-1'
+			},
+			
 		},
 		methods: {
+			okbtn() {
+				this.popupShow = false;
+				this.getList(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()
 			
+			},
+			showTime(name){
+				if(!name){
+					return ''
+				}
+				return name.replace('-','年')+'月';
+			},
+			myLoadmore() {
+				this.pageIndex += 1;
+				this.getList()
+			},
+			getList(bl){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				if (bl) {
+					this.list = [];
+					this.pageIndex = 1;
+				}
+				API.chargingRecordVipData({
+					pageIndex: this.pageIndex,
+					startDate: this.startTime,
+					endDate: this.endTime,
+					platform: this.platform,
+					pageSize:20,
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.list = [
+						...this.list,
+						...res.data.data
+					];
+					
+					this.electricQuantity = res.data.electricQuantity;
+					this.recordsTotal = res.data.recordsTotal;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+				
+			},
 		}
 	}
 </script>
@@ -135,7 +247,19 @@
 		}
 	}
 
-
+.carNone{
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		img{
+			width: 100%;
+			height: 100%;
+		}
+		p{
+			margin-top: -60px;
+		}
+	}
 .details{
 	height: 100%;