<template>
	<view class="goods">
		<view class="goods-hd">
			<view class="item">
				<view class="a">商品名称<text>*</text></view>
				<view class="b">
					<input type="text" placeholder="请输入商品价格，最低0.1元" />元
				</view>
			</view>
			<view class="item">
				<view class="a">商品分类</view>
				<view class="b" @click="openPage(1)">
					<view class="select">请选择商品分类<u-icon name="arrow-right"></u-icon></view>
				</view>
			</view>
			<view class="items">
				<view class="a">商品照片<text>*</text><view class="tip">最多上传100张</view></view>
				<view class="c">
					<u-upload :action="action" width="180" height="180" :file-list="fileList" :custom-btn="true" max-count="5">
						<template v-slot:addBtn>
							<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<image src="/static/news/icon-upload.png"></image>
								<view class="1">上传图片</view>
							</view>
						</template>
					</u-upload>
				</view>
			</view>
			<view class="items">
				<view class="a">商品详情<text>*</text><view class="input"><input type="text" placeholder="可输入商品的详细描述"/></view></view>
				<view class="c">
					<u-upload :action="action" width="180" height="180" :file-list="fileList" :custom-btn="true" max-count="5">
						<template v-slot:addBtn>
							<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<image src="/static/news/icon-upload.png"></image>
								<view class="1">上传图片</view>
							</view>
						</template>
					</u-upload>
				</view>
			</view>
			<view class="items">
				<view class="a">商品素材<text>*</text></view>
				<view class="c">
					<u-upload :action="action" width="180" height="180" :file-list="fileList" :custom-btn="true" max-count="5">
						<template v-slot:addBtn>
							<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
								<image src="/static/news/icon-upload.png"></image>
								<view class="1">上传图片</view>
							</view>
						</template>
					</u-upload>
				</view>
			</view>
		</view>
		<view class="goods-hd">
			<view class="items">
				<view class="a" style="justify-content: space-between;">多规格<u-switch v-model="checked" active-color="#55BD6A" ></u-switch></view>
				<view class="b">
					最多添加3个商品规格组，生成SKU数量不能超出50个
				</view>
			</view>
			<view class="item">
				<view class="a">商品价格<text>*</text></view>
				<view class="b">
					<input type="text" placeholder="请输入商品价格，最低0.1元" />元
				</view>
			</view>
			<view class="item">
				<view class="a">商品原价</view>
				<view class="b">
					<input type="text" placeholder="请输入商品划线价格" />元
				</view>
			</view>
			<view class="item">
				<view class="a">商品库存<text>*</text></view>
				<view class="b">
					<input type="number" placeholder="请输入商品库存" />件
				</view>
			</view>
			<view class="item">
				<view class="a">商品重量<text>*</text></view>
				<view class="b">
					<input type="text" placeholder="请输入商品重量" />kg
				</view>
			</view>
		</view>
		<view class="goods-hd">
			<view class="item">
				<view class="a">配送方式<text>*</text></view>
				<view class="b" @click="openPage(2)">
					<view class="select">请选择配送方式<u-icon name="arrow-right"></u-icon></view>
				</view>
			</view>
			<view class="item">
				<view class="a">运费模版<text>*</text></view>
				<view class="b" @click="openPage(3)">
					<view class="select">全国包邮（除偏远地区）<u-icon name="arrow-right"></u-icon></view>
				</view>
			</view>
			<view class="item">
				<view class="a">销售状态<text>*</text></view>
				<view class="b">
					<u-switch v-model="checked" active-color="#F34A40" ></u-switch>
				</view>
			</view>
		</view>
		<view class="goods-fd">
			<view class="btn">确认</view>
		</view>
		<u-popup v-model="isShow" mode="bottom" border-radius="12" mask-close-able="false" closeable>
			<view class="goods-classify" v-if="popupType == 1">
				<view class="goods-classify-hd">
					<view class="a" @click="openPage(4)"><u-icon name="plus"></u-icon>新增分类</view>
					商品分类
				</view>
				<view class="goods-classify-bd">
					<scroll-view scroll-y class="l">
						<view class="item" @click="tabLItem(0)"><view :class="tabLIndex == 0?'item-on':''">数码</view></view>
						<view class="item" @click="tabLItem(1)"><view :class="tabLIndex == 0?'item-on':''">食品</view></view>
						<view class="item" @click="tabLItem(2)"><view :class="tabLIndex == 0?'item-on':''">服饰鞋包</view></view>
						<view class="item" @click="tabLItem(3)"><view :class="tabLIndex == 0?'item-on':''">家居百货</view></view>
						<view class="item" @click="tabLItem(4)"><view :class="tabLIndex == 0?'item-on':''">美妆/个户</view></view>
						<view class="item" @click="tabLItem(5)"><view :class="tabLIndex == 0?'item-on':''">家居百货</view></view>
						<view class="item" @click="tabLItem(6)"><view :class="tabLIndex == 0?'item-on':''">美妆/个户</view></view>
						<view class="item" @click="tabLItem(7)"><view :class="tabLIndex == 0?'item-on':''">食品</view></view>
						<view class="item" @click="tabLItem(8)"><view :class="tabLIndex == 0?'item-on':''">服饰鞋包</view></view>
						<view class="item" @click="tabLItem(9)"><view :class="tabLIndex == 0?'item-on':''">家居百货</view></view>
						<view class="item" @click="tabLItem(10)"><view :class="tabLIndex == 0?'item-on':''">美妆/个户</view></view>
					</scroll-view>
					<scroll-view scroll-y class="r">
						<view class="item" v-for="(a,i) in 10" @click="tabRItem(i)"><view :class="tabRIndex == i?'item-on':''">水产肉类/新鲜水果</view></view>
					</scroll-view>
				</view>
			</view>
			<view class="goods-classify" v-if="popupType == 2">
				<view class="goods-classify-hd">配送方式</view>
				<view class="goods-classify-bd">
					<scroll-view scroll-y class="m">
						<view class="item" v-for="(a,i) in 10" @click="tabMItem(i)"><view :class="tabMIndex == i?'item-on':''">物流</view></view>
					</scroll-view>
				</view>
			</view>
			<view class="goods-classify" v-if="popupType == 3">
				<view class="goods-classify-hd">运费模板</view>
				<view class="goods-classify-bd">
					<scroll-view scroll-y class="m">
						<view class="item" v-for="(a,i) in 2" @click="tabMItem1(i)"><view :class="tabMIndex1 == i?'item-on':''">物流</view></view>
					</scroll-view>
				</view>
			</view>		
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				fileList: [
					{
						url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg',
					}
				],
				isShow: false,
				checked: false,
				value: "",
				popupType: 1,
				tabLIndex: 0,
				tabRIndex: 0,
				tabMIndex: 0,
				tabMIndex1: 0
			};
		},
		methods: {
			openPage(i){
				if(i<= 3){
					this.isShow = true;
					this.popupType=i
				}else if(i == 4){
					uni.navigateTo({
						url: "/pages/news/goods/classification"
					})
				}
			},
			tabLItem(i){
				this.tabLIndex = i
				console.log(this.tabLIndex)
			},
			tabRItem(i){
				this.tabRIndex = i
				console.log(this.tabRIndex)
			},
			tabMItem(i){
				this.tabMIndex = i
				console.log(this.tabMIndex)
			},
			tabMItem1(i){
				this.tabMIndex1 = i
				console.log(this.tabMIndex1)
			},
		}
	}
</script>

<style lang="scss" scoped>
.goods{
	padding: 0 0 130rpx;
	overflow: hidden;
	&-hd{
		background-color: #fff;
		padding: 0 25rpx 0;
		overflow: hidden;
		margin-bottom: 20rpx;
		.item{
			padding: 20rpx 30rpx;
			line-height: 50rpx;
			font-size: 28rpx;
			color: #212121;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #F7F7F7;
			.a{
				text{
					color: #F34A40;
					margin-left: 5rpx;
				}
			}		
			.b{	
				font-size: 28rpx;
				color: #212121;
				display: flex;
				align-items: center;
					justify-content: flex-end;
				flex: 1;
				input{
					font-size: 28rpx;
					color: #212121;
					flex: 1;
					line-height: 50rpx;
					font-size: 28rpx;
					color: #212121;
					text-align: right;
					margin-right: 10rpx;
				}
				.select{
					width: 100%;
					display: flex;
					align-items: center;
					color: #C7C7C7;
					justify-content: flex-end;
					&-on{
						color: #212121;
					}
				}
			}
		}
		.items{
				padding: 20rpx 30rpx;
				line-height: 50rpx;
				font-size: 28rpx;
				color: #212121;
				border-bottom: 1px solid #F7F7F7;
				.a{
					flex: 1;
					display: flex;
					align-items: center;
					input{
						flex: 1;
						font-size: 26rpx;
						color: #212121;
						line-height: 50rpx;
						margin-left: 20rpx;
					}
					text{
						color: #F34A40;
						margin-left: 5rpx;
					}
					.select{
						flex: 1;
					}
					.tip{
						margin-left: 15rpx;
						font-size: 24rpx;
						font-weight: 500;
						color: #9F9F9F;
					}
				}
				.b{
					padding-top: 20rpx;
					font-size: 24rpx;
					font-weight: 400;
					color: #C7C7C7;
				}
				.c{
					padding-top: 20rpx;
					overflow: hidden;
					.slot-btn{
						width: 180rpx;
						height: 180rpx;
						background: #F6F6F6;
						border-radius: 10rpx;
						border: 1px solid #C0C0C0;
						text-align: center;
						font-size: 28rpx;
						font-weight: 500;
						color: #6D6D6D;
						image{
							width: 50rpx;
							height: 50rpx;
							margin-top: 30rpx;
						}
					}
				}
			}
		
	}	
	&-fd{
		width: 100%;
		position: fixed;
		left: 0;
		bottom: 0;
		padding: 30rpx;
		z-index: 99;
		background-color: #fafafa;
		box-sizing: border-box;
		.btn{
			width: 630rpx;
			line-height: 88rpx;
			background: #F34A40;
			border-radius: 88rpx;
			text-align: center;
			font-size: 28rpx;
			font-weight: 500;
			color: #FFFFFF;
		}
	}
	&-classify{
		width: 100%;
		overflow: hidden;
		&-hd{
			padding: 30rpx 60rpx;
			position: relative;
			font-size: 32rpx;
			font-weight: 500;
			color: #303030;
			text-align: center;
			.a{
				display: flex;
				align-items: center;
				font-size: 28rpx;
				font-weight: 500;
				color: #FF624F;
				position: absolute;
				top: 30rpx;
				left: 40rpx;
				z-index: 2;
			}
		}
		&-bd{
			overflow: hidden;
			display: flex;
			align-items: flex-start;
			.l{
				width: 210rpx;
				height: 560rpx;
				background-color: #F7F8FA;
				.item{
					text-overflow: ellipsis;
					overflow: hidden;
					height: 70rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #303030;
					white-space: nowrap;
					line-height: 70rpx;
					padding-left: 30rpx;
					box-sizing: border-box;
					&-on{
						background-color: #fff;
						font-weight: 500;
					}
				}
			}
			.m{
				width: 100%;
				text-align: center;
				max-height: 560rpx;
				.item{
					text-overflow: ellipsis;
					overflow: hidden;
					height: 70rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #303030;
					white-space: nowrap;
					line-height: 70rpx;
					padding-left: 80rpx;
					box-sizing: border-box;
					&-on{
						color: #FF624F;
					}
				}
			}
			.r{
				width: 540rpx;
				height: 560rpx;
				.item{
					text-overflow: ellipsis;
					overflow: hidden;
					height: 70rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #303030;
					white-space: nowrap;
					line-height: 70rpx;
					padding-left: 80rpx;
					box-sizing: border-box;
					&-on{
						color: #FF624F;
					}
				}
			}
		}
	}
}
</style>
