<template>
	<view class="home">
		<!-- #ifdef MP-WEIXIN -->
		<view class="search-wrap"
			:style="'height:'+(rect.height)+'px;line-height:'+rect.height+'px;padding-top:'+(rect.top)+'px'">
		<!-- #endif -->
			<!-- #ifndef MP-WEIXIN -->
			<view class="search-wrap" :style="'padding-top:'+statusBarHeight+'px;height:64rpx'">
			<!-- #endif -->
				<!-- <view class="back-icon" :style="rect?'padding:'+(rect.height-24)+'rpx 20rpx':''">
				<u-icon name="arrow-left" size="24" color="#ffffff" @click="pageBack"></u-icon>
			</view> -->
				<!-- <span class="text">首页</span> -->
				<!-- <span v-if="isDealerUser" class="current-tanent" @click="changeTanent">
					{{currentTanent}}
					<u-icon name="arrow-down"></u-icon>
				</span> -->
				<view class="custom" v-if="isDealerUser || isEnterpriseUser" @click="changeTanent">
					<span v-if="currentTanent">
						{{currentTanent}}
					</span>
					<u-badge v-else type="error" :value="$t('base.common.placeholderTenant')"></u-badge>
					<u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>

				</view>
				<view class="custom" v-if="isDriverUser" @click="toSelectVehicle">
					{{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
					<u-icon name="arrow-down-fill" style="margin-left:10rpx" color="#fff" size="8"></u-icon>
				</view>
			</view>
			<!-- <view v-if="isDealerUser" class="all-order" @click="toDealerOrderList()">
				<image src="../../static/czzn-img/home/home-order.png"
					style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
					<view class="order-text">
						<text class="title">{{ $t("home.allOrder") }}</text>
						<text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
					</view>
					<uni-icons type="forward" size="20"></uni-icons>
			</view> -->
			<!-- <view v-if="isDriverUser && isDealerUser==false" class="all-order" @click="toDriverOrderList()">
				<image src="../../static/czzn-img/home/home-order.png"
					style="margin-right:28rpx;height:84rpx;width:84rpx" alt="">
					<view class="order-text">
						<text class="title">{{ $t("home.allOrder") }}</text>
						<text class="text">{{ $t("home.orderHistory") }} / {{ $t("home.orderQuery") }}</text>
					</view>
					<uni-icons type="forward" size="20"></uni-icons>
			</view> -->
			<!-- <u-notice-bar v-if="isDriverUser && !currentVehicleInfo" bgColor="red" color="white"
				:text="$t('driver.selectRunCar')"></u-notice-bar> -->
			<view class="oper-btn">
				<template v-if="isDealerUser">
					<view class="menu-line" v-show="dealerMenuList.headMenuList.length">
						<view class="menu-item" v-for="(item,index) in dealerMenuList.headMenuList" :key="index"
							@click="todo(item)">
							<image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
							<text class="text">{{item.title}}</text>
						</view>
					</view>
					<view class="menu-wrap" v-show="dealerMenuList.menuList.length">
						<view class="menu-module-title">
							<image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
								style="width:36rpx;height:36rpx;margin-right:20rpx" />
							{{$t('home.dealerMenu.orderManage')}}
						</view>
						<view class="menu-list">
							<template v-for="(item,index) in dealerMenuList.menuList">
								<view class="item" :key="index"
									v-if="item.isShow==true" @click="todo(item)">
									<image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
									<text class="text">{{item.title}}</text>
								</view>
							</template>
						</view>
					</view>
				</template>
				<template v-if="isDriverUser">
					<view class="menu-line" v-show="driverMenuList.headMenuList.length">
						<view class="menu-item" v-for="(item,index) in driverMenuList.headMenuList" :key="index"
							@click="todo(item)">
							<image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
							<text class="text">{{item.title}}</text>
						</view>
					</view>
					<view class="menu-wrap" v-show="driverMenuList.menuList.length">
						<view class="menu-module-title">
							<image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
								style="width:36rpx;height:36rpx;margin-right:20rpx" />
							{{$t('home.dealerMenu.orderManage')}}
						</view>
						<view class="menu-list">
							<view class="item" v-for="(item,index) in driverMenuList.menuList" :key="index"
								@click="todo(item)">
								<image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
								<text class="text">{{item.title}}</text>
							</view>
						</view>
					</view>
				</template>
				<!-- <template v-if="isEnterpriseUser">
					<view class="menu-line" v-show="operatorMenuList.headMenuList.length">
						<view class="menu-item" v-for="(item,index) in operatorMenuList.headMenuList" :key="index"
							@click="todo(item)">
							<image :src="item.icon" style="height:88rpx;width:88rpx" mode="scaleToFill" />
							<text class="text">{{item.title}}</text>
						</view>
					</view>
					<view class="menu-wrap"
						v-show="operatorMenuList.menuList.filter((item)=>{return item.isShow==true}).length">
						<view class="menu-module-title">
							<image src="../../static/czzn-img/home/home-xdgl.png" mode="scaleToFill"
								style="width:36rpx;height:36rpx;margin-right:20rpx" />
							{{$t('home.dealerMenu.orderManage')}}
						</view>
						<view class="menu-list">
							<view class="item"
								v-for="(item,index) in operatorMenuList.menuList.filter((item)=>{return item.isShow==true})"
								:key="index" @click="todo(item)">
								<image :src="item.icon" style="height:100rpx;width:100rpx" mode="scaleToFill" />
								<text class="text">{{item.title}}</text>
							</view>
						</view>
					</view>
				</template> -->
			</view>
			<!-- <view v-if="isDriverUser" class="vehicle-main" @click="toSelectVehicle">
				<view class="vehicle-item">
					{{ currentVehicleInfo.vehicle|| $t('base.common.placeholderS')+$t('driver.runCar')}}
				</view>
			</view> -->
			<!-- <view class="menu-wrap" style="padding:32rpx">
				<span class="label">{{$t('home.inDevelopment')}}</span>
				<view class="message-title">
					<span class="label">{{$t('home.dealerMenu.messageNotification')}}</span>
					<span class="message">
						3条未读信息
						<u-icon name="arrow-right" color="#222222"></u-icon>
					</span>
				</view>
				<view class="message-item">
					<view class="title">
						<image src="https://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/laba.png"
							style="height:26rpx;width:28rpx" mode="scaleToFill" />
						<span>23分钟前</span>
					</view>
				</view>
			</view> -->
			<Bars></Bars>
		
			
			<u-toast ref="loadingToast"></u-toast>
		</view>
</template>

<script>
	import {
		getVehicleListByCondition,
		getQueueListByVehicle
	} from '../../api/driver'
	import {
		getUrlValueByParamName
	} from '../../utils/util.js'
	import {
		getHandleOrder,
		getDriverLatelyOrderInfo
	} from "../../api/order"
	import {
		getTenantPermission
	} from "../../api/tenant"
	
	import {
		mapGetters,
		mapMutations
	} from "vuex";
	import QQMapWX from '../../components/map/qqmap-wx-jssdk';

	import Bars from '../../components/tabBar/tabBar.vue';
	import img from '../../utils/imgUtil'
	import {
		getTenantCacheList
	} from '../../utils/util.js'
	import {
		sendHandleOrder
	} from "../../api/order"
	
	export default {
		components: {
			Bars,
		},
		data() {
			return {
				qqmapsdk: {},
				code: "",
				currentTanent: '',
				permissionList: [],
		
				//客商服务菜单
				dealerMenuList: {
					headMenuList: [{
							title: this.$t("home.dealerMenu.tenant"),
							to: '/subpages/tenant/list',
							icon: img.tenantList,
							key: null,
							isShow: false,
						},
						// {
						// 	title: this.$t("home.dealerMenu.payment"),
						// 	to: '/subpages/payment/collate',
						// 	icon: img.payment,
						// 	key: "app_home_add_collate",
						// 	isShow: false,
						// },
						{
							title: this.$t("home.dealerMenu.driver"),
							to: '/subpages/driver/dealerList',
							icon: img.driverList,
							key: null,
							isShow: false,
						},
						{
							title: this.$t("home.allOrder"),
							to: '/subpages/order/dealerList?index=0',
							icon: img.orderList,
							key: null,
							isShow: false,
						}
					],
					menuList: [{
							title: this.$t("home.dealerMenu.order"),
							to: '/subpages/order/add',
							icon: img.orderAdd,
							key: 'app_home_add_order',
							isShow: true,
						},
						{
							title: this.$t("home.dealerMenu.vehicles"),
							to: '/subpages/order/batchOrderAdd',
							icon: img.batchAdd,
							key: "app_home_batch_order",
							isShow: false,
						},
						{
							title: this.$t("home.dealerMenu.vehicles"),
							to: '/subpages/order/batchVehicleAdd',
							icon: img.moerAdd,
							key: "app_home_vehicle_order",
							isShow: false,
						},
						{
							title: this.$t("home.dealerMenu.plan"),
							to: '/subpages/order/planOrderAdd',
							icon: img.orderAdd,
							key: "app_home_plan_order",
							isShow: false,
						},
						{
							title: this.$t("home.dealerMenu.mixed"),
							to: '/subpages/order/mixedOrderAdd',
							icon: img.hzAdd,
							key: "app_home_mixed_order",
							isShow: false,
						},
		{
							title: this.$t("home.dealerMenu.bigOrder"),
							to: '/subpages/order/bigOrderAdd',
							icon: img.hzAdd,
							key: "app_home_big_order",
							isShow: false,
						},
					]
				},
				//司机服务菜单
				driverMenuList: {
					headMenuList: [{
							id: "scanCode",
							title: this.$t("home.driverMenu.scan"),
							do: "scanCode",
							icon: img.scan
						},
						{
							id: "vehicleList",
							title: this.$t("home.driverMenu.car"),
							to: '/subpages/driver/driverList',
							icon: img.vehicleList
						},
						{
							title: this.$t("home.allOrder"),
							to: '/subpages/order/driverList',
							icon: img.orderList,
							key: null,
							isShow: false,
						},
						// {
						// 	id: "vehicleList",
						// 	title: this.$t("home.driverMenu.runOrder"),
						// 	do: "getRunOrderInfo",
						// 	icon: img.yyVehicle
						// }
					],
					menuList: [{
						id: "queueList",
						title: this.$t("home.driverMenu.queueList"),
						do: "getQueueList",
						icon: img.hzAdd
					},
					// {
					// 	id: "mapCheck",
					// 	title: this.$t("home.driverMenu.mapCheck"),
					// 	do: "mapCheck",
					// 	icon: img.hzAdd
					// }
					]
				},
				//企业验收服务菜单
				operatorMenuList: {
					headMenuList: [{
							id: "scanCode",
							title: this.$t("home.driverMenu.scan"),
							do: "scanCode",
							icon: img.scan,
							key: "app_home_enterprise_scanCode",
						}, {
							title: this.$t("home.dealerMenu.tenant"),
							to: '/subpages/tenant/list',
							icon: img.tenantList,
							key: null,
							isShow: true,
						}

						// {
						// 	title: this.$t("home.allOrder"),
						// 	to: '/substaticpages/cargoOperator/order/orderList',
						// 	icon: img.orderList,
						// 	key: null,
						// 	isShow: true,
						// }
					],
					menuList: [{
						id: "orderAccept",
						title: this.$t("home.acceptMenu.orderAccept"),
						to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=0',
						icon: img.orderDeliver,
						isShow: false,
						key: "app_home_enterprise_accept",
					}, {
						id: "orderAcceptList",
						title: this.$t("home.acceptMenu.orderAcceptList"),
						to: '/substaticpages/cargoOperator/accept/orderAcceptList?isCheck=1',
						icon: img.orderDeliver,
						isShow: false,
						key: "app_home_enterprise_accept",
					}, {
						id: "orderDeliver",
						title: this.$t("home.deliverMenu.orderDeliver"),
						to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=0',
						icon: img.orderDeliver,
						isShow: false,
						key: "app_home_enterprise_deliver",
					}, {
						id: "orderDeliverList",
						title: this.$t("home.deliverMenu.orderDeliverList"),
						to: '/substaticpages/cargoOperator/deliver/orderDeliverList?isDeliver=1',
						icon: img.orderDeliver,
						isShow: false,
						key: "app_home_enterprise_deliver",
					}]
				},
				isAuditUser: false,
				isDealerUser: false,
				isDriverUser: false,
				isEnterpriseUser: false,
				currentVehicleInfo: {}, //司机端当前运营车号
				location: {
					address: '',
					lat: '',
					lng: ''
				},
				vehicleList: [],
				rect: '',
				statusBarHeight: '',
				options:null,
				firstshow:false,
			}
		},
		watch: {
			currentVehicleInfo: function(newValue, oldValue) {
				if (newValue != oldValue) {
					uni.setStorageSync("currentVehicleInfo", newValue);
				}
			},
		},
		computed: {
			...mapGetters({
				hasLogin: "user/hasLogin",
			}),
		},
		onShow() {
			if (!this.hasLogin && this.firstshow) {
				uni.showModal({
					// title: '提示',
					content: this.$t('tips.loginerror'),
					showCancel: true,
					success: function(res) {
						if (res.confirm) {
							uni.removeStorageSync('token')
							uni.removeStorageSync('tenantId')
							uni.removeStorageSync('userId')
							uni.removeStorageSync('userName')
							uni.removeStorageSync('userInfo')
							uni.removeStorageSync('userType')
							uni.removeStorageSync('tenantInfo')
							uni.removeStorageSync('serverAddress');
							uni.removeStorageSync('serverPrefix');
							uni.removeStorageSync('enterpriseInfo')
							uni.reLaunch({
								url: "/pages/login/login"
							})
							console.log('用户点击确定');
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			}else{
				this.firstshow = true
			}
		},
		onLoad(options) {
			this.options = options
			this.noNeedUpdate()
		},
		methods: {
			noNeedUpdate(){
				// console.log("获取到参数信息、", this.options);
				// uni.hideTabBar()
				// console.log(this.location);
				// console.log("获取到参数信息、", this.options);
				// this.countNavber()
				// if (this.options.q) {
				// 	const url = decodeURIComponent(this.options.q)
				// 	this.code = getUrlValueByParamName(url, 'code')
				// 	console.log("获取到编号信息", this.code)
				// } else {
				// 	console.log('非扫二维码进入')
				// }

				this.isDealerUser = uni.getStorageSync('isDealerUser')
				this.isDriverUser = uni.getStorageSync('isDriverUser')

				this.isAuditUser = uni.getStorageSync('isAuditUser')
				this.isEnterpriseUser = uni.getStorageSync('isEnterpriseUser')

				this.currentVehicleInfo = uni.getStorageSync("currentVehicleInfo");
				var userRoleCodeList = uni.getStorageSync('userRoleCode');

				if (this.isDealerUser == true || this.isEnterpriseUser == true) {
					this.dealerInit()
				} else if (this.isDriverUser == true) {
					this.driverInit()
				}
				if (!this.hasLogin) {
					uni.showModal({
						// title: '提示',
						content: this.$t('tips.loginerror'),
						showCancel: true,
						success: function(res) {
							if (res.confirm) {
								uni.removeStorageSync('token')
								uni.removeStorageSync('tenantId')
								uni.removeStorageSync('userId')
								uni.removeStorageSync('userName')
								uni.removeStorageSync('userInfo')
								uni.removeStorageSync('userType')
								uni.removeStorageSync('tenantInfo')
								uni.removeStorageSync('serverAddress');
								uni.removeStorageSync('serverPrefix');
								uni.removeStorageSync('enterpriseInfo')
								uni.reLaunch({
									url: "/pages/login/login"
								})
								console.log('用户点击确定');
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}
			},
			dealerInit() {
				try {
					var tenantList = getTenantCacheList();
					if (!tenantList || tenantList.length == 0) {
						// uni.showModal({
						// 	title: this.$t('settings.tips'),
						// 	content: this.$t('base.common.registerTenant'),
						// 	cancelText: this.$t('base.button.cancel'),
						// 	confirmText: this.$t('base.button.regedit'),
						// 	success: res => {
						// 		if (res.confirm) {
						// 			uni.navigateTo({
						// 				url: '/subpages/tenant/list?q=add'
						// 			});
						// 		}
						// 	},
						// 	fail: () => {},
						// 	complete: () => {}
						// });
					} else {
						var curentTenatnInfo = uni.getStorageSync('currentTenantId');
						console.log('当前租户', curentTenatnInfo);
						if (curentTenatnInfo) {
							this.currentTanent = uni.getStorageSync('currentTenantId').text;
						} else {
							console.log('开始默认租户', tenantInfo[0]);
							uni.setStorageSync("currentTenantId", tenantInfo[0]);
							this.currentTanent = tenantInfo[0].text; //切换完 页面重新赋值
						}
					}

					this.bindTenantPermission();
				} catch (e) {
					console.log('初始化客商时出错：', e);
				}
			},
			driverInit() {
				try {
					if (!this.currentVehicleInfo) {
						let data = {}
						getVehicleListByCondition(data).then(res => {
							if (res.statusCode == 200 && res.data.code == 0) {
								var vehicleInfoList = res.data.data;
								if (vehicleInfoList) {

									if (vehicleInfoList.length == 1) {
										this.currentVehicleInfo = vehicleInfoList[0]
										uni.setStorageSync("currentVehicleInfo", this.currentVehicleInfo)
									} else {
										var vehicleInfo = vehicleInfoList.filter(p => {
											return p.runFlag == 1
										});
										if (vehicleInfo) {
											uni.setStorageSync("currentVehicleInfo", vehicleInfo[0]);
										}
									}
								}
							}
						})
					}
					var that = this;
					setInterval(function() {
						var storeVehicleInfo = uni.getStorageSync('currentVehicleInfo')
						if (storeVehicleInfo) {
							if (that.currentVehicleInfo) {
								if (storeVehicleInfo.vehicle != that.currentVehicleInfo.vehicle) {
									that.currentVehicleInfo = storeVehicleInfo
								}
							} else {
								that.currentVehicleInfo = storeVehicleInfo
							}
						} else {
							if (that.currentVehicleInfo) {
								that.currentVehicleInfo = storeVehicleInfo
							}
						}
					}, 5000);
				} catch (e) {
					console.log('初始化司机时出错：', e);
				}
			},
			toSelectVehicle() {
				uni.navigateTo({
					url: '/subpages/driver/vehicle'
				})
			},
			//切换租户
			changeTanent() {
				var tenantList = getTenantCacheList();
				console.log("当前租户信息、", tenantList);
				uni.showActionSheet({
					itemList: tenantList.map(item => {
						return item.text
					}),
					success: res => {
						console.log("获取到企业信息", res.tapIndex); //点击切换租户

						uni.setStorageSync("currentTenantId", tenantList[res.tapIndex]);
						this.currentTanent = uni.getStorageSync('currentTenantId').text; //切换完 页面重新赋值
						this.bindTenantPermission();
					},
					fail: () => {},
					complete: () => {}
				});
			},
			bindTenantPermission() {
				var tenantId = uni.getStorageSync('currentTenantId').value;
				if (tenantId) {
					getTenantPermission({
						appUser: uni.getStorageSync('userId'),
						tenantId: uni.getStorageSync('currentTenantId').value
					}).then(res => {
						if (this.isDealerUser == true) {
							this.dealerMenuList.menuList.forEach((item) => {
								if (item.key != null) {
									console.log("开始处理菜单、", item);
									this.permissionList = []
									if (res.statusCode == 200 && res.data.code == 0 && res.data.data
										.length >
										0) {
										this.permissionList = res.data.data

										if (this.permissionList.filter((permissionInfo) => {
												return permissionInfo.path == item.key
											}).length > 0) {
											item.isShow = true
											console.log("显示该菜单、", item.to, item.key);
										} else {
											item.isShow = false
											console.log("影藏该菜单、", item.to, item.key);
										}
									}
									uni.setStorageSync('permissionInfo', this.permissionList)
								}
							});
						}
						if (this.isEnterpriseUser == true) {
							this.operatorMenuList.menuList.forEach((item) => {
								if (item.key != null) {
									console.log("开始处理菜单、", item);
									this.permissionList = []
									if (res.statusCode == 200 && res.data.code == 0 && res.data.data
										.length >
										0) {
										this.permissionList = res.data.data
										if (this.permissionList.filter((permissionInfo) => {
												return permissionInfo.path == item.key
											}).length > 0) {
											item.isShow = true
											console.log("显示该菜单、", item.to, item.key);
										} else {
											item.isShow = false
											console.log("影藏该菜单、", item.to, item.key);
										}
									}
									uni.setStorageSync('permissionInfo', this.permissionList)
								}
							});
						}
					})
				}
			},
			//计算设备状态栏
			countNavber() {
				try {
					let sysInfo = uni.getSystemInfoSync(); //状态栏的高度
					console.log("系统信息、", sysInfo);
					this.statusBarHeight = sysInfo.statusBarHeight;
					// #ifdef MP-WEIXIN
					this.rect = wx.getMenuButtonBoundingClientRect();
					// #endif
					console.log(this.rect, this.statusBarHeight);
				} catch (e) {
					console.log("计算设备状态栏出错、", e);
				}
			},




			...mapMutations({
				setUserInfo: 'user/login'
			}),
			toPendingList() {
				uni.navigateTo({
					url: '/subpages/approval/launch'
				})
			},
			todo(item) {
				if (item.to) {
					uni.navigateTo({
						url: item.to
					})
				}
				if (item.do) {
					console.log(this[item.do]);
					this[item.do]()
				}
			},
			toDealerOrderList() {
				uni.navigateTo({
					url: '/subpages/order/dealerList?index=0'
				})
			},
			toDriverOrderList() {
				uni.navigateTo({
					url: '/subpages/order/driverList?index=0'
				})
			},
			toOrder(xfFlag) {
				uni.navigateTo({
					url: '/subpages/order/add?xfFlag=' + xfFlag
				})
			},
			scanCode() {
				let _this = this
				if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
					uni.showToast({
						title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
						icon: 'none',
						duration: 2000
					})
					return;
				}

				// _this.getLocationInfo();
				console.log('打开扫码功能');
				uni.scanCode({
					scanType: ['qrCode'],
					onlyFromCamera: true,
					hideAlbum: true,
					success: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						if (res.result) {
							let code = res.result.indexOf('http') === 0 ? getUrlValueByParamName(res
								.result,
								'code') : res.result
							_this.submitCode(code)
						}
					}
				});
			},
			getRunOrderInfo() {
				getDriverLatelyOrderInfo().then(res => {
					if (res.statusCode == 200) {
						console.log('获取到运行订单：', res.data);
						if (res.data.code == "0") {
							uni.navigateTo({
								url: `/subpages/driver/runOrderInfo?orderInfo=${JSON.stringify(res.data.data)}`
							})
						}
					}
				})
			},
			getQueueList() {
				let _this = this
				if (this.isDriverUser == true && !uni.getStorageSync("currentVehicleInfo")) {
					uni.showToast({
						title: _this.$t("base.common.placeholderS") + _this.$t("home.driverMenu.runCar"),
						icon: 'none',
						duration: 2000
					})
					return;
				}
				
				if (uni.getStorageSync("tenantInfo").length<=0) {
					uni.showToast({
						title: _this.$t("home.driverMenu.tenantIdIsNull"),
						icon: 'none',
						duration: 2000
					})
					return;
				}
				uni.navigateTo({
					url: `/substaticpages/cargoOperator/queue/queueList`
				})
			},
			mapCheck() {
				uni.navigateTo({
					url: `/substaticpages/cargoOperator/map/mapcheck`
				})
			},
			//提交扫码内容
			submitCode(result, id) {
				this.$refs.loadingToast.show({
					type: "loading",
					message: this.$t('base.common.loading'),
					duration: "1000000"
				})
				try {
					if (this.isEnterpriseUser == true) {
						if (result.indexOf('-') == -1) {
							uni.showToast({
								title: "订单格式存在问题，没有租户信息，",
								icon: 'none',
								duration: 2000
							})
							this.$refs.loadingToast.hide()
							return;
						}
						var tenantId = result.split('-')[0]
						var orderId = result.split('-')[1]
						uni.navigateTo({
							url: `/substaticpages/cargoOperator/order/orderInfo?orderId=${orderId}&tenantId=${tenantId}&operationType=1`
						})
						this.$refs.loadingToast.hide()
					} else {
						getHandleOrder({
							appUser: uni.getStorageSync('userId'),
							qrCode: result,
							vehicle: this.currentVehicleInfo.vehicle,
						}).then(res => {
							console.log("调用成功返回、", res);
							this.$refs.loadingToast.hide()
							if (res.statusCode == 200 && res.data.code == 0) {
								console.log("扫码获取到的信息", res.data.data);
								if (res.data.data.placeType && res.data.data.placeType == 10407) {
									uni.navigateTo({
										url: `/subpages/order/driverAdd?data=${JSON.stringify(res.data.data)}`
									})
								} else {
									if(res.data.data.length === 1){
										this.selectOrder(res.data.data[0],result)
									}else{
										uni.navigateTo({
											url: `/subpages/order/selectList?data=${JSON.stringify(res.data.data)}&hardInfo=${JSON.stringify(res.data.hardInfo)}&qrCode=${result}&location=${JSON.stringify(this.location)}`
										})
									}
								}
							}
						}).catch(res => {
							this.$refs.loadingToast.hide()
							console.log("调用异常返回、", res);
						});
					}
				} catch (e) {
					this.$refs.loadingToast.hide()
				}
			},

			//扫码只要一条订单时
			selectOrder(item,qrCode) {
				this.$refs.loadingToast.show({
					type: "loading",
					message: this.$t('base.common.loading'),
					duration: "1000000"
				})
				console.log("选择到订单ID、", item);
				console.log("获取到二维码信息、", qrCode);
				if (qrCode) {
					let data = {
						orderId: item.id,
						orderType: item.orderType,
						vehicleSourceId: item.vehicleSourceId,
						vehicle:item.vehicle,
						qrCode: qrCode,
						orderNumber:null,
					}
					sendHandleOrder(data).then(res => {
						this.$refs.loadingToast.hide()
						console.log('扫码返回信息、', res.data);
						if (res.statusCode == 200) {
							uni.showModal({
								content: res.data.msg,
								showCancel: false,
								confirmText: this.$t("base.button.confirm"),
								success: function(res) {
									
								}
							})
						}
					}).catch(() => {
						this.$refs.loadingToast.hide()
					})
				} else {
					this.$refs.loadingToast.hide()
				}
				this.tempItem={};
			},
			//获取位置信息
			getLocationInfo() {
				let that = this;
				uni.getLocation({
					type: "gcj02",
					success(res) {
						console.log(res);
						// 腾讯地图Api
						const qqmapsdk = new QQMapWX({
							key: '26SBZ-5XVL3-QTE37-OIVPU-LPFS6-UDB4S' //这里填写自己申请的key
						});
						qqmapsdk.reverseGeocoder({
							success(response) {
								let info = response.result;
								console.log(JSON.stringify(info));
								that.location.address = info.address;
								that.location.lat = info.location.lat;
								that.location.lng = info.location.lng;
								console.log(that.location.address);
							},
						});
					},
					fail(err) {
						console.log(err)
						uni.showToast({
							title: err,
							icon: 'none',
							duration: 2000
						})
					},
				});
			}
		}
	}
</script>
<style scope>
	/* #ifndef APP-NVUE */
	page {
		background-color: #f5f7fa;
	}

	/* #endif */
</style>
<style lang="scss" scoped>
	.home {
		padding: 0 32rpx 32rpx;
		min-height: 100vh;
		background: url('http://icc-oss.oss-cn-hangzhou.aliyuncs.com/app/icc-app/home-bg.jpg') no-repeat;
		background-size: 100% auto;
		background-color: #f8f8f8;

		// background-color: #f8f8f8;
		.search-wrap {
			padding: 16px 0;
			// background-color: #f8f8f8;
			// box-shadow:0 0 16rpx 0px rgba(0, 0, 0, 0.1);
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 278rpx;

			.custom {
				height: 100%;
				color: #fff;
				display: flex;
				align-items: center;
				line-height: 1;
			}

			.input-wrap {
				flex: 1;
				margin: 0 32rpx;
			}
		}

		.top-banner {
			margin-bottom: 32rpx;

			.swiper-image {
				width: 100%;
			}
		}

		.all-order {
			height: 84rpx;
			box-shadow: 0 0 16rpx 0px rgba(0, 0, 0, 0.1);
			background-color: #fff;
			border-radius: 16rpx;
			padding: 24rpx 32rpx;
			margin: 24rpx 32rpx 0;
			display: flex;
			line-height: 100rpx;

			.order-text {
				display: flex;
				flex-direction: column;
				flex: 1;

				.title {
					height: 42rpx;
					line-height: 42rpx;
					font-size: 30rpx;
					font-weight: bold;
					color: #333;
				}

				.text {
					height: 42rpx;
					line-height: 42rpx;
					font-size: 24rpx;
					color: #aaa;
				}
			}
		}

		.menu-line {
			margin-bottom: 32rpx;
			display: flex;
			flex-direction: row;
			justify-content: space-around;
			background: #fff;
			padding: 32rpx 40rpx;
			border-radius: 10rpx;

			.menu-item {
				box-sizing: border-box;
				border-radius: 12rpx;
				font-size: 26rpx;
				font-weight: bold;
				color: #222;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				background-size: 100% 100%;

				.text {
					margin-top: 20rpx;
					text-align: center;
				}
			}

		}

		.menu-wrap {
			box-sizing: border-box;
			width: 100%;
			// padding: 32rpx 0 0;
			background-color: #fff;
			border-radius: 10rpx;
			margin-bottom: 32rpx;
			box-shadow: 0rpx 0rpx 18rpx 2rpx #eee;

			.menu-module-title {
				display: flex;
				align-items: center;
				padding: 32rpx;
				font-size: 30rpx;
				font-weight: bold;
			}

			.menu-list {
				min-height: 130rpx;
				position: relative;
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				justify-content: left;

				.item {
					font-size: 22rpx;
					color: #222;
					width: 25%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					align-items: center;
					background-size: 100% 100%;
					margin-bottom: 32rpx;

					.text {
						margin-top: 12rpx;
						text-align: center;
						padding: 0 10rpx;
					}
				}

				.absolute {
					position: absolute;
					right: 0;
					bottom: 0;
				}
			}

			.message-title {
				display: flex;
				justify-content: space-between;
				line-height: 32rpx;

				.label {
					color: #222;
					font-size: 28rpx;
					font-weight: bold;
				}

				.message {
					display: flex;
					color: #999;
					font-size: 24rpx;
				}
			}

			.message-item {
				margin-top: 32rpx;

				.title {
					display: flex;
					width: 176rpx;
					padding: 8rpx 16rpx;
					color: #999;
					font-size: 24rpx;
					align-items: center;
					justify-content: space-between;
					background-color: #F5F8FF;
				}
			}
		}
	}

	button {
		// background:linear-gradient(to right,#0052d9 0%,#00e2fa 80%,#00e2fa 100%);
		background: #0052d9;
		line-height: 100rpx;
		color: #fff;
		border: none;
	}

	uni-button:after {
		border: none;
	}

	/*首先，我们需要指定一个div元素作为整个车牌的容器*/
	.vehicle-item {
		margin-top: 10rpx;
		line-height: 60rpx;
		color: white; // 字体颜色
		background-color: #1e68bb; // 背景色
		border-radius: 2px; // 边框圆角
		border: white .5px solid; // 白色外边框
		text-align: center; // 字体居中
		padding: 2px 9px; // 内边距
		display: inline-block; // 视用在什么元素上而定
		box-shadow: 0 0 1px 2px #1e68bb;
		width: 90%;
		// 外阴影  前两个参数分别是上下和左右偏移  后两个属性依次为模糊距离和阴影尺寸  最后是颜色
	}
</style>