Browse Source

bug 新增

lilei 4 years ago
parent
commit
8b73fe85af
3 changed files with 98 additions and 33 deletions
  1. 45 13
      pages/index/index.vue
  2. 3 2
      pages/tdRecord/tdRecord.vue
  3. 50 18
      pages/userAuth/userAuth.vue

+ 45 - 13
pages/index/index.vue

@@ -1,5 +1,6 @@
 <template>
 	<view class="content">
+		<view @click="toTdRecord" class="tdrecord">投递记录</view>
 		<view class="cz-box" @click="toWork">
 			<view :class="loading?'turn':''">
 				<u-image width="100rpx" height="100rpx" src="/static/chengzhong.png"></u-image>
@@ -56,32 +57,49 @@
 			uni.$off('blueReConnect')
 		},
 		methods: {
+			// 查看投递记录
+			toTdRecord(){
+				uni.navigateTo({
+					url: '/pages/tdRecord/tdRecord'
+				})
+			},
 			// 去认证用户并开始称重
 			toWork(){
 				let _this = this
 				// 连接成功
 				if(this.connectStatus){
-					uni.navigateTo({
-						url: '/pages/userAuth/userAuth?deviceId=' + this.deviceId
-					})
-				}else{
-					let hasDev = this.deviceList.length
 					uni.showModal({
 						title:'提示',
-						content:hasDev ? '请先连接设备':'请先绑定设备',
-						confirmText: hasDev ? '确定':'去绑定',
+						content:'请检查物品是否已经放在电子秤上?',
 						complete(e) {
 							console.log(e)
 							if(e.confirm){
-								if(hasDev == 1){
-									_this.connectBlue(_this.deviceList[0])
-								}
-								if(hasDev == 0){
-									_this.toInit()
-								}
+								 uni.navigateTo({
+								 	url: '/pages/userAuth/userAuth?deviceId=' + _this.deviceId
+								 })
 							}
 						}
 					})
+				}else{
+					let hasDev = this.deviceList.length
+					if(!this.loading){
+						uni.showModal({
+							title:'提示',
+							content:hasDev ? '请先连接设备':'请先绑定设备',
+							confirmText: hasDev ? '确定':'去绑定',
+							complete(e) {
+								console.log(e)
+								if(e.confirm){
+									if(hasDev == 1){
+										_this.connectBlue(_this.deviceList[0])
+									}
+									if(hasDev == 0){
+										_this.toInit()
+									}
+								}
+							}
+						})
+					}
 				}
 			},
 			// 初始化蓝牙
@@ -173,6 +191,9 @@
 			},
 			// 连接蓝牙设备
 			connectBlue(item){
+				if(this.loading){
+					return
+				}
 				if(item){
 					this.deviceId = item.deviceId
 				}
@@ -411,6 +432,17 @@
 		background-image: radial-gradient( #2ab4e5 0%, #0081c1 100%);
 		height: 100vh;
 		width: 100%;
+		position: relative;
+	}
+	.tdrecord{
+		position: absolute;
+		right: 0;
+		top: 5%;
+		background: rgba(255,255,255,0.8);
+		border-radius: 150rpx 0 0 150rpx;
+		box-shadow: 2rpx 2rpx 6rpx rgba(0,0,0,0.4);
+		padding: 15rpx 20rpx 15rpx 30rpx;
+		font-size: 26rpx;
 	}
 	.cz-box{
 		text-align: center;

+ 3 - 2
pages/tdRecord/tdRecord.vue

@@ -2,9 +2,9 @@
 	<view class="content">
 		<!-- 筛选弹框 -->
 		<search-modal v-if="openScreen" :visible="openScreen" :defaultParams="searchForm" @refresh="refresh" @close="openScreen=false"></search-modal>
-		<view class="page-head">
+		<view class="page-head" @click="openScreen=true">
 			<text>筛选</text>
-			<image class="filter-icon" src="@/static/filter.png" @tap="openScreen=true"></image>
+			<image class="filter-icon" src="@/static/filter.png"></image>
 		</view>
 		<scroll-view class="list" scroll-y :scroll-top="scrollTop" @scrolltolower="onreachBottom">
 			<view class="list-box" v-for="item in 12" :key="item">
@@ -110,6 +110,7 @@
 		margin-bottom: 20rpx;
 		.list-time{
 			font-size: 28rpx;
+			color: #666666;
 		}
 		.list-cons{
 			display: flex;

+ 50 - 18
pages/userAuth/userAuth.vue

@@ -17,19 +17,7 @@
 			<view class="form-row">
 				<view><text class="red">*</text>投递类型</view>
 				<view class="form-grid">
-					<view class="active">
-						<view>废旧纸张</view>
-						<view class="texts">200g/1乐豆</view>
-					</view>
-					<view>
-						<view>废旧纸张</view>
-						<view class="texts">200g/1乐豆</view>
-					</view>
-					<view>
-						<view>废旧纸张</view>
-						<view class="texts">200g/1乐豆</view>
-					</view>
-					<view>
+					<view :class="item==0?'active':''" v-for="item in 8" :key="item">
 						<view>废旧纸张</view>
 						<view class="texts">200g/1乐豆</view>
 					</view>
@@ -43,7 +31,7 @@
 			</view>
 			<view class="form-row form-flex">
 				<view>用户乐豆余额</view>
-				<view><text>560</text></view>
+				<view class="flex-row"><text>560</text><u-image width="30rpx" height="30rpx" src="/static/ledou.png"></u-image></view>
 			</view>
 			<view class="form-row form-flex">
 				<view>投递类型</view>
@@ -58,7 +46,7 @@
 			</view>
 			<view class="form-row form-flex">
 				<view>可兑换乐豆数</view>
-				<view><text class="nums">10</text></view>
+				<view class="flex-row"><text class="nums">10</text><u-image width="30rpx" height="30rpx" src="/static/ledou.png"></u-image></view>
 			</view>
 		</view>
 		<view class="buttons">
@@ -67,6 +55,15 @@
 			<view v-if="current==1"><u-button shape="circle" @click="submit()" :custom-style="customStyle" type="primary">提交</u-button></view>
 		</view>
 		
+		<!-- 注意事项 -->
+		<view class="notes">
+			<view>注意事项:</view>
+			<view>
+				<view>1.请等待电子秤数据稳定后,再点击提交按钮</view>
+				<view>2.提交数据时,请仔细检查投递重量是否正确</view>
+				<view>3.下次称重时,记得将上次称重的物品取下,避免重发提交数据</view>
+			</view>
+		</view>
 		<!-- 提交确认弹框 -->
 		<u-modal v-model="showOk" :duration="50" show-cancel-button @confirm="confirm" @cancel="cancel">
 			<view class="slot-content">
@@ -94,7 +91,8 @@
 				formData:{
 					address: '',
 					phone: '',
-					washType: '0'
+					washType: '0',
+					washWeight:0
 				},
 				blueConnect: true,
 				deviceId: null
@@ -102,8 +100,10 @@
 		},
 		computed: {
 			balanceData() {
+				this.cancel()
+				
 				let data = this.$store.state.vuex_balanceData
-				console.log(data.split(','))
+				console.log(data)
 				let weight = data.split(',')[2]
 				let uit = ''
 				let fh = ''
@@ -134,7 +134,9 @@
 					weight = Number(weight)
 					uit = 'g'
 				}
+				
 				console.log(weight,uit,fh,'weight end')
+				this.washWeight = weight
 				return fh + weight
 			}
 		},
@@ -201,6 +203,14 @@
 			},
 			submit(){
 				let that = this
+				console.log(this.washWeight,'this.washWeight')
+				if(this.washWeight==0){
+					uni.showToast({
+						icon: 'none',
+						title: '投递重量不能是0,请投放称重'
+					})
+					return
+				}
 				// 判断设备仍然连接中
 				uni.getBluetoothDevices({
 				  success(res) {
@@ -242,6 +252,11 @@
 		padding: 40rpx 0;
 		border-bottom: 1px solid #f8f8f8;
 	}
+	.flex-row{
+		display: flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
 	.form-flex{
 		display: flex;
 		align-items: center;
@@ -280,7 +295,7 @@
 		flex-wrap: wrap;
 		justify-content: space-around;
 		> view{
-			width: 45%;
+			width: 30%;
 			border: 1px solid #eee;
 			margin: 20rpx 0;
 			padding: 20rpx;
@@ -311,6 +326,23 @@
 			padding: 0 5%;
 		}
 	}
+	.notes{
+		background: #fff3dc;
+		border:1px solid #efb564;
+		margin-top: 60rpx;
+		border-radius: 10rpx;
+		> view{
+			&:first-child{
+				padding: 20rpx;
+			}
+			&:last-child{
+				padding: 0 20rpx;
+				> view{
+					padding: 10rpx 20rpx;
+				}
+			}
+		}
+	}
 	.slot-content{
 		padding: 25rpx 50rpx 50rpx;
 	}