<template>
	<view class="index">
		<view class="onecontenttowone flex-start">
			<view class="onecontenttowone_one">
				{{title}}
			</view>
		</view>
		<view class="indexbox">
			<view class="indexboxitem flex-start" v-for="(item,index) in list" :key="index" @click="mallInfoInfo(item)">
				<image class="indexboxitemimage" :src="item.host_img" mode="aspectFill"></image>
				<view class="indexboxitemleft flex-colum-start">
					<view class="indexboxitemleftone">
						{{item.title}}
					</view>
					<view class="indexboxitemlefttow">
						{{item.intro}}
					</view>
					<view class="indexboxitemleftthere flex-colum-start">
						<view class="indexboxitemlefttheretext flex-start">
							<view class="indexboxitemlefttheretextone">
								<text>¥</text>
								<text>{{item.price}}</text>
							</view>
							<view class="indexboxitemlefttheretexttow">
								¥{{item.y_price}}
							</view>

						</view>
						<view class="indexboxitemleftthere_countdown flex-start">
							<text class="indexboxitemleftthere_countdowntext">倒计时:</text>
							<view v-if="item.end_times == 0" class="indexboxitemleftthere_countdowntexts">
								已失效
							</view>
							<view v-else class="indexboxitemleftthere_countdowntexts">
								<uni-countdown @timeup="updateCity" :day="item.end_times.d" :hour="item.end_times.h"
									:minute="item.end_times.m" :second="item.end_times.s"
									:indexs='index'></uni-countdown>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniCountdown from '@/components/countdown.vue'
	export default {
		data() {
			return {}
		},
		props: {
			list: {
				type: Array,
				default () {
					return [

					]
				}
			},
			title: {
				type: String,
				default: '银收客'
			},

		},
		components: {
			uniCountdown
		},
		onLoad() {

		},
		methods: {
			updateCity(data) {
				this.list[data].end_times = 0;
				this.$forceUpdate();
			},
			mallInfoInfo(e) { //查看订单详情
				if (e.end_times != 0) {
					if (e.spec_type == 1) {
						uni.pro.navigateTo('mall/mallInfo', {
							id: e.id,
						})
					} else {
						uni.pro.navigateTo('mall/mallInfos', {
							id: e.id,
						})
					}
				} else {
					uni.showToast({
						title: '请购时间以结束',
						icon: "none"
					})
				}
			},

		}
	}
</script>

<style lang="scss">
	.index {
		width: 100%;
		padding: 32rpx 32rpx 0 32rpx;

		.onecontenttowone::before {
			content: '';
			display: inline-block;
			width: 4rpx;
			height: 20rpx;
			background: var(--bg-color-buttonone);
			border-radius: 4rpx;
		}

		.onecontenttowone {
			.onecontenttowone_one {
				margin-left: 8rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: bold;
				color: #1A1A1A;
			}
		}

		.indexbox {
			margin-bottom: 24rpx;

			.indexboxitem {
				margin-top: 24rpx;
				width: 100%;
				background: #FFFFFF;
				box-shadow: 0px 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
				border-radius: 18rpx;
				padding: 16rpx;

				.indexboxitemimage {
					width: 220rpx;
					height: 220rpx;
					border-radius: 16rpx;
				}

				.indexboxitemleft {
					flex: auto;
					height: 220rpx;
					margin-left: 24rpx;
					justify-content: flex-start;

					.indexboxitemleftone {
						width: 400rpx;
						font-size: 32rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						font-family: Roboto, Roboto;
						font-weight: bold;
						color: #1A1A1A;
					}

					.indexboxitemlefttow {
						width: 400rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						margin-top: 16rpx;
						font-size: 24rpx;
						font-family: Source Han Sans CN, Source Han Sans CN;
						font-weight: 400;
						color: #666666;
					}

					.indexboxitemleftthere {
						margin-top: 34rpx;
						padding-left: 26rpx;
						width: 100%;
						height: 88rpx;
						background: url(@/static/imge/flashsale.png) no-repeat;
						background-size: 100% 100%;

						.indexboxitemlefttheretext {
							.indexboxitemlefttheretextone {
								text {
									font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
									font-weight: normal;
									color: #FF5053;
								}

								text:nth-child(2) {
									font-weight: bold;
									font-size: 34rpx;
								}

								text:nth-child(1) {
									font-size: 24rpx;
								}
							}

							.indexboxitemlefttheretexttow {
								margin-left: 12rpx;
								font-size: 20rpx;
								font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
								font-weight: normal;
								color: #999999;
								text-decoration: line-through;
							}
						}

						.indexboxitemleftthere_countdown {
							.indexboxitemleftthere_countdowntext {
								font-family: Roboto, Roboto;
								font-weight: 400;
								color: #333333;
								font-size: 18rpx;
							}

							.indexboxitemleftthere_countdowntexts {
								font-family: Roboto, Roboto;
								font-weight: 400;
								color: #333333;
								margin-left: 16rpx;
								font-size: 22rpx;
							}
						}
					}
				}
			}
		}
	}
</style>