zhengkaixin 3 роки тому
батько
коміт
bcd86ff7d3
5 змінених файлів з 130 додано та 65 видалено
  1. 84 0
      components/Tabbar.vue
  2. 9 28
      pages/index/index.vue
  3. 1 1
      pages/login/index.vue
  4. 28 34
      pages/user/index.vue
  5. 8 2
      pages/user/recharge.vue

+ 84 - 0
components/Tabbar.vue

@@ -0,0 +1,84 @@
+<template >
+	<view>
+		<u-tabbar v-model="myCurrent" :list="tabbarList" 
+		:before-switch="beforeSwitch"
+		:mid-button="true" active-color="#1677ff"></u-tabbar>
+		
+	</view>
+</template>
+
+<script>
+ 	
+ 	export default {
+		name:"tabbarJob",
+		props:{
+			current: 0
+			
+		},
+		data() {
+			return {
+				activeColor:"#5098FF",
+				oldindex:this.current,
+				 myCurrent:this.current,
+				 tabbarList: [{
+				 		iconPath: "motuoche-diandongche",
+				 		selectedIconPath: "motuoche-diandongche",
+				 		text: '充电中',
+				 		count: 0,
+				 		isDot: true,
+				 		customIcon: true,
+						pagePath2:"/pages/index/index",
+						
+				 	},
+				 	{
+				 		iconPath: "/static/img/min_button_select.png",
+				 		selectedIconPath: "/static/img/min_button_select.png",
+				 		text: '充电',
+				 		midButton: true,
+				 		customIcon: true,
+						pagePath2:"/pages/charge/index",
+				 	},
+				 	{
+				 		iconPath: "31wode",
+				 		selectedIconPath: "31wode",
+				 		text: '我的',
+				 		count: 0,
+				 		isDot: false,
+				 		customIcon: true,
+						pagePath2:"/pages/user/index",
+				 	},
+				 ],
+			};
+			
+		},methods:{
+			beforeSwitch(index){
+			
+				
+				if(index==this.current){
+					return false
+				}
+				var url =this.tabbarList[index].pagePath2;
+				
+				uni.navigateTo({
+					url: url
+				})
+				if(index==1){
+					this.myCurrent=this.oldindex;
+					return false;
+				}else{
+					return true;
+				}
+				
+			},
+			
+		},mounted(){
+			
+		},destroyed(){
+		}
+		
+	}
+</script>
+
+<style>
+	 
+</style>

+ 9 - 28
pages/index/index.vue

@@ -41,44 +41,25 @@
 			<view class="chargeBtn-item">退款</view>
 			<view class="chargeBtn-item">费用说明</view>
 		</view>
-		<u-tabbar v-model="current" :list="tabbarList" :mid-button="true" active-color="#1677ff"></u-tabbar>
-	</view>
+		<Tabbar :current="0" ></Tabbar>
+ 	</view>
 </template>
 
 <script>
+	import Tabbar from '@/components/Tabbar.vue'
+	
 	export default {
 		data() {
 			return {
-				tabbarList: [{
-						iconPath: "motuoche-diandongche",
-						selectedIconPath: "motuoche-diandongche",
-						text: '充电',
-						count: 0,
-						isDot: true,
-						customIcon: true,
-					},
-					{
-						iconPath: "/static/img/min_button_select.png",
-						selectedIconPath: "/static/img/min_button_select.png",
-						text: '充电中',
-						midButton: true,
-						customIcon: true,
-					},
-					{
-						iconPath: "31wode",
-						selectedIconPath: "31wode",
-						text: '我的',
-						count: 0,
-						isDot: false,
-						customIcon: true,
-					},
-				],
-				current: 0
+				 
 			}
 		},
 		methods: {
 
-		}
+		},components: {
+			Tabbar
+			
+		},
 	}
 </script>
 

+ 1 - 1
pages/login/index.vue

@@ -66,7 +66,7 @@
 			},
 			finish(){
 				uni.redirectTo({
-						url:'pages/user/index'
+						url:'/pages/user/index'
 					})
 				return
 				if(!this.carhelp.getOpenId()){

+ 28 - 34
pages/user/index.vue

@@ -10,7 +10,8 @@
 				<view class="userHead-img">
 					<u-avatar class="userHead-head" :src="src" size="144"></u-avatar>
 				</view>
-				<view class="userHead-btn">
+				<view class="userHead-btn" 
+				 @click="gotoUrl('pages/user/recharge')" >
 					<u-icon name="jiagebaohu" custom-prefix="custom-icon" color="#1677ff" size="32"></u-icon>
 					<span>充值</span>
 				</view>
@@ -26,26 +27,31 @@
 				</view>
 			</view>
 			<view class="user-cell">
-				<view class="user-cell-item">
+				<view 
+				@click="gotoUrl('pages/user/rechargeList')"
+				
+				class="user-cell-item">
 					<view class="user-cell-title">
 						<u-icon name="jiagebaohu" custom-prefix="custom-icon" color="#1677ff" size="32"></u-icon>
 						<span>充值记录</span>
 					</view>
 					<view class="user-cell-value"></view>
 				</view>
-				<view class="user-cell-item">
+				<view 
+				@click="gotoUrl('pages/charge/chargeList')"
+				class="user-cell-item">
 					<view class="user-cell-title">
 						<u-icon name="shoujichongdian" custom-prefix="custom-icon" color="#1677ff" size="32"></u-icon>
 						<span>充电记录</span>
 					</view>
 					<view class="user-cell-value"></view>
 				</view>
-				<view class="user-cell-item">
+				<view class="user-cell-item" @click="phone()">
 					<view class="user-cell-title">
 						<u-icon name="kefu" custom-prefix="custom-icon" color="#1677ff" size="32"></u-icon>
 						<span>我的客服</span>
 					</view>
-					<view class="user-cell-value">400-8899-619</view>
+					<view class="user-cell-value">{{tel}}</view>
 				</view>
 				<view class="user-cell-item">
 					<view class="user-cell-title">
@@ -56,47 +62,35 @@
 				</view>
 			</view>
 		</view>
-		<u-tabbar v-model="current" :list="tabbarList" :mid-button="true" active-color="#1677ff"></u-tabbar>
-	</view>
+			<Tabbar :current="2" ></Tabbar>
+ 	</view>
 </template>
 
 <script>
+	import Tabbar from '@/components/Tabbar.vue'
+	
 	export default {
 		data() {
 			return {
+				src:'',
+				tel:'400-8899-619',
 				background: {
 					backgroundColor: '#1677ff',
 				},
-				tabbarList: [{
-						iconPath: "motuoche-diandongche",
-						selectedIconPath: "motuoche-diandongche",
-						text: '充电',
-						count: 0,
-						isDot: true,
-						customIcon: true,
-					},
-					{
-						iconPath: "/static/img/min_button_select.png",
-						selectedIconPath: "/static/img/min_button_select.png",
-						text: '充电中',
-						midButton: true,
-						customIcon: true,
-					},
-					{
-						iconPath: "31wode",
-						selectedIconPath: "31wode",
-						text: '我的',
-						count: 0,
-						isDot: false,
-						customIcon: true,
-					},
-				],
-				current: 0
+				
 			}
 		},
 		methods: {
-
-		}
+			phone( ){
+				uni.makePhoneCall({
+				    phoneNumber:this.tel //仅为示例
+				});
+			}
+		},
+		components: {
+			Tabbar
+			
+		},
 	}
 </script>
 

+ 8 - 2
pages/user/recharge.vue

@@ -7,7 +7,9 @@
 				<p>账单余额(元)</p>
 				<h1>0.00</h1>
 			</view>
-			<view class="recharge-btn">
+			<view 
+			 @click="gotoUrl('pages/user/rechargeList')"
+			class="recharge-btn">
 				账单
 			</view>
 		</view>
@@ -22,7 +24,8 @@
 				<view class="chargeMain-item"><p>100元</p> <span>赠20元</span></view>
 			</view>
 		</view>
-		<view class="charge">
+		<view style=" padding-bottom: 120px; ">
+			<view class="charge">
 			<view class="chargeRadio">
 				<view class="u-flex">
 					<u-icon name="weixinzhifu" custom-prefix="custom-icon" color="#22ac38" size="80"></u-icon>
@@ -36,6 +39,9 @@
 				</u-radio-group>
 			</view>
 		</view>
+			
+		</view>
+		
 		<view class="foot-btn">
 			<view class="foot-pirce">
 				<u-icon name="tikuan" custom-prefix="custom-icon" color="#FF9502" size="48"></u-icon>