<template>
	<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
		<view class="list-scroll-view">
			<view class="order">
				<tabs :tabs="tabs" @tabsChange="tabsChange">
					<view class="tabsList">
						<view class="list" v-for="(item,index) in orderList" :key="index">
							<view class="list_1" v-if="tabs.active=='0'">
								<view class="goods">
									<view class="goodsList" v-for="(tag,indexs) in item.goods" :key="indexs">
										<view class="shopname">
											<view class="shop" v-if="tag.is_set=='0'">
												<view class="r">
													<text class="set">套装</text> {{tag.name}}
												</view>
											</view>
											<view class="shop" v-else>
												<text class="iconfont icon-shangdian"></text>
												<text>{{tag.shop_name}}</text>
											</view>
											<view class="status">
												{{item.zhStatus}}
											</view>
										</view>
										<view class="goodsList_1">
											<view class="market" v-for="(tags,indexss) in tag.goods" :key="indexss">
												<view class="market_1">
													<image class="image"
														:src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''"
														mode=""></image>
												</view>
												<view class="market_2">
													<view class="goodsname textOver">
														{{tags.goods.name}}
													</view>
													<view class="specs" v-if="tag.is_set=='0'">
														{{tags.spec_name}}
													</view>
													<view class="specs" v-else>
														{{tags.name}}
													</view>
													<text v-if="tags.gift&&tags.gift.length>0" class="gift">赠品</text>
													<text v-if="tags.sp_price" class="act">特价</text>
												</view>
												<view class="market_3" v-if="tag.is_set=='0'">
													<view class="price">{{tags.set_num}}件/套x{{tags.set_num}}
													</view>
												</view>
												<view class="market_3" v-else>
													<view v-if="item.type=='0'" class="price">
														¥{{tags.price||tags.sell_money}}
													</view>
													<view v-else class="price">
														¥{{tags.group_config.money}}
													</view>
													<view class="num">
														×{{tags.buy_num}}
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="other">
									<text>共{{item.buy_num_total}}件商品</text>
									<text>实付款¥{{item.real_pay}}</text>
								</view>
							</view>
							<view class="list_2" v-else>
								<view class="list_2_1">
									<view class="shopname" v-if="item.is_set=='0'">
										<view class="r">
											<text class="set">套装</text> {{tag.name}}
										</view>
									</view>
									<view class="shopname" v-else>
										<text class="iconfont icon-shangdian"></text>
										<text>{{item.shop.name}}</text>
									</view>
									<view class="status">
										{{item.zhStatus}}
									</view>
								</view>
								<view class="list_2_2" v-for="(tag,indexs) in item.goods" :key="indexs">
									<view v-if="tag.is_set=='0'">
										<view class="goods" v-for="(tags,indexss) in tag.goods" :key="indexss">
											<view class="goods_1">
												<image class="image"
													:src="tags.goods.file&&tags.goods.file.length>0?tags.goods.file[0].url:''"
													mode=""></image>
											</view>
											<view class="goods_2">
												<view class="goodsname textOver">
													{{tags.goods.name}}
												</view>
												<view class="specs">
													{{tags.spec_name}}
												</view>
											</view>
											<view class="goods_3">
												<view class="price">{{tags.set_num}}件/套x{{tags.set_num}}
												</view>
											</view>
										</view>
										<view class="set">
											<view class="set_1">套装价：￥{{tag.sell_money}}</view>
											<view class="set_2">数量：×{{tag.buy_num}}</view>
										</view>
									</view>
									<view v-else>
										<view class="goods">
											<view class="goods_1">
												<image class="image" :src="tag.url" mode=""></image>
											</view>
											<view class="goods_2">
												<view class="goodsname textOver">
													{{tag.goods.name}}
												</view>
												<view class="specs">
													{{tag.name}}
												</view>
												<text v-if="tag.gift&&tag.gift.length>0" class="gift">赠品</text>
												<text v-if="tag.sp_price" class="act">特价</text>
											</view>
											<view class="goods_3">
												<view v-if="item.type=='0'" class="price">
													¥{{tag.price||tag.sell_money}}
												</view>
												<view v-else class="price">
													¥{{tag.group_config.money}}
												</view>
												<view class="num">
													×{{tag.buy_num}}
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="other">
									<text>共{{item.buy_num_total||0}}件商品</text>
									<text>实付款¥{{item.real_pay}}</text>
								</view>
							</view>
							<view class="button" @tap="toSend(item)">
								<text>发送</text>
							</view>
						</view>
					</view>
				</tabs>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	import tabs from '../../components/tabs/index.vue';
	export default {
		components: {
			tabs
		},
		props: {
			orderList: {
				type: Array
			},
			status: {
				type: String
			},
			tabs: {
				type: Object
			}
		},
		data() {
			return {};
		},
		methods: {
			// 分页
			toPage(e) {
				const that = this;
				that.$emit('toPage')
			},
			// 选择选项卡
			tabsChange(e) {
				const that = this;
				that.$emit('tabsChange', e)
			},
			// 发送
			toSend(e) {
				const that = this;
				that.$emit('toSend', e)
			}
		},
	}
</script>

<style lang="scss">
	.order {
		background-color: var(--f9Color);

		.tabsList {

			.list {
				background-color: #fff;
				border: 1px solid var(--f5Color);
				padding: 2vw;
				margin: 0 2vw 2vw 2vw;
				border-radius: 5px;

				.list_1 {
					.goods {
						.goodsList {
							border-bottom: 1px solid #f1f1f1;

							.shopname {
								display: flex;
								justify-content: space-between;
								margin: 0 0 2vw 0;

								.shop {
									text:last-child {
										padding: 0 0 0 2vw;
									}

									.r {
										.set {
											margin: 0 1vw 0 0;
											font-size: 12px;
											border-radius: 5px;
											padding: 0 1vw;
											color: #ffffff;
											background-color: #FF6347;
											border: 1px solid #FFA500;
										}
									}
								}

								.status {
									text-align: right;
									color: var(--fFB1Color);
									margin: 0 0 1vw 0;
								}
							}

							.goodsList_1 {
								.market {
									display: flex;
									padding: 0 0 2vw 0;

									.market_1 {
										width: 20vw;
										height: 20vw;

										.image {
											width: 100%;
											height: 100%;
											border-radius: 5px;
										}
									}

									.market_2 {
										width: 55vw;
										padding: 0 0 0 2vw;

										.goodsname {
											font-size: 16px;
											margin: 0 0 1vw 0;
										}

										.specs {
											font-size: 14px;
											color: #858585;
										}

										.gift {
											margin: 0 1vw 0 0;
											font-size: 12px;
											color: #FFA500;
											border: 1px solid #FFA500;
											border-radius: 5px;
											padding: 0 1vw;
										}

										.act {
											font-size: 12px;
											border: 1px solid var(--fFB1Color);
											color: var(--fFB1Color);
											border-radius: 5px;
											padding: 0 1vw;
										}
									}

									.market_3 {
										width: 15vw;
										text-align: right;

										.price {
											color: var(--fFB1Color);
										}
									}
								}
							}
						}
					}

					.other {
						padding: 0 0 2vw 0;
						margin: 2vw 0;
						text-align: right;
						border-bottom: 1px solid #f1f1f1;

						text {
							font-size: 14px;
							padding: 0 0 0 2vw;
						}
					}
				}

				.list_2 {
					.list_2_1 {
						display: flex;
						justify-content: space-between;
						margin: 0 0 2vw 0;

						.shopname {
							text:last-child {
								padding: 0 0 0 2vw;
							}

							.r {
								.set {
									margin: 0 1vw 0 0;
									font-size: 12px;
									border-radius: 5px;
									padding: 0 1vw;
									color: #ffffff;
									background-color: #FF6347;
									border: 1px solid #FFA500;
								}
							}
						}

						.status {
							color: var(--fFB1Color);
						}
					}

					.list_2_2 {
						border-bottom: 1px solid #f1f1f1;
						padding-top: 1vw;

						.goods {
							display: flex;
							padding: 0 0 2vw 0;

							.goods_1 {
								width: 20vw;
								height: 20vw;

								.image {
									width: 100%;
									height: 100%;
									border-radius: 5px;
								}
							}

							.goods_2 {
								width: 55vw;
								padding: 0 0 0 2vw;

								.goodsname {
									font-size: 16px;
									margin: 0 0 1vw 0;
								}

								.specs {
									font-size: 14px;
									color: #858585;
								}

								.gift {
									margin: 0 1vw 0 0;
									font-size: 12px;
									color: #FFA500;
									border: 1px solid #FFA500;
									border-radius: 5px;
									padding: 0 1vw;
								}

								.act {
									font-size: 12px;
									border: 1px solid var(--fFB1Color);
									color: var(--fFB1Color);
									border-radius: 5px;
									padding: 0 1vw;
								}
							}

							.goods_3 {
								width: 15vw;
								text-align: right;

								.price {
									color: var(--fFB1Color);
								}
							}
						}

						.set {
							display: flex;
							padding: 2vw 0;
							justify-content: space-between;
							color: var(--fFB1Color);
						}
					}


					.other {
						padding: 0 0 2vw 0;
						margin: 2vw 0;
						text-align: right;
						border-bottom: 1px solid #f1f1f1;

						text {
							font-size: 14px;
							padding: 0 0 0 2vw;
						}
					}
				}

				.button {
					text-align: right;

					text {
						font-size: 12px;
						padding: 10rpx 20rpx;
						border-radius: 20rpx;
						color: #ffffff;
						background-color: #FF4500;
					}
				}
			}
		}
	}

	.scroll-view {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;

		.list-scroll-view {
			display: flex;
			flex-direction: column;
		}
	}
</style>
