瀏覽代碼

Merge branch 'test' of git.echepei.com:sailun/sailun-tbr-web into test

qukaidi 4 年之前
父節點
當前提交
a2e12189fc
共有 4 個文件被更改,包括 110 次插入37 次删除
  1. 18 1
      common/request/request.js
  2. 42 15
      pages/home/scancode/index.vue
  3. 47 18
      pages/home/scancode/scancodeout.vue
  4. 3 3
      pages/me/scancodequery/result.vue

+ 18 - 1
common/request/request.js

@@ -37,13 +37,30 @@ export function request(config) {
 	    console.log('err' + error)
 	    let { message } = error;
 	    if (message == "Network Error") {
-	      message = "后端接口连接异常";
+	      message = "系统接口连接异常";
+		  uni.showToast({
+		  	icon: 'none',
+		  	title: message,
+		  	position: "bottom"
+		  })
 	    }
 	    else if (message.includes("timeout")) {
 	      message = "系统接口请求超时";
+		  uni.showToast({
+		  	icon: 'none',
+		  	title: message,
+		  	position: "bottom"
+		  })
 	    }
 	    else if (message.includes("Request failed with status code")) {
 	      message = "系统接口" + message.substr(message.length - 3) + "异常";
+		  
+		  uni.showToast({
+		  	icon: 'none',
+		  	title: message,
+		  	position: "bottom"
+		  })
+		  
 	    }
 		console.log(message)
 	    return Promise.reject(error)

+ 42 - 15
pages/home/scancode/index.vue

@@ -152,6 +152,8 @@
 				console.log(res.errCode);
 			});
 			this.coord = ''
+		},
+		onShow(){
 			this.mounteds()
 		},
 		methods: {
@@ -162,8 +164,7 @@
 					geocode: true,
 					success: function(res) {
 						console.log(res)
-						this.addd = res
-						that.tishi(that.coord, res)
+						that.tishi(res)
 					},
 					fail: function(e) {
 						uni.showToast({
@@ -173,10 +174,10 @@
 					}
 				})
 			},
-			async tishi(x, res) {
+			async tishi(res) {
 				console.log(res)
 				let this_ = this
-				this_.coord = x
+				this_.baidu = res
 				qqmapsdk.reverseGeocoder({
 					location: {
 						latitude: res.latitude,
@@ -185,33 +186,59 @@
 					success(res) {
 						var newCity = ''
 						// 取到用户的定位地址,赋值传递出去
-						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component.city + res.result.formatted_addresses.recommend
-							console.log(res)
-						this_.addreev(res,aress)
+						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component
+							.city + res.result.formatted_addresses.recommend
+						request({
+							url: '/baseReq/getBaiDuMapMsg',
+							method: 'get',
+							params: {
+								longitude: this_.baidu.longitude,
+								latitude: this_.baidu.latitude
+							}
+						}).then(res => {
+							console.log(res.data.data.result)
+							console.log(res.data)
+							if(res.data.code != 0){
+								uni.showToast({
+									icon: 'none',
+									title: '获取定位失败,请稍后再试~'
+								})
+							}else{
+								this_.baidu = res.data.data.result
+								this_.addreev(this_.baidu, aress)
+							}
+						}).catch(err => {
+							console.log(err)
+							uni.showToast({
+								icon: 'none',
+								title: '网络繁忙请稍后再试~'
+							})
+						}).finally(() => {
+							// Loading.close()
+						})
 					}
 				})
 			},
-			async addreev(res,x) {
+			async addreev(res, x) {
 				this.address = x
-				this.addd = res.result.location
-				console.log(this.addd)
+				this.degree = res
+				console.log(res)
+				console.log(x)
 			},
 			//手动录入调用
 			manualentry() {
-				console.log(this.coord)
-				console.log(this.address)
 				if (this.number_a.length != 0) {
 					request({
 							url: '/storeScan/storeScanGetTyre',
 							method: 'Post',
-							data:{
+							data: {
 								storeId: this.$store.state.storeInfo.storeId,
 								userId: this.$store.state.storeInfo.userId,
 								tyreNum: this.number_a,
 								scanType: 1,
 								scanWay: 0,
-								longitude: this.addd.lng,
-								latitude: this.addd.lat,
+								longitude: this.degree.x,
+								latitude: this.degree.y,
 								scanAddress: this.address
 							}
 						}).then(res => {

+ 47 - 18
pages/home/scancode/scancodeout.vue

@@ -12,7 +12,7 @@
 				</view>
 				<view class="lnput" v-if="show==false">
 					<input type="text" v-model="number_a" :placeholder="content" clearable="true" focus="true" />
-					<u-button type="primary" size="medium" @click="manualentry" >确认录入</u-button>
+					<u-button type="primary" size="medium" @click="manualentry">确认录入</u-button>
 				</view>
 				<view class="" v-else>
 					<view>{{tips}}:{{number}}</view>
@@ -103,7 +103,7 @@
 				point: '',
 				coord: '',
 				address: '',
-				addd:''
+				addd: ''
 			}
 		},
 		onBackPress(options) {
@@ -152,6 +152,8 @@
 				console.log(res.errCode);
 			});
 			this.coord = ''
+		},
+		onShow(){
 			this.mounteds()
 		},
 		methods: {
@@ -162,8 +164,7 @@
 					geocode: true,
 					success: function(res) {
 						console.log(res)
-						this.addd = res
-						that.tishi(that.coord, res)
+						that.tishi(res)
 					},
 					fail: function(e) {
 						uni.showToast({
@@ -173,10 +174,10 @@
 					}
 				})
 			},
-			async tishi(x, res) {
+			async tishi(res) {
 				console.log(res)
 				let this_ = this
-				this_.coord = x
+				this_.baidu = res
 				qqmapsdk.reverseGeocoder({
 					location: {
 						latitude: res.latitude,
@@ -187,31 +188,57 @@
 						// 取到用户的定位地址,赋值传递出去
 						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component
 							.city + res.result.formatted_addresses.recommend
-						this_.addreev(res,aress)
+						request({
+							url: '/baseReq/getBaiDuMapMsg',
+							method: 'get',
+							params: {
+								longitude: this_.baidu.longitude,
+								latitude: this_.baidu.latitude
+							}
+						}).then(res => {
+							console.log(res.data.data.result)
+							console.log(res.data)
+							if(res.data.code != 0){
+								uni.showToast({
+									icon: 'none',
+									title: '获取定位失败,请稍后再试~'
+								})
+							}else{
+								this_.baidu = res.data.data.result
+								this_.addreev(this_.baidu, aress)
+							}
+						}).catch(err => {
+							console.log(err)
+							uni.showToast({
+								icon: 'none',
+								title: '网络繁忙请稍后再试~'
+							})
+						}).finally(() => {
+							// Loading.close()
+						})
 					}
 				})
 			},
-			async addreev(res,x) {
+			async addreev(res, x) {
 				this.address = x
-				this.addd = res.result.location
-				console.log(this.addd)
+				this.degree = res
+				console.log(res)
+				console.log(x)
 			},
 			//手动录入调用
 			manualentry() {
-				console.log(this.coord)
-				console.log(this.address)
 				if (this.number_a.length != 0) {
 					request({
 							url: '/storeScan/storeScanGetTyre',
 							method: 'Post',
-							data:{
+							data: {
 								storeId: this.$store.state.storeInfo.storeId,
 								userId: this.$store.state.storeInfo.userId,
 								tyreNum: this.number_a,
 								scanType: 2,
 								scanWay: 0,
-								longitude: this.addd.lng,
-								latitude: this.addd.lat,
+								longitude: this.degree.x,
+								latitude: this.degree.y,
 								scanAddress: this.address
 							}
 						}).then(res => {
@@ -463,7 +490,7 @@
 						}
 						// console.log(this.lisi)
 					}).catch(err => {
-						if (err.code == 400) {//谁给我删了......
+						if (err.code == 400) { //谁给我删了......
 							this.$refs.repeat.show({
 								title: "无网络",
 								type: 'default',
@@ -527,6 +554,7 @@
 				this.lisi.splice(index, 1)
 			},
 			scancodein() {
+				console.log("1111")
 				if (this.lisi == '') {
 					this.$refs.repeat.show({
 						title: '请扫码或录入后再点击!',
@@ -534,9 +562,10 @@
 						position: 'bottom'
 					})
 				} else {
+					console.log("1111")
 					this.$u.route({
 						type: 'redirectTo',
-						url: 'pages/home/Scan-code-in/index'
+						url: 'pages/home/Scan-code-out/index'
 					})
 					uni.$emit('update', {
 						materialList: this.lisi
@@ -678,4 +707,4 @@
 		width: 100%;
 		background-color: #0095FF;
 	}
-</style>
+</style>

+ 3 - 3
pages/me/scancodequery/result.vue

@@ -32,8 +32,8 @@
 					<view><text>轮胎规格</text><text>{{Information.specification}}</text></view>
 					<view><text>操作类型</text><text>{{Information.mouldInType}}</text></view>
 					<view><text>操作时间</text><text>{{Information.mouldInTime}}</text></view>
-					<view><text>操作类型</text><text>{{Information.mouldOutType}}</text></view>
-					<view><text>操作时间</text><text>{{Information.mouldOutTime}}</text></view>
+					<view v-if="Information.mouldOutType != null "><text>操作类型</text><text>{{Information.mouldOutType}}</text></view>
+					<view v-if="Information.mouldOutTime != null "><text>操作时间</text><text>{{Information.mouldOutTime}}</text></view>
 				</view>
 				<view v-else style="margin-top: 100rpx;margin-bottom: 100rpx;">
 					<u-empty :text="text" mode="list"></u-empty>
@@ -163,7 +163,7 @@
 						this.empty = false
 						this.show_s = false
 						this.Information = res.data.data
-						
+						this.number = ''
 					} else if (res.data.code == 500) {
 						this.empty = true
 						this.show_s = true