<template>
	<view>
		<lf-nav title="订单详情" :showIcon="true"></lf-nav>
		<view class="tips">
			<view class="lf-font-24 lf-color-white">剩余支付时间：</view>
			<view>
				<countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
					<template v-slot="{minute, second}">
						<!-- <view>{{minute}}:{{second}}</view> -->
						<view class="lf-flex">
							<view class="lf-font-24 lf-color-white">{{ minute >= 10 ? minute : "0" + minute }}</view>
							<view class="lf-font-24 lf-color-white">:</view>
							<view class="lf-font-24 lf-color-white">{{ second >= 10 ? second : "0" + second }}</view>
						</view>
					</template>
				</countdown-timer>
			</view>
		</view>
		<view class="card" v-if="type == 'default'" style="margin-top: 0;">
			<view class="lf-font-28">
				<text class="lf-color-222 lf-font-bold">王小二</text>
				<text class="lf-color-777 lf-m-l-20">18284385380</text>
			</view>
			<view class="lf-font-28 lf-color-333 lf-m-t-20">
				<text>广西壮族自治区-南宁市-青秀区-民族大道民族大道民族大道民族大道民族大道民族大道15号</text>
			</view>
		</view>
		<view class="card goods">
			<view>
				<text class="lf-iconfont icon-Group- lf-font-30"></text>
				<text class="shop-name">精品超市</text>
				<text class="lf-iconfont icon-xiangyou lf-font-24"></text>
			</view>
			<view class="lf-flex lf-m-t-20">
				<image class="goods-img"></image>
				<view class="info">
					<view class="lf-font-26 lf-color-333 lf-line-1">爱他美较大婴儿配方奶粉较大配方奶粉较2段 </view>
					<view class="lf-font-24 lf-color-777">500g</view>
					<view class="lf-row-between" style="line-height: 1;">
						<text class="price">¥385</text>
						<text class="lf-font-28 lf-color-777">x 2</text>
					</view>
				</view>
			</view>
		</view>
		<view class="card" v-if="type == 'point'">
			<view class="lf-row-between lf-font-28">
				<text class="lf-color-777">积分数量</text>
				<text class="lf-color-222">385</text>
			</view>
		</view>
		<view class="lf-bg-white lf-m-t-20 lf-p-b-30 lf-row-center lf-flex-column">
			<view class="qrcode">
				<lf-qrcode :options="qrc"></lf-qrcode>
			</view>
			<view class="lf-font-28" style="color:#15716E" v-if="true">待提货</view>
			<view class="lf-font-28 lf-color-777" v-else>已取货</view>
		</view>
		<view class="card" v-if="type == 'default'">
			<view class="lf-row-between lf-font-28">
				<text class="lf-color-777">优惠券</text>
				<text style="color: #F63434;">-¥20</text>
			</view>
			<view class="lf-row-between lf-m-t-30 lf-font-28">
				<text class="lf-color-777">订单总价</text>
				<text class="lf-color-222">¥375</text>
			</view>
		</view>
		<view class="card">
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">订单编号</text>
				<text class="lf-color-222">75894375395739345</text>
			</view>
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">创建时间</text>
				<text class="lf-color-222">2021-09-07 10:21:38</text>
			</view>
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">留言</text>
				<text class="lf-color-222">暂无留言</text>
			</view>
			<!-- 待自提 -->
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">支付方式</text>
				<text class="lf-color-222">余额支付</text>
			</view>
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">收货方式</text>
				<text class="lf-color-222">自提</text>
			</view>
			<view class="lf-row-between lf-font-28 lf-m-t-30">
				<text class="lf-color-777">支付时间</text>
				<text class="lf-color-222">2021-09-07 10:21:38</text>
			</view>
		</view>
		<view style="height: 120rpx;margin-top: 20rpx;"></view>
		<!-- 待付款 -->
		<view class="order-btn">
			<view class="lf-font-28 lf-row-center" style="color:#F63434">
				待付款
			</view>
			<view class="lf-flex">
				<view class="btn-cancel lf-m-r-20">
					取消订单
				</view>
				<view class="btn-atonce">
					立即付款
				</view>
			</view>
		</view>
		<!-- 待自提 -->
		<view class="order-btn">
			<view class="lf-font-28 lf-row-center lf-color-black">
				待自提
			</view>
			<view class="lf-flex">
				<view style="width: 220rpx;"></view>
				<view style="width: 220rpx;"></view>
			</view>
		</view>
		<!-- 已完成 -->
		<view class="order-btn">
			<view class="lf-font-28 lf-row-center" style="color: #22A19F;">
				已完成
			</view>
			<view class="lf-flex">
				<view style="width: 220rpx;"></view>
				<view style="width: 220rpx;"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import countdownTimer from '@/components/countdown-timer/countdown-timer';
	import lfQrcode from '@/components/lf-code/lf-qrcode.vue';
	export default {
		data(){
			return {
				type: 'default' ,// point积分订单详情, default默认普通商品订单详情
				time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 14:10:00').getTime(),
				qrc: {
					code: "https://weixin.qq.com/g/AwYAAHO3aO4zlasEij6bLsk4hlZd5XNFkkBmqyS55mLPFxmn5c9PaI1omqLhd24fABCD23333",
					size: 300, // 二维码大小
					level: 4, //等级 0～4
					bgColor: '#FFFFFF', //二维码背景色 默认白色
					// border: {
					// 	color: ['#8A2387', '#F27121'], //边框颜色支持渐变色
					// 	lineWidth: 3, //边框宽度
					// },
					// img: '/static/logo.png', //图片
					// iconSize: 40, //二维码图标的大小
					color: '#000000', //边框颜色支持渐变色
				}
			}
		},
		components: {
			countdownTimer,
			lfQrcode
		},
		onLoad(options){
			this.type = options.type || this.type;
		},
		methods: {
			dateFinish(){
				console.log("倒计时结束");
			},
		}
	}
</script>

<style>
	page{
		background-color: #F8F8F8;
	}
</style>
<style lang="scss" scoped="scoped">
	.qrcode{
		display: flex;
		justify-content: center;
		margin-top: 30rpx;
	}
	.tips-waitconfirm {
		width: 100%;
		height: 113rpx;
		background: #15716E;
		display: flex;
		justify-content: space-between;
		padding: 0 32rpx;
		align-items: center;
	}
	.waitconfirm-tag {
		width: 136rpx;
		height: 53rpx;
		border-radius: 27rpx;
		border: 2rpx solid #FFFFFF;
		font-size: 24rpx;
		color: white;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.btn-cancel {
		width: 220rpx;
		height: 90rpx;
		border-radius: 45rpx;
		border: 2rpx solid #999999;
		color: #777;
		font-size: 28rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.btn-confirm {
		width: 220rpx;
		height: 90rpx;
		border-radius: 45rpx;
		background-color: #15716E;
		color: #fff;
		font-size: 28rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.btn-atonce {
		width: 220rpx;
		height: 90rpx;
		border-radius: 45rpx;
		background-color: #F63434;
		color: #fff;
		font-size: 28rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.order-btn {
		width: 100%;
		height: 120rpx;
		background: #FFFFFF;
		display: flex;
		justify-content: space-between;
		padding: 0 32rpx;
		position: fixed;
		bottom: 0;
	}
	.tips {
		display: flex;
		background-color: #F63434;
		height: 64rpx;
		width: 100%;
		justify-content: center;
		align-items: center;
	}
	.card{
		height: max-content;
		width: 750rpx;
		padding: 30rpx 32rpx;
		background-color: #FFFFFF;
		&:nth-child(n+2){
			margin-top: 20rpx;
		}
	}
	.goods{
		.shop-name{
			font-size: 28rpx;
			color: #222222;
			font-weight: bold;
			margin: 0 15rpx;
		}
		.goods-img{
			width: 130rpx;
			height: 130rpx;
			border-radius: 4rpx;
			margin-right: 15rpx;
			background-color: #EEEEEE;
		}
		.info{
			width: 540rpx;
			height: 130rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			.price{
				font-size: 32rpx;
				color: #F63434;
				font-weight: bold;
			}
		}
		.order-num{
			font-size: 24rpx;
			color: #999999;
			display: flex;
			justify-content: space-between;
			margin-top: 28rpx;
		}
	}
</style>
