<template>
	<view class="sureOrder">
		<view>
			<u-navbar title="确认订单" :border-bottom="false" title-color="#333" :background="background"></u-navbar>
		</view>
		<view class="buyType">
			<view class="toDoor" :class="buyType=='sm'?'':'toDoor-dis'"
				@click="handleSwichDelivery(DeliveryTypeEnum.EXPRESS.value,'sm')">
				送货上门
			</view>
			<view class="toDoor" :class="buyType=='zq'?'':'toDoor-dis'"
				@click="handleSwichDelivery(DeliveryTypeEnum.EXTRACT.value,'zq')">
				到店自取
			</view>
			<view class="toDoor-on" :style="{'left': buyType=='sm'?'0':'350rpx'}">{{buyType=='zq'?'到店自取':'送货上门'}}</view>
		</view>
		<view class="getSelf">
			<view class="address" v-if="buyType=='sm'" @click="onSelectAddress">
				<view class="addAddress">
					<view class="tip" v-if="!order.address">请点击添加收货地址</view>
					<view class="info" v-else>
						<view class="name">{{ order.address.name}}<text>{{ order.address.phone }}</text></view>
						<view class="detail">
							<text v-for="(region, idx) in order.address.region" :key="idx">{{ region }}</text>
							<text>{{ order.address.detail }}</text>
						</view>
					</view>
				</view>
				<view class="leftImg">
					<image :src="$picUrl+'/static/order/left.png'"></image>
				</view>
			</view>
			<view class="shopAddress" v-if="buyType=='zq'">
				<view class="info" v-if="order.extractShop.shop_id">
					<view class="a">
						<view class="youTime">
							{{ order.extractShop.shop_name }}
						</view>
						<view class="leftImg" @click="onSelectExtractPoint()">
							切换
							<image :src="$picUrl+'/static/order/left.png'" mode=""></image>
						</view>
					</view>
					<view class="b">
						{{ order.extractShop.region.province }}
						{{ order.extractShop.region.city }}{{ order.extractShop.region.region }}
						{{ order.extractShop.address }}
					</view>
					<view class="lookMap">
						<image :src="$picUrl+'/static/user/address.png'" mode="" class="addressIcon"></image>
						<view class="range">
							距您{{distance_unit}}
						</view>
						<view class="checkMap" @click="openMap(order.extractShop)">
							查看地图
						</view>
						<image :src="$picUrl+'/static/order/left.png'" mode="" class="rightIcon"></image>
					</view>
				</view>
				<view class="tip" v-else @click="onSelectExtractPoint()">请选择门店<image
						:src="$picUrl+'/static/order/left.png'" mode=""></image>
				</view>
				<view class="pickUp">
					<view class="pickPeople">
						<view class="title">
							取件人
						</view>
						<view class="name">
							<input class="input" placeholder="请填写联系人姓名" v-model="linkman" />
							<image :src="$picUrl+'/static/order/edit.png'" mode="" class="edit"></image>
						</view>
					</view>
					<view class="pickPeople">
						<view class="title">
							预留电话
						</view>
						<view class="name">
							<input class="input" placeholder="请填写联系电话" v-model="phone" />
							<image :src="$picUrl+'/static/order/edit.png'" mode="" class="edit"></image>
						</view>
					</view>
				</view>
			</view>

		</view>
		<view class="preTime" v-if="buyType=='zq'">
			<view class="left">
				<view class="bagImg">
					<image :src="$picUrl+'/static/order/bag.png'" mode="" class="bag"></image>
					街边取
				</view>
				<view class="preText">
					如果您不方便，只需要在街边稍候，送到您的手上
				</view>
			</view>
			<view class="switch">
				<u-switch v-model="is_street_take"></u-switch>
			</view>
		</view>
		<view class="timer" v-if="buyType=='zq'">
			<view class="youTime">
				预计到店时间
			</view>
			<view class="leftImg" @click="openPicker(1)">
				<text v-if="timer" class="leftText">{{timer}}</text>
				<text v-else>请选择</text>
				<image :src="$picUrl+'/static/order/left.png'" mode=""></image>
			</view>
		</view>
		<view class="timer" v-if="buyType=='sm'">
			<view class="youTime">
				您期待的收货时间
			</view>
			<view class="leftImg" @click="openPicker(2)">
				<text v-if="timer" class="leftText">{{timer}}</text>
				<text v-else>请选择</text>
				<image :src="$picUrl+'/static/order/left.png'" mode=""></image>
			</view>
		</view>
		<view class="goodsDetail">
			<view class="goodsType" @click="toStore()">
				<image :src="$picUrl+'/static/order/bag.png'" mode="" class="bag"></image>
				<text>{{cityInfo.shop_name}}</text>
				<image :src="$picUrl+'/static/order/left.png'" mode="" class="leftIcon"></image>
			</view>
			<view class="goods" v-for="(item, index) in order.goodsList" :key="index">
				<view class="goodsImg">
					<image :src="item.goods_image" mode=""></image>
				</view>
				<view class="goodsInfo">
					<view class="goodsName">
						{{ item.goods_name }}
					</view>
					<!-- 商品规格 -->
					<view class="goods-props">
						<view class="goods-props-item" v-for="(props, idx) in item.skuInfo.goods_props" :key="idx">
							<text class="group-name">{{ props.group.name }}: </text>
							<text>{{ props.value.name }}；</text>
						</view>
					</view>
					<view class="goodsPrice">
						￥ <text>{{item.goods_price_min?Number(item.goods_price_min):item.goods_price_min}}</text>
					</view>
				</view>
				<view class="goodsNum">
					x{{ item.total_num }}
				</view>
			</view>
		</view>
		<view class="timer">
			<view class="youTime" style="width: 60rpx;">
				留言
			</view>
			<input type="textarea" placeholder="建议留言前先和店家沟通" v-model="remark" style="width:100%;" maxlength="100" />
		</view>
		<view class="orderTips">
			<view class="orderTitle">
				<view class="total">
					商品总额
				</view>
				<view class="price">
					￥{{ order.orderTotalPrice?Number(order.orderTotalPrice):order.orderTotalPrice }}
				</view>
			</view>
			<view class="orderTitle" v-if="order.address">
				<view class="total">
					运费
				</view>
				<view class="price" v-if="order.isIntraRegion">
					￥{{ order.expressPrice?Number(order.expressPrice):order.expressPrice }}
				</view>
				<view class="price" v-else>
					不在配送范围
				</view>
			</view>
			<view class="orderTitle">
				<view class="total">
					商品数量
				</view>
				<view class="price">
					<text class="couponNum">{{order.orderTotalNum}}件</text>
				</view>
			</view>
			<view class="orderTitle">
				<view class="total">
					优惠券
				</view>
				<view class="price" v-if="order.couponList.length > 0" @click="handleShowPopup">
					<text class="couponNum" v-if="order.couponId > 0">-￥{{ order.couponMoney }}</text>
					<text class="couponNum" v-else>{{order.couponList.length}}张可用</text>
					<image :src="$picUrl+'/static/order/left.png'"></image>
				</view>
				<view class="price" v-else @click="handleNotUseCoupon">
					<text class="couponNum">无优惠券可用</text>
					<image :src="$picUrl+'/static/order/left.png'"></image>
				</view>
			</view>
			<view class="line">

			</view>
			<view class="amount">
				<view class="left">

				</view>
				<view class="right">
					<text class="totalNum">共{{order.orderTotalNum}}件，合计：</text>
					<text
						class="allPrice">￥{{ order.orderPayPrice?Number(order.orderPayPrice):order.orderPayPrice }}</text>
				</view>
			</view>
		</view>
		<!-- <view class="payType">
			<view class="itemType">
				<view class="payName">
					<image src="/static/order/wChat.png" mode="" class="payIcon"></image>
					微信支付
				</view>
				<image src="/static/order/right.png" mode="" class="chose"></image>
			</view>
			<view class="line">

			</view>
			<view class="itemType">
				<view class="" v-for="(item,index) in payMethList" :key="index" @click="chosePayType(item)">
					<view class="payName">
						<image src="/static/order/friends.png" mode="" class="payIcon"></image>
						余额支付
					</view>
					<image src="/static/order/right.png" mode="" class="chose" v-if="payType==item.method"></image>
				</view>
			</view>
			<view class="line">

			</view> -->
		<!-- <view class="itemType">
				<view class="payName">
					<image src="/static/order/shop.png" mode="" class="payIcon"></image>
					到店支付
				</view>
				
			</view> -->
		<!-- </view> -->
		<view class="footer">
			<view class="meetPrice">
				应付款
				<text class="type">￥</text>
				<text class="price">{{order.orderPayPrice?Number(order.orderPayPrice):order.orderPayPrice}}</text>
			</view>
			<view class="btn" @click="onSubmitOrder()" v-if="stockValue=='有货'">
				提交订单
			</view>
			<view class="btn" style="background: #cecece;" v-else>
				无货
			</view>
		</view>
		<!-- 优惠券弹出框 -->
		<u-popup v-model="showPopup" mode="bottom">
			<view class="popup__coupon">
				<view class="coupon__title f-30">选择优惠券</view>
				<!-- 优惠券列表 -->
				<view class="coupon-list">
					<scroll-view :scroll-y="true" style="height: 565rpx;">
						<view class="coupon-item" v-for="(item, index) in order.couponList" :key="index">
							<view class="item-wrapper"
								:class="[item.is_apply ? 'color-' + CouponColors[index % CouponColors.length] : 'color-gray']"
								@click="handleSelectCoupon(index)">
								<view class="coupon-type">{{ CouponTypeEnum[item.coupon_type].name }}</view>
								<view class="tip dis-flex flex-dir-column flex-x-center">
									<view v-if="item.coupon_type == CouponTypeEnum.FULL_DISCOUNT.value">
										<text class="f-30">￥</text>
										<text class="money">{{ item.reduce_price }}</text>
									</view>
									<text class="money"
										v-if="item.coupon_type == CouponTypeEnum.DISCOUNT.value">{{ item.discount }}折</text>
									<text class="pay-line">满{{ item.min_price }}元可用</text>
								</view>
								<view class="split-line"></view>
								<view class="content dis-flex flex-dir-column flex-x-between">
									<view class="title">{{ item.name }}</view>
									<view class="bottom dis-flex flex-y-center">
										<view class="time flex-box">
											<block v-if="item.start_time === item.end_time">{{ item.start_time }} 当天有效
											</block>
											<block v-else>{{ item.start_time }}~{{ item.end_time }}</block>
										</view>
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
				<!-- 不使用优惠券 -->
				<view class="coupon__do_not dis-flex flex-y-center flex-x-center">
					<view class="control dis-flex flex-y-center flex-x-center" @click="handleNotUseCoupon()">
						<text class="f-26">不使用优惠券</text>
					</view>
				</view>
			</view>
		</u-popup>
		<u-toast ref="uToast" />
		<u-picker mode="time" v-model="show1" :params="params" @confirm="confirm"></u-picker>
	</view>
</template>

<script>
	import * as Verify from '@/utils/verify'
	import * as CheckoutApi from '@/api/checkout'
	import * as SharpCheckoutApi from '@/api/sharp/checkout'
	import * as BargainCheckoutApi from '@/api/bargain/checkout'
	import * as GrouponCheckoutApi from '@/api/groupon/checkout'
	import * as GoodsApi from '@/api/goods'
	import {
		CouponTypeEnum
	} from '@/common/enum/coupon'
	import {
		OrderTypeEnum,
		DeliveryTypeEnum
	} from '@/common/enum/order'

	const CouponColors = ['red', 'blue', 'violet', 'yellow']

	// 根据指定mode获取对应的api类
	const getCheckoutApi = (mode) => {
		const apiEnum = {
			buyNow: CheckoutApi,
			cart: CheckoutApi,
			bargain: BargainCheckoutApi,
			sharp: SharpCheckoutApi,
			groupon: GrouponCheckoutApi
		}
		return apiEnum[mode]
	}

	// 根据指定mode获取param
	const getModeParam = (mode, options) => {
		const param = {}
		// 结算模式: 立即购买
		if (mode === 'buyNow') {
			param.goodsId = options.goodsId
			param.goodsNum = options.goodsNum
			param.goodsSkuId = options.goodsSkuId
		}
		// 结算模式: 购物车
		if (mode === 'cart') {
			param.cartIds = options.cartIds
		}
		// 结算模式: 砍价活动
		if (mode === 'bargain') {
			param.taskId = options.taskId
			param.goodsSkuId = options.goodsSkuId
		}
		// 结算模式: 整点秒杀
		if (mode === 'sharp') {
			param.activeTimeId = options.activeTimeId
			param.sharpGoodsId = options.sharpGoodsId
			param.goodsSkuId = options.goodsSkuId
			param.goodsNum = options.goodsNum
		}
		// 结算模式: 多人拼团
		if (mode === 'groupon') {
			param.grouponGoodsId = options.grouponGoodsId
			param.taskId = options.taskId
			param.goodsSkuId = options.goodsSkuId
			param.goodsNum = options.goodsNum
			param.stepPeople = options.stepPeople
		}
		return param
	}

	export default {
		data() {
			return {
				is_street_take: false,
				expect_receive_time: "",
				to_store_time: "",
				cityInfo: {},
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true
				},
				show1: false,
				background: {
					background: 'url(https://www.royaum.com.cn/static/news/login-bg.png) center top no-repeat',
					backgroundSize: '100% auto',
				},
				// 枚举类
				OrderTypeEnum,
				DeliveryTypeEnum,
				CouponTypeEnum,
				// 当前页面参数
				options: {},
				// 配送方式
				isShowTab: false,
				DeliveryTypeEnum,
				curDelivery: null,
				// 自提信息
				selectedShopId: 0, // 选择的门店ID
				linkman: '', // 自提联系人
				phone: '', // 自提联系电话
				// 优惠券颜色组
				CouponColors,
				// 选择的优惠券
				selectCouponId: 0,
				// 是否使用积分抵扣
				isUsePoints: false,
				// 买家留言
				remark: '',
				// 禁用submit按钮
				disabled: false,
				// 是否显示积分说明
				showPoints: false,
				// 是否显示优惠券弹窗
				showPopup: false,
				// 订单信息 (从后端api中获取)
				order: {
					// 商品列表
					goodsList: [],
					// 优惠券列表
					couponList: [],
					// 是否存在收货地址
					existAddress: false,
					// 默认收货地址
					address: null,
					// 是否存在收货地址
					existAddress: false,
					// 当前用户收货城市是否存在配送规则中
					isIntraRegion: true,
					// 是否存在错误
					hasError: false,
					// 错误信息
					errorMsg: '',
				},
				// 个人信息
				personal: {},
				buyType: 'sm',
				// 商城设置
				setting: {},
				timer: "",
				distance_unit: "",
				stockValue: '无货',
				addressResult: {
					province: '江苏省',
					city: '南京市',
					district: '玄武区'
				}
			}
		},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			this.options = options;
			this.cityInfo = uni.getStorageSync("cityInfo")
			console.log(options)
			// 注册全局事件订阅: 选择自提门店
			uni.$on('syncSelectedId', selectedId => {
				this.selectedShopId = selectedId
			})
			// 注册全局事件订阅: 选择自提门店
			uni.$on('syncSelectedDistance_unit', distance_unit => {
				this.distance_unit = distance_unit
			})
		},

		/**
		 * 生命周期函数--监听页面的卸载
		 */
		onUnload() {
			// 卸载全局事件订阅: 选择自提门店
			uni.$off('syncSelectedId')
		},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow() {
			// 获取当前订单信息
			this.getOrderData()
		},

		methods: {
			async getGoodsStockInfor(order) {
				console.log(order)
				let that = this
				let list = [];
				order.goodsList.forEach(item => {
					list.push({
						goods_id: item.goods_id,
						num: item.total_num
					})
				});
				that.addressResult.province = order.address ? order.address.region.province : '江苏省'
				that.addressResult.city = order.address ? order.address.region.city : '南京市'
				that.addressResult.district = order.address ? order.address.region.region : '玄武区'
				let params = {
					list: list,
					province: this.addressResult.province,
					city: this.addressResult.city,
					district: this.addressResult.district
				}
				console.log(params)
				let {
					status,
					message,
					data
				} = await GoodsApi.getGoodsStock(params);
				if (status == 200) {
					this.stockValue = data.stock
				}
			},
			toStore() {
				uni.navigateTo({
					url: "/pages/news/consult/about"
				})
			},
			openMap(info) {
				uni.openLocation({
					latitude: Number(info.latitude),
					longitude: Number(info.longitude),
					complete: function(res) {
						console.log('success', res);
					}
				});
			},
			openPicker() {
				this.show1 = true;
			},
			confirm(e) {
				this.timer = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.second
			},
			// 获取订单数据
			getOrderData() {
				const app = this
				const {
					options: {
						mode
					}
				} = app
				// 请求的参数
				const params = app.getRequestParam()
				// 请求api
				getCheckoutApi(mode)
					.order(mode, params)
					.then(result => app.initData(result.data))
					.catch(err => err)
			},

			// 初始化数据
			initData({
				order,
				setting,
				personal
			}) {
				const app = this
				app.order = order
				app.personal = personal
				app.setting = setting
				// 显示错误信息
				if (order.hasError) {
					app.showToast(order.errorMsg, 3000)
				}
				// 当前选择的配送方式
				app.curDelivery = order.delivery
				// 如果只有一种配送方式则不显示选项卡
				app.isShowTab = setting.deliveryType.length > 1
				// 上门自提联系信息
				if (app.linkman === '') {
					app.linkman = order.lastExtract.linkman
				}
				if (app.phone === '') {
					app.phone = order.lastExtract.phone
				}
				this.getGoodsStockInfor(app.order)
			},

			// 获取api请求的参数
			getRequestParam() {
				const app = this
				const {
					options
				} = app
				// 结算模式的固定参数
				const modeParam = getModeParam(options.mode, options)
				// 订单结算参数(用户选择)
				const orderParam = {
					delivery: app.curDelivery || 0,
					shopId: app.selectedShopId || 0,
					couponId: app.selectCouponId || 0,
					isUsePoints: app.isUsePoints ? 1 : 0,
				}
				return {
					...orderParam,
					...modeParam
				}
			},

			// 切换配送方式
			handleSwichDelivery(key, val) {
				this.curDelivery = key
				this.getOrderData();
				this.timer = ""
				this.is_street_take = false
				this.buyType = val;
			},

			// 显示积分说明
			handleShowPoints() {
				this.showPoints = true
			},

			// 显示优惠券弹窗
			handleShowPopup() {
				this.showPopup = true
			},

			// 选择优惠券
			handleSelectCoupon(index) {
				const app = this
				const {
					couponList
				} = app.order
				// 当前选择的优惠券
				const couponItem = couponList[index]
				// 判断是否在适用范围
				if (!couponItem.is_apply) {
					app.showToast(couponItem.not_apply_info)
					return
				}
				// 记录选中的优惠券id
				app.selectCouponId = couponItem.user_coupon_id
				// 重新获取订单信息
				app.getOrderData()
				// 隐藏优惠券弹层
				app.showPopup = false
			},

			// 不使用优惠券
			handleNotUseCoupon() {
				const app = this
				app.selectCouponId = 0
				// 重新获取订单信息
				app.getOrderData()
				// 隐藏优惠券弹层
				app.showPopup = false
			},

			// 快递配送：选择收货地址
			onSelectAddress() {
				this.$navTo('pages/address/index', {
					from: 'checkout'
				})
			},

			// 上门自提：选择自提点
			onSelectExtractPoint() {
				this.$navTo('pages/shop/extract', {
					selectedId: this.selectedShopId
				})
			},

			// 跳转到商品详情页
			onTargetGoods(goodsId) {
				this.$navTo('pages/goods/detail', {
					goodsId
				})
			},

			// 订单提交
			onSubmitOrder() {
				const app = this
				if (app.disabled) {
					return false
				}
				// 表单验证
				if (!app.onVerifyFrom()) {
					return false
				}
				// 按钮禁用
				app.disabled = true
				// 请求api
				getCheckoutApi(app.options.mode)
					.submit(app.options.mode, app.getFormData())
					.then(result => {
						// 订单创建成功: 跳转到订单支付页
						const orderId = result.data.orderId
						setTimeout(() => {
							this.$navTo('pages/checkout/cashier/index', {
								orderId
							}, 'redirectTo')
						}, 100)
					})
					.catch(res => app.showToast(res.errMsg, 3000))
					.finally(() => setTimeout(() => app.disabled = false, 800))
			},

			// 跳转到我的订单(等待1秒)
			navToMyOrder() {
				setTimeout(() => {
					this.$navTo('pages/order/index', {}, 'redirectTo')
				}, 1000)
			},
			// 表单提交的数据
			getFormData() {
				const app = this
				const {
					options
				} = app
				// 表单数据
				const form = {
					delivery: app.curDelivery,
					couponId: app.selectCouponId || 0,
					shopId: app.selectedShopId || 0,
					linkman: app.linkman,
					phone: app.phone,
					isUsePoints: app.isUsePoints ? 1 : 0,
					remark: app.remark || '',
					expect_receive_time: app.buyType == 'sm' ? app.timer : '',
					is_street_take: app.buyType == 'zq' ? (app.is_street_take ? 1 : 0) : '',
					to_store_time: app.buyType == 'zq' ? app.timer : '',
					ziti_address: app.buyType == 'zq' ? ({
						shopId: app.selectedShopId || 0,
						linkman: app.linkman,
						phone: app.phone,
					}) : ''
				}
				// 获取不同模式的参数
				const modeParam = getModeParam(options.mode, options)
				return {
					...form,
					...modeParam
				}
			},

			// 表单验证
			onVerifyFrom() {
				const app = this
				if (app.hasError) {
					app.showToast(app.errorMsg, 3000)
					return false
				}
				// 验证自提填写的联系方式
				if (app.curDelivery == DeliveryTypeEnum.EXTRACT.value) {
					app.linkman = app.linkman.trim()
					app.phone = app.phone.trim()
					if (app.selectedShopId <= 0) {
						app.showToast('请选择自提的门店')
						return false
					}
					if (Verify.isEmpty(app.linkman)) {
						app.showToast('请填写自提联系人')
						return false
					}
					if (Verify.isEmpty(app.phone)) {
						app.showToast('请填写自提联系电话')
						return false
					}
					if (!Verify.isPhone(app.phone)) {
						app.showToast('请输入正确的联系电话')
						return false
					}
				}
				return true
			},

			// 显示toast信息
			showToast(title, duration = 2000) {
				this.$refs.uToast.show({
					title,
					duration
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.sureOrder {
		width: 750rpx;
		min-height: 750rpx;
		padding-bottom: 140rpx;
		background: url('https://www.royaum.com.cn/static/news/login-bg.png') center top no-repeat;
		background-size: 100% auto;

		/* 优惠券选择 */
		.popup__coupon {
			background: #fff;
			box-sizing: border-box;
			padding: 30rpx;
			// 设置ios刘海屏底部横线安全区域
			padding-bottom: calc(constant(safe-area-inset-bottom) + 30rpx);
			padding-bottom: calc(env(safe-area-inset-bottom) + 30rpx);

			.coupon__do_not {
				.control {
					width: 90%;
					height: 72rpx;
					color: #888;
					border: 1rpx solid #e3e3e3;
					border-radius: 10rpx;
				}
			}

			.coupon__title {
				text-align: center;
				margin-bottom: 30rpx;
			}

			.coupon-list {
				/* #ifdef H5 */
				max-width: 1120rpx;
				margin: 0 auto;
				/* #endif */
				margin-bottom: 24rpx;
			}

			.coupon-item {
				position: relative;
				overflow: hidden;
				margin-bottom: 22rpx;
			}

			.item-wrapper {
				width: 100%;
				display: flex;
				background: #fff;
				border-radius: 8rpx;
				color: #fff;
				height: 180rpx;

				.coupon-type {
					position: absolute;
					top: 0;
					right: 0;
					z-index: 10;
					width: 128rpx;
					padding: 6rpx 0;
					background: #a771ff;
					font-size: 20rpx;
					text-align: center;
					color: #ffffff;
					transform: rotate(45deg);
					transform-origin: 64rpx 64rpx;
				}

				&.color-blue {
					background: linear-gradient(-125deg, #57bdbf, #2f9de2);
				}

				&.color-red {
					background: linear-gradient(-128deg, #ff6d6d, #ff3636);
				}

				&.color-violet {
					background: linear-gradient(-113deg, #ef86ff, #b66ff5);

					.coupon-type {
						background: #55b5ff;
					}
				}

				&.color-yellow {
					background: linear-gradient(-141deg, #f7d059, #fdb054);
				}

				&.color-gray {
					background: linear-gradient(-113deg, #bdbdbd, #a2a1a2);

					.coupon-type {
						background: #9e9e9e;
					}
				}

				.content {
					flex: 1;
					padding: 30rpx 20rpx;
					border-radius: 16rpx 0 0 16rpx;

					.title {
						font-size: 32rpx;
					}

					.bottom {
						.time {
							font-size: 24rpx;
						}

						.receive {
							height: 46rpx;
							width: 122rpx;
							border: 1rpx solid #fff;
							border-radius: 30rpx;
							color: #fff;
							font-size: 24rpx;
							display: flex;
							justify-content: center;
							align-items: center;

							&.state {
								border: none;
							}
						}
					}
				}

				.tip {
					position: relative;
					flex: 0 0 32%;
					text-align: center;
					border-radius: 0 16rpx 16rpx 0;

					.money {
						font-weight: bold;
						font-size: 52rpx;
					}

					.pay-line {
						font-size: 22rpx;
					}
				}

				.split-line {
					position: relative;
					flex: 0 0 0;
					border-left: 4rpx solid #fff;
					margin: 0 10rpx 0 6rpx;
					background: #fff;

					&:before,
						{
						border-radius: 0 0 16rpx 16rpx;
						top: 0;
					}

					&:after {
						border-radius: 16rpx 16rpx 0 0;
						bottom: 0;
					}

					&:before,
					&:after {
						content: '';
						position: absolute;
						width: 24rpx;
						height: 12rpx;
						background: #f7f7f7;
						left: -14rpx;
						z-index: 1;
					}


				}
			}

		}

	}

	.buyType {
		width: 700rpx;
		margin: 30rpx auto 0;
		position: relative;
		height: 88rpx;

		.toDoor {
			width: 50%;
			height: 74rpx;
			background-color: rgba(255, 255, 255, 0.5);
			font-size: 28rpx;
			font-weight: 500;
			color: #606060;
			line-height: 74rpx;
			text-align: center;
			float: left;
			margin-top: 14rpx;
			float: left;

			&-on {
				width: 350rpx;
				height: 88rpx;
				background-color: #FFF;
				text-align: center;
				font-size: 34rpx;
				font-weight: 400;
				color: #000;
				line-height: 88rpx;
				position: absolute;
				bottom: 0;
				left: 0;
				z-index: 2;
				border-radius: 10rpx 10rpx 0 0;
			}

			&-dis {
				border-radius: 10rpx 10rpx 0 0;
			}
		}
	}

	.getSelf {
		width: 700rpx;
		margin: 0 auto;
		background-image: url('https://www.royaum.com.cn/static/order/map.png');
		background-size: 100%;
		min-height: 160rpx;
		padding: 14rpx 46rpx 0 32rpx;
		box-sizing: border-box;

	}

	.timer {
		display: flex;
		width: 700rpx;
		height: 90rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		opacity: 1;
		margin: 12rpx 0 0 26rpx;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx 0 28rpx;

		.youTime {
			font-size: 25rpx;
			font-weight: 400;
			color: #000000;
		}

		input {
			flex: 1;
			padding: 0 20rpx;
			font-size: 25rpx;
			font-weight: 400;
			color: #000000;
			text-align: right;
		}

		.leftImg {
			font-size: 24rpx;
			font-weight: 400;
			color: #9E9E9E;

			image {
				width: 12rpx;
				height: 18rpx;
				margin-left: 16rpx;
			}
		}
	}

	.leftText {
		font-size: 24rpx;
		font-weight: 400;
		color: #F21A1C;
		line-height: 28rpx;
	}

	.shopAddress {
		max-height: 260rpx;
		padding-bottom: 20rpx;
		overflow: hidden;

		.tip {
			font-size: 24rpx;
			color: #F32E2E;
			display: flex;
			align-items: center;
			justify-content: space-between;

			image {
				width: 12rpx;
				height: 18rpx;
			}
		}

		.pickUp {
			display: flex;
			justify-content: space-around;
			margin-top: 16rpx;

			.pickPeople {
				flex: 1;

				&:first-child {
					margin-right: 20rpx;
				}

				.title {
					font-size: 24rpx;
					font-weight: 400;
					color: #838383;
				}

				.name {
					margin-top: 10rpx;
					display: flex;
					align-items: center;

					input {
						width: 200rpx;
						line-height: 60rpx;
						font-size: 24rpx;
						color: #2C2C2C;
						display: block;
					}

					.edit {
						width: 30rpx;
						height: 30rpx;
						margin-left: 10rpx;
					}
				}
			}
		}

		.a {
			display: flex;
			align-items: center;
			justify-content: space-between;

			.youTime {
				font-size: 28rpx;
				font-weight: 600;
				color: #1D1D1D;
			}

			.leftImg {
				font-size: 24rpx;
				font-weight: 400;
				color: #F42B17;

				image {
					width: 12rpx;
					height: 18rpx;
					margin-left: 16rpx;
				}
			}
		}

		.b {
			font-size: 24rpx;
			color: #838383;
			line-height: 50rpx;
		}

		.lookMap {
			display: flex;
			align-items: center;
			margin-top: 8rpx;
			margin-bottom: 10rpx;

			.addressIcon {
				width: 23rpx;
				height: 26rpx;
				margin-right: 14rpx;
			}

			.range {
				font-size: 20rpx;
				font-weight: 400;
				color: #F42B17;
				line-height: 26rpx;
				padding-right: 10rpx;
				border-right: 2rpx solid #D9D9D9;
				margin-right: 10rpx;
			}

			.checkMap {
				font-size: 20rpx;
				font-weight: 400;
				color: #2B2B2B;
				line-height: 26rpx;
				margin-right: 24rpx;
			}

			.rightIcon {
				width: 12rpx;
				height: 18rpx;
			}
		}
	}

	.address {
		width: 100%;
		display: flex;
		height: 120rpx;
		align-items: center;
		justify-content: space-between;
		padding: 0 22rpx 0 32rpx;
		box-sizing: border-box;

		.addAddress {
			font-size: 28rpx;
			font-weight: 500;
			// color: #F32E2E;
			color: #212121;

			.info {
				flex: 1;

				.name {
					font-size: 28rpx;
					color: #212121;

					text {
						margin-left: 20rpx;
						color: #666;
					}
				}

				.detail {
					margin-top: 10rpx;
					font-size: 26rpx;
				}
			}

			.tip {
				font-size: 30rpx;
				font-weight: 500;
				color: #F32E2E;
			}
		}

		.leftImg {
			width: 12rpx;
			height: 18rpx;

			image {
				width: 100%;
				height: 100%;
				display: block;
			}
		}
	}

	.ziqu {
		overflow: hidden;
		padding: 0 22rpx 0 32rpx;
	}

	.preTime {
		width: 700rpx;
		height: 140rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		margin: 12rpx 0 0 26rpx;
		display: flex;
		justify-content: space-between;
		padding: 34rpx 0 0 30rpx;
		box-sizing: border-box;

		.left {
			.bagImg {
				font-size: 24rpx;
				font-weight: 400;
				color: #000000;
				display: flex;
				align-items: center;

				.bag {
					width: 35rpx;
					height: 35rpx;
					margin-right: 10rpx;
				}
			}

		}

		.preText {
			font-size: 24rpx;
			font-weight: 400;
			color: #959595;
			margin-top: 15rpx;
		}
	}



	.goodsDetail {
		width: 700rpx;
		min-height: 266rpx;
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		opacity: 1;
		margin: 12rpx 0 0 26rpx;
		padding: 32rpx 24rpx 24rpx 12rpx;

		.goodsType {
			display: flex;
			align-items: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #333333;

			.bag {
				width: 30rpx;
				height: 30rpx;
				margin-right: 20rpx;
			}

			.leftIcon {
				width: 12rpx;
				height: 18rpx;
				margin-left: 20rpx;
			}
		}

		.goods {
			display: flex;
			align-items: center;
			margin-top: 28rpx;
			justify-content: space-between;

			.goodsImg {
				width: 162rpx;
				height: 148rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.goodsInfo {
				margin-left: 20rpx;
				max-width: 400rpx;

				.goodsName {
					min-height: 40rpx;
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #1E1E1E;
					line-height: 40rpx;
					margin-bottom: 4rpx;
				}

				.goodsPrice {
					height: 50rpx;
					font-size: 24rpx;
					font-weight: 600;
					color: #F21A1C;
					line-height: 50rpx;

					text {
						font-size: 36rpx;
					}
				}
			}

			.goods-props {
				font-size: 24rpx;
				color: #999;
				display: flex;
				align-items: center;
			}

			.goodsNum {
				font-size: 28rpx;
				font-weight: 500;
				color: #1E1E1E;
				flex: 1;
				text-align: right;
			}
		}
	}

	.orderTips {
		width: 694rpx;
		height: 342rpx;
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		opacity: 1;
		margin: 12rpx 0 0 26rpx;
		padding: 22rpx 36rpx 24rpx 24rpx;

		.orderTitle {
			margin-bottom: 24rpx;
			display: flex;
			justify-content: space-between;
			height: 34rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #2D2D2D;
			line-height: 34rpx;

			.total {
				font-size: 24rpx;
			}

			.price {
				.couponNum {
					font-size: 28rpx;
					color: #F42B17;
				}

				image {
					width: 12rpx;
					height: 18rpx;
					margin-left: 18rpx;
				}
			}
		}

		.amount {
			display: flex;
			justify-content: space-between;
			margin-top: 20rpx;

			.left {
				width: 20rpx;
				height: 34rpx;
			}

			.right {
				display: flex;
				align-items: center;

				.totalNum {
					height: 34rpx;
					font-size: 24rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					color: #000000;
					line-height: 34rpx;
				}

				.allPrice {
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 600;
					color: #F42B17;
					line-height: 34rpx;

				}
			}
		}
	}

	.line {
		width: 100%;
		height: 0rpx;
		opacity: 1;
		border: 2rpx solid #F1F1F1;
	}

	.payType {
		width: 694rpx;
		height: 270rpx;
		background: #FFFFFF;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		opacity: 1;
		margin: 12rpx 0 0rpx 26rpx;
		padding: 24rpx 26rpx 0;

		.line {
			margin-bottom: 24rpx;
		}

		.itemType {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 28rpx;

			.payName {
				display: flex;
				align-items: center;
				height: 42rpx;
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #000000;
				line-height: 42rpx;

				.payIcon {
					width: 42rpx;
					height: 42rpx;
					margin-right: 16rpx;
				}
			}

			.chose {
				width: 34rpx;
				height: 24rpx;
				margin-right: 26rpx;
			}
		}
	}

	.footer {
		width: 100%;
		height: 120rpx;
		position: fixed;
		background-color: #FFF;
		bottom: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		z-index: 22;

		.meetPrice {
			margin-left: 26rpx;
			font-size: 24rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #000000;

			.type {
				font-size: 24rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #F42B17;
				margin-left: 12rpx;
			}

			.price {
				font-size: 40rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 600;
				color: #F42B17;
			}
		}

		.btn {
			width: 214rpx;
			height: 74rpx;
			background: linear-gradient(180deg, #FD5D06 0%, #F3211A 100%);
			border-radius: 100rpx 100rpx 100rpx 100rpx;
			opacity: 1;
			text-align: center;
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 74rpx;
			margin-right: 20rpx;
		}


	}
</style>
