Parcourir la source

Merge branch 'master' of https://e.coding.net/chuanghaikeji/moxuanyunshangwaimai/moxuan_takeaway_qishou

xiaoxin il y a 10 mois
Parent
commit
cdc850f34f
3 fichiers modifiés avec 181 ajouts et 73 suppressions
  1. 88 2
      common/httpRequest.js
  2. 30 28
      pages/index/index.vue
  3. 63 43
      pages/index/luma.vue

+ 88 - 2
common/httpRequest.js

@@ -199,6 +199,7 @@ module.exports = {
 			})
 		}
 	},
+	
 
 	postJson: function(url, data, header) {
 		if(ifShangxian==1){
@@ -285,6 +286,91 @@ module.exports = {
 			})
 		}
 	},
+	putJson: function(url, data, header) {
+		if(ifShangxian==1){
+			if(data){
+				var a=JSON.stringify(data)
+				data='"' + urlSafeBase64Encode(encrypt(a)) + '"'
+			}else{
+			}
+		}
+		header = header || "application/json";
+		url = this.config("APIHOST1") + url;
+		// let token = uni.getStorageSync("token");
+		// console.log(token,'参数')
+		let token = uni.getStorageSync("token");
+		if (token) {
+			return new Promise((succ, error) => {
+				uni.request({
+					url: url,
+					data: data,
+					method: "PUT",
+					header: {
+						"content-type": header,
+						"token": token
+					},
+					success: function(result) {
+						// var jie="tXquWL6DiEMzcgrDG-GyedlovPRtnTra4C69Mc1gPdZb7CZ1SzqGcDLa4Fjrw48f"
+						// console.log('结果',decrypt(urlSafeBase64Decode(jie)))
+						if(ifShangxian==1){
+							const decryptData =decrypt(urlSafeBase64Decode(result.data))
+							result.data=JSON.parse(decryptData)
+						}
+						if (result.data.code == 401 && token) {
+							uni.removeStorageSync("token")
+							uni.removeStorageSync("userId")
+							uni.removeStorageSync("phone")
+							uni.removeStorageSync("openid")
+							uni.removeStorageSync("userName")
+							uni.removeStorageSync("relation")
+							uni.removeStorageSync("relation_id")
+							uni.removeStorageSync("isInvitation")
+							uni.removeStorageSync("zhiFuBao")
+							uni.removeStorageSync("zhiFuBaoName")
+	
+							uni.showModal({
+								title: '提示',
+								content: '用户信息失效,请重新登录!',
+								showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
+								success: function(res) {
+									if (res.confirm) {
+										uni.redirectTo({
+											url: '/pages/login/login'
+										})
+									}
+								}
+							});
+						}
+						succ.call(self, result.data)
+					},
+					fail: function(e) {
+						error.call(self, e)
+					}
+				})
+			})
+		} else {
+			return new Promise((succ, error) => {
+				uni.request({
+					url: url,
+					data: data,
+					method: "PUT",
+					header: {
+						"content-type": header,
+					},
+					success: function(result) {
+						if(ifShangxian==1){
+							const decryptData =decrypt(urlSafeBase64Decode(result.data))
+							result.data=JSON.parse(decryptData)
+						}
+						succ.call(self, result.data)
+					},
+					fail: function(e) {
+						error.call(self, e)
+					}
+				})
+			})
+		}
+	},
 	putT: function(url, data, header) {
 		if(ifShangxian==1){
 			if(data){
@@ -422,8 +508,8 @@ module.exports = {
 						"token": token
 					},
 					success: function(result) {
-						// var jie="VoOvrGkObjpwTxh9fnFHWLZa4RM1RG34gaxRoGoPmoG2fl8iJmTFqAYeA8_KoWVfwy94Je0aw_uTqgBxRgbs6Q=="
-						// console.log('解密结果',decrypt(urlSafeBase64Decode(jie)))
+						// var jie="tXquWL6DiEMzcgrDG-GyedlovPRtnTra4C69Mc1gPdZb7CZ1SzqGcDLa4Fjrw48f"
+						// console.log('结果',decrypt(urlSafeBase64Decode(jie)))
 						if(ifShangxian==1){
 							const decryptData =decrypt(urlSafeBase64Decode(result.data))
 							result.data=JSON.parse(decryptData)

+ 30 - 28
pages/index/index.vue

@@ -1531,44 +1531,45 @@ export default {
 				mask: true // 是否显示透明蒙层,防止触摸穿透
 			})
 			var that = this
+			that.list2=[]
 			that.$Request
-				.getT('/app/tbindent/selectTbIndentPage', {
-					page: 1,
-					limit: 10,
-					acquireCode: that.shoudanma
+				.getT(`/app/tbindent/get-by-code/${that.shoudanma}`, {///app/tbindent/selectTbIndentPage
+					// page: 1,
+					// limit: 10,
+					// acquireCode: that.shoudanma
 				})
 				.then((res) => {
 					console.log(res, 'lk')
 					uni.hideLoading()
 					if (res.data) {
-						if (res.data.list.length > 0) {
-							for (var i = 0; i < res.data.list.length; i++) {
-								if (res.data.list[i].distancess > 1000) {
-									res.data.list[i].distancess = Number(res.data.list[i].distancess / 1000).toFixed(2) + 'km'
+						if (res.data.length > 0) {
+							for (var i = 0; i < res.data.length; i++) {
+								if (res.data.distancess > 1000) {
+									res.data.distancess = Number(res.data.distancess / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancess == '0') {
-										res.data.list[i].distancess = '0m'
+									if (res.data.distancess == '0') {
+										res.data.distancess = '0m'
 									} else {
-										res.data.list[i].distancess = Number(res.data.list[i].distancess).toFixed(1) + 'm'
+										res.data.distancess = Number(res.data.distancess).toFixed(1) + 'm'
 									}
 								}
 
-								if (res.data.list[i].distancessd > 1000) {
-									res.data.list[i].distancessd = Number(res.data.list[i].distancessd / 1000).toFixed(2) + 'km'
+								if (res.data.distancessd > 1000) {
+									res.data.distancessd = Number(res.data.distancessd / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancessd == '0') {
-										res.data.list[i].distancessd = '0m'
+									if (res.data.distancessd == '0') {
+										res.data.distancessd = '0m'
 									} else {
-										res.data.list[i].distancessd = Number(res.data.list[i].distancessd).toFixed(1) + 'm'
+										res.data.distancessd = Number(res.data.distancessd).toFixed(1) + 'm'
 									}
 								}
 							}
 						}
 						var saomajie = []
-						saomajie = res.data.list
-						that.list2 = res.data.list
+						saomajie.push(res.data)
+						that.list2.push(res.data)
 						console.log(saomajie, '列表')
-						if (that.list2.length > 0) {
+						// if (that.list2.length > 0) {
 							if (that.list2[0].indentState == '2' || that.list2[0].indentState == '3') {
 								//收单
 								that.shouorder()
@@ -1578,11 +1579,11 @@ export default {
 								that.jiedanNo = true
 								that.shoudanma = ''
 							}
-						} else {
-							// that.saomaPeisong=true
-							that.jiedanNo = true
-							that.shoudanma = ''
-						}
+						// } else {
+						// 	// that.saomaPeisong=true
+						// 	that.jiedanNo = true
+						// 	that.shoudanma = ''
+						// }
 					} else if (res.msg == '当前订单无法接单') {
 						that.jiedanNo = true
 						that.shoudanma = ''
@@ -1616,8 +1617,8 @@ export default {
 			})
 			console.log('用户点击确定')
 			that.$Request
-				.postT('/app/tbindent/orderIndentReceiving', {
-					acquireCode: that.shoudanma
+				.putJson(`/app/tbindent/receive/${that.shoudanma}`, {///app/tbindent/orderIndentReceiving
+					// acquireCode: that.shoudanma
 				})
 				.then((res) => {
 					console.log(res, 'ppp')
@@ -2338,6 +2339,7 @@ export default {
 							}
 						}
 						this.totalCount2 = res.data.totalCount
+						
 						if (this.page2 == 1) {
 							this.list_box = res.data.list
 						} else {
@@ -2525,7 +2527,7 @@ export default {
 			var that = this
 			uni.chooseLocation({
 				success: function (res) {
-					console.log(res)
+					console.log(res,'pgy')
 
 					uni.setStorageSync('dizhi', res)
 					that.quyu = res.name
@@ -2946,7 +2948,7 @@ export default {
 			if (this.shoudanma != '') {
 				console.log('1aaaaa')
 				this.$Request
-					.postJson('/app/tbindent/orderRiderDelivery', {
+					.postJson('/app/tbindent/finish-order', {///app/tbindent/orderRiderDelivery
 						smsTemplateId: that.duanxin[0].id,
 						// indentNumber: that.indentNumber,
 						acquireCode: that.shoudanma

+ 63 - 43
pages/index/luma.vue

@@ -786,7 +786,8 @@ export default {
 
 			saomaPeisong: false,
 			//画板边长默认是屏幕宽度,正方形画布
-			cw: uni.getSystemInfoSync().windowWidth
+			cw: uni.getSystemInfoSync().windowWidth,
+			list2:[]
 		}
 	},
 	onHide() {
@@ -959,42 +960,43 @@ export default {
 				mask: true // 是否显示透明蒙层,防止触摸穿透
 			})
 			var that = this
+			that.list2=[]
 			that.$Request
-				.getT('/app/tbindent/selectTbIndentPage', {
-					page: 1,
-					limit: 10,
-					acquireCode: that.shoudanma
+				.getT(`/app/tbindent/get-by-code/${that.shoudanma}`, {///app/tbindent/selectTbIndentPage
+					// page: 1,
+					// limit: 10,
+					// acquireCode: that.shoudanma
 				})
 				.then((res) => {
 					console.log(res, 'lk')
 					uni.hideLoading()
 					if (res.data) {
-						if (res.data.list.length > 0) {
-							for (var i = 0; i < res.data.list.length; i++) {
-								if (res.data.list[i].distancess > 1000) {
-									res.data.list[i].distancess = Number(res.data.list[i].distancess / 1000).toFixed(2) + 'km'
+						if (res.data.length > 0) {
+							for (var i = 0; i < res.data.length; i++) {
+								if (res.data.distancess > 1000) {
+									res.data.distancess = Number(res.data.distancess / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancess == '0') {
-										res.data.list[i].distancess = '0m'
+									if (res.data.distancess == '0') {
+										res.data.distancess = '0m'
 									} else {
-										res.data.list[i].distancess = Number(res.data.list[i].distancess).toFixed(1) + 'm'
+										res.data.distancess = Number(res.data.distancess).toFixed(1) + 'm'
 									}
 								}
 
-								if (res.data.list[i].distancessd > 1000) {
-									res.data.list[i].distancessd = Number(res.data.list[i].distancessd / 1000).toFixed(2) + 'km'
+								if (res.data.distancessd > 1000) {
+									res.data.distancessd = Number(res.data.distancessd / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancessd == '0') {
-										res.data.list[i].distancessd = '0m'
+									if (res.data.distancessd == '0') {
+										res.data.distancessd = '0m'
 									} else {
-										res.data.list[i].distancessd = Number(res.data.list[i].distancessd).toFixed(1) + 'm'
+										res.data.distancessd = Number(res.data.distancessd).toFixed(1) + 'm'
 									}
 								}
 							}
 						}
 						var saomajie = []
-						saomajie = res.data.list
-						this.list2 = res.data.list
+						saomajie.push(res.data)
+						that.list2.push(res.data)
 						console.log(saomajie, '列表')
 						if (saomajie[0].indentState == '2' || saomajie[0].indentState == '3') {
 							//收单
@@ -1039,52 +1041,69 @@ export default {
 				mask: true // 是否显示透明蒙层,防止触摸穿透
 			})
 			var that = this
+			that.list2=[]
 			var data = {
 				page: that.page2,
 				limit: 10,
 				acquireCode: that.shoudanma
 			}
 			console.log(data, 'data')
+			that.list_box = []
 			that.$Request
-				.getT('/app/tbindent/selectTbIndentPage', {
-					page: that.page2,
-					limit: 10,
-					acquireCode: that.shoudanma
+				.getT(`/app/tbindent/get-by-code/${that.shoudanma}`, {///app/tbindent/selectTbIndentPage
+					// page: that.page2,
+					// limit: 10,
+					// acquireCode: that.shoudanma
 				})
 				.then((res) => {
 					console.log(res, 'lk')
 					uni.hideLoading()
 					if (res.data) {
-						if (res.data.list.length > 0) {
-							for (var i = 0; i < res.data.list.length; i++) {
-								if (res.data.list[i].distancess > 1000) {
-									res.data.list[i].distancess = Number(res.data.list[i].distancess / 1000).toFixed(2) + 'km'
+						if (res.data.length > 0) {
+							for (var i = 0; i < res.data.length; i++) {
+								if (res.data.distancess > 1000) {
+									res.data.distancess = Number(res.data.distancess / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancess == '0') {
-										res.data.list[i].distancess = '0m'
+									if (res.data.distancess == '0') {
+										res.data.distancess = '0m'
 									} else {
-										res.data.list[i].distancess = Number(res.data.list[i].distancess).toFixed(1) + 'm'
+										res.data.distancess = Number(res.data.distancess).toFixed(1) + 'm'
 									}
 								}
 
-								if (res.data.list[i].distancessd > 1000) {
-									res.data.list[i].distancessd = Number(res.data.list[i].distancessd / 1000).toFixed(2) + 'km'
+								if (res.data.distancessd > 1000) {
+									res.data.distancessd = Number(res.data.distancessd / 1000).toFixed(2) + 'km'
 								} else {
-									if (res.data.list[i].distancessd == '0') {
-										res.data.list[i].distancessd = '0m'
+									if (res.data.distancessd == '0') {
+										res.data.distancessd = '0m'
 									} else {
-										res.data.list[i].distancessd = Number(res.data.list[i].distancessd).toFixed(1) + 'm'
+										res.data.distancessd = Number(res.data.distancessd).toFixed(1) + 'm'
 									}
 								}
 							}
 						}
-						that.totalCount2 = res.data.totalCount
-						if (that.page2 == 1) {
-							that.list_box = res.data.list
+						that.totalCount2 = 1//res.data.totalCount
+						// if (that.page2 == 1) {
+							// that.list_box = res.data
+							that.list_box.push(res.data)
+						// } else {
+						// 	that.list_box = that.list_box.concat(res.data)
+						// }
+						console.log('list_box', that.list_box)
+						
+						var saomajie = []
+						saomajie.push(res.data)
+						that.list2.push(res.data)
+						console.log(saomajie, '列表')
+						if (saomajie[0].indentState == '2' || saomajie[0].indentState == '3') {
+							//收单
+							that.bindorder()
+						} else if (saomajie[0].indentState == '4') {
+							that.saomaPeisong = true
 						} else {
-							that.list_box = that.list_box.concat(res.data.list)
+							that.jiedanNo = true
+							that.shoudanma = ''
 						}
-						console.log('list_box', that.list_box)
 					} else if (res.msg == '当前订单无法接单') {
 						this.jiedanNo = true
 					}
@@ -1278,8 +1297,8 @@ export default {
 			})
 			console.log('用户点击确定')
 			that.$Request
-				.postT('/app/tbindent/orderIndentReceiving', {
-					acquireCode: that.shoudanma
+				.putJson(`/app/tbindent/receive/${that.shoudanma}`, {///app/tbindent/orderIndentReceiving
+					// acquireCode: that.shoudanma
 				})
 				.then((res) => {
 					console.log(res, 'ppp')
@@ -1828,7 +1847,7 @@ export default {
 				mask: true // 是否显示透明蒙层,防止触摸穿透
 			})
 			this.$Request
-				.postJson('/app/tbindent/orderRiderDelivery', {
+				.postJson('/app/tbindent/finish-order', {///app/tbindent/orderRiderDelivery
 					smsTemplateId: that.duanxin[0].id,
 					// indentNumber: that.indentNumber,
 					acquireCode: that.shoudanma
@@ -1856,6 +1875,7 @@ export default {
 							title: res.msg,
 							icon: 'none'
 						})
+						that.list_box = []
 						// 在toast显示2000毫秒(2秒)后执行操作
 						setTimeout(function () {
 							that.sousuoList()