Browse Source

【增加】ad

程志平 4 years ago
parent
commit
ca354ecae4
6 changed files with 126 additions and 30 deletions
  1. 14 0
      pages.json
  2. 24 10
      pages/jiaofei/jiaofei.css
  3. 23 5
      pages/jiaofei/jiaofei.vue
  4. 26 1
      pages/reshui/reshui.vue
  5. 1 0
      pages/show/show.css
  6. 38 14
      pages/show/show.vue

+ 14 - 0
pages.json

@@ -15,6 +15,13 @@
 			}
 		},
 		{
+			"path": "pages/reshui/ad_reshui",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
 			"path": "pages/recharge/recharge",
 			"style": {
 				"navigationBarTitleText": "热水钱包充值",
@@ -29,6 +36,13 @@
 			}
 		},
 		{
+			"path": "pages/jiaofei/ad_dianfei",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
 			"path": "pages/show/show",
 			"style": {
 				"navigationBarTitleText": "台账管理",

+ 24 - 10
pages/jiaofei/jiaofei.css

@@ -18,11 +18,11 @@ page {
 }
 
 .show-item {
-	margin: 20upx 0;
+	margin: 10upx 0;
 	display: flex;
 	flex-direction: row;
 	background-color: #ffffff;
-	height: 139upx;
+	height: 118upx;
 }
 
 .picker-item-logol {
@@ -34,7 +34,7 @@ page {
 .picker-item-logo-left {
 	width: 58upx;
 	height: 58upx;
-	margin: 41upx 0upx 40upx 0upx;
+	margin: 34upx 0upx 40upx 0upx;
 }
 
 .picker-item-label {
@@ -42,7 +42,7 @@ page {
 	width: 161upx;
 	height: 30upx;
 	line-height: 30upx;
-	margin: 52upx 0upx 52upx 0upx;
+	margin: 48upx 0upx 52upx 0upx;
 	display: flex;
 	justify-content: center;
 }
@@ -52,7 +52,7 @@ page {
 	height: 30upx;
 	line-height: 30upx;
 	font-size: 36upx;
-	margin: 52upx 0upx 46upx 60upx;
+	margin: 48upx 0upx 46upx 60upx;
 	display: flex;
 	justify-content: flex-start;
 	color: #999999;
@@ -89,7 +89,7 @@ page {
 }
 
 .add-money {
-	height: 365upx;
+	height: 340upx;
 	display: flex;
 	flex-direction: column;
 }
@@ -131,8 +131,8 @@ page {
 }
 
 .input-money {
-	height: 139upx;
-	font-size: 38upx;
+	height: 98upx;
+	font-size: 32upx;
 	font-weight: bold;
 	color: #333333;
 	margin-left: 29upx;
@@ -143,7 +143,7 @@ page {
 }
 
 .submit-item {
-	margin: 54upx 30upx 0upx 30upx;
+	margin: 20upx 30upx 0upx 30upx;
 	width: 690upx;
 	height: 96upx;
 
@@ -161,10 +161,24 @@ page {
 .change-show {
 	width: 120upx;
 	font-size: 30upx;
-	margin: 47upx 316upx;
+	margin: 30upx 316upx;
 	color: #1296DB;
 }
 
+.jine {
+	height: 98rpx;
+}
+
+.ad {
+	width: 750rpx;
+	height: 194rpx;
+}
+
+.ad_img {
+	width: 100%;
+	height: 100%;
+}
+
 .bg-color {
 	background-color: #1296DB;
 	color: #ffffff;

+ 23 - 5
pages/jiaofei/jiaofei.vue

@@ -51,7 +51,7 @@
 				</view>
 			</view>
 		</view>
-		<view class="show-item">
+		<view class="show-item jine">
 			<input type="number" class="input-money" maxlength="4" placeholder="请输入金额(10-200)"
 				placeholder-class="input-ph-color" v-model:value="amount" @input="onInput" @blur="onBlur" />
 		</view>
@@ -61,6 +61,9 @@
 		<view class="change-show" @tap="navigateToShow">
 			台账管理
 		</view>
+		<view class="ad">
+			<image src="../../static/image/ad_dianfei.png" mode="aspectFit" class="ad_img" @tap="ad_redirect"></image>
+		</view>
 	</view>
 </template>
 
@@ -98,13 +101,21 @@
 		},
 		methods: {
 			/**
+			 * 跳转到ad页面
+			 */
+			ad_redirect() {
+				uni.navigateTo({
+					url: 'ad_dianfei'
+				})
+			},
+			/**
 			 * 获取基本信息
 			 */
 			get_base_info(options, param) {
 				try {
 					// 获取学号
 					this.stu_number = this.$store.state.userInfo.card_number
-					
+
 					if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
 						if (userinfo) {
@@ -167,7 +178,7 @@
 								title: res.errMsg,
 								icon: 'none'
 							});
-							
+
 							// 跳转到首页
 							uni.redirectTo({
 								url: '../index/index?from=0'
@@ -219,11 +230,11 @@
 					} else if (res.data.mess == '未查询到用户信息') {
 						// 数据库中 未查询到用户信息,就清除本地存储
 						uni.removeStorageSync('userinfo_storage_key');
-						
+
 						uni.showToast({
 							title: '获取用户信息失败!'
 						})
-						
+
 						// 跳转到首页
 						if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
 							uni.navigateTo({
@@ -296,6 +307,13 @@
 
 			//跳转到台账页面
 			navigateToShow(e) {
+				if (this.roomSelect == '请选择宿舍号') {
+					uni.showToast({
+						title: '请选择宿舍号',
+						icon: 'success'
+					})
+					return
+				}
 				uni.navigateTo({
 					url: '../show/show',
 				});

+ 26 - 1
pages/reshui/reshui.vue

@@ -39,6 +39,9 @@
 			<view class="start_up_process">
 				<uni-steps :options="list1" :active-color="colorPrimary" :active="active" />
 			</view>
+			<view class="ad">
+				<image src="../../static/image/ad_reshui.png" mode="aspectFit" class="ad_img" @tap="ad_redirect"></image>
+			</view>
 			<view class="title">
 				消费记录
 			</view>
@@ -181,7 +184,18 @@
 			}
 		},
 		methods: {
-			// 保留小数点数值后两位,尾数四舍五入
+			/**
+			 * 跳转到广告ad页
+			 */
+			ad_redirect() {
+				uni.navigateTo({
+					url: 'ad_reshui'
+				})
+			},
+			/**
+			 * 保留小数点数值后两位,尾数四舍五入
+			 * @param {Object} value
+			 */ 
 			numFilter(value) {
 				// 截取当前数据到小数点后两位
 				let realVal = parseFloat(value).toFixed(2)
@@ -1389,6 +1403,17 @@
 				padding: 20rpx 0;
 				color: #007AFF;
 			}
+			
+			.ad {
+				margin: 0 -40rpx;
+				width: 750rpx;
+				height: 216rpx;
+				
+				.ad_img {
+					height: 100%;
+					width: 100%;
+				}
+			}
 
 			.title {
 				height: 100rpx;

+ 1 - 0
pages/show/show.css

@@ -53,6 +53,7 @@ page {
 	/* padding-bottom: 40upx; */
 	height: 160upx;
 	display: flex;
+	justify-content: space-around;
 	align-items: center;
 }
 

+ 38 - 14
pages/show/show.vue

@@ -12,7 +12,8 @@
 					tooltipFormat="tooltipDemo1" />
 			</view>
 			<view class="select-show">
-				<button class="first-button">月</button>
+				<button class="first-button" @tap="getEnergyConsumption('day')">日</button>
+				<button class="first-button" @tap="getEnergyConsumption('month')">月</button>
 			</view>
 		</view>
 		<view class="show-item-date">
@@ -105,7 +106,7 @@
 				// console.log(this.stu_number);
 				// console.log(this.roomSelect);
 				// 能耗记录
-				this.get_nenghaojilu()
+				this.getEnergyConsumption('month')
 				// 缴费记录
 				this.get_jiaofeijilu()
 			} catch (e) {
@@ -114,6 +115,13 @@
 		},
 		methods: {
 			/**
+			 * 按日、月获取能耗
+			 */
+			getEnergyConsumption(dayOrMonth) {
+				// 按日、月显示能耗
+				this.get_nenghaojilu(dayOrMonth)
+			},
+			/**
 			 * 获取选择日期
 			 */
 			bindDateChange: function(e) {
@@ -168,19 +176,35 @@
 			/**
 			 * 能耗记录
 			 */
-			async get_nenghaojilu() {
+			async get_nenghaojilu(dayOrMonth) {
+				// console.log(this.roomSelect);
 				if (this.roomSelect != '' && typeof(this.roomSelect) != 'undefined') {
-					const res = await this.$myRequest({
-						host: this.ceshi,
-						url: '/HotWaters/buildgetMonthBill.action',
-						method: 'POST',
-						header: {
-							'content-type': 'application/x-www-form-urlencoded'
-						},
-						data: {
-							'roomSelect': this.roomSelect
-						}
-					})
+					let res = null;
+					if (dayOrMonth == 'day') {
+						res = await this.$myRequest({
+							host: this.ceshi,
+							url: '/HotWaters/buildgetDayBill.action',
+							method: 'POST',
+							header: {
+								'content-type': 'application/x-www-form-urlencoded'
+							},
+							data: {
+								'roomSelect': this.roomSelect
+							}
+						})
+					} else {
+						res = await this.$myRequest({
+							host: this.ceshi,
+							url: '/HotWaters/buildgetMonthBill.action',
+							method: 'POST',
+							header: {
+								'content-type': 'application/x-www-form-urlencoded'
+							},
+							data: {
+								'roomSelect': this.roomSelect
+							}
+						})
+					}
 
 					// console.log(res);
 					if (res.data.mess == '未查询到数据') {