gjy il y a 2 ans
Parent
commit
4bd0f1a150

+ 45 - 0
components/uni-popup/keypress.js

@@ -0,0 +1,45 @@
+// #ifdef H5
+export default {
+  name: 'Keypress',
+  props: {
+    disable: {
+      type: Boolean,
+      default: false
+    }
+  },
+  mounted () {
+    const keyNames = {
+      esc: ['Esc', 'Escape'],
+      tab: 'Tab',
+      enter: 'Enter',
+      space: [' ', 'Spacebar'],
+      up: ['Up', 'ArrowUp'],
+      left: ['Left', 'ArrowLeft'],
+      right: ['Right', 'ArrowRight'],
+      down: ['Down', 'ArrowDown'],
+      delete: ['Backspace', 'Delete', 'Del']
+    }
+    const listener = ($event) => {
+      if (this.disable) {
+        return
+      }
+      const keyName = Object.keys(keyNames).find(key => {
+        const keyName = $event.key
+        const value = keyNames[key]
+        return value === keyName || (Array.isArray(value) && value.includes(keyName))
+      })
+      if (keyName) {
+        // 避免和其他按键事件冲突
+        setTimeout(() => {
+          this.$emit(keyName, {})
+        }, 0)
+      }
+    }
+    document.addEventListener('keyup', listener)
+    this.$once('hook:beforeDestroy', () => {
+      document.removeEventListener('keyup', listener)
+    })
+  },
+	render: () => {}
+}
+// #endif

+ 22 - 0
components/uni-popup/message.js

@@ -0,0 +1,22 @@
+export default {
+	created() {
+		if (this.type === 'message') {
+			// 不显示遮罩
+			this.maskShow = false 
+			// 获取子组件对象
+			this.childrenMsg = null
+		}
+	},
+	methods: {
+		customOpen() {
+			if (this.childrenMsg) {
+				this.childrenMsg.open()
+			}
+		},
+		customClose() {
+			if (this.childrenMsg) {
+				this.childrenMsg.close()
+			}
+		}
+	}
+}

+ 50 - 0
components/uni-popup/popup.js

@@ -0,0 +1,50 @@
+import message from './message.js';
+// 定义 type 类型:弹出类型:top/bottom/center
+const config = {
+	// 顶部弹出
+	top: 'top',
+	// 底部弹出
+	bottom: 'bottom',
+	// 居中弹出
+	center: 'center',
+	// 消息提示
+	message: 'top',
+	// 对话框
+	dialog: 'center',
+	// 分享
+	share: 'bottom',
+}
+
+export default {
+	data() {
+		return {
+			config: config,
+			popupWidth: 0,
+			popupHeight: 0
+		}
+	},
+	mixins: [message],
+	computed: {
+		isDesktop() {
+			return this.popupWidth >= 500 && this.popupHeight >= 500
+		}
+	},
+	mounted() {
+		const fixSize = () => {
+			const {
+				windowWidth,
+				windowHeight,
+				windowTop
+			} = uni.getSystemInfoSync()
+			this.popupWidth = windowWidth
+			this.popupHeight = windowHeight + windowTop
+		}
+		fixSize()
+		// #ifdef H5
+		window.addEventListener('resize', fixSize)
+		this.$once('hook:beforeDestroy', () => {
+			window.removeEventListener('resize', fixSize)
+		})
+		// #endif
+	},
+}

+ 16 - 0
components/uni-popup/share.js

@@ -0,0 +1,16 @@
+export default {
+	created() {
+		if (this.type === 'share') {
+			// 关闭点击
+			this.mkclick = false
+		}
+	},
+	methods: {
+		customOpen() {
+			console.log('share 打开了');
+		},
+		customClose() {
+			console.log('share 关闭了');
+		}
+	}
+}

+ 2 - 2
config/index.js

@@ -1,6 +1,6 @@
 const dev = {
 const dev = {
-	baseUrlNew: 'https://apitest.eliangeyun.com',
-	// baseUrlNew: 'http://192.168.110.9:8099',
+	// baseUrlNew: 'https://apitest.eliangeyun.com',
+	baseUrlNew: 'http://192.168.110.9:8099',
 	h5Appid: 'wxb66b599f7f61b46f',
 	h5Appid: 'wxb66b599f7f61b46f',
 	debug: false
 	debug: false
 }
 }

+ 89 - 36
pages/order/index.vue

@@ -184,19 +184,27 @@
 		<u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
 		<u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
 			:closeOnClickOverlay='true' :showCancelButton='showCancelButton' @confirm="confirmClick"
 			:closeOnClickOverlay='true' :showCancelButton='showCancelButton' @confirm="confirmClick"
 			@close="cancelClick" @cancel="cancelClick" class="modal">
 			@close="cancelClick" @cancel="cancelClick" class="modal">
-			<view style="margin: 0 auto;">
-				<u-radio-group v-model="radiovalue1" placement="" v-if='isShowTerminationReason'>
-				<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
-					:label="item.name" :name="item.name" @change="radioChange">
-				</u-radio>
-			</u-radio-group>
-			</view>
-			
-			<u--textarea class="row" v-model="value2" placeholder="终止原因描述" count maxlength='50'
-				v-if='isShowTerminationReason'>
-			</u--textarea>
 		</u-modal>
 		</u-modal>
-
+		<u-popup :show="show" mode="bottom" @close="close" @open="open">
+			<view class="">
+				<view ><u-icon @click="closepopup" class='close' name="close" size="20"></u-icon></view>
+				
+				<view style='fon-size:34rpx;margin-bottom:20px;text-align:center;font-weight: 600;'>确认终止订单</view>
+				<view style="margin: 0 auto;">
+		           	<u-radio-group iconPlacement="right" v-model="radiovalue1" placement="" >
+		           	<u-radio  :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
+		           		:label="item.name" :name="item.name" @change="radioChange" >
+		           	</u-radio>
+		           </u-radio-group>
+		           </view>
+				   <view style='border-top:10px solid #F2F4F7;position:absolute;left:0;height:0;width:100%;'></view>
+		           <view style='padding:40rpx 0 30rpx;'>终止原因描述</view>
+		           <u--textarea class="row" v-model="value2" placeholder="终止原因描述" count maxlength='50'>
+		           </u--textarea>
+				   <view class='termination' :class="{'active':value2.length>0}" @click='termination'>终止</view>
+			</view>
+		           
+		</u-popup>
 		<u-toast ref="uToast"></u-toast>
 		<u-toast ref="uToast"></u-toast>
 	</view>
 	</view>
 </template>
 </template>
@@ -206,15 +214,20 @@
 	import {
 	import {
 		mapState
 		mapState
 	} from 'vuex';
 	} from 'vuex';
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	import {
 	import {
 		apiGoods
 		apiGoods
 	} from "@/api/mock.js"
 	} from "@/api/mock.js"
 	export default {
 	export default {
+		components:{
+			uniPopup
+		},
 		mixins: [MescrollMixin], // 使用mixin
 		mixins: [MescrollMixin], // 使用mixin
 		data() {
 		data() {
 			return {
 			return {
 				confirmText: '',
 				confirmText: '',
+				show:false,
 				showCancelButton: true,
 				showCancelButton: true,
 				type: null,
 				type: null,
 				objData: {},
 				objData: {},
@@ -484,9 +497,9 @@
 				// } else {
 				// } else {
 				// 	this.isShowTerminationReason = true
 				// 	this.isShowTerminationReason = true
 				// }
 				// }
-					this.alertTitle = '确定终止订单?'
+					// this.alertTitle = '确定终止订单?'
 				this.id = item.id
 				this.id = item.id
-				this.isShowAlert = true
+				this.show = true
 			},
 			},
 			init() {
 			init() {
 
 
@@ -494,6 +507,42 @@
 			del() {
 			del() {
 				this.isShowAlert = true
 				this.isShowAlert = true
 			},
 			},
+			termination(){
+				var that=this
+				let _terminationReason = ''
+				if (this.radiovalue1 == '已与货主协商') {
+					_terminationReason = 1
+				} else if (this.radiovalue1 == '货主原因终止') {
+					_terminationReason = 2
+				} else if (this.radiovalue1 == '司机个人原因终止') {
+					_terminationReason = 3
+				} else if (this.radiovalue1 == '其他') {
+					_terminationReason = 4
+				}
+					this.$request.baseRequest('post', '/orderInfo/api/end', {
+							id: this.id,
+							terminator: 2,
+							terminationReason: _terminationReason,
+							terminationReasonDescription: this.value2
+						}).then(res => {
+							if (res.code == 200) {
+								this.show=false
+								this.$refs.uToast.show({
+									type: 'success',
+									message: '终止订单成功',
+								})
+							} else {
+								this.$refs.uToast.show({
+									type: 'success',
+									message: '终止订单失败',
+								})
+							}
+							that.mescroll.resetUpScroll()
+						})
+						.catch(res => {
+							uni.$u.toast(res.message);
+						});
+			},
 			confirmClick() {
 			confirmClick() {
 				var that =this
 				var that =this
 				// // #ifdef APP-PLUS
 				// // #ifdef APP-PLUS
@@ -523,6 +572,7 @@
 									type: 'success',
 									type: 'success',
 									message: _title,
 									message: _title,
 									complete() {
 									complete() {
+										that.upCallback({size: 10,num: 1})
 										that.mescroll.resetUpScroll()
 										that.mescroll.resetUpScroll()
 									}
 									}
 								})
 								})
@@ -536,6 +586,7 @@
 									type: 'success',
 									type: 'success',
 									message: _title,
 									message: _title,
 									complete() {
 									complete() {
+										that.upCallback({size: 10,num: 1})
 										that.mescroll.resetUpScroll()
 										that.mescroll.resetUpScroll()
 									}
 									}
 								})
 								})
@@ -570,28 +621,7 @@
 						.catch(res => {
 						.catch(res => {
 							uni.$u.toast(res.message);
 							uni.$u.toast(res.message);
 						});
 						});
-				} else {
-					this.$request.baseRequest('post', '/orderInfo/api/end', {
-							id: this.id,
-							terminator: 2,
-						}).then(res => {
-							if (res.code == 200) {
-								this.$refs.uToast.show({
-									type: 'success',
-									message: '终止订单成功',
-								})
-							} else {
-								this.$refs.uToast.show({
-									type: 'success',
-									message: '终止订单失败',
-								})
-							}
-							that.mescroll.resetUpScroll()
-						})
-						.catch(res => {
-							uni.$u.toast(res.message);
-						});
-				}
+				} 
 			},
 			},
 			cancelClick() {
 			cancelClick() {
 				this.isShowAlert = false
 				this.isShowAlert = false
@@ -1037,4 +1067,27 @@
 		padding: 20rpx;
 		padding: 20rpx;
 		border-radius: 20rpx;
 		border-radius: 20rpx;
 	}
 	}
+	/deep/.u-popup__content{
+		border-radius: 10px;
+		padding:20px;
+	}
+	/deep/.u-radio{
+		margin:40rpx 0;
+	}
+	.close{
+		position:absolute;
+		right:20px;
+	}
+	.termination{
+		background:#F1F3F6;
+		color:#C5CAD4;
+		padding:10px;
+		border-radius:30px;
+		text-align: center;
+		margin-top:30rpx;
+	}
+	.termination.active{
+		background: #2772FB;
+		color: white;
+	}
 </style>
 </style>

+ 13 - 5
pages/order/map.nvue

@@ -3,7 +3,7 @@
 		<map v-if="polyline[0].points.length > 0" id="myMap" :markers="markers" :polyline="polyline"
 		<map v-if="polyline[0].points.length > 0" id="myMap" :markers="markers" :polyline="polyline"
 			:latitude="polyline[0].points[0].latitude" :longitude="polyline[0].points[0].longitude"
 			:latitude="polyline[0].points[0].latitude" :longitude="polyline[0].points[0].longitude"
 			style="width: 100%; height: 2000rpx" @updated="test" />
 			style="width: 100%; height: 2000rpx" @updated="test" />
-		<view class="hcp-bottom">
+		<view v-if="polyline[0].points.length > 0" class="hcp-bottom">
 			<button v-if="startMove" @click="handleStopMove()">暂停移动</button>
 			<button v-if="startMove" @click="handleStopMove()">暂停移动</button>
 			<button v-else @click="handleStartMove()">开始移动</button>
 			<button v-else @click="handleStartMove()">开始移动</button>
 		</view>
 		</view>
@@ -65,11 +65,19 @@
 						'content-type': 'application/json' //'application/x-www-form-urlencoded; charset=UTF-8',
 						'content-type': 'application/json' //'application/x-www-form-urlencoded; charset=UTF-8',
 					},
 					},
 					success: (res) => {
 					success: (res) => {
-						console.log(res.data.data,11111111)
+						console.log(res.data,11111111)
 						if(res.data.code==200){
 						if(res.data.code==200){
-							if(res.data.data.longitudeLatitude){
-								console.log(JSON.parse(res.data.data.longitudeLatitude));
-								this.polyline[0].points =JSON.parse(res.data.data.longitudeLatitude)
+							if(res.data.data){
+								if(res.data.data.longitudeLatitude){
+									console.log(JSON.parse(res.data.data.longitudeLatitude));
+									this.polyline[0].points =JSON.parse(res.data.data.longitudeLatitude)
+								}
+							}else{
+								uni.showToast({
+									title: '暂无运输轨迹',
+									icon: 'none',
+									duration: 2000
+								})
 							}
 							}
 						}
 						}
 					}
 					}

+ 67 - 4
pages/order/orderDetails.vue

@@ -22,7 +22,7 @@
 				</u-button>
 				</u-button>
 				<u-button class="btn" text="接受" @click="accept(1)" v-if="dataObj.cargoOwnerStatus=='待接单'">
 				<u-button class="btn" text="接受" @click="accept(1)" v-if="dataObj.cargoOwnerStatus=='待接单'">
 				</u-button>
 				</u-button>
-				<u-button class="btn" text="终止" @click="stop()" v-if="dataObj.cargoOwnerStatus=='未装车'">
+				<u-button class="btn" text="终止" @click="clickstop()" v-if="dataObj.cargoOwnerStatus=='未装车'">
 				</u-button>
 				</u-button>
 				<u-button class="btn" text="查看合同" @click="lookContract" v-if="dataObj.cargoOwnerContract=='1'">
 				<u-button class="btn" text="查看合同" @click="lookContract" v-if="dataObj.cargoOwnerContract=='1'">
 				</u-button>
 				</u-button>
@@ -262,6 +262,26 @@
 				v-if='isShowTerminationReason'>
 				v-if='isShowTerminationReason'>
 			</u--textarea>
 			</u--textarea>
 		</u-modal>
 		</u-modal>
+		<u-popup :show="show" mode="bottom" @close="close" @open="open">
+			<view class="">
+				<view ><u-icon @click="closepopup" class='close' name="close" size="20"></u-icon></view>
+				
+				<view style='fon-size:34rpx;margin-bottom:20px;text-align:center;font-weight: 600;'>确认终止订单</view>
+				<view style="margin: 0 auto;">
+		           	<u-radio-group iconPlacement="right" v-model="radiovalue1" placement="" >
+		           	<u-radio  :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
+		           		:label="item.name" :name="item.name" @change="radioChange" >
+		           	</u-radio>
+		           </u-radio-group>
+		           </view>
+				   <view style='border-top:10px solid #F2F4F7;position:absolute;left:0;height:0;width:100%;'></view>
+		           <view style='padding:40rpx 0 30rpx;'>终止原因描述</view>
+		           <u--textarea class="row" v-model="value2" placeholder="终止原因描述" count maxlength='50'>
+		           </u--textarea>
+				   <view class='termination' :class="{'active':value2.length>0}" @click='termination'>终止</view>
+			</view>
+		           
+		</u-popup>
 		<u-toast ref="uToast"></u-toast>
 		<u-toast ref="uToast"></u-toast>
 		<!-- 		<view v-if="lookAlert" class="look-contract" @click="lookAlert==false">
 		<!-- 		<view v-if="lookAlert" class="look-contract" @click="lookAlert==false">
 			<u-button class="btn" text="查看合同" @click="lookContract"></u-button>
 			<u-button class="btn" text="查看合同" @click="lookContract"></u-button>
@@ -293,8 +313,12 @@
 
 
 <script>
 <script>
 	var that;
 	var that;
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import uploadImage from '@/components/ossutil/uploadFile.js';
 	import uploadImage from '@/components/ossutil/uploadFile.js';
 	export default {
 	export default {
+		components:{
+			uniPopup
+		},
 		data() {
 		data() {
 			return {
 			return {
 				cyinfoStatus: '未装车',
 				cyinfoStatus: '未装车',
@@ -309,6 +333,7 @@
 				status2: false,
 				status2: false,
 				status3: false,
 				status3: false,
 				id: '',
 				id: '',
+				show:false,
 				value2: '',
 				value2: '',
 				radiolist1: [{
 				radiolist1: [{
 						name: '已与货主协商',
 						name: '已与货主协商',
@@ -600,7 +625,10 @@
 						.catch(res => {
 						.catch(res => {
 							uni.$u.toast(res.message);
 							uni.$u.toast(res.message);
 						});
 						});
-				} else {
+				} 
+			},
+			termination(){
+				var that=this
 					if (this.radiovalue1 == '其他' && !this.value2) {
 					if (this.radiovalue1 == '其他' && !this.value2) {
 						this.$refs.uToast.show({
 						this.$refs.uToast.show({
 							type: 'error',
 							type: 'error',
@@ -621,8 +649,11 @@
 					this.$request.baseRequest('post', '/orderInfo/api/end', {
 					this.$request.baseRequest('post', '/orderInfo/api/end', {
 							id: this.id,
 							id: this.id,
 							terminator: 2,
 							terminator: 2,
+							terminationReason: _terminationReason,
+							terminationReasonDescription: this.value2
 						}).then(res => {
 						}).then(res => {
 							if (res.code == 200) {
 							if (res.code == 200) {
+								that.show=false
 								this.$refs.uToast.show({
 								this.$refs.uToast.show({
 									type: 'success',
 									type: 'success',
 									message: '终止订单成功',
 									message: '终止订单成功',
@@ -633,12 +664,10 @@
 									message: '终止订单失败',
 									message: '终止订单失败',
 								})
 								})
 							}
 							}
-							that.mescroll.resetUpScroll()
 						})
 						})
 						.catch(res => {
 						.catch(res => {
 							uni.$u.toast(res.message);
 							uni.$u.toast(res.message);
 						});
 						});
-				}
 			},
 			},
 			cancelClick() {
 			cancelClick() {
 				this.isShowAlert = false
 				this.isShowAlert = false
@@ -654,6 +683,17 @@
 				this.id = item.id
 				this.id = item.id
 				this.isShowAlert = true
 				this.isShowAlert = true
 			},
 			},
+			clickstop(){
+				let item = this.dataObj
+				// 货主接单
+				if (item.cargoOwnerStatusKey == 1) {
+					this.isShowTerminationReason = false
+				} else {
+					this.isShowTerminationReason = true
+				}
+				this.id = item.id
+				this.show = true
+			},
 			toPhone() {
 			toPhone() {
 				var that=this
 				var that=this
 				uni.makePhoneCall({
 				uni.makePhoneCall({
@@ -1066,4 +1106,27 @@
 		top: 120rpx;
 		top: 120rpx;
 		left: 10rpx;
 		left: 10rpx;
 	}
 	}
+	/deep/.u-popup__content{
+		border-radius: 10px;
+		padding:20px;
+	}
+	/deep/.u-radio{
+		margin:40rpx 0;
+	}
+	.close{
+		position:absolute;
+		right:20px;
+	}
+	.termination{
+		background:#F1F3F6;
+		color:#C5CAD4;
+		padding:10px;
+		border-radius:30px;
+		text-align: center;
+		margin-top:30rpx;
+	}
+	.termination.active{
+		background: #2772FB;
+		color: white;
+	}
 </style>
 </style>

+ 18 - 7
util/request.js

@@ -21,15 +21,26 @@ const baseRequest = (method, url, data,header) => {
 			uni.request(baseDefaultOpts).then(
 			uni.request(baseDefaultOpts).then(
 				(res) => {
 				(res) => {
 					// console.log(JSON.stringify(res[1].data))
 					// console.log(JSON.stringify(res[1].data))
-					if(res[1].data.code == '200' || res[1].data.code == 200){
-						// 后端返回的状态码100为成功状态,成功则返回请求结果,在app调试时可以通过console.log(JSON.stringify(res[1].data))来查看返回值(以项目实际情况为准)
-						resolve(res[1].data)
+					// if(res[1].data.code == '200' || res[1].data.code == 200){
+					// 	// 后端返回的状态码100为成功状态,成功则返回请求结果,在app调试时可以通过console.log(JSON.stringify(res[1].data))来查看返回值(以项目实际情况为准)
+					// 	resolve(res[1].data)
+					// }else{
+					// 	uni.showToast({
+					// 		icon:'none',
+					// 	    title: res[1].data.message,
+					// 	    duration: 2000 
+					// 	}); 
+					// }
+					if(res[1]){
+						if(res[1].data.code == '200' || res[1].data.code == 200){
+							resolve(res[1].data)
+						}
 					}else{
 					}else{
 						uni.showToast({
 						uni.showToast({
-							icon:'none',
-						    title: res[1].data.message,
-						    duration: 2000 
-						}); 
+								icon:'none',
+							    title: '网络异常,请检查网络状况',
+							    duration: 2000 
+							}); 
 					}
 					}
 					// // 登录失败
 					// // 登录失败
 					// if(res[1].data.code == '11006' || res[1].data.code == 11006){
 					// if(res[1].data.code == '11006' || res[1].data.code == 11006){