Ver código fonte

调整, 无id

zhengkaixin 3 anos atrás
pai
commit
2830ab00db

+ 1 - 1
.env.prod.js

@@ -1,6 +1,6 @@
 const UNI_APP = {
   	
-    BASE_URL: 'https://charging.xiaoxinda.com/charging-station-server/',
+    BASE_URL: 'https://51team.xiaoxinda.com/charging-station-server/',
 	NODE_ENV :"prod",
 	SIMPLE_RUN:false,
 	openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",//测试用openId

+ 2 - 1
.env.test.js

@@ -1,7 +1,8 @@
 const UNI_APP = {  
+    BASE_URL: 'https://51team.xiaoxinda.com/charging-station-server/',
 
     // BASE_URL: 'http://192.168.77.162:8080/charging-station/' ,
-	BASE_URL: 'https://charging.xiaoxinda.com/charging-station-test/',
+	//BASE_URL: 'https://charging.xiaoxinda.com/charging-station-test/',
    // BASE_URL: 'https://charging.xiaoxinda.com/charging-station-server/',
    
 

+ 8 - 3
components/Tabbar.vue

@@ -12,8 +12,8 @@
  	export default {
 		name:"tabbarJob",
 		props:{
-			current: 0
-			
+			current: 0,
+			id: 0
 		},
 		data() {
 			return {
@@ -58,7 +58,12 @@
 					return false
 				}
 				var url =this.tabbarList[index].pagePath2;
-				
+				if(index==1){
+						var id =this.carhelp.get("qr-default-id");
+						if(!id){
+							url="/pages/charge/switchCharge?index=1"
+						}
+				}
 				uni.navigateTo({
 					url: url
 				})

+ 2 - 8
pages.json

@@ -63,16 +63,10 @@
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
-		{
-			"name":"充值记录",
-			"path": "pages/user/rechargeList-test",
-			"style": {
-				//"navigationStyle": "custom" // 隐藏系统导航栏
-			}
-		},
+		
 		{
 			"name":"充值记录",
-			"path": "pages/user/rechargeList-prod",
+			"path": "pages/user/rechargeList",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}

+ 36 - 35
pages/charge/index.vue

@@ -207,50 +207,51 @@
 		},
 		methods: {
 			switchCharge(){
-			
-				uni.redirectTo({
+				console.log("switchCharge")
+				uni.navigateTo({
 					url:'/pages/charge/switchCharge?id='+this.id
 				})
 			},
 			init(){
-				
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
-				var data = {
-					
-				};
-				if(this.id){
-					data.deviceId=this.id
+				if(!this.id){
+					this.switchCharge()
 				}else{
-					uni.showToast({
-						title:'链接超时,请重新扫码'
-					})
-					return
-				}
-				API.chargingData(data).then((res) => {
-					this.detail = res.data.chargingDevice;
 					
-					if(!this.detail .online){
+						
+					
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					var data = {
+						
+					};
+					if(this.id){
+						data.deviceId=this.id
+					}
+					API.chargingData(data).then((res) => {
+						this.detail = res.data.chargingDevice;
+						
+						if(!this.detail .online){
+							uni.showToast({
+								title:'设备不在线,请扫描其他二维码'
+							})
+							return
+						}
+						
+						this.carhelp.set("qr-default-id",this.id);
+						this.user = res.data.userAccount;
+						this.list=this.detail.chargeStatusArray
+						this.isReady=true;
+						uni.hideLoading()
+						
+					}).catch(error => {
+						this.isReady=true;
 						uni.showToast({
-							title:'设备不在线,请扫描其他二维码'
+							title: error
 						})
-						return
-					}
-					
-					this.carhelp.set("qr-default-id",this.id);
-					this.user = res.data.userAccount;
-					this.list=this.detail.chargeStatusArray
-					this.isReady=true;
-					uni.hideLoading()
-					
-				}).catch(error => {
-					this.isReady=true;
-					uni.showToast({
-						title: error
 					})
-				})
+				}
 			},
 			selectItem(row){
 				if(row.status==0){

+ 28 - 18
pages/charge/switchCharge.vue

@@ -1,13 +1,19 @@
 <template>
 	<view>
-		<u-navbar title="切换充电桩"
+		<u-navbar title="选择充电桩"
 		    :autoBack="false"
-			:custom-back="selectBtn">
-		<!-- 	<view class="slot-wrap">
+			>
+			
+			<view class="slot-wrap">
 				<view class="navbar-left"></view>				
 				<view class="navbar-right" @click="selectBtn"><span>确定</span></view>
-			</view> -->
+			</view>
 		</u-navbar>
+		<view style="text-align: center;margin-top: 100px" v-if="!list.length">
+		
+			<img src="@/assets/img/blankpage.png">
+			<p>暂无充电记录</p>
+		</view>
 		<view class="chargeList">
 			<template v-for="(item,i) in list">
 			
@@ -21,7 +27,7 @@
 				<view class="chargeList-item-row">
 					<u-icon name="qichexiangguan-chongdianzhan" custom-prefix="custom-icon" color="#1677ff" size="40"></u-icon>
 					<p>名称</p>
-					<span>{{item.name}}</span>
+					<span>{{item.stationName}} {{item.name}}</span>
 				</view>
 				<view class="chargeList-item-row">
 					<u-icon name="shoujichongdian" custom-prefix="custom-icon" color="#1677ff" size="40"></u-icon>
@@ -55,37 +61,41 @@
 					
 				],
 				select:'',
+				selectBtnId:'',
+				index:false,
 			}
 		},
 		onLoad(op) {
-			this.select=op.id;
+			if(op.id){
+				this.select=op.id;
+				
+			}
+			if(op.index){
+				this.index=true;
+			}
 		},
 		methods: {
 			
 			selectBtn(){
-				
-				//uni.navigateBack()
+				this.selectBtnId=this.select;
+				this.carhelp.set("qr-default-id",this.selectBtnId);
 				uni.redirectTo({
-					url:'/pages/charge/index?id='+this.select
+					url:'/pages/charge/index?id='+this.selectBtnId
 				})
+				
+				
 			},
 			getList(){
+				
 				uni.showLoading({
 					title:"加载中",mask:true,
 				})
-				if(this.select){
-				
-				}else{
-					uni.showToast({
-						title:'链接超时,请重新扫码'
-					})
-					return
-				}
+			
 				var data={
 					deviceId:this.select
 				};
 				API.chargingDeviceData(data).then((res) => {
-						 
+						 console.log(res)
 					this.list=[
 						...this.list,
 						...res.data.data

+ 10 - 4
pages/index/index.vue

@@ -107,7 +107,7 @@
 	
 
 		</u-modal>
-		<Tabbar :current="0"></Tabbar>
+		<Tabbar :current="0" :id="id"></Tabbar>
 	</view>
 </template>
 
@@ -301,9 +301,15 @@
 
 					this.list = res.data.chargingRecordList;
 					this.isCharge = res.data.isCharge;
-					this.isReady = true;
-					if (!this.isCharge && this.k != 1) {
-						this.gotoUrl("pages/charge/index?id=" + this.id)
+					this.isReady = true;
+					
+					if (!this.isCharge && this.k != 1) {
+						if( this.id){
+							this.gotoUrl("pages/charge/index?id=" + this.id)
+						}else{
+								uni.hideLoading()							
+						}
+						return
 					} else {
 						uni.hideLoading()
 					}

+ 8 - 8
pages/login/index.vue

@@ -87,10 +87,10 @@
 			finish() {
 
 				if (!this.carhelp.getOpenId()) {
-					uni.showToast({
-						title: "请使用“微信”访问本系统登录"
-					})
-					return
+					// uni.showToast({
+					// 	title: "请使用“微信”访问本系统登录"
+					// })
+					// return
 				}
 				if (!this.form.phone) {
 					uni.showToast({
@@ -223,10 +223,10 @@
 				}).catch(error => {
 					uni.hideLoading();
 					if (!this.carhelp.getOpenId()) {
-						uni.showToast({
-							title: "请使用“微信”访问本系统登录"
-						})
-						return
+						// uni.showToast({
+						// 	title: "请使用“微信”访问本系统登录"
+						// })
+						// return
 					} else if (this.message) {
 						uni.showToast({
 							title: this.message.split(",")[0],

+ 12 - 11
pages/user/index.vue

@@ -62,7 +62,7 @@
 				</view>
 			</view>
 		</view>
-			<Tabbar :current="2" ></Tabbar>
+			<Tabbar :current="2" :id="id" ></Tabbar>
  	</view>
 </template>
 
@@ -73,6 +73,7 @@
 	export default {
 		data() {
 			return {
+				id:"",
 				src:'',
 				isReady:false,
 				tel:'400-8899-619',
@@ -83,21 +84,21 @@
 				
 			}
 		},onLoad(op){
+			if (op.id) {
+				this.id = op.id;
+				this.carhelp.set("qr-default-id",op.id);
+			}else{
+				//用于支付后返回系统  -- 点金计划
+				this.id =this.carhelp.get("qr-default-id");
+			}
 			this.init();
 		},
 		methods: {
 			gotorechargeDeatils( ){
 				
-				var v=process.env['NODE_NAME']
-				if(v === "production"){
-					uni.navigateTo({
-						url:'/pages/user/rechargeList-prod'
-					})
-				}else{
-					uni.navigateTo({
-						url:'/pages/user/rechargeList-test'
-					})
-				}
+				uni.navigateTo({
+					url:'/pages/user/rechargeList'
+				})
 				
 			},
 			init(){

+ 1 - 1
pages/user/recharge.vue

@@ -4,7 +4,7 @@
 		</u-navbar>
 		<view class="recharge">
 			<view class="recharge-text">
-				<p>账余额(元)</p>
+				<p>账余额(元)</p>
 				<h1>{{detail.balance}}</h1>
 			</view>
 			<view 

+ 0 - 188
pages/user/rechargeList-prod.vue

@@ -1,188 +0,0 @@
-<template>
-	<view>
-		<u-navbar title="充值记录">
-		</u-navbar>
-		<view class="chargeScreen">
-			<view class="chargeScreen-item">
-				<p>
-				 <picker mode="date" :value="startDate"  :end="endDate"   @change="bindDateChange0">
-				            <view class="uni-input">{{startDate}}</view>
-				     </picker>
-				</p>
-				<u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
-			</view>
-			<span>至</span>
-			<view class="chargeScreen-item">
-				<p>
-				<picker mode="date" :value="endDate" :start="startDate"   @change="bindDateChange1">
-				           <view class="uni-input">{{endDate}}</view>
-				    </picker>
-				
-				</p>
-				<u-icon name="arrow-down-fill" color="#999" size="24"></u-icon>
-			</view>
-		</view>
-		<view style="text-align: center;margin-top: 100px" v-if="!list.length">
-		
-			<img src="@/assets/img/blankpage.png">
-			<p>暂无充值记录</p>
-		</view>
-		<view class="chargeList">
-			<view v-for="(item ,index) in list" :key="item.id"
-			 @click="gotoUrl('pages/user/rechargeDeatils?id=' + item.id)"
-			 class="chargeList-item" 
-			 >
-				<view class="chargeList-text">
-					<p>余额充值</p>
-					<h4>{{item.payNameStr}}</h4>
-				</view>
-				<view class="chargeList-right">
-					<span>{{item.amount}}元</span>
-					<h4>{{item.createTime}}</h4>
-				</view>
-			</view> 
-			
-		</view>
-	</view>
-</template>
-
-<script>
-	import * as API from '@/apis/index.js'
-	import {parseUnixTime,beforeTimeStamp} from  '@/utils/index.js'
-	export default {
-		data() {
-			return {
-				form: {
-
-				},
-				startDate:'',
-				endDate:'',
-				pageIndex: 1,
-				recordsTotal: 0,
-				list: [],
-			}
-		},
-		onReachBottom() {
-			if (this.list.length < this.recordsTotal) {
-				this.myLoadmore();
-			}
-		},
-		methods: {
-		
-			  bindDateChange0: function(e) {
-			            this.startDate= e.target.value
-			            
-						
-						this.getList(true)
-			  },
-			  bindDateChange1: function(e) {
-			          this.endDate= e.target.value
-			          
-			  						this.getList(true)
-			  },
-			myLoadmore() {
-
-				this.pageIndex += 1;
-				this.getList()
-			},
-			getList(bl) {
-				
-				uni.showLoading({
-					title: "加载中",
-					mask: true,
-				})
-				if (bl) {
-					this.list = [];
-					this.pageIndex = 1;
-				}
-				var data = {
-					startDate:this.startDate,
-					endDate:this.endDate,
-					pageIndex: this.pageIndex
-				};
-				API.accountRecordData(data).then((res) => {
-
-					this.list = [
-						...this.list,
-						...res.data.data
-					];
-					this.recordsTotal = res.data.recordsTotal
-					uni.hideLoading()
-
-				}).catch(error => {
-					uni.showToast({
-
-						title: error
-					})
-				})
-			},
-			onReady() {
-				this.startDate=parseUnixTime(beforeTimeStamp(5),"{y}-{m}-{d}")
-				this.endDate=parseUnixTime(new Date(),"{y}-{m}-{d}")
-				
-				this.getList()
-				
-			}
-		}
-	}
-</script>
-<style>
-	page {
-		background-color: #f7f7f7;
-	}
-</style>
-<style lang="scss" scoped>
-	.chargeScreen {
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		padding: 10px 0;
-		background-color: #fff;
-
-		span {
-			color: #777;
-		}
-	}
-
-	.chargeScreen-item {
-		display: flex;
-		align-items: center;
-		flex: 1;
-		justify-content: center;
-
-		p {
-			color: #777;
-			margin-right: 5px;
-		}
-	}
-
-	.chargeList {
-		margin-top: 10px;
-	}
-
-	.chargeList-item {
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		padding: 15px;
-		background-color: #fff;
-		border-bottom: 1px solid #f7f7f7;
-
-		h4 {
-			font-weight: normal;
-			color: #999;
-			margin-top: 3px;
-			font-size: 12px;
-		}
-
-		span {
-			font-size: 14px;
-			color: #1677FF;
-			font-weight: bold;
-		}
-	}
-
-	.chargeList-right {
-		text-align: right;
-	}
-</style>

+ 152 - 0
pages/user/rechargeList.vue

@@ -0,0 +1,152 @@
+
+<template>
+	<view>
+		<u-navbar title="充值记录"></u-navbar>
+		<view class="rechargeTime" @click="show = true">
+			<u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
+			<span>{{month}}月</span>
+			<u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
+		</view>
+		<view style="text-align: center;margin-top: 100px" v-if="!accountList.length">
+		
+			<img src="@/assets/img/blankpage.png">
+			<p>暂无充值记录</p>
+		</view>
+	<!-- 	<view class="carNone" v-if="accountList.length == 0">
+			<img src="static/img/暂无数据-缺省页.png" alt="">
+			<p>暂无充值记录</p>
+		</view> -->
+		<view class="rechargeList" v-if="accountList.length > 0">
+			<view class="rechargeList-item" v-for="(item,index) in accountList" :key="item.id" @click="gotoUrl('pages/user/finance/rechargeDet?id=' + item.id)">
+				<view class="rechargeList-row"><span>充值金额</span><h4>{{item.amount}}</h4></view>
+				<view class="rechargeList-row"><p>{{item.payNameStr}}</p><p>{{item.createTime}}</p></view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/index.js'
+	
+	export default {
+		data() {
+			return {
+				userId: '',
+				params: {
+					year: true,
+					month: true,
+					day: false,
+					hour: false,
+					minute: false,
+					second: false,
+					timestamp: true,
+				},
+				show: false,
+				month: '',
+				dateMonth: '',
+				accountList: [],
+			}
+		},
+		onReady() {			
+			if(this.carhelp.getPersonInfo()) {
+				this.userId = this.carhelp.getPersonInfo().id;
+			}
+			
+			var date = new Date();
+			this.month = date.getMonth() + 1;
+			
+			var year = date.getFullYear();
+			var monthN = this.month;
+			if(monthN >= 1 && monthN <= 9) {
+				monthN = "0" + monthN;
+			}
+			this.dateMonth = year + '-' + monthN + '-01';
+					
+			this.getAccountRecordData();
+		},
+		methods: {
+			getAccountRecordData() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				API.accountRecordData({
+					queryDate: this.dateMonth,
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.accountList = res.data.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			confirmTime(params) {
+				this.dateMonth = params.year + '-' + params.month + '-01';
+				if(params.month.slice(0,1) == '0') {
+					this.month = params.month.slice(1);
+				} else {
+					this.month = params.month;
+				}
+				this.getAccountRecordData();
+				this.show = false;
+			},
+			cancelTime() {
+				this.show = false;
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.carNone{
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		img{
+			width: 100%;
+			height: 100%;
+		}
+		p{
+			margin-top: -60px;
+		}
+	}
+	.rechargeTime{
+		background-color: #fff;
+		height: 44px;
+		display: flex;
+		align-items: center;
+		padding: 12px 16px;
+		border-bottom: 1px solid #f7f7f7;
+		span{
+			margin-right: 4px;
+		}
+	}
+	.rechargeList{
+		background-color: #fff;
+		padding-left: 16px;
+		.rechargeList-item{
+			padding: 12px 16px 12px 0;
+			border-bottom: 1px solid #f7f7f7;
+			&:last-child{
+				border-bottom: none;
+			}
+		}
+		.rechargeList-row{
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			h4{
+				font-size: 16px;
+			}
+			p{
+				font-size: 12px;
+				margin-top: 4px;
+				color:#888;
+			}
+		}
+	}
+</style>

+ 10 - 10
pagesFinance/login/index.vue

@@ -83,10 +83,10 @@
 			finish() {
 		
 				if (!this.carhelp.getOpenId()) {
-					uni.showToast({
-						title: "请使用“微信”访问本系统登录"
-					})
-					return
+					// uni.showToast({
+					// 	title: "请使用“微信”访问本系统登录"
+					// })
+					// return
 				}
 				if (!this.form.phone) {
 					uni.showToast({
@@ -212,12 +212,12 @@
 				
 				}).catch(error => {
 					uni.hideLoading();
-					if (!this.carhelp.getOpenId()) {
-						uni.showToast({
-							title: "请使用“微信”访问本系统登录"
-						})
-						return
-					}
+					// if (!this.carhelp.getOpenId()) {
+					// 	uni.showToast({
+					// 		title: "请使用“微信”访问本系统登录"
+					// 	})
+					// 	return
+					// }
 					var time = this.carhelp.get("getvcodetime");
 					if (time) {
 						//this.$refs.uCode.start();

+ 3 - 3
utils/init.js

@@ -23,9 +23,9 @@ var app = {
 				}
 			} else{
 				var NODE_NAME=  process.env['NODE_NAME']
-				if(NODE_NAME=="production"){
-					alert("请使用微信打开本页面")
-				}
+				// if(NODE_NAME=="production"){
+				// 	alert("请使用微信打开本页面")
+				// }
 				
 			}
 		}else{