<template>
	<view class="therecontent flex-between">
		<view class="therecontent_box_item">
			<view class="therecontent_box_imge flex-between" @click="jrtoday(0)">
				<view class="therecontent_box_imge_text">
					{{todayList.name}}
				</view>
				<view class="therecontent_box_imge_right flex-start">
					<view>
						{{todayList.date}}
					</view>
					<u-icon name="arrow-right" color="#666666" size="16"></u-icon>
				</view>
			</view>
			<view class="therecontent_box_itembox">
				<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in todayList.todayList"
					:key="index" @click="clickproduct(item)">
					<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_114,h_136`" mode="aspectFill"></image>
					<view class="therecontent_box_itembox_itemview flex-colum-start">
						<view class="therecontent_box_itembox_itemviewone">
							<text
								style="margin-left: 0;">{{item.productName.length>5?item.productName.substring(0,5)+'...':item.productName}}</text>
						</view>
						<view class="therecontent_box_itembox_itemviewtow flex-around">
							<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/xia.png" mode="widthFix">
							</image>
							<view>
								{{item.discount || '1'}}折
							</view>
						</view>
						<view class="therecontent_box_itembox_itemviewthere ">
							<text>￥{{item.salePrice}}</text>
							<text>￥{{item.originPrice}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="therecontent_box_item">
			<view class="therecontent_box_imge flex-between"
				style="background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box2.png) no-repeat; background-size: cover;"
				@click="jrtoday(1)">
				<view class="therecontent_box_imge_text">
					{{salesList.name}}
				</view>
				<view class="therecontent_box_imge_right flex-start">
					<view>
						{{salesList.date}}
					</view>
					<u-icon name="arrow-right" color="#666666" size="16"></u-icon>
				</view>
			</view>
			<view class="therecontent_box_itembox">
				<view class="therecontent_box_itembox_item flex-between" v-for="(item,index) in salesList.hotList"
					:key="index" @click="clickproduct(item)">
					<image :src="`${item.image}?x-oss-process=image/resize,m_lfit,w_114,h_136`" mode="aspectFill"></image>
					<view class="therecontent_box_itembox_itemview flex-colum-start">
						<view class="therecontent_box_itembox_itemviewone flex-start">
							<view class="therecontent_box_itembox_itemviewoneafter">
								TOP.{{index + 1}}
							</view>
							<text>{{ item.productName.length>5?item.productName.substring(0,5)+'...':item.productName }}</text>
						</view>
						<view class="therecontent_box_itembox_itemviewtowdiscount flex-around">
							已抢{{item.realSalesNumber}}份
						</view>
						<view class="therecontent_box_itembox_itemviewthere  ">
							<text>￥{{item.salePrice}}</text>
							<text>￥{{item.originPrice}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		props: {
			salesList: {
				type: Object,
				default () {
					return {
						salesList: []
					}
				}
			},
			todayList: {
				type: Object,
				default () {
					return {
						todayList: []
					}
				}
			},
			title: {
				type: String,
				default: '每日特价'
			}
		},
		methods: {
			clickproduct(item) {
				uni.pro.navigateTo('product/index', {
					id: item.id
				})
			},
			jrtoday(e) {
				if (e == 0) {
					uni.pro.navigateTo('index/jtoday')
				} else {
					uni.pro.navigateTo('index/hotlist')
				}
			}
		}
	};
</script>

<style scoped lang="scss">
	.therecontent {
		padding: 0 28rpx;

		.therecontent_box_item {
			width: 336rpx;
			border-radius: 18rpx;
			background: #FFFFFF;
			height: 396rpx;

			.therecontent_box_itembox {
				padding: 10rpx 18rpx 24rpx 24rpx;

				.therecontent_box_itembox_item {
					margin-top: 20rpx;
					flex-wrap: nowrap;

					image {
						width: 114rpx;
						height: 136rpx;
						border-radius: 10rpx;
					}

					.therecontent_box_itembox_itemview {
						margin-left: 12rpx;

						.therecontent_box_itembox_itemviewone {
							width: 168rpx;
							font-family: Source Han Sans CN, Source Han Sans CN;
							font-weight: 400;
							font-size: 24rpx;
							color: #333333;

							text {
								margin-left: 4rpx;
								overflow: hidden;
								text-overflow: ellipsis;
								display: -webkit-box;
								-webkit-box-orient: vertical;
								-webkit-line-clamp: 2;
							}

							.therecontent_box_itembox_itemviewoneafter {
								width: 48rpx;
								height: 24rpx;
								line-height: 24rpx;
								text-align: center;
								background: linear-gradient(116deg, #FF9D2B 0%, #FF4805 100%);
								border-radius: 4rpx 4rpx 4rpx 4rpx;
								font-family: Roboto, Roboto;
								font-weight: 500;
								font-size: 16rpx;
								color: #FFFFFF;
							}
						}

						.therecontent_box_itembox_itemviewtow {
							margin-top: 8rpx;
							width: 60rpx;
							// padding: 4rpx 10rpx;
							background: #FFFFFF;
							border-radius: 4rpx;
							border: 2rpx solid #FF7127;

							image {
								width: 9.74rpx;
								height: 13.51rpx;
							}

							view {
								padding-right: 2rpx;
								font-family: Source Han Sans CN, Source Han Sans CN;
								font-weight: bold;
								font-size: 16rpx;
								color: #FF7127;
							}
						}

						.therecontent_box_itembox_itemviewtowdiscount {
							margin-top: 10rpx;
							font-family: Source Han Sans CN, Source Han Sans CN;
							font-weight: 500;
							font-size: 16rpx;
							color: #FF7127;
						}

						.therecontent_box_itembox_itemviewthere {
							// margin-top: 4rpx;
							// align-items: flex-end;
							display: flex;
							align-items: center;
							justify-content: center;

							text:nth-child(1) {
								font-family: Source Han Sans CN, Source Han Sans CN;
								font-weight: Bold;
								font-size: 24rpx;
								color: #FF7127;
							}

							text:nth-child(2) {
								font-family: Source Han Sans CN, Source Han Sans CN;
								font-weight: 500;
								font-size: 16rpx;
								color: #999999;
								text-decoration-line: line-through;
								margin-top: 4rpx;
							}
						}
					}
				}

				.therecontent_box_itembox_item:nth-child(1) {
					margin-top: 0;
				}
			}

			.therecontent_box_imge {
				padding: 24rpx 16rpx 6rpx 24rpx;
				background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/towcontent_box1.png) no-repeat;
				width: 100%;
				height: 70rpx;
				background-size: cover;

				.therecontent_box_imge_text {
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: bold;
					font-size: 28rpx;
					color: #333333;
				}

				.therecontent_box_imge_right {
					font-family: Source Han Sans CN, Source Han Sans CN;
					// font-weight: 500;
					font-size: 24rpx;
					color: #666666;
				}
			}
		}
	}
</style>