<template>
	<view class="pages">
		<!-- 地址 -->
		<view class="text-center text-red" v-if="isTrue && orderType == 2">超出配送距离</view>
		<view class="food">
			<view class="flex bg justify-between padding-lr-xl">
				<view @click="switchTab(2)" :class="orderType == 2 ? 'select' : ''" class="tabBtn"
					v-if="XCXIsSelect == '是'">
					<view class="title">外卖配送</view>
					<view :class="orderType == 2 ? 'active' : ''"></view>
				</view>
				<view @click="switchTab(1)" :class="orderType == 1 ? 'select' : ''" class="tabBtn">
					<view class="title">到店自取</view>
					<view :class="orderType == 1 ? 'active' : ''"></view>
				</view>
			</view>
			<view v-if="orderType == 1">
				<!-- <view class="text-black text-lg margin-top">商家地址</view> -->
				<view class="flex margin-top" style="">
					<u-icon name="map" size="50"></u-icon>
					<view class="flex-sub padding-tb-sm margin-left-sm">
						<view class="text-lg text-bold text-black">
							<text>{{ dataList.shopName }}</text>
							<text class="margin-left-sm" @click="call">{{ dataList.shopPhone }}</text>
						</view>
						<view class="text-df margin-top-xs" style="color: #999999;" @click="goMap">
							{{ dataList.detailedAddress }}
						</view>
					</view>
				</view>
				<!-- 预约送达时间 -->
				<!-- <view class="goods_address" v-if="reservationOpenFlag==1">
					<view class="address_box">
						<view class="address_name">送达时间</view>
						<picker class='time-picker' mode="multiSelector" @change="bindStartMultiPickerChange"
							@columnchange="bindMultiPickerColumnChange" :range="data.multiArray">
							{{data.startDate}}
						</picker>
						<view class="songda_image">
							<image src="../../../static/images/index/right.png"></image>
						</view>
					</view>
				</view> -->
			</view>
			<view class="" v-if="orderType == 2">
				<view class="goods_address" v-if="JSON.stringify(address) == '{}'" @click="goAddress">
					<view class="address_box">
						<view class="address_name">请选择收货地址</view>
						<view class="address_image margin-left">
							<image src="../../../static/images/index/right.png"></image>
						</view>
					</view>
				</view>
				<view class="flex margin-top" style="" v-else @click="goAddress">
					<u-icon name="map" size="50"></u-icon>
					<view class="flex-sub padding-tb-sm margin-left-sm">
						<view class="text-lg text-bold text-black">
							<text>{{ address.userName }}</text>
							<text class="margin-left-sm">{{ address.userPhone }}</text>
						</view>
						<view class="text-df margin-top-xs" style="color: #999999;">
							{{ address.province }}{{ address.city }}{{ address.district }}{{ address.addressDetail }}
						</view>
					</view>
					<view class="address_image margin-left">
						<image src="../../../static/images/index/right.png"></image>
					</view>
				</view>
				<!-- 预约送达时间 -->
				<!-- <view class="goods_address" v-if="reservationOpenFlag==1">
					<view class="address_box">
						<view class="address_name">送达时间</view>
						<picker class='time-picker' mode="multiSelector" @change="bindStartMultiPickerChange"
							@columnchange="bindMultiPickerColumnChange" :range="data.multiArray">
							{{data.startDate}}
						</picker>
						<view class="songda_image">
							<image src="../../../static/images/index/right.png"></image>
						</view>
					</view>
				</view> -->
			</view>
		</view>

		<!-- 商品 -->
		<view class="food">
			<view class="tosend_header_food" v-for="(item, index) in goodsList" :key="index">
				<view class="tosend_header_food_le">
					<image :src="item.goodsPicture[0]" style="border-radius: 10rpx;" mode=""></image>
				</view>
				<view class="flex-sub margin-left-sm">
					<view class="flex justify-between align-center">
						<view class="text-lg text-bold text-black">{{ item.goodsName }}</view>
						<view class="text-lg text-bold text-black">
							<text class="text-sm">¥</text>
							{{ item.goodsPrice }}
						</view>
					</view>
					<view class="flex justify-between align-center text-gray">
						<view v-if="item.skuMessage">{{ item.skuMessage }}</view>
						<view>x{{ item.goodsNum }}</view>
					</view>
					<view class="flex justify-between align-center text-gray margin-tb-sm">
						<view>打包费</view>
						<view class="">￥{{ item.goodsPack }} / 份</view>
					</view>
				</view>
			</view>
			<!-- <view class="tosend_header_do do_top" v-if="item.goodsPack>0" >
				<view>打包费</view>
				<view class="tosend_header_do_ri">￥{{item.goodsPack}}</view>
			</view> -->
			<view class="tosend_header_do justify-between" v-if="paotuiMoney > 0 && orderType == 2">
				<view>跑腿费</view>
				<view class="tosend_header_do_ri">￥{{ paotuiMoney }}</view>
			</view>
			<view class="tosend_header_do justify-between do_bot" @click="isShow">
				<view>优惠券</view>
				<view class="tosend_header_do_ri" v-if="coupon">- ￥{{ coupon.money }}</view>
				<view v-else>
					<image src="../../../static/images/order/right1.png" style="width: 14rpx;height: 24rpx;" mode="">
					</image>
				</view>
			</view>
			<view class="tosend_header_do justify-between do_bot" @click="huodongShow">
				<view>优惠活动</view>
				<view class="tosend_header_do_ri" v-if="huodong">- ￥{{ huodong.discountAmount }}</view>
				<view v-else>
					<image src="../../../static/images/order/right1.png" style="width: 14rpx;height: 24rpx;" mode="">
					</image>
				</view>
			</view>
			<view class="tosend_header_do justify-between">
				<view class="tosend_header_do_le2">合计</view>
				<view class="tosend_header_do_ri2">
					<text>￥</text>
					{{ totalPrice1 }}
				</view>
			</view>
		</view>
		<!-- 订单备注 -->
		<view class="food">
			<view class="padding-tb-sm text-lg text-bold text-bold text-black">订单备注</view>
			<view class="flex align-center justify-between padding-tb-sm padding-lr"
				style="background: #f5f5f5;width: 100%;">
				<u-input v-model="remark" type="textarea" placeholder="请输入订单备注" height="180" maxlength="200"
					style="width: 100%;"></u-input>
			</view>
		</view>

		<!-- 支付方式 -->
		<view class="food">
			<view class="padding-tb-sm text-lg text-bold text-bold text-black">支付方式</view>
			<view style="height: 100upx;" v-for="(item, index) in openLists" :key="index">
				<view class="flex align-center justify-between padding-tb" v-if="item.text != '零钱'">
					<image :src="item.image" style="width: 55rpx;height: 55rpx;border-radius: 50upx;"></image>
					<view class="flex-sub text-xl margin-left">{{ item.text }}</view>
					<radio-group name="openWay" style="margin-left: 20upx;" @change="selectWay(item)">
						<label class="tui-radio">
							<radio class="red" :checked="openWay === item.id ? true : false" />
						</label>
					</radio-group>
				</view>
				<view class="flex align-center justify-between padding-tb" v-if="item.text === '零钱'">
					<image :src="item.image" style="width: 55rpx;height: 55rpx;border-radius: 50upx;"></image>
					<view class="flex-sub text-xl margin-left">{{ item.text }} <text
							style="font-size: 30rpx;margin-left: 10rpx;"
							v-if="userMoney && userMoney > 0">(余额：{{userMoney}})</text>
						<!-- <text v-else
							style="font-size: 30rpx;margin-left: 10rpx;text-decoration:underline;color: #ea0000;"
							@tap="goCash()">去充值</text> -->
					</view>
					<radio-group name="openWay" style="margin-left: 20upx;" @change="selectWay(item)">
						<label class="tui-radio">
							<radio class="red" :checked="openWay === item.id ? true : false" />
						</label>
					</radio-group>
				</view>
			</view>
		</view>
		<view style="height: 120rpx;"></view>
		<!-- 结算 -->
		<view class="goorder">
			<!-- <view class="goorder_but" @click="toSettlement">立即结算</view> -->
			<view class="goorder_but" :class="isTrue && orderType == 2 ? 'goorder_but_' : ''" @click="toSettlement">立即结算
			</view>
		</view>

		<view class="hintPopul" v-if="shopDet && shopDet.putawayFlag == 1">
			<view class="content_">
				<image src="../../../static/images/index/shop.png" style="width: 200rpx;height: 180rpx;"></image>
				<view class="text-xl text-bold">店铺打烊啦</view>
				<view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
				<view class="margin-top-xs text-gray margin-bottom">{{ shopDet.businessHours }}-{{ shopDet.lockHours }}
				</view>
				<view class="Btns" @click="goBack()">知道了</view>
			</view>
		</view>

		<u-popup v-model="show" mode="center" :closeable="true" close-icon-pos="top-right" close-icon="close-circle"
			close-icon-size="50" border-radius="20" width="80%" @close="close">
			<view class="padding bg-gray">
				<view class="text-center text-lg text-bold margin-bottom-sm">可用优惠券</view>
				<scroll-view scroll-y="true" style="height: 600rpx;" v-if="couponList.length > 0">
					<view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
						v-for="(item, index) in couponList" :key="index" @click="selCoupon(item)">
						<view>
							<view>{{ item.couponName }}</view>
							<view>有效期至{{ item.expirationTime }}</view>
						</view>
						<view class="text-sm text-bold">
							¥
							<text class="text-lg">{{ item.money }}</text>
						</view>
					</view>
				</scroll-view>
				<view v-if="couponList.length == 0"
					style="height: 100rpx;line-height: 100rpx;text-align: center;font-weight: 700;">暂无可用优惠券</view>
			</view>
		</u-popup>
		<!-- 选择优惠活动 -->
		<u-popup v-model="youhui" mode="center" :closeable="true" close-icon-pos="top-right" close-icon="close-circle"
			close-icon-size="50" border-radius="20" width="80%" @close="closeYouhui()">
			<view class="padding bg-gray">
				<view class="text-center text-lg text-bold margin-bottom-sm">可用优惠活动</view>
				<scroll-view scroll-y="true" style="height: 600rpx;" v-if="huoList.length > 0">
					<view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
						v-for="(item, index) in huoList" :key="index" @click="selctHuo(item)">
						<view>
							<view>{{ item.activityTitle }}</view>
							<view>有效期至{{ item.activityEndTime }}</view>
						</view>
						<!-- <view class="text-sm text-bold">
							¥
							<text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
							<text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
							<text class="text-lg" v-if="item.activityType=='4'">全场打{{ item.discountAmount }}折</text>
						</view> -->
					</view>
				</scroll-view>
				<view v-if="huoList.length == 0"
					style="height: 100rpx;line-height: 100rpx;text-align: center;font-weight: 700;">暂无可用优惠活动</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	/**
	 * 获取任意时间
	 */
	function getDate(date, AddDayCount = 0) {
		if (!date) {
			date = new Date()
		}
		if (typeof date !== 'object') {
			date = date.replace(/-/g, '/')
		}
		const dd = new Date(date)
	
		dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
	
		var a = new Array("日", "一", "二", "三", "四", "五", "六");  
		var week = new Date().getDay();    
		var week2 = new Date().getDay()+1;    
		const y = dd.getFullYear()
		const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期，不足10补0
		const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号，不足10补0
		const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
		const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
		const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
		return {
			fullDate: y + '-' + m + '-' + d,
			fullDate2: y + '-' + m + '-' + d+' '+h+':'+f+':'+s,
			fullTime: m + '月' + d + '日',
			year: y,
			month: m,
			date: d,
			day: dd.getDay(),
			sWeek:"周"+ a[week],
			eWeek:"周"+ a[week2]
		}
	}
	export default {
		data() {
			return {
				userMoney: 0,
				shopDet: '',
				isThrottle: true, //防抖，待支付结果返回后继续
				storeCommodityId: 0,
				openLists: [],
				openWay: 2,
				orderId: '',
				page: 1,
				limit: 100,
				dataList: [],
				packMoney: 0, //打包费
				totalPrice: 0,
				totalPrice1: 0,
				address: {}, //地址
				addressId: '',
				parentId: '',
				shopId: '',
				show: false,
				youhui: false, //优惠活动
				coupon: '', //选择的优惠券信息
				huodong: '', //选择的活动信息
				couponList: [],
				huoList: [], //可用活动
				orderType: 2,
				paotuiMoney: 0,
				dabaoMoney: 0,
				goodsMoney: null,
				distance: 0,
				isTrue: false,
				goodsList: [],
				XCXIsSelect: '是',
				remark: '',
				GoodsorderId: '',
				ifPaotui: 0, //是否满减
				lng: '',
				lat: '',
				data: {
					multiArray: [],
					warning: '',
					startDate: '请选择'
				},
				workStart:'',//骑手上班时间
				workStartMin:'',//上班分钟
				workEnd:'',//骑手下班时间
				yusongTime:'',//骑手预计送达时长
				reservationFlag:0,//是否预约单 1是、0否
				expectDeliveryTime:'',//预约送达时间
				timer:'',//定时器
				autoSendOrder:0,//autoSendOrder为1商家自配，0平台配送
				reservationOpenFlag:0,//1预约，0不预约
			};
		},
		onLoad(option) {
			// #ifdef APP
			this.openLists = [{
					image: '../../../static/images/my/weixin.png',
					text: '微信',
					id: 2
				},
				{
					image: '../../../static/images/my/zhifubao.png',
					text: '支付宝',
					id: 3
				},
				{
					image: '../../../static/images/my/jinbi.png',
					text: '零钱',
					id: 1
				}
			];
			// #endif

			// #ifdef MP-WEIXIN
			this.XCXIsSelect = this.$queue.getData('XCXIsSelect') ? this.$queue.getData('XCXIsSelect') : '是';
			this.openLists = [{
					image: '../../../static/images/my/weixin.png',
					text: '微信',
					id: 2
				},
				{
					image: '../../../static/images/my/jinbi.png',
					text: '零钱',
					id: 1
				}
			];
			// #endif

			// #ifdef H5
			this.openLists = [{
					image: '../../../static/images/my/weixin.png',
					text: '微信',
					id: 2
				},
				{
					image: '../../../static/images/my/zhifubao.png',
					text: '支付宝',
					id: 3
				},
				{
					image: '../../../static/images/my/jinbi.png',
					text: '零钱',
					id: 1
				}
			];
			// #endif

			this.shopId = option.shopId;
			// #ifndef H5
			uni.getLocation({
				type: 'gcj02', //返回可以用于uni.openLocation的经纬度
				success: function(res) {
					this.lat = res.latitude;
					this.lng = res.longitude;

				}
			});
			this.getShopDet(this.shopId);
			// #endif
			// #ifdef H5
			uni.getLocation({
				type: 'gcj02', //返回可以用于uni.openLocation的经纬度
				success: function(res) {
					this.lat = res.latitude;
					this.lng = res.longitude;
				}
			});

			this.getShopDet(this.shopId);
			// #endif

			this.orderType = option.orderType;
			if (option.orderId) {
				this.orderId = option.orderId;
			}

			uni.showLoading({
				title: '加载中...',
				mask: true, // 是否显示透明蒙层，防止触摸穿透
			});
			// this.getOrderList();
			this.getAddressList();
		},
		  onUnload() {
		    // 页面销毁时清除定时器
		    if (this.timer) {
		      clearInterval(this.timer);
		    }
		  },
		onShow() {
			this.getMsgData();
			console.log(uni.getStorageSync('addressId'), '地址id');
			this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId');
			if (this.addressId) {
				console.log(this.addressId, '地址id');
				this.address = {};
				this.getAddressDet(this.addressId);
			}
			// 设置定时器
			this.timer = setInterval(() => {
			  // 定时器执行的操作
			  // this.getQishou()
			  console.log('每分钟执行一次');
			  // 这里可以放置你需要每分钟执行的代码
			  this.getCouponList();
			  this.getHuoList();
			}, 60 * 1000); // 60 * 1000 毫秒代表一分钟
		},
		methods: {
			//获取骑手上下班时间
			getQishou(){
				this.$Request.get('/app/tbindent/work-time').then(res => {
					console.log(res,'p')
					if (res.code == 0 && res.data) {
						if(this.orderType==2){
							if(this.autoSendOrder==0){
								//0是平台配
								this.workStart=parseInt((res.data.workingHoursOfRider).substring(0,2))
								this.workStartMin=parseInt((res.data.workingHoursOfRider).substring(3,5))
								this.workEnd=parseInt((res.data.workingHoursOfRider).substring(6,8))
							}else if(this.autoSendOrder==1){
								this.workStart=parseInt((this.shopDet.businessHours).substring(0,2))
								this.workStartMin=parseInt((this.shopDet.businessHours).substring(3,5))
								this.workEnd=parseInt((this.shopDet.lockHours).substring(0,2))
							}
						}else if(this.orderType==1){
							this.workStart=parseInt((this.shopDet.businessHours).substring(0,2))
							this.workStartMin=parseInt((this.shopDet.businessHours).substring(3,5))
							this.workEnd=parseInt((this.shopDet.lockHours).substring(0,2))
						}
						this.yusongTime=res.data.timeOfRider
						
						var date = new Date();
						var currentHours = date.getHours();
						var currentMinute = date.getMinutes();
						var temp = [];
						// currentHours = 12;
						var temp_time = [];
						//如果当前时间大于20点
						var minite=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
						if(parseInt(this.yusongTime/60)==0){
							var h1=0
							var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
						}else{
							var h1=parseInt(this.yusongTime/60)
							var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
						}
						var acc=currentHours + h1
						var bcc=currentMinute + h2
						var teshu=this.workStart + h1
						if(bcc>=60){
							var b=bcc-60
							var a=acc+1
						}else{
							var b=bcc
							var a=acc
						}
						var a1=a + 1
						
						var s1=a.toString()
						var s2=a1.toString()
						var e1=b.toString()
						console.log(this.workEnd,h1,currentHours,'o')
						var cc=(this.workStartMin+h2).toString()
						if (currentHours >= (this.workEnd-h1)) {
							var time2=teshu+1
							// this.data.warning = '当前时间段无骑手配送,现在下单,最早将于明日'+teshu + ':00'+'送达'
							uni.showModal({
							  title: '提示',
							  content: '当前时间段无骑手配送,现在下单,最早将于明日'+teshu + ':00'+'送达',
							  success: function (res) {
								if (res.confirm) {
								} else if (res.cancel) {
								}
							  }
							});
							
							// this.data.startDate = '明日 | '+teshu + ':00' + '-' + time2 + ':00'
							// this.data.startDate = '明早 | '+a + ':'+b + '-' + a1 + ':'+b
							temp[0] = ["明天"];
							temp[1] = [];
							// console.log(teshu,'明1',this.workEnd-h1)
							for (let i = teshu; i < (this.workEnd-h1);) {
								var i1 = i + 1;
								var ss1=i.toString()
								var ss2=i1.toString()
								// console.log(ss1,'明')
								temp[1].push(ss1.padStart(2,0) + ':'+cc.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+cc.padStart(2,0))
								i += 1;
							}
						} else if (currentHours < this.workStart) {
							var time2=teshu+1
							uni.showModal({
							  title: '提示',
							  content: '当前时间段无骑手配送,现在下单,最早将于今日'+teshu + ':00'+'送达',
							  success: function (res) {
							    if (res.confirm) {
							    } else if (res.cancel) {
							    }
							  }
							});
							temp[0] = ["今天", "明天"];
							temp[1] = [];
							for (let i = teshu; i < (this.workEnd-h1);) {
								var i1 = i + 1;
								var ss1=i.toString()
								var ss2=i1.toString()
								temp[1].push(ss1.padStart(2,0) + ':'+cc.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+cc.padStart(2,0))
								i += 1;
							}
						} else {
							temp[0] = ["今天", "明天"];
							temp[1] = [];
							for (let i = a; i < (this.workEnd-h1);) {
								var i1 = i + 1;
								var ss1=i.toString()
								var ss2=i1.toString()
								temp[1].push(ss1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+e1.padStart(2,0))
								i += 1;
							}
						}
						// this.$queue.setData({
						//   multiArray:temp,
						// })
						
						this.data.multiArray = temp
						if(this.data.warning!=''){
						  wx.showToast({
						    title: this.data.warning,
						    icon: 'none',
						    duration: 3000
						  })
						}
					}
				});
			},
			bindMultiPickerColumnChange: function(e) {
				console.log(e)
				console.log('第几列发生变化', e.detail.column)
				console.log('选择第几个', e.detail.value)
				let c = e.detail.column;
				let v = e.detail.value;
				var time = [];
				var date = new Date();
				var currentHours = date.getHours();
				var currentMinute = date.getMinutes();
				var minite=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
				if(parseInt(this.yusongTime/60)==0){
					var h1=0
					var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
				}else{
					var h1=parseInt(this.yusongTime/60)
					var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
				}
				var acc=currentHours + h1
				var bcc=currentMinute + h2
				var teshu=this.workStart + h1
				if(bcc>=60){
					var b=bcc-60
					var a=acc+1
				}else{
					var b=bcc
					var a=acc
				}
				var a1=a + 1
				var s1=a.toString()
				var s2=a1.toString()
				var e1=b.toString()
				var cc=(this.workStartMin+h2).toString()
				// console.log(this.workStartMin,h2,'kkk')
				var temp = this.data.multiArray;
				// currentHours = 12;
				if (c == 0) {
					if (temp[c][v] == '今天') {
						temp[1] = [];
						for (let i = a; i < (this.workEnd-h1);) {
							var i1 = i + 1;
							var ss1=i.toString()
							var ss2=i1.toString()
							temp[1].push(ss1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+e1.padStart(2,0))
							i += 1;
						}
					} else {
						temp[1] = [];
						for (let i = teshu; i < (this.workEnd-h1);) {
							var i1 = i + 1;
							var ss1=i.toString()
							var ss2=i1.toString()
							temp[1].push(ss1.padStart(2,0) + ':'+cc.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+cc.padStart(2,0))
							i += 1;
						}
					}
					// this.$queue.setData({
					//   multiArray:temp
					// })
					this.data.multiArray = temp
					this.$forceUpdate();
				}
			},
			bindStartMultiPickerChange: function(e) {
				let temp = this.data.multiArray;
				// this.$queue.setData({
				//   startDate:temp[0][e.detail.value[0]]+' | '+temp[1][e.detail.value[1]]
				// })
				this.data.startDate = temp[0][e.detail.value[0]] + ' | ' + temp[1][e.detail.value[1]]
				console.log(temp[0][e.detail.value[0]],temp[1][e.detail.value[1]].substring(0,5),getDate(new Date(),2).fullDate)
				if(this.data.startDate){
					this.reservationFlag=1
					if(temp[0][e.detail.value[0]]=="今天") {
						var date=getDate(new Date()).fullDate
						this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(0,5)+":00"
					}else if(temp[0][e.detail.value[0]]=="明天") {
						var date=getDate(new Date(),1).fullDate
						this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(0,5)+":00"
					}else if(temp[0][e.detail.value[0]]=="后天") {
						var date=getDate(new Date(),2).fullDate
						this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(0,5)+":00"
					}
				}
			},

			goCash() {
				uni.navigateTo({
					url: '/my/wallet/index'
				});
			},
			getMsgData() {
				this.$Request.get("/app/userintegral/findUserMessage").then(res => {
					if (res.code == 0 && res.data) {
						this.userMoney = res.data.userMoney ? res.data.userMoney : 0;
					}
				});
			},
			//获取店铺详情
			getShopDet(shopId) {
				let data = {
					shopId,
					lng: this.lng,
					lat: this.lat
				};
				this.$Request.get('/app/goods/selectGoodsList', data).then(res => {
					if (res.code == 0 && res.data) {
						this.reservationOpenFlag=res.data.goodsShop.reservationOpenFlag
						this.autoSendOrder=res.data.goodsShop.autoSendOrder
						this.shopDet = res.data.goodsShop;
						this.ifPaotui = res.data.goodsShop.enableFullReductionFlag
						this.getOrderList();
						// this.getQishou()
					}
				});
			},
			goBack() {
				uni.navigateBack({});
			},
			isShow() {
				this.show = true;
			},
			//选择优惠活动弹框
			huodongShow() {
				this.youhui = true
			},
			getDistance() {
				if (this.address.lng && this.dataList.shopLng) {
					let data = {
						ol: this.address.lng,
						od: this.address.lat,
						dl: this.dataList.shopLng,
						dd: this.dataList.shopLat
					};
					this.$Request.post('/app/tbindent/distance', data).then(res => {
						if (res.code == 0) {
							this.distance = res.data;
							if (this.distance > Number(this.dataList.distributionDistance)) {
								this.isTrue = true;
							} else {
								this.isTrue = false;
							}
						}
					});
				}
			},
			close() {
				this.show = false;
			},
			closeYouhui() {
				this.youhui = false;
			},
			switchTab(e) {
				this.orderType = e;
				this.coupon = '';
				this.huodong=''
				if (JSON.stringify(this.address) != '{}') {
					this.getDistance();
				}
				if (this.orderType == 2) {

					this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(
						this.dabaoMoney)).toFixed(2);

				} else {
					this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2);
				}
				if (this.coupon) {
					let totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? 
						this.coupon.money : 0)-(this.huodong.discountAmount ? this.huodong.discountAmount : 0).toFixed(2));
					if (totalMoney <= 0) {
						this.totalPrice1 = 0.01;
					} else {
						this.totalPrice1 = totalMoney;
					}
				}
				
				if (this.huodong) {
					let totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? 
						this.coupon.money : 0)-(this.huodong.discountAmount ? this.huodong.discountAmount : 0).toFixed(2));
					if (totalMoney <= 0) {
						this.totalPrice1 = 0.01;
					} else {
						this.totalPrice1 = totalMoney;
					}
				}
			},
			// 删除优惠券
			detCoupon() {
				let data = {
					orderId: this.dataList.orderId
				};
				this.$Request.post('/app/order/deleteCouponByOrderId', data).then(res => {
					if (res.code == 0) {}
				});
			},
			// 选择优惠券
			selCoupon(item) {
				this.coupon = item;
				if (this.orderType == 2) {
					this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
				} else {
					this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
				}

				let totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0) - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)).toFixed(2);

				if (totalMoney <= 0) {
					this.totalPrice1 = 0.01;
				} else {
					this.totalPrice1 = totalMoney;
				}

				let data = {
					parentId: this.dataList.parentId,
					couponId: this.coupon ? this.coupon.id : ''
				};
				this.$Request.post('/app/order/employCoupon', data).then(res => {
					if (res.code == 0) {
						this.show = false;
					}
				});
			},
			//选择活动activityId
			selctHuo(item) {
				this.huodong = item;
				if (this.orderType == 2) {
					this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
				} else {
					this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
				}
				let totalMoney = parseFloat(this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)- (this.coupon.money ? this.coupon.money : 0)).toFixed(2);
				if (totalMoney <= 0) {
					this.totalPrice1 = 0.01;
				} else {
					this.totalPrice1 = totalMoney;
				}
				this.youhui = false;
			},
			// 优惠卷列表
			getCouponList() {
				// console.log(this.paotuiMoney)
				// console.log(this.dabaoMoney, '123123')
				let minMoney =
					this.orderType == 2 ?
					parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(this.dabaoMoney))
					.toFixed(2) :
					parseFloat(this.totalPrice).toFixed(2);
				let data = {
					shopId: this.dataList.shopId,
					page: 1,
					limit: 10,
					minMoney: minMoney
				};
				this.$Request.get('/app/coupon/selectUserCouponList', data).then(res => {
					if (res.code == 0) {
						this.couponList = res.data.list;
						// console.log(this.couponList,'this.couponList',this.coupon)
						if(this.coupon){
							let activityExists = this.couponList.some(item => item.couponId === this.coupon.couponId);
							if(!activityExists){
								this.coupon=''
								if (this.orderType == 2) {
									this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
								} else {
									this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
								}
								
								let totalMoney = parseFloat(this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)- (this.coupon.money ? this.coupon.money : 0)).toFixed(2);
								
								if (totalMoney <= 0) {
									this.totalPrice1 = 0.01;
								} else {
									this.totalPrice1 = totalMoney;
								}
								uni.showModal({
								  title: '提示',
								  content: '当前选择的优惠券已过期，请重新选择',
								  success: function (res) {
									if (res.confirm) {
										this.coupon=''
									} else if (res.cancel) {
										this.coupon=''
									}
								  }
								});
							}
						}
					}
				});
			},
			// 优惠活动列表
			getHuoList() {
				let data = {
					orderId: this.dataList.orderId,
				};
				this.$Request.get(`/app/activity/suit-activity/${this.dataList.orderId}`, data).then(res => {
					if (res.code == 0) {
						this.huoList = res.data;
						// console.log(this.huodong)
						if(this.huodong){
							// console.log(this.huodong,'有呢')
							let activityExists = this.huoList.some(item => item.activityId === this.huodong.activityId);
							if(!activityExists){
								this.huodong=''
								if (this.orderType == 2) {
									this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
								} else {
									this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
								}
								
								let totalMoney = parseFloat(this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)- (this.coupon.money ? this.coupon.money : 0)).toFixed(2);
								
								if (totalMoney <= 0) {
									this.totalPrice1 = 0.01;
								} else {
									this.totalPrice1 = totalMoney;
								}
								uni.showModal({
								  title: '提示',
								  content: '当前选择的优惠活动已过期，请重新选择',
								  success: function (res) {
									if (res.confirm) {
										this.huodong=''
									} else if (res.cancel) {
										this.huodong=''
									}
								  }
								});
							}
						}
						
						// for(var i=0;i<this.huoList.length;i++){
						// 	if(this.huodong!=''&&this.huodong.activityId!=this.huoList[i].activityId){
						// 		console.log('优惠活动过期')
						
						// 	}
						// }
						// if(this.huoList.length==0){
						// 	this.huodong=''
						// }
					}
				});
			},

			//拼单支付成功取消订单

			cancelPinDan() {
				let that = this;
				// if (that.orderId) {
				// 	let data = {
				// 		orderId: that.orderId
				// 	};
				// 	that.$Request.post('/app/order/deleteOrder', data).then(res => {
				// 		if (res.code == 0) {
				// 			uni.removeStorageSync('orderId');
				// 		}
				// 	});
				// }
			},
			// 商品列表
			getOrderList() {
				// 显示加载提示
				uni.showLoading({
				    title: '加载中', // 加载提示文本
					mask: true, // 是否显示透明蒙层，防止触摸穿透
				});
				this.paotuiMoney =0
				this.totalPrice1 =0
				let data = {
					shopId: this.shopId,
					status: 1,
					page: 1,
					limit: 1000
					// orderType: this.orderType
				};
				this.$Request.get('/app/order/selectAllOrderList', data).then(res => {
					uni.hideLoading();
					if (res.code == 0 && res.data.pageUtils.list) {
						this.GoodsorderId = res.data.pageUtils.list[0].orderId;
						this.dataList = res.data.pageUtils.list[0];

						if (this.dataList && this.dataList.orderGoodsList && this.dataList.orderGoodsList[0]) {
							this.dataList.orderGoodsList[0].forEach(res => {
								res.goodsPicture = res.goodsPicture.split(',');
								this.dabaoMoney += res.goodsPack * res.goodsNum;
								this.goodsMoney += res.goodsPrice * res.goodsNum;
								this.goodsMoney = parseFloat(this.goodsMoney + this.dabaoMoney);
							});
							this.goodsList = this.dataList.orderGoodsList[0];
						}
						console.log(this.dataList,this.dabaoMoney,'kkklll')

						// this.paotuiMoney = this.dataList.errandMoney
						if (this.ifPaotui == 1) {
							this.paotuiMoney = this.dataList.errandMoney;
						} else if (this.ifPaotui == 0) {
							// 判断商品金额是否大于最低减免配送费金额
							console.log(this.goodsMoney, '商品总金额', res, this.dataList.exemptMinMoney)
							if (Number(this.goodsMoney) >= Number(this.dataList.exemptMinMoney)) {
								this.paotuiMoney = 0;
							} else {
								this.paotuiMoney = this.dataList.errandMoney;
							}
						}

						this.totalPrice = res.data.money;
						if (this.orderType == 2) {
							this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this
								.paotuiMoney) + parseFloat(this.dabaoMoney)).toFixed(2);
						} else {
							this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this
								.dabaoMoney)).toFixed(2);
						}

						// console.log(this.dataList)
						this.getCouponList();
						this.getHuoList();
						this.detCoupon();
						this.getDistance();
					}
					// 加载提示关闭
					uni.hideLoading()
				});
			},
			selectWay(item) {
				this.openWay = item.id;
			},
			takeReark() {
				let datas = {
					orderId: this.GoodsorderId,
					remark: this.remark
				};
				this.$Request.post('/app/order/updateOrdersRemark', datas).then(res => {

					if (res.code == 0) {} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				});
			},
			// 立即结算
			toSettlement() {
				if (this.isThrottle == false) {
					return
				}
				let that = this;

				if (this.isTrue && this.orderType == 2) {
					uni.showToast({
						title: '超出配送范围',
						icon: 'none'
					});
					reutrn;
				}
				if (this.orderType == 2 && !this.address.addressId) {
					uni.showToast({
						title: '请选择收货地址',
						icon: 'none'
					});
					return;
				}
				if (this.remark) {
					this.takeReark();
				}
				uni.showLoading({
					title: '支付中...',
					mask: true, // 是否显示透明蒙层，防止触摸穿透

				});
				this.isThrottle = false
				if (this.openWay == 1) {
					//零钱支付
					let data = {
						userId:uni.getStorageSync('userId'),
						type:1,//支付方式 1表示微信支付、4或5表示支付宝支付
						activityId:this.huodong ? this.huodong.activityId : '',
						reservationFlag:this.reservationFlag,//是否预约单 1是、0否
						expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType
					};
					console.log(data,'l')
					this.$Request.post('/app/wxPay/balanceOrder', data).then(res => {
						console.log(res,'结果')
						if (res.code == 0) {
							uni.hideLoading();
							that.$queue.showToast('支付成功');
							that.cancelPinDan();
							setTimeout(function() {
								that.isThrottle = true
								uni.switchTab({
									url: '/pages/order/index'
								});
							}, 1000);
						} else {
							that.$queue.showToast(res.msg);
							that.isThrottle = true
						}
					});
				} else if (this.openWay == 2) {
					//微信支付
					// #ifdef H5
					let data = {
						userId:uni.getStorageSync('userId'),
						type:1,//支付方式 1表示微信支付、4或5表示支付宝支付
						activityId:this.huodong ? this.huodong.activityId : '',
						reservationFlag:this.reservationFlag,//是否预约单 1是、0否
						expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType,
						type: 2
					};
					this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
						uni.hideLoading();
						if (res.code == 0) {
							this.callPay(res.data);
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
							this.isThrottle = true
						}
					});
					// #endif
					// #ifdef MP-WEIXIN

					let data = {
						userId:uni.getStorageSync('userId'),
						type:4,//支付方式 1表示微信支付、4或5表示支付宝支付
						activityId:this.huodong ? this.huodong.activityId : '',
						reservationFlag:this.reservationFlag,//是否预约单 1是、0否
						expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType,
						type: 3
					};
					this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
						// uni.hideLoading();
						if (res.code == 0) {
							uni.requestPayment({
								provider: 'wxpay',
								timeStamp: res.data.timestamp,
								nonceStr: res.data.noncestr,
								package: res.data.package,
								signType: res.data.signType,
								paySign: res.data.sign,
								success: function(suc) {
									that.cancelPinDan();
									uni.hideLoading();
									that.$queue.showToast('支付成功');
									setTimeout(function() {
										that.isThrottle = true
										uni.switchTab({
											url: '/pages/order/index'
										});
									}, 1000);
								},
								fail: function(err) {
									console.log('fail:' + JSON.stringify(err));
									that.isThrottle = true
									uni.showToast({
										title: '支付失败',
										icon: 'none'
									});
								}
							});
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
							that.isThrottle = true
						}
					});
					// #endif

					// #ifdef APP
					let data = {
						type: 1,
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType
					};
					this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
						console.log(res);
						this.showpay = false;
						if (res.code == 0) {
							this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
						} else {
							that.isThrottle = true
						}
					});
					// #endif
				} else if (this.openWay == 3) {
					// #ifdef H5
					let data = {
						type: 5,
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType
					};
					this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
						this.showpay = false;
						this.isThrottle = true
						const div = document.createElement('div');
						div.innerHTML = res.data; //此处form就是后台返回接收到的数据
						document.body.appendChild(div);
						document.forms[0].submit();
					});
					// #endif

					// #ifdef APP
					let data = {
						type: 4,
						parentId: this.dataList.parentId,
						couponId: this.coupon ? this.coupon.id : '',
						addressId: this.address.addressId ? this.address.addressId : '',
						orderType: this.orderType
					};
					this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
						this.showpay = false;
						this.setPayment('alipay', res.data);
					});
					// #endif
				}
			},
			callPay: function(response) {
				if (typeof WeixinJSBridge === 'undefined') {
					if (document.addEventListener) {
						document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
					} else if (document.attachEvent) {
						document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
						document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
					}
				} else {
					this.onBridgeReady(response);
				}
			},
			onBridgeReady: function(response) {
				let that = this;
				if (!response.package) {
					return;
				}
				WeixinJSBridge.invoke(
					'getBrandWCPayRequest', {
						appId: response.appid, //公众号名称，由商户传入
						timeStamp: response.timestamp, //时间戳，自1970年以来的秒数
						nonceStr: response.noncestr, //随机串
						package: response.package,
						signType: response.signType, //微信签名方式：
						paySign: response.sign //微信签名
					},
					function(res) {
						if (res.err_msg === 'get_brand_wcpay_request:ok') {
							// 使用以上方式判断前端返回,微信团队郑重提示：
							//res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。

							that.cancelPinDan();
							that.$queue.showToast('支付成功');
							setTimeout(function() {
								uni.switchTab({
									url: '/pages/order/index'
								});
								that.isThrottle = true
							}, 1000);
						} else {
							uni.hideLoading();
							that.isThrottle = true
						}
						WeixinJSBridge.log(response.err_msg);
					}
				);
			},
			isCheckPay(code, name, order) {
				if (code == 0) {
					console.log('999999999999');
					this.setPayment(name, order);
				} else {
					uni.hideLoading();
					uni.showToast({
						title: '支付信息有误'
					});
					this.isThrottle = true
				}
			},
			setPayment(name, order) {
				let that = this;

				console.log(777777777, name, order);
				uni.requestPayment({
					provider: name,
					orderInfo: order, //微信、支付宝订单数据
					success: function(res) {
						uni.hideLoading();
						that.cancelPinDan();
						uni.showLoading({
							title: '支付成功',
							icon: 'none'
						});
						setTimeout(function() {
							that.isThrottle = true
							uni.navigateBack();
						}, 1000);
					},
					fail: function(err) {
						uni.hideLoading();
						that.isThrottle = true
					},
					complete() {
						that.isThrottle = true
						uni.hideLoading();
					}
				});
			},
			// 获取选择的地址
			getAddressDet(e) {
				let data = {
					addressId: e
				}
				this.$Request.get('/app/address/selectAddressById',data).then(res => {
					if (res.code == 0) {
						this.address = res.data;
						if (JSON.stringify(this.address) != '{}') {
							this.getDistance();
						}
						uni.removeStorageSync('addressId');
					}
				});
			},
			// 获取地址列表
			getAddressList() {
				let that = this;
				let data = {
					page: 1,
					limit: 100
				};
				that.$Request.get('/app/address/selectAddressList', data).then(res => {
					if (res.code == 0) {
						that.address = res.data.list[0] ? res.data.list[0] : {};
						res.data.list.forEach(ret => {
							if (ret.addressDefault == 1) {
								that.address = ret;
							}
						});

						if (JSON.stringify(this.address) != '{}') {
							this.getDistance();
						}
					}
				});
			},
			goAddress() {
				uni.navigateTo({
					url: '/my/address/index?add=1'
				});
			},
			// 点击调起地图查看位置
			goMap() {
				// let that = this
				// let plugin = requirePlugin('routePlan');
				// let key = 'A3RBZ-23MHW-PTPR5-RLCER-UJTXQ-JIF2G'; //使用在腾讯位置服务申请的key
				// let referer = that.dataList.shopName; //调用插件的app的名称
				// let endPoint = JSON.stringify({ //终点
				// 	'name': that.dataList.shopName,
				// 	'latitude': that.dataList.shopLat,
				// 	'longitude': that.dataList.shopLng,
				// });
				// wx.navigateTo({
				// 	url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
				// });

				let that = this;
				let lati = parseFloat(that.dataList.shopLat);
				let longi = parseFloat(that.dataList.shopLng);
				uni.authorize({
					scope: 'scope.userLocation',
					success(res) {
						uni.openLocation({
							name: that.dataList.shopName,
							latitude: lati,
							longitude: longi,
							success: function() {}
						});
					},
					fail(err) {}
				});
			},
			// 打电话
			call() {
				uni.makePhoneCall({
					phoneNumber: this.dataList.shopPhone
				});
			}
		}
	};
</script>

<style scoped>
	.hintPopul {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 999;
	}

	.content_ {
		position: absolute;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		margin: auto;
		text-align: center;
		width: 500rpx;
		height: 400rpx;
		border-radius: 20rpx;
		background-color: #fff;
		padding-top: 120rpx;
	}

	.content_ image {
		position: absolute;
		top: -50rpx;
		left: 0;
		right: 0;
		margin: auto;
	}

	.hintText {
		font-size: 30rpx;
	}

	.Btns {
		width: 460rpx;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		background: #fcd202;
		font-size: 28rpx;
		border: 2rpx solid #fcd202;
		color: #333333;
		border-radius: 50rpx;
		font-weight: 700;
		margin: auto;
	}


	.goods_address {
		width: 94%;
		background: #ffffff;
		height: 120rpx;
		margin: 20rpx auto 0;
		border-radius: 18rpx;
	}

	.address_box {
		width: 90%;
		margin: 0 auto;
		height: 120rpx;
		display: flex;
		line-height: 120rpx;
	}

	.address_name {
		flex: 1;
		font-size: 30rpx;
	}

	.address_image {
		/* flex: 1; */
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.address_image image {
		width: 25rpx;
		height: 40rpx;
	}

	.songda_image image {
		width: 20rpx;
		height: 30rpx;
		margin-left: 20rpx;
	}

	/* 地址 */
	.address {
		width: 88%;
		margin: 3% auto;
		padding: 3%;
		display: flex;
		background-color: #ffffff;
		border-radius: 18rpx;
	}

	.adderss_le {
		width: 90%;
		line-height: 1.5;
	}

	.adderss_le_text {
		font-size: 30rpx;
		font-weight: bold;
		color: #333333;
	}

	.adderss_le_text2 {
		font-size: 24rpx;
		font-weight: 500;
		color: #999999;
		display: flex;
	}

	.adderss_le_text2 view {
		margin-left: 2%;
	}

	.adderss_le_text2 view:first-child {
		margin-left: 0;
	}

	.adderss_ri {
		width: 10%;
		text-align: right;
		line-height: 3;
	}

	.adderss_ri image {
		width: 18rpx;
		height: 30rpx;
	}

	/* 商品 */
	.food {
		width: 94%;
		margin: 3% auto;
		padding: 3%;
		background-color: #ffffff;
		border-radius: 18rpx;
	}

	.tosend_header_food {
		width: 100%;
		display: flex;
		margin-top: 3%;
	}

	.tosend_header_food_le {
		width: 15%;
	}

	.tosend_header_food_le image {
		width: 110rpx;
		height: 110rpx;
		border-radius: 10rpx;
	}

	.tosend_header_food_ce {
		margin: 0 0 0 4%;
		width: 57%;
	}

	.tosend_header_food_ri {
		text-align: right;
		width: 25%;
	}

	.tosend_header_food_text {
		font-size: 34rpx;
		font-weight: 500;
		color: #333333;
		line-height: 1.8;
	}

	.tosend_header_food_text text {
		font-size: 25rpx;
	}

	.tosend_header_food_text2 {
		font-size: 28rpx;
		font-weight: 500;
		color: #999999;
	}

	.do_top {
		padding-top: 3%;
	}

	.do_bot {
		padding-bottom: 3%;
		border-bottom: 2rpx solid #e6e6e6;
	}

	.tosend_header_do {
		width: 100%;
		color: #333333;
		font-size: 30rpx;
		display: flex;
		margin-top: 20rpx;
		line-height: 1.5;
	}

	.tosend_header_do view {
		/* flex: 1; */
	}

	.tosend_header_do_ri {
		text-align: right;
	}

	.tosend_header_do_le2 {
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		padding-top: 1.5%;
	}

	.tosend_header_do_ri2 {
		text-align: right;
		color: #ea0000;
		font-size: 40rpx;
	}

	.tosend_header_do_ri2 text {
		font-size: 30rpx;
	}

	/* 支付 */
	/* .payment_all{
		width: 88%;margin: 3% auto;padding: 3%;background-color: #FFFFFF;
		border-radius: 18rpx;
	}
	.payment{
		width: 100%;display: flex;margin-top: 3%;
	}
	.payment_le{
		width: 13%;
	}
	.payment_le image{
		width: 60rpx;height: 60rpx;
	}
	.payment_ce{
		width: 52%;
		font-size: 30rpx;
		font-weight: bold;
		color: #333333;line-height: 60rpx;
	}
	.payment_ri{
		width: 35%;text-align: right;line-height: 60rpx;
	} */
	/* 结算 */
	.goorder {
		width: 100%;
		padding: 2% 3%;
		position: fixed;
		bottom: 0;
		background-color: #ffffff;
		z-index: 999;
	}

	.goorder_but {
		width: 100%;
		line-height: 3.5;
		text-align: center;
		background: #fcd202;
		border-radius: 36rpx;
		font-weight: 700;
	}

	.goorder_but_ {
		opacity: 0.5;
	}

	.bg {
		background-color: #ffffff;
	}

	.tabBtn {
		/* background-color: #f6f6fa; */
		height: 60rpx;
		line-height: 60rpx;
		color: #999999;
		font-size: 38rpx;
	}

	.active {
		/* width: 82rpx; */
		height: 6rpx;
		background: #fcd202;
		/* position: relative;
		top: -20rpx; */
		z-index: 9;
	}
</style>