<template>
	<view style="padding-bottom: 50upx;">
		<view v-if="shangxian=='是'">
			<view class="top_view">
				<!-- <view class="flex justify-between padding-left-xl">
					<image src="../../static/upload/hometoplefttitle.png" style="width: 312rpx;height: 102rpx;"></image>
					<image src="../../static/upload/hometopimage.png" style="width: 329rpx;height: 151rpx;"></image>
				</view> -->
				<view>
					<image v-if="globalImages" :src="globalImages + 'imgs/banner.jpg'" style="width: 100%;height: 320rpx;" mode=""></image>
				</view>
				
				<view style="margin: 0 auto; text-align: center;" class="padding">
					<view style="font-size: 40rpx; font-weight: bold;">千万车主的新选择</view>
					<view class="flex padding" style="margin-top: 30rpx;">
						<view style="margin: 0 auto;">
							<image v-if="globalImages" :src="globalImages + 'imgs/dingdan.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
							<view style="font-size: 24rpx;">海量订单</view>
						</view>
						<view style="margin: 0 auto;">
							<image v-if="globalImages" :src="globalImages + 'imgs/hegui.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
							<view style="font-size: 24rpx;">合法合规</view>
						</view>
						<view style="margin: 0 auto;">
							<image v-if="globalImages" :src="globalImages + 'imgs/tixian (2).png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
							<view style="font-size: 24rpx;">快速提现</view>
						</view>
					</view>
				</view>

				<view class="top_centerView">
					<view style="margin: 0 10rpx 20rpx;">
						出发地
					</view>
					<view class="addboxs bg" style="padding: 0 30rpx;" @click="goCFAddress(1)">
						<view class="add_cont">
							<view class="green"></view>
							<view class="" v-if="addlist.address === ''">请选择出发地...</view>
							<view class="add_tit" v-else>
								<view class="flex align-center">
									从<view class="text-cut" style="color: #346EF6;max-width: 420rpx;">
										{{addlist.address}}
									</view>出发
								</view>
								<!-- <view class="text-sm" style="color: #999999;font-weight: 500;margin-top: 5rpx;"
								v-if="riderNumber">
								附近有{{riderNumber}}个司机
							</view> -->
							</view>
						</view>
						<view>
							<image src="../../static/image/go.png" style="width: 16rpx;height: 25rpx;">
							</image>
						</view>
					</view>
					
					<view style="margin: 0 10rpx 20rpx;">
						目的地
					</view>
					<view class="addboxs bg" style="padding: 0 30rpx;" @click="goCFAddress(2)">
						<view class="add_cont">
							<view class="orgin"></view>
							<view class="add_tit" v-if="addlists.address === ''">输入目的地</view>
							<view class="add_tit" v-else>{{addlists.address}}</view>
						</view>
						<view>
							<image src="../../static/image/go.png" style="width: 16rpx;height: 25rpx;">
							</image>
						</view>
					</view>
					
					<view style="margin: 0 10rpx 20rpx;">
						出发时间
					</view>
					<view class="flex align-center addboxs bg" style="padding: 0 30rpx;" @click="openTime()">
						<view class="flex align-center">
							<image src="/static/upload/time.png" style="width: 34rpx;height: 34rpx;"></image>
							<view class="add_tit margin-left-xs" v-if="!yuyueTime">选择预约时间</view>
							<view class="add_tit margin-left-xs" v-else>{{yuyueTime}}</view>
						</view>
						<view class="margin-left-xs">
							<image src="/static/image/right.png" style="width: 12rpx;height: 20rpx;">
							</image>
						</view>
					</view>
					<view class="fb_btn" @tap="goSave">发布行程</view>
				</view>
			</view>


			<view>
				<view v-if="orderList && orderList.length > 0">
					<view class="myOrder_view">
						<view>您有{{orderCounts}}个正在进行中的行程</view>
						<view @tap="goMore('')">查看全部</view>
					</view>
					<view class="myOrder_itemView">
						<view class="" v-for="(item,index) in orderList" @tap="goItemDetail(item)">
							<view class="flex justify-between align-center">
								<view class="item_title">正在寻找乘客</view>
								<image src="/static/image/right.png" style="width: 16rpx;height: 25rpx;"></image>
							</view>
							<view class="flex align-center add_name" style="margin: 30rpx 0rpx 4rpx;">
								<view class="green"></view>{{item.shipCity}} {{item.shipAddress}}
							</view>
							<image src="/static/upload/up.png" class="order_up"></image>
							<view class="flex align-center add_name">
								<view class="orgin"></view>{{item.deliveryCity}} {{item.deliveryAddress}}
							</view>
							<view class="item_title" style="margin-top: 26rpx;">{{item.startTime}}出发</view>
							<view v-if="index != orderList.length - 1" class="margin-tb-sm"
								style="width: 100%;height:1rpx;background: #F2F2F2;"></view>
						</view>
					</view>
				</view>
				<!-- #ifdef H5 -->
				<u-sticky :h5-nav-height="0" @fixed="xdCheck" @unfixed="noXDCheck">
				<!-- #endif -->
					<!-- #ifndef H5 -->
					<u-sticky @fixed="xdCheck" @unfixed="noXDCheck">
					<!-- #endif -->
						<view class="tab_view" id="tabSelView"
							:style="scrollTop == 1 ? '' : 'margin-top: 40rpx;height: 100rpx;'">
							<view :class="tabSel == 1 ? 'tab_items' : 'tab_item'" @tap="tabSelClick(1)">市内订单</view>
							<view :class="tabSel == 2 ? 'tab_items' : 'tab_item'" @tap="tabSelClick(2)">跨城订单</view>
						</view>


						<view style="background: #FFFFFF;">
							<u-dropdown :menu-icon='menuicon' ref="uDropdown" @open="open" @close="close"
								menu-icon-size="18">
								<u-dropdown-item v-model="value1" :title="mrtitle">
									<view class="slot-content">
										<view class=" flex flex-wrap padding">
											<view class="listpp" v-for="(item,index) in mrlist" :key="index"
												:class="mrIndex==index?'listppAct':''" @click="changeTj(item,index)">
												{{item.label}}
											</view>
										</view>
									</view>
								</u-dropdown-item>
								<u-dropdown-item v-model="value2" :title="carname">
									<view class="slot-content">
										<view class="padding">
											<!-- <view class="text-df text-bold">订单类型</view> -->
											<view class="text-df text-bold">订单类型</view>
											<view class="flex">
												<view :class="appointmentType  == 0 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZ(0)">
													全部
												</view>
												<view :class="appointmentType  == 1 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZ(1)">
													独享
												</view>
												<view :class="appointmentType == 2 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZ(2)">
													愿拼
												</view>
											</view>

											<view class="text-df text-bold margin-top">乘车人数</view>
											<view class="flex">
												<view :class="appointmentNum == 0 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZNum(0)">
													全部
												</view>
												<view :class="appointmentNum == 1 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZNum(1)">
													1位乘客
												</view>
												<view :class="appointmentNum == 2 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZNum(2)">
													2位乘客
												</view>
												<view :class="appointmentNum == 3 ? 'bz_item_sel' : 'bz_item'"
													@tap="checkBZNum(3)">
													3位及以上乘客
												</view>
											</view>
										</view>
									</view>
								</u-dropdown-item>
							</u-dropdown>
						</view>
					</u-sticky>
					<view class="boxa" @click="goOrder(item)" v-for="(item,index) in list" :key="index">
						<view class="flex align-center justify-between" style="padding: 30rpx 30rpx 0rpx;">
							<view class="item_time">{{item.appointmentStartTime}}</view>
							<!-- <view class="item_shunlu">{{item.similarity ? item.similarity : '0'}}% <text
							style="font-size: 24rpx;">顺路</text> </view> -->
						</view>
						<view class="padding margin-top-xs">
							<view class="flex align-center justify-between" style="margin-bottom: 4rpx;">
								<view class="flex align-center">
									<view class="green"></view>
									<view class="item_addName">{{item.shipAddress}}</view>
								</view>
								<!-- <view class="item_juli">{{item.startDistance}}km</view> -->
							</view>
							<view class="flex align-center margin-top justify-between">
								<view class="flex align-center">
									<view class="orgin"></view>
									<view class="item_addName">{{item.deliveryAddress}}</view>
								</view>
								<!-- <view class="item_juli">{{item.endDistance}}km</view> -->
							</view>
							<view class="margin-top flex align-center justify-between">
								<view class="flex align-center">
									<image src="/static/upload/person.png" style="width: 30rpx;height: 31rpx;"></image>
									<view style="margin-left: 16rpx;width: fit-content;" class="item_addName">
										{{item.appointmentNum}}人乘坐·{{item.appointmentType == 1 ? '独享' : '拼车'}}
									</view>
								</view>
								<!-- <view class="item_juli">订单里程{{item.kmDistance}}km</view> -->
							</view>
						</view>

						<view class="margin-tb-sm" style="width: 100%;height:1rpx;background: #F2F2F2;"></view>
						<view class="flex align-center justify-between padding-lr ">
							<view style="color: #FF2020;font-size: 32rpx;font-weight: bold;">
								<text>¥</text><text style="font-size: 42rpx;">{{item.driveMoney}}</text>
							</view>
							<view class="item_btn" @tap.stop="goOrder(item)">立即同行</view>
						</view>
					</view>
					<view class="empty" v-if="list.length == 0">
						<view style="width: 100%;margin: 0 auto;text-align: center;">
							<image src="/static/image/empty.png" style="width: 300rpx;height: 300rpx;"></image>
							<view style="color: #CCCCCC;" v-if="driverRouteId != ''">暂无订单内容</view>
							<view style="color: #CCCCCC;" v-else>请发布行程后再来查看订单信息</view>
						</view>
					</view>
			</view>

			<u-popup v-model="remkShow" mode="bottom" border-radius="40" :closeable="true">
				<view style="padding: 50rpx 30rpx 50rpx 30rpx;">
					<view class="text-lg text-bold padding-bottom-sm">出行车辆与座位数</view>

					<view class="bz_item_sel">
						{{driverPlate}}
					</view>

					<view class="text-df text-bold margin-top">乘车人数</view>
					<view class="flex">
						<view :class="personNum == 1 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZFB(1)">
							1座
						</view>
						<view :class="personNum == 2 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZFB(2)">
							2座
						</view>
						<view :class="personNum == 3 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZFB(3)">
							3座
						</view>
						<view :class="personNum == 4 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZFB(4)">
							4座
						</view>
					</view>

					<view class="text-df text-bold margin-top">是否有同行亲友</view>
					<view class="flex">
						<view :class="friendsType == 1 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZQY(1)">
							是
						</view>
						<view :class="friendsType == 2 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZQY(2)">
							否
						</view>
					</view>
					<view class="text-df text-bold margin-top">高速费用</view>
					<view class="flex">
						<view :class="isHighSpeedPrice == 1 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZGS(1)">
							司机承担
						</view>
						<view :class="isHighSpeedPrice == 2 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZGS(2)">
							乘客承担
						</view>
						<view :class="isHighSpeedPrice == 3 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZGS(3)">
							费用AA
						</view>
					</view>
					<view class="remkbtn" @click="remarkSave()">确定</view>
				</view>
			</u-popup>


			<u-picker :start-year="dqYear" v-model="Timeshow" mode="time" :params="params"
				@confirm="timeConfirm"></u-picker>
			<view class="soss" @click="goJinji()">
				<image src="../../static/my/jjqz.png" mode=""></image>
			</view>
			<view class="sosTD" v-if="orderCounts && orderCounts > 0 && scrollShow" @tap="showTD">
				<image src="/static/upload/tingdan.png"></image>
			</view>
			<view class="sosT" v-if="orderCounts && orderCounts > 0 && !scrollShow">
				<image v-if="!tdShow" src="../../static/upload/starttd.png" @click="goTingDan()"
					style="width: 149rpx;height: 24rpx;">
				</image>
				<image v-if="tdShow" src="../../static/upload/endTD.png" @click="goTingDan()"
					style="width: 149rpx;height: 24rpx;">
				</image>
				<u-line direction="col" color="#FFFFFF" length="30" />
				<view class="flex align-center" @click="goEditTD()">
					<image src="/static/upload/tdset.png" style="width: 28rpx;height: 26rpx;"></image>
					<view class="sosT_text">设置</view>
				</view>
			</view>
			<view class="sos" @click="goTop()">
				<image src="/static/upload/goTop.png" mode=""></image>
			</view>

			<view class="sos" @click="goRefers()" style="bottom: 160rpx;">
				<image src="/static/upload/refers.png" mode=""></image>
			</view>
		</view>
		
		<view v-if="shangxian=='否'">
			<view class="flex align-center padding-lr padding-top" style="padding-top: 100rpx;">
				<view class="u-m-r-10">
					<image :src="avatar" style="width: 100rpx;height: 100rpx;border-radius: 100rpx;"
						@click="goNav('/pages/login/login')"></image>
				</view>
				<view class="u-flex-1 u-m-l-10 text-white r" v-if="!isLogin">
					<view class="" @click="goNav('/pages/login/login')">{{userName}}</view>
				</view>
				<view v-else class="text-xl u-p-l-20 text-bold" @click="goNav('/pages/login/login')">
					登录
				</view>
			</view>
			<view class="flex align-center padding-left">
				<image src="/static/image/data.png" style="width: 26upx;height: 26upx;"></image>
				<view class="margin-left-xs flex align-center" style="color: #999999;">
					<view>开始时间</view>
					至
					<view>结束时间</view>
				</view>
			</view>
			<view class="flex align-center box  text-center">
				<view class="">
					￥<text class="text-bold text-xl">0</text>
					<view>总收益</view>
				</view>
				<view class="" style="margin-left:180upx">
					<text class="text-bold text-xl">0</text>
					<view>用户评分</view>
				</view>
			
			</view>
			
			<view style="padding: 30upx 30upx;">
				<view class="text-bold text-lg margin-bottom-sm flex justify-between">
					<view>接单管理</view>
					<view>
						<text style="color: #666666;font-size: 26upx;margin-right: 10upx;">查看全部</text>
					</view>
				</view>
				<view class="orderbox ">
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">待完成</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">已完成</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">已评价</view>
					</view>
				</view>
			</view>
			
			<view style="padding: 30upx 30upx;">
				<view class="text-bold text-lg margin-bottom-sm flex justify-between">
					<view>今日订单</view>
					<view>
						<text style="color: #666666;font-size: 26upx;margin-right: 10upx;">查看全部</text>
					</view>
				</view>
				<view class="orderbox ">
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">待完成</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">已完成</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">0</text>
						<view class="margin-top-xs">已评价</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import empty from '@/components/empty'
	import { waitForGlobalImages } from '@/utils/globalImageLoader'
	export default {
		components: {
			empty
		},
		onShareAppMessage(res) { //发送给朋友
			return {
				title: this.tuiguang,
				path: '/pages/index/index',
				imageUrl: this.tuiguangImg,
			}
		},
		onShareTimeline(res) { //分享到朋友圈
			return {
				title: this.tuiguang,
				path: '/pages/index/index',
				imageUrl: this.tuiguangImg,
			}
		},
		data() {
			return {
				avatar:'/static/logo.png',
				isLogin: true,
				userName: '匿名',
				
				isHighSpeedPrice: 0,
				tdShow: false,
				dqYear: '',
				orderCounts: 0,
				orderList: [],
				friendsType: 0,
				remkShow: false,
				personNum: 0,
				appointmentNum: 0,
				appointmentType: '',
				shangxian: '',
				pricetit: '全部目的地',
				carname: '高级筛选',
				value1: 1,
				value2: 2,
				value3: 1,
				value4: 2,
				menuicon: 'arrow-down-fill',
				mrtitle: '智能筛选',
				mrlist: [{
					label: '智能排序',
					value: 0,
				}, {
					label: '最早出发',
					value: 1,
				}, {
					label: '价格最高',
					value: 2,
				}, {
					label: '起点最近',
					value: 3,
				}],
				mrIndex: 0,

				driverRouteId: '',
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: false
				},
				Timeshow: false,
				tabSel: 1,
				addlist: {
					address: ''
				}, //出发地址
				addressId: '',
				addlists: {
					address: ''
				}, //目的地
				addressIds: "",
				yuyueTime: '',

				tuiguang: '',
				tuiguangImg: '',
				time: '',
				indent: {},
				latitude: '',
				longitude: '',
				province: '',
				city: '',
				district: '',
				list: [],
				page: 1,
				driverPlate: '',
				checkCertification: 0, //是否实名 状态 1待审核 2已通过 3已拒绝
				cashDeposit: 0, //缴纳保证金
				onLineFlag: 1, //1上线 2下线
				arr: [],
				showModal1: true,
				riderLine: 0,
				tabList: [{
						name: '即时代驾',
						id: 1
					},
					{
						name: '包时代驾',
						id: 1
					},
					{
						name: '朋友代叫',
						id: 2
					},
					{
						name: '预约代驾',
						id: 3
					}
				],
				bfShow: false,
				userId: '',
				current: 0,
				isDrop: false, //是否打开下拉筛选
				isVip: false, //是否是会员
				scrollTop: 0,
				scrollShow: false,
				globalImages: ''
			}
		},
		onHide() {
			// clearInterval(this.time)

		},
		onLoad(e) {
			waitForGlobalImages().then((path) => {
			    console.log('✅ 全局图片路径:', path)
			    this.globalImages = path
			  })
			let that = this
			// #ifdef MP-WEIXIN
			if (e.scene) {
				const scene = decodeURIComponent(e.scene);
				if (scene.split('=')[0].indexOf('userId') != -1) {
					let riderUserId = scene.split('=')[1]
					that.$queue.setData('riderUserId', riderUserId);
				} else {
					that.$queue.setData('inviterCode', scene.split(',')[0]);
				}
			}
			// #endif

			// 获取邀请码保存到本地
			if (e.invitation) {
				that.$queue.setData('inviterCode', e.invitation);
			}

			this.$Request.getT('/app/common/type/284').then(res => {
				if (res.code === 0) {
					//	#ifdef MP-WEIXIN
					uni.setStorageSync('shangxian', res.data.value)
					// #endif
					// #ifndef MP-WEIXIN
					uni.setStorageSync('shangxian', '否')
					// #endif
					this.shangxian = uni.getStorageSync('shangxian')
				}
			});

			let timeNow = new Date();
			timeNow.setMinutes(timeNow.getMinutes() + 30);
			this.dqYear = timeNow.getFullYear()
			this.yuyueTime =
				`${this.padZero(timeNow.getMonth() + 1)}月${this.padZero(timeNow.getDate())}日${this.padZero(timeNow.getHours())}:${this.padZero(timeNow.getMinutes())}`;
			// this.yuyueTime = e.month + '月' + e.day + '日' + ' ' + e.hour + ':' + e.minute
			let sysInfo = uni.getSystemInfoSync()
			let tabbarHeight = sysInfo.screenHeight - sysInfo.safeArea.bottom
			console.log(tabbarHeight, '2222222')
			that.userId = uni.getStorageSync('userId')
			// that.shouru()
			// that.getNewOrder()
			uni.getLocation({
				// #ifdef APP
				type: 'wgs84',
				// #endif
				// #ifndef APP
				type: 'gcj02', //wgs84  gcj02
				// #endif
				success: function(res) {
					console.log(res, '获取经纬度')
					that.latitude = res.latitude
					that.longitude = res.longitude
					that.addlist.lng = res.longitude
					that.addlist.lat = res.latitude
					uni.setStorageSync('latitude', res.latitude)
					uni.setStorageSync('longitude', res.longitude)
					let data = {
						lat: res.latitude,
						lng: res.longitude
					}
					that.$Request.getT('/app/Login/selectCity', data).then(res => {
						if (res.code === 0) {
							that.province = res.data.province
							that.city = res.data.city
							that.district = res.data.district
							uni.setStorageSync('cityName', res.data.city)
							that.addlist.address = res.data.address
							that.addlist.province = res.data.province
							that.addlist.city = res.data.city
							that.addlist.district = res.data.district
							that.taskData()
							that.getLocation()
						}
					});
					that.getUserInfo()

				},
				fail: function(ree) {
					console.log(ree, '获取地址失败')
					if (uni.getStorageSync('latitude') && uni.getStorageSync('longitude')) {
						that.latitude = uni.getStorageSync('latitude')
						that.longitude = uni.getStorageSync('longitude')
						that.getUserInfo()
						that.getLocation()
					}
					// else {
					// 	uni.startLocationUpdate({
					// 		type: 'gcj02', //gcj02  wgs84
					// 		isHighAccuracy: true, //开启高精度定位(！！！必需)
					// 		geocode: true,
					// 		success: res => {
					// 			uni.onLocationChange(function(res2) {
					// 				console.log('实时纬度：' + res2.latitude);
					// 				console.log('实时经度：' + res2.longitude);
					// 				that.latitude = res2.latitude
					// 				that.longitude = res2.longitude
					// 				uni.setStorageSync('latitude', that.latitude)
					// 				uni.setStorageSync('longitude', that.longitude)
					// 				let data = {
					// 					lat: res.latitude,
					// 					lng: res.longitude
					// 				}
					// 				that.$Request.getT('/app/Login/selectCity', data)
					// 					.then(
					// 						res => {
					// 							if (res.code === 0) {
					// 								that.province = res.data.province
					// 								that.city = res.data.city
					// 								that.district = res.data.district
					// 								that.getLocation()
					// 							}
					// 						});
					// 				that.getUserInfo()

					// 			});
					// 		},
					// 		fail: err => {
					// 			// clearInterval(this.ordertimer)
					// 			console.error('开启小程序接收位置消息失败：', err)
					// 		},
					// 		complete: msg => {
					// 			// clearInterval(this.ordertimer)
					// 			console.log('调用开启小程序接收位置消息 API 完成')
					// 		}
					// 	});
					// }
				}
			});
			if (that.userId) {
				that.time = setInterval(function() {
					// that.getNewOrder()
					uni.getLocation({
						// #ifdef APP
						type: 'wgs84',
						// #endif
						// #ifndef APP
						type: 'gcj02', //wgs84  gcj02
						// #endif
						success: function(res) {
							console.log(res, '获取经纬度')
							that.latitude = res.latitude
							that.longitude = res.longitude
							uni.setStorageSync('latitude', res.latitude)
							uni.setStorageSync('longitude', res.longitude)
							let data = {
								lat: res.latitude,
								lng: res.longitude
							}
							that.$Request.getT('/app/Login/selectCity', data).then(res => {
								if (res.code === 0) {
									that.province = res.data.province
									that.city = res.data.city
									uni.setStorageSync('cityName', res.data.city)
									that.district = res.data.district
									that.getLocation()
								}
							});
							// that.getUserInfo()

						},
						fail: function() {
							console.log('获取地址失败')
							if (uni.getStorageSync('latitude') && uni.getStorageSync('longitude')) {
								that.latitude = uni.getStorageSync('latitude')
								that.longitude = uni.getStorageSync('longitude')
								// that.getUserInfo()
								that.getLocation()
							} else {
								// that.getUserInfo()
								// that.getLocation()
								uni.startLocationUpdate({
									// #ifdef APP
									type: 'wgs84',
									// #endif
									// #ifndef APP
									type: 'gcj02', //wgs84  gcj02
									// #endif
									isHighAccuracy: true, //开启高精度定位(！！！必需)
									geocode: true,
									success: res => {
										uni.onLocationChange(function(res2) {
											console.log('实时纬度：' + res2.latitude);
											console.log('实时经度：' + res2.longitude);
											that.latitude = res2.latitude
											that.longitude = res2.longitude
											uni.setStorageSync('latitude', that
												.latitude)
											uni.setStorageSync('longitude', that
												.longitude)
											let data = {
												lat: res.latitude,
												lng: res.longitude
											}
											that.$Request.getT(
												'/app/Login/selectCity',
												data).then(res => {
												if (res.code === 0) {
													that.province = res
														.data
														.province
													that.city = res.data
														.city
													that.district = res
														.data
														.district
													that.getLocation()
												}
											});
											// that.getUserInfo()

										});
									},
									fail: err => {
										// clearInterval(this.ordertimer)
										console.error('开启小程序接收位置消息失败：', err)
									},
									complete: msg => {
										// clearInterval(this.ordertimer)
										console.log('调用开启小程序接收位置消息 API 完成')
									}
								});
							}
						}
					});
				}, 10000)

			}
		},
		onShow() {
			this.$Request.getT('/app/common/type/358').then(res => {
				if (res.code === 0) {
					uni.setStorageSync('tuiguang', res.data.value)
					this.tuiguang = res.data.value;
				}
			});
			this.$Request.getT('/app/common/type/357').then(res => {
				if (res.code === 0) {
					uni.setStorageSync('tuiguangImg', res.data.value)
					this.tuiguangImg = res.data.value;
				}
			});
			let that = this
			that.$Request.getT('/app/common/type/428').then(res => { //师傅端小程序订单状态通知 428
				if (res.code == 0) {
					if (res.data && res.data.value) {
						that.arr.push(res.data.value)
					}
				}
			})
			that.$Request.getT('/app/common/type/429').then(res => { //师傅端小程序新订单通知 429
				if (res.code == 0) {
					if (res.data && res.data.value) {
						that.arr.push(res.data.value)
					}
				}
			})
			that.userId = uni.getStorageSync('userId')
			if (that.userId) {
				that.getMyOrderList();
				that.getUserInfo()
				// that.shouru()
				if (that.showModal1) {
					// #ifdef MP-WEIXIN
					that.openMsg()
					// #endif
				}
			} else {
				this.userId = ''
				this.orderCounts = 0;
				this.orderList = []
				this.list = []
				this.isVip = false
				clearInterval(that.time)
				clearInterval(that.timeTD)
				this.tdShow = false
				this.indent = {}
			}
		},
		onPageScroll(e) {
			// e.scrollTop 是页面在垂直方向已滚动的距离（单位px）
			this.scrollShow = true;
		},
		methods: {
			showTD() {
				this.scrollShow = false;
			},
			getMassgeList() {
				let that = this;
				this.$Request.getT('/app/message/selectMessageByUserId?state=13&isSee=0&page=1&limit=1').then(res => {
					if (res.code == 0 && res.data) {
						if (res.data.records && res.data.records.length > 0) {
							if (res.data.records[0].content) {
								clearInterval(that.timeTD)
								const innerAudioContext = uni.createInnerAudioContext();
								innerAudioContext.autoplay = true;
								innerAudioContext.src = res.data.records[0].content;
								innerAudioContext.onPlay(() => {
									console.log('开始播放');
								});
								innerAudioContext.onEnded(() => {
									that.timeTD = setInterval(function() {
										that.getMassgeList();
									}, 3000);
								});
								that.page = 1;
								that.getMyOrderList();
								that.getUserInfo()
							}
						}
					}
				});
			},
			goTingDan() {
				let that = this;
				if (!this.tdShow) {
					that.tdShow = true
					let driverId = this.$queue.getData('driverId');
					let city = that.city ? that.city : ''
					let data = {
						isListeningOrders: 1,
						driverId: driverId,
						city: city,
						latitude: that.latitude,
						longitude: that.longitude
					}
					that.$queue.showLoading('设置中...')
					that.$Request.postJson('/app/driver/updateDriver', data).then(res => {
						uni.hideLoading();
						if (res.code == 0) {
							that.$queue.showToast('开始听单！')
							setTimeout(d => {
								that.timeTD = setInterval(function() {
									console.log(that.bfShow, "13456")
									that.getMassgeList();
								}, 5000);
							}, 1500)
						} else {
							that.$queue.showToast(res.msg)
						}
					});

				} else {
					let driverId = this.$queue.getData('driverId');
					let city = that.city ? that.city : ''
					let data = {
						isListeningOrders: 1,
						driverId: driverId,
						city: city,
						latitude: that.latitude,
						longitude: that.longitude
					}
					that.$queue.showLoading('设置中...')
					that.$Request.postJson('/app/driver/updateDriver', data).then(res => {
						uni.hideLoading();
						if (res.code == 0) {
							that.tdShow = false
							that.$queue.showToast('已结束听单！')
							clearInterval(that.timeTD)
						} else {
							that.$queue.showToast(res.msg)
						}
					});
				}
			},
			goEditTD() {
				if (!this.userId) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return;
				}

				uni.navigateTo({
					url: '/my/order/tdSet'
				});
			},
			goTop() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			goRefers() {
				if (this.userId) {
					this.$queue.showLoading('刷新中...')
					this.page = 1;
					this.getMyOrderList();
					this.getUserInfo()
				} else {
					this.orderCounts = 0;
					this.orderList = []
					this.list = []
					this.isVip = false
					clearInterval(that.time)
					this.indent = {}
				}
			},
			getMyOrderList() {
				this.$Request.getT('/app/driverRoute/selectDriverRouteListByUserId?page=1&limit=2').then(red => {
					if (red.code == 0 && red.data) {
						this.orderList = red.data.records;
						this.orderCounts = red.data.total;
						if (red.data.records && red.data.records.length > 0) {
							this.driverRouteId = red.data.records[0].driverRouteId;
							// this.addlist.province = red.data.records[0].shipProvince;
							// this.addlist.city = red.data.records[0].shipCity;
							// this.addlist.district = red.data.records[0].shipDistrict;
							// this.addlist.lng = red.data.records[0].shipAddressLongitude;
							// this.addlist.lat = red.data.records[0].shipAddressLatitude;
							// this.addlist.address = red.data.records[0].shipAddress;
							// this.addlists.province = red.data.records[0].deliveryProvince;
							// this.addlists.city = red.data.records[0].deliveryCity;
							// this.addlists.district = red.data.records[0].deliveryDistrict;
							// this.addlists.lng = red.data.records[0].deliveryAddressLongitude;
							// this.addlists.lat = red.data.records[0].deliveryAddressLatitude;
							// this.addlists.address = red.data.records[0].deliveryAddress;
							// this.yuyueTime = red.data.records[0].startTime;
							this.$queue.setData('driverRouteId', red.data.records[0].driverRouteId)
							this.taskData();

						}
					}

					uni.hideLoading();
				});
			},
			remarkSave() {
				this.remkShow = false;
				if (this.friendsType < 1 || this.personNum < 1) {
					this.$queue.showToast('请选择乘车人数和是否有亲友同行！')
					return;
				}
				if (this.isHighSpeedPrice < 1) {
					this.$queue.showToast('请选择是否承担高速费用！')
					return;
				}

				this.$queue.showLoading('提交中...')
				let driverId = this.$queue.getData('driverId');
				let userId = this.$queue.getData('userId');
				let data = {
					driverId: driverId,
					shipProvince: this.addlist.province,
					shipCity: this.addlist.city,
					shipDistrict: this.addlist.district,
					shipAddressLongitude: this.addlist.lng,
					shipAddressLatitude: this.addlist.lat,
					shipAddress: this.addlist.address,
					deliveryProvince: this.addlists.province,
					deliveryCity: this.addlists.city,
					isHighSpeedPrice: this.isHighSpeedPrice,
					seatNum: this.personNum,
					isFriends: this.friendsType,
					deliveryDistrict: this.addlists.district,
					deliveryAddressLongitude: this.addlists.lng,
					deliveryAddressLatitude: this.addlists.lat,
					deliveryAddress: this.addlists.address,
					startTime: this.yuyueTime,
					userId: userId
				}
				this.$Request.postJson('/app/driverRoute/insertDriverRoute', data).then(
					res => {
						uni.hideLoading();
						if (res.code == 0) {
							this.addlists.address = '';
							let timeNow = new Date();
							timeNow.setMinutes(timeNow.getMinutes() + 30);
							this.dqYear = timeNow.getFullYear()
							this.yuyueTime =
								`${this.padZero(timeNow.getMonth() + 1)}月${this.padZero(timeNow.getDate())}日${this.padZero(timeNow.getHours())}:${this.padZero(timeNow.getMinutes())}`;
							this.$queue.showToast('发布成功！');
							this.getUserInfo();
							this.getMyOrderList();
						} else {
							this.$queue.showToast(res.msg);
						}
					})
			},
			//获取正在进行的订单数量
			getMasterHaveOrder() {
				// this.$Request.getT('/app/orders/getMasterHaveOrder').then(res=>{
				// 	if(res.code == 0){

				// 	}
				// })
				return new Promise((resolve, reject) => {
					this.$Request.getT('/app/orders/getMasterHaveOrder').then(res => {
						if (res.code == 0) {
							resolve(res.data); // 假设你要获取的数据在res.data中，这里根据实际情况修改
						} else {
							reject(res);
						}
					}).catch(error => {
						reject(error);
					});
				});
			},
			goJinji() {
				uni.navigateTo({
					url: '/my/setting/jinji'
				})
			},
			open(index) {
				console.log('open', index)
				this.$refs.uDropdown.highlight();
				this.isDrop = true
			},
			close(index) {
				console.log('close', index)
				// 关闭的时候，给当前项加上高亮
				// 当然，您也可以通过监听dropdown-item的@change事件进行处理
				this.$refs.uDropdown.highlight(index);
				this.isDrop = false
			},
			timeConfirm(e) {
				this.yuyueTime = e.month + '月' + e.day + '日' + '' + e.hour + ':' + e.minute
			},
			openTime() {
				this.Timeshow = true
			},
			goCFAddress(index) {
				let that = this
				uni.chooseLocation({
					success: function(res) {
						console.log('位置名称：' + res.name);
						console.log('详细地址：' + res.address);
						console.log('纬度：' + res.latitude);
						console.log('经度：' + res.longitude);
						if (index == 1) {
							that.addlist.address = res.name
							that.addlist.lng = res.longitude
							that.addlist.lat = res.latitude
							let data = {
								lat: res.latitude,
								lng: res.longitude
							}
							that.$Request.getT('/app/Login/selectCity', data).then(res => {
								if (res.code === 0) {
									that.addlist.province = res.data.province
									that.addlist.city = res.data.city
									that.addlist.district = res.data.district
								}
							});
						} else if (index == 2) {
							that.addlists.address = res.name
							that.addlists.lng = res.longitude
							that.addlists.lat = res.latitude
							let data = {
								lat: res.latitude,
								lng: res.longitude
							}
							that.$Request.getT('/app/Login/selectCity', data).then(res => {
								if (res.code === 0) {
									that.addlists.province = res.data.province
									that.addlists.city = res.data.city
									that.addlists.district = res.data.district
								}
							});
						}
					}
				});
			},
			//时间格式转换
			padZero(num) {
				return num < 10 ? `0${num}` : num;
			},
			change(index) {
				if (uni.getStorageSync('token')) {
					this.current = index
					this.taskData()
				}
			},
			// 今日收入、订单量
			shouru() {
				// this.$Request.getT('/app/orders/findIncome').then(res => {
				// 	if (res.code == 0) {
				// 		this.indent = res.data
				// 	}
				// 	console.log('res', res)

				// });
			},
			getNewOrder() {
				this.$Request.getT('/app/message/getOrderMessage').then(res => {
					if (res.code == 0) {
						if (res.data > 0) {
							// this.aplayAudio()
						}
					}
				});
			},
			//接单池刷新
			aplayAudio() {
				// console.log('语音提示')
				// const innerAudioContext = uni.createInnerAudioContext();
				// innerAudioContext.autoplay = true;
				// // innerAudioContext.src ='../../static/mpc/order.mp3';
				// innerAudioContext.src =
				// 	'https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3';
				// innerAudioContext.onPlay(() => {
				// 	console.log('开始播放');
				// });
				// innerAudioContext.onError((res) => {
				// 	console.log(res.errMsg);
				// 	console.log(res.errCode);
				// });
			},
			// 获取个人信息
			getUserInfo() {
				let userId = this.$queue.getData('userId');
				if (!userId) {
					return;
				}
				this.$Request.getT("/app/user/selectUserDetails?userId=" + userId).then(res => {
					if (res.code == 0) {
						this.$nextTick(function() {
							// this.checkCertification = res.data.checkCertification
							this.cashDeposit = res.data.cashDeposit
							this.onLineFlag = res.data.onLineFlag
							this.riderLine = res.data.riderLine
							if (res.data.isVip && res.data.isVip == 1) {
								this.isVip = true
							} else {
								this.isVip = false
							}
						})
					} else {
						this.$queue.logout();
						uni.showModal({
							showCancel: false,
							title: '登录失败',
							content: res.msg,
						});
					}
				});


				this.$Request.getT('/app/driver/selectDriverByUserId?userId=' + userId).then(res => {
					if (res.code == 0 && res.data) {
						this.checkCertification = res.data.status
						this.driverPlate = res.data.driverPlate
						if (this.checkCertification && this.checkCertification == 2) {
							// this.$Request.getT('/app/driverRoute/selectDriverRouteByUserId?userId=' + userId).then(
							// 	red => {
							// 		if (red.code == 0 && red.data) {
							// 			this.driverRouteId = red.data.driverRouteId;
							// 			this.addlist.province = red.data.shipProvince;
							// 			this.addlist.city = red.data.shipCity;
							// 			this.addlist.district = red.data.shipDistrict;
							// 			this.addlist.lng = red.data.shipAddressLongitude;
							// 			this.addlist.lat = red.data.shipAddressLatitude;
							// 			this.addlist.address = red.data.shipAddress;
							// 			this.addlists.province = red.data.deliveryProvince;
							// 			this.addlists.city = red.data.deliveryCity;
							// 			this.addlists.district = red.data.deliveryDistrict;
							// 			this.addlists.lng = red.data.deliveryAddressLongitude;
							// 			this.addlists.lat = red.data.deliveryAddressLatitude;
							// 			this.addlists.address = red.data.deliveryAddress;
							// 			this.yuyueTime = red.data.startTime;
							// 			this.$queue.setData('driverRouteId', red.data.driverRouteId)
							// 			this.taskData();
							// 		}
							// 	})

						}
						uni.setStorageSync('checkCertification', res.data.status)
						uni.setStorageSync('driverId', res.data.driverId)
					}
				})
			},
			async goCloseSave() {
				let data = await this.getMasterHaveOrder()
				console.log(data, '22222222222222')
				if (data > 0) {
					uni.showModal({
						title: '提示',
						content: '有订单正在进行中，无法取消当前行程',
						showCancel: false
					})
					return
				}
				if (this.isDrop) {
					this.$refs.uDropdown.close();
				}
				let that = this;

				uni.showModal({
					title: '提示',
					content: '确认取消发布行程吗？',
					cancelText: '取消',
					confirmText: '确认',
					complete: function(ret) {
						if (ret.confirm) {

							let data = {
								driverRouteId: that.driverRouteId
							}
							that.$Request.postT('/app/driverRoute/deleteDriverRoute', data).then(res => {
								if (res.code == 0) {
									that.addlist.address = ''
									that.addlists.address = ''
									that.driverRouteId = ''
									that.$queue.removeItem('driverRouteId')
									that.list = []
									that.page = 1;
									that.$queue.showToast('取消成功！');
									let timeNow = new Date();
									that.yuyueTime =
										`${that.padZero(timeNow.getMonth() + 1)}月${that.padZero(timeNow.getDate())}日${that.padZero(timeNow.getHours())}:${that.padZero(timeNow.getMinutes())}`;
								} else {
									that.$queue.showToast(res.msg);
								}
							});

						}
					}
				})
			},
			goItemDetail(item) {
				if (!this.userId) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return;
				}

				uni.navigateTo({
					url: '/my/order/myOrderDetail?driverRouteId=' + item.driverRouteId
				});
			},
			goMore(indentNumber) {
				if (!this.userId) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return;
				}

				if (this.orderCounts < 1) {
					this.$queue.showToast('请发布行程后再来查看吧！')
					return;
				}

				uni.navigateTo({
					url: '/my/order/myOrderList?indentNumber=' + indentNumber
				});
			},
			goSave() {
				// this.$refs.uDropdown.close();
				if (this.userId) {
					if (this.addlist.address === '') {
						this.$queue.showToast('请选择出发地址！')
						return;
					}

					if (this.addlists.address === '') {
						this.$queue.showToast('请选择目的地！')
						return;
					}

					if (this.yuyueTime === '') {
						this.$queue.showToast('请选择预约时间！')
						return;
					}

					if (this.checkCertification == 2) {
						this.$Request.getT('/app/common/type/261').then(res => {
							if (res.code === 0) {
								let baozhengjin = res.data.value;
								if (uni.getStorageSync('isBindung') == '是') {
									if ((Number(this.cashDeposit) < Number(baozhengjin))) {
										uni.showModal({
											title: '提示',
											content: '保证金不足，请先缴纳保证金后再发单',
											success: function(res) {
												if (res.confirm) {
													console.log('用户点击确定');
													uni.navigateTo({
														url: '/my/wallet/baozhengjin'
													})
												} else if (res.cancel) {
													console.log('用户点击取消');
												}
											}
										});
										return
									}
								}

								this.remkShow = true;
							}
						});

					} else if (this.checkCertification == 1) {
						uni.showToast({
							title: '实名认证审核中，请稍等...',
							icon: 'none'
						})
						return
					} else {
						uni.showModal({
							title: '提示',
							content: '请先实名认证后再发单',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									uni.navigateTo({
										url: '/my/renzheng/index'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
						return;
					}
				} else {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}
			},
			goOrder(e) {
				if (this.userId) {
					if (this.checkCertification == 2) {
						this.$Request.getT('/app/common/type/261').then(res => {
							if (res.code === 0) {
								let baozhengjin = res.data.value;
								// console.log((Number(this.cashDeposit) - Number(baozhengjin))>0)
								// return
								if (uni.getStorageSync('isBindung') == '是') {
									if ((Number(this.cashDeposit) >= Number(baozhengjin))) {
										// uni.navigateTo({
										// 	url: '/pages/index/orderDet?indentNumber=' + e.ordersId
										// })
										this.goMore(e.ordersId);
									} else {
										uni.showModal({
											title: '提示',
											content: '保证金不足，请先缴纳保证金后再接单',
											success: function(res) {
												if (res.confirm) {
													console.log('用户点击确定');
													uni.navigateTo({
														url: '/my/wallet/baozhengjin'
													})
												} else if (res.cancel) {
													console.log('用户点击取消');
												}
											}
										});
									}
								} else {

									this.goMore(e.ordersId);
									// uni.navigateTo({
									// 	url: '/pages/index/orderDet?indentNumber=' + e.ordersId
									// })
								}

							}
						});

					} else if (this.checkCertification == 1) {
						uni.showToast({
							title: '实名认证审核中，请稍等...',
							icon: 'none'
						})
						return
					} else if (this.checkCertification == '' || this.checkCertification == null) {
						uni.showModal({
							title: '提示',
							content: '请先实名认证后再接单',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									uni.navigateTo({
										url: '/my/renzheng/index'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
						return;
					}
				} else {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}
			},
			checkBZGS(index) {
				this.isHighSpeedPrice = index;
			},
			checkBZQY(index) {
				this.friendsType = index;
			},
			checkBZFB(index) {
				this.personNum = index;
			},
			checkBZNum(index) {
				this.appointmentNum = index
				this.page = 1;
				this.taskData()
			},
			checkBZ(index) {
				this.appointmentType = index
				this.page = 1;
				this.taskData()
			},
			changeTj(item, index) {
				this.$refs.uDropdown.close();
				this.mrIndex = index
				this.page = 1;
				this.taskData()
			},
			xdCheck(e) {
				this.scrollTop = 1;
				console.log('吸顶')
			},
			noXDCheck(e) {
				this.scrollTop = 0;
				console.log('no吸顶')
			},
			tabSelClick(index) {
				this.tabSel = index;
				this.page = 1;
				this.taskData()
			},
			// 获取新任务数据
			taskData() {
				// if (this.orderCounts < 1) {
				// 	uni.hideLoading();
				// 	uni.stopPullDownRefresh();
				// 	return;
				// }
				let shipProvince = this.province
				let shipCity = this.city


				let orderType = 1;
				if (this.tabSel == 2) { //跨市
					shipProvince = '';
					shipCity = '';
					orderType = 2;
				}

				let sort = this.mrIndex ? this.mrIndex : '';

				let userId = this.$queue.getData('userId');
				let data = {
					page: this.page,
					limit: 10,
					od: this.latitude,
					ol: this.longitude,
					appointmentType: this.appointmentType ? this.appointmentType : '',
					appointmentNum: this.appointmentNum ? this.appointmentNum : '',
					shipProvince: shipProvince,
					driverUserId: userId,
					shipCity: shipCity,
					orderType: orderType,
					status: 2,
					sort: sort
				}
				this.$Request.getT('/app/orders/selectOrdersList', data).then(res => {
					uni.hideLoading()
					if (res.code == 0) {
						if (this.page == 1) {
							this.list = res.data.list
						} else {
							this.list = [...this.list, ...res.data.list]
						}
					}
					uni.stopPullDownRefresh();
				});
			},

			// 接单成功语音播放
			// aplayAudios() {
			// 	// console.log('语音提示')
			// 	const innerAudioContext = uni.createInnerAudioContext();
			// 	innerAudioContext.autoplay = true;
			// 	innerAudioContext.src =
			// 		'https://pw.xianmxkj.com/file/uploadPath/2022/03/15/c096db4257ecc2547814d4f51c6518bd.mp3';
			// 	innerAudioContext.onPlay(() => {
			// 		console.log('开始播放');
			// 	});
			// 	innerAudioContext.onError((res) => {
			// 		console.log(res.errMsg);
			// 		console.log(res.errCode);
			// 	});
			// },
			// 上传师傅位置
			getLocation() {
				if (!this.userId) {
					return;
				}
				if (this.orderCounts < 1) {
					return;
				}
				let data = {
					lng: this.longitude,
					lat: this.latitude,
					userId: this.userId,
					province: this.province,
					city: this.city,
					district: this.district,
				}
				this.$Request.getT('/timedtask/riderLocation', data).then(res => {
					if (res.code == 0) {
						console.log('上传师傅位置')
					}
				});
			},

			//接单
			jiedan(item) {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				if (this.isDrop) {
					this.$refs.uDropdown.close();
				}
				if (this.userId) {
					if (uni.getStorageSync('isOpenVip') == '是') {
						if (this.isVip == false) {
							uni.showModal({
								title: '提示',
								content: '开通会员后可接单',
								confirmText: '开通会员',
								complete(ret) {
									if (ret.confirm) {
										uni.navigateTo({
											url: '/my/vip/vip'
										})
									}
								}
							})
							return
						}
					}
					if (this.checkCertification == 2) {
						this.$Request.getT('/app/common/type/261').then(res => {
							if (res.code === 0) {
								let baozhengjin = res.data.value;
								let that = this
								console.log((Number(this.cashDeposit) >= Number(baozhengjin)))
								// return
								if (uni.getStorageSync('isBindung') == '是') {
									if ((Number(this.cashDeposit) >= Number(baozhengjin))) {
										uni.showModal({
											title: '提示',
											content: '确定抢单吗？',
											success: function(res) {
												if (res.confirm) {
													// console.log('用户点击确定');
													that.$Request.postT(
															'/app/orders/takingOrders?ordersId=' +
															item.ordersId + '&userId=' + that.userId +
															'&driverRouteId=' + that.driverRouteId)
														.then(res => {
															if (res.code == 0) {
																that.taskData()
																uni.showToast({
																	title: '接单成功',
																	icon: 'none'
																})
																setTimeout(function() {
																	uni.switchTab({
																		url: '/pages/order/order'
																	})
																}, 1000)
															} else {
																that.taskData()
																uni.showToast({
																	title: res.msg,
																	icon: 'none',
																	duration: 1500
																})
															}
														});
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
									} else {
										uni.showModal({
											title: '提示',
											content: '还未缴纳保证金，请先去缴纳保证金',
											success: function(res) {
												if (res.confirm) {
													console.log('用户点击确定');
													uni.navigateTo({
														url: '/my/wallet/baozhengjin'
													})
												} else if (res.cancel) {
													console.log('用户点击取消');
												}
											}
										});
									}
								} else {
									uni.showModal({
										title: '提示',
										content: '确定抢单吗？',
										success: function(res) {
											if (res.confirm) {
												// console.log('用户点击确定');
												that.$Request.postT(
														'/app/orders/takingOrders?ordersId=' +
														item.ordersId + '&userId=' + that.userId +
														'&driverRouteId=' + that.driverRouteId)
													.then(res => {
														if (res.code == 0) {
															that.taskData()
															uni.showToast({
																title: '接单成功',
																icon: 'none'
															})
															setTimeout(function() {
																uni.switchTab({
																	url: '/pages/order/order'
																})
															}, 1000)
														} else {
															that.taskData()
															uni.showToast({
																title: res.msg,
																icon: 'none',
																duration: 1500
															})
														}
													});
											} else if (res.cancel) {
												// console.log('用户点击取消');
											}
										}
									});
								}

							}
						});
					} else if (this.checkCertification == 1) {
						uni.showToast({
							title: '实名认证审核中，请稍等...',
							icon: 'none'
						})
						return
					} else if (this.checkCertification == '' || this.checkCertification == null) {
						uni.showModal({
							title: '提示',
							content: '请先实名认证后再接单',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									uni.navigateTo({
										url: '/my/renzheng/index'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
						return;
					}
				} else {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}

			},
			goNav(e,) {
				console.log(e)
				if (this.userId) {
					uni.navigateTo({
						url: e
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								uni.navigateTo({
									url: '/pages/login/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			},
			// 开启订阅消息
			openMsg() {
				console.log('订阅消息')
				var that = this
				uni.getSetting({
					withSubscriptions: true, //是否获取用户订阅消息的订阅状态，默认false不返回
					success(ret) {
						console.log(ret.subscriptionsSetting, '------------------')
						// if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
						if (ret.subscriptionsSetting.itemSettings) {
							uni.setStorageSync('sendMsg', true)
							uni.openSetting({ // 打开设置页 
								success(rea) {
									console.log(rea.authSetting)
								}
							});
						} else { // 用户没有点击“总是保持以上，不再询问”则每次都会调起订阅消息
							console.log(99999)
							uni.setStorageSync('sendMsg', false)
							uni.showModal({
								title: '提示',
								content: '为了更好的体验,请绑定消息推送',
								confirmText: '确定',
								cancelText: '取消',
								success: function(res) {
									if (res.confirm) {
										console.log(that.arr)
										wx.requestSubscribeMessage({
											tmplIds: that.arr,
											success(re) {
												console.log(JSON.stringify(re),
													'++++++++++++++')
												var datas = JSON.stringify(re);
												if (datas.indexOf("accept") != -1) {
													console.log(re)
													// uni.setStorageSync('sendMsg', true)
												}
											},
											fail: (res) => {
												console.log(res)
											}
										})
										// uni.setStorageSync('sendMsg', true)
										console.log('确认')
										that.showModal1 = false
									} else if (res.cancel) {
										console.log('取消')
										// uni.setStorageSync('sendMsg', false)
										that.showModal1 = true
									}
								}
							})
						}
					}
				})
			}
		},
		// 上拉加载
		onReachBottom: function() {
			if (this.userId) {
				this.page = this.page + 1;
				this.taskData();
			}
		},
		onPullDownRefresh: function() {
			// #ifdef MP-WEIXIN
			if (uni.getStorageSync('sendMsg')) {
				uni.requestSubscribeMessage({
					tmplIds: this.arr,
					success(re) {
						// console.log(re,'**********')
						var datas = JSON.stringify(re);
						if (datas.indexOf("accept") != -1) {
							console.log(re)
						}
					},
					fail: (res) => {
						console.log(res)
					}
				})
			}
			// #endif
			if (this.userId) {
				this.page = 1;
				this.taskData();
			} else {
				uni.hideLoading();
				uni.stopPullDownRefresh();
			}
		},
	}
</script>

<style lang="less">
	page {
		background: #F5F5F5;
	}

	::v-deep .u-sticky {
		background-color: #F5F5F5;
	}

	.sosTD {
		width: 140rpx;
		height: 80rpx;
		position: fixed;
		bottom: 160rpx;
		left: 32rpx;
		z-index: 99;

		image {
			width: 80rpx;
			height: 80rpx;
		}
	}

	.sosT {
		width: 390rpx;
		position: fixed;
		bottom: 160rpx;
		left: 25%;
		background: #25262A;
		padding: 20rpx;
		z-index: 99;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 26rpx;
		color: #FFFFFF;
		border-radius: 45px;
		display: flex;
		justify-content: space-between;
		padding: 30rpx 40rpx;
		align-items: center;

		.sosT_text {
			font-family: Source Han Sans CN;
			font-weight: 500;
			font-size: 26rpx;
			color: #FFFFFF;
			margin-left: 10rpx;
		}
	}

	.soss {
		width: 70rpx;
		height: 70rpx;
		position: fixed;
		bottom: 290rpx;
		left: 32rpx;
		z-index: 99;

		image {
			width: 70rpx;
			height: 70rpx;
		}
	}

	.sos {
		width: 100rpx;
		height: 100rpx;
		position: fixed;
		bottom: 290rpx;
		right: 32rpx;
		z-index: 99;

		image {
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
		}
	}

	.labelsx {
		padding: 0 30rpx;

		.scroll-view_H {
			white-space: nowrap;
			width: 100%;
		}

		.scroll-view-item_labe {
			display: inline-block;
			// width: 20%;
			padding: 0 35rpx;
			// width: 121rpx;
			height: 60rpx;
			background: #FFFFFF;
			border-radius: 8rpx;
			text-align: center;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			// line-height: 60rpx;
			margin-right: 20rpx;
			display: inline-flex;
			align-items: center;
			justify-content: center;
		}

		.scroll-view-item_labeAct {
			background: #EAF9FF;
			color: #00c18a;
		}
	}

	// 价格 车龄筛选  
	.slot-content {
		border-radius: 0rpx 0rpx 32rpx 32rpx;
		padding-bottom: 30rpx;
		background: #FFFFFF;

		.listpp {
			// text-align: center;
			padding: 0rpx 20rpx;
			// width: 150rpx;
			height: 60rpx;
			background: #F7F8FC;
			border-radius: 8rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #171717;
		}

		.listppAct {
			padding: 0rpx 20rpx;
			height: 60rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			background: #e8fbf6;
			border: 1px solid #00c18a;
			border-radius: 8rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #00c18a;
		}

		.btn {
			background: #00c18a;
			color: #FFF;
			padding: 20rpx 0;
			text-align: center;
		}
	}

	.empty {
		width: 100%;
		background: #ffffff;
		height: 600rpx;
		// margin-top: 20rpx;
		padding-top: 60rpx;
	}

	.item_addName {
		font-family: PingFang SC;
		font-weight: 600;
		font-size: 28rpx;
		color: #1A1A1A;
		width: 520rpx;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}

	.item_juli {
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 26rpx;
		color: #999999;
	}

	.item_btn {
		width: 150rpx;
		height: 58rpx;
		background: #00c18a;
		border-radius: 29rpx;
		text-align: center;
		line-height: 58rpx;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #FFFFFF;
	}

	.tab_view {
		width: 750rpx;
		background: #F3F5F9;
		display: flex;
		// margin-top: 40rpx;

		.tab_item {
			width: 375rpx;
			height: 100rpx;
			background: #F3F5F9;
			border-radius: 24rpx 24rpx 0px 0px;
			text-align: center;
			line-height: 100rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			font-size: 28rpx;
			color: #999999;
		}

		.tab_items {
			width: 375rpx;
			height: 100rpx;
			background: #FFFFFF;
			border-radius: 24rpx 24rpx 0px 0px;
			text-align: center;
			line-height: 100rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			font-size: 28rpx;
			color: #333333;
		}
	}

	.addboxs {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 10rpx 30rpx;
		height: 80rpx;
		border-radius: 16rpx;

		.add_cont {
			display: flex;
			align-items: center;
		}

		.add_tit {
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
			margin-left: 10rpx;
		}
	}



	.bg {
		// background: #FFFFFF;
		background: #f5f5f5;
		border-radius: 16rpx;
		border: 1px solid #f5f5f5;
	}

	.bgc {
		// background: #FFFFFF;
	}

	.myOrder_view {
		width: 686rpx;
		height: 120rpx;
		background: #e8fbf6;
		border-radius: 32rpx 32rpx 0px 0px;
		margin: 0 auto;
		margin-top: 30rpx;
		display: flex;
		justify-content: space-between;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 26rpx;
		color: #00c18a;
		padding: 30rpx;
	}

	.myOrder_itemView {
		width: 686rpx;
		// height: 549rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		margin: 0 auto;
		margin-top: -30rpx;
		padding: 30rpx 40rpx;

		.item_title {
			font-family: Source Han Sans CN;
			font-weight: 600;
			font-size: 32rpx;
			color: #242424;
		}
	}

	.order_up {
		width: 6rpx;
		height: 24rpx;
		margin-left: 6rpx;
	}


	.green {
		width: 16rpx;
		height: 16rpx;
		background: #1FC657;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.orgin {
		width: 16rpx;
		height: 16rpx;
		background: #FBAC04;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.fb_btn {
		width: 592rpx;
		height: 80rpx;
		background: #00c18a;
		border-radius: 16rpx;
		margin: 0 auto;
		margin-top: 40rpx;
		font-family: PingFang SC;
		font-weight: 800;
		font-size: 28rpx;
		color: #FFFFFF;
		text-align: center;
		line-height: 80rpx;
	}

	.bz_item {
		width: fit-content;
		padding: 18rpx 30rpx;
		// height: 71rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		border: 1px solid #CCCCCC;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #030303;
		margin-top: 20rpx;
		margin-right: 20rpx;
	}

	.bz_item_sel {
		width: fit-content;
		padding: 18rpx 30rpx;
		// height: 71rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		border: 1px solid #00c18a;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #00c18a;
		margin-top: 20rpx;
		margin-right: 20rpx;
	}

	.remkbtn {
		width: 100%;
		height: 98rpx;
		background: #346EF6;
		border-radius: 16rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		line-height: 98rpx;
		margin-top: 40rpx;
	}

	.top_view {
		width: 750rpx;
		// height: 681rpx;
		// background: linear-gradient(80deg, #3670F6 0%, #8EB0FF 100%);
		// background: linear-gradient(to bottom, #3670F6 0%, #8EB0FF 70%, #F5F5F5 90%);
		// padding-top: 100rpx;

		.top_centerView {
			width: 686rpx;
			// height: 409rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			margin: 0 auto;
			// margin-top: 40rpx;
			padding: 20rpx 20rpx 40rpx;
		}
	}

	.maps {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		z-index: 1;
	}

	.bottomBtn {
		position: fixed;
		bottom: 88rpx;
		right: 20rpx;
		z-index: 10;

		.bottomBtn-img {
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
		}

	}

	.orderInfoNum {
		width: 100%;
		height: auto;
		background-color: #F5F5F5;
		padding: 30rpx 0;

		.orderInfoNum-box {
			width: 686rpx;
			height: 100%;
			background-color: #FFFFFF;
			border-radius: 24rpx;
			padding: 20rpx;
		}

		.orderInfoNum-box-title {
			width: 100%;
			text-align: center;
			font-weight: bold;
			font-size: 30rpx;
		}

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

		.orderInfoNum-box-num-item-top {
			font-size: 26rpx;
			font-weight: bold;
		}

		.orderInfoNum-box-num-item-txt {
			color: #999999;
			font-size: 24rpx;
		}
	}

	.boxa {
		background: #FFFFFF;
		border-radius: 24rpx;
		margin: 0 30rpx;
		// padding: 30rpx 0;
		margin-top: 30rpx;
		padding-bottom: 20rpx;
		// margin-bottom: 30rpx;

		.item_time {
			font-family: Source Han Sans CN;
			font-weight: bold;
			font-size: 28rpx;
			color: #242424;
		}

		.item_shunlu {
			width: 210rpx;
			height: 80rpx;
			background: #EFF4FF;
			border-radius: 0px 24rpx 0px 50rpx;
			text-align: center;
			line-height: 80rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			font-size: 32rpx;
			color: #346EF6;
		}

		.addbox {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 30rpx;
			height: 110rpx;
			border-radius: 16rpx;

		}

		.add_cont {
			display: flex;
			align-items: center;
		}

		.add_tit {
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.bg {
			background: #F5F5F5;
		}

		.bgs {
			background: #F5F8FF;

		}

		.green {
			width: 16rpx;
			height: 16rpx;
			background: #1FC657;
			border-radius: 50%;
			margin-right: 20rpx;
		}

		.orgin {
			width: 16rpx;
			height: 16rpx;
			background: #FBAC04;
			border-radius: 50%;
			margin-right: 20rpx;
		}

		.btn {
			height: 78rpx;
			background: linear-gradient(87deg, #346EF6 0%, #7BA2FF 100%);
			border-radius: 4rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			margin: 30rpx 30rpx 0;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
	
	
	.box {
		width: 690upx;
		margin: 0 auto;
		height: 120rpx;
		background: #557EFD;
		border-radius: 16upx 16upx 0px 0px;
		color: #FFFFFF;
		padding: 0upx 30upx;
		margin-top: 20upx;
	}
	
	.orderbox {
		width: 690upx;
		margin: 0 auto;
		height: 153upx;
		background: #FAFAFA;
		border-radius: 16upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		text-align: center;
		padding: 0upx 30upx;
	}
</style>