Browse Source

接口对接

lilei 4 years ago
parent
commit
10fc539e5f
3 changed files with 36 additions and 14 deletions
  1. 1 1
      App.vue
  2. 15 2
      pages/tdRecord/tdRecord.vue
  3. 20 11
      pages/userAuth/userAuth.vue

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	// const uat_URL = 'https://lese.test.sxzxyj.net/gc-channel/' // 预发布
-	const uat_URL = 'http://192.168.16.134:8303/gc-channel/' // 本地
+	const uat_URL = 'http://192.168.16.104:8303/gc-channel/' // 本地
 	const pro_URL = 'https://lese.sxzxyj.net/gc-channel/'  // 生产
 	const buildType = 1 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 15 - 2
pages/tdRecord/tdRecord.vue

@@ -11,8 +11,8 @@
 				<view class="list-time">{{item.deliveryTime}}</view>
 				<view class="list-cons">
 					<view class="list-imgs">
-						<u-image width="80rpx" height="80rpx" src="/static/GLASS.png"></u-image>
-						<view class="cls-names">废旧金属/塑料</view>
+						<u-image width="80rpx" height="80rpx" :src="`/static/${item.rubbishType}.png`"></u-image>
+						<view class="cls-names">{{getRbt(item.rubbishType,'dispName')}}</view>
 					</view>
 					<view class="list-md">
 						<view>
@@ -54,9 +54,22 @@
 				listdata: [],
 				noDataText: '暂无数据',  //  列表请求状态提示语
 				status: 'loadmore',  //  加载中状态
+				rubbishType: []
 			}
 		},
+		onLoad() {
+			this.rubbishType = this.$store.state.vuex_rubbishType
+		},
+		onShow() {
+			this.openScreen = false  //  关闭筛选框
+			this.refresh({})
+		},
 		methods: {
+			// 获取对应的投递类型
+			getRbt(code,key){
+				let row = this.rubbishType.find(item => item.rubbishType == code)
+				return row[key]
+			},
 			// 获取查询参数 刷新列表
 			refresh(params){
 				this.searchForm = params

+ 20 - 11
pages/userAuth/userAuth.vue

@@ -119,14 +119,18 @@
 				}
 				return Math.floor(ret)
 			},
+			// 称重结果
 			balanceData() {
 				this.cancel()
-				
-				let data = this.$store.state.vuex_balanceData
+				let _this = this
+				let data = _this.$store.state.vuex_balanceData
 				console.log(data)
+				
+				// 解析结果
 				let weight = data.split(',')[2]
-				let uit = ''
-				let fh = ''
+				let uit = '' // 单位
+				let fh = '' // 正负符号
+				// 去掉换行符
 				weight = weight.replace('\n','')
 				
 				// 符号位
@@ -155,13 +159,14 @@
 					uit = 'g'
 				}
 				
-				console.log(weight,uit,fh,'weight end')
-				this.formData.rubbishWeight = weight
+				// console.log(weight,uit,fh,'weight end')
+				_this.formData.rubbishWeight = weight
 				return fh + weight
 			}
 		},
 		onLoad(options) {
 			let _this = this
+			// 设备id,去掉冒号并转小写
 			this.deviceId = options.deviceId.toLowerCase()
 			this.deviceId = this.deviceId.replace(/:/g,'')
 			
@@ -246,7 +251,7 @@
 				}
 				
 				this.loading = true
-				// 查询用户余额
+				// 查询用户乐豆余额
 				queryldByMobile({mobile: this.formData.customerMobile}).then(res => {
 					if(res.status == 200){
 						this.current = this.current + 1
@@ -255,9 +260,11 @@
 					this.loading = false
 				})
 			},
+			// 上一步
 			prev(){
 				this.current = this.current - 1
 			},
+			// 提交保存结果
 			submit(){
 				let that = this
 				console.log(this.formData.rubbishWeight,'this.formData.rubbishWeight')
@@ -268,14 +275,14 @@
 					})
 					return
 				}
-				// 判断设备仍然连接中
+				// 判断设备蓝牙是否仍然连接中
 				uni.getBluetoothDevices({
 				  success(res) {
 					let has = res.devices.find(item => {
 						let deviceId = item.deviceId.toLowerCase()
 						return deviceId.replace(/:/g,'') == that.deviceId
 					})
-					console.log(has,'判断设备仍然连接中')
+					// console.log(has,'判断设备仍然连接中')
 					if(that.blueConnect && has){
 						that.showOk = true
 						that.modelContent = `
@@ -300,7 +307,9 @@
 				console.log(this.formData,'formData')
 				saveDelivery(this.formData).then(res => {
 					if(res.status == 200){
-						uni.navigateBack()
+						setTimeout(()=>{
+							uni.navigateBack()
+						},500)
 					}
 					uni.showToast({
 						icon: 'none',
@@ -365,7 +374,7 @@
 		> view{
 			width: 46%;
 			border: 1px solid #eee;
-			margin: 10rpx 0;
+			margin: 10rpx;
 			padding: 10rpx 20rpx;
 			border-radius: 8rpx;
 			display: flex;