<template>
	<view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
		<tm-menubars title="" :shadow="0" :showback="false"></tm-menubars>
		<view class="C1b1b1b">
			<view class="dingwei ml-20" v-if="itemuser!=0">
				<image class="touxiang" style="vertical-align: middle;" src="/static/img/41.png" mode="widthFix"></image>
				<text style="vertical-align: middle;" class="text-size-m mr-20">{{itemuser.username}}的衣橱</text>
				<!-- <image @click="qiehuanFun" style="vertical-align: middle;" src="/static/img/42.png" mode="widthFix"></image> -->
				<!-- <text @click="qiehuanFun" style="vertical-align: middle;" class="text-size-m">切换</text> -->
			</view>
			<view class="dingwei" v-if="itemuser==0">
				<text style="vertical-align: middle;" class="text-size-m mr-20">暂无家庭成员去添加</text>
				<image @click="tianjia" style="vertical-align: middle;" src="/static/img/42.png" mode="widthFix"></image>
			</view>
		</view>
		<!-- 推荐 -->
		<view class="zhuti">
			<!-- 衣橱 -->
			<tm-sheet class="yichu" style="margin-bottom: 70px !important;">
				<tm-tabs class="C1b1b1b qiehuan" @change="fenleichange" color="white"  align="left"  v-model="activeIndex" :list="list" range-key="title"></tm-tabs>
				<view class="yiguicla black pa-6 ma-4 fl" :class="item.aa?'C0178FD':''" v-for="(item,index) in quanbuList" @click="yifu(index,item)">
					<image :src="item.src" mode="widthFix"></image>
					<view class="text-align-center text-size-m mt-8">{{item.text}}</view>
					<view class="text-align-center text-size-m mt-6 mb-6">{{item.type}}</view>
				</view>
				<view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
					<image src="/static/img/30.png" mode="widthFix"></image>
					<text class="text-size-s">下拉加载更多~</text>
				</view>
			</tm-sheet>
			<view class="anniu">
				<tm-button @click="quxiao" :round="24" class="fl" theme="gray" size="n">取消</tm-button>
				<tm-button :round="24" class="fl" theme="primary" size="n">取出</tm-button>
			</view>
			<view class="anniu">
				<tm-button :round="24" class="fl" theme="red" size="n">删除</tm-button>
				<tm-button :round="24" class="fl" theme="primary" size="n">保存</tm-button>
			</view>
		</view>
	</view>
</template>	
<script>
import{myRequest} from '@/api/request.js'
export default {
	data() {
		return {
			itemuser:0,
			soso:'',
			activeIndex:0,
			list:[],
			listlx:[],
			quanbuList:[{
				src:'/static/img/45.png',
				text:'NEO CITY 涂鸦',
				type:'手提包',
				aa:false
			},{
				src:'/static/img/46.png',
				text:'满印迷你标识',
				type:'围巾',
				aa:false
			},{
				src:'/static/img/47.png',
				text:'大号版型夹克',
				type:'新品',
				aa:false
			},{
				src:'/static/img/45.png',
				text:'NEO CITY 涂鸦',
				type:'手提包',
				aa:false
			},{
				src:'/static/img/46.png',
				text:'满印迷你标识',
				type:'围巾',
				aa:false
			},{
				src:'/static/img/47.png',
				text:'大号版型夹克',
				type:'新品',
				aa:false
			}],
			chooseindex:-1
		};
	},
	onLoad() {
		console.log("111")
	},
	created() {
		this.sys = uni.getSystemInfoSync();
		console.log("222")
		// this.getfenltext()
		this.fenleichange();
	},
	methods: {
		quxiao(){
			for(let i=0;i<this.quanbuList.length;i++){
				this.quanbuList[i].aa=false;
			}
		},
		chuku(){
			uni.navigateTo({
				url: "/pages/quchu/index",
			})
		},
		sosoFun(){
			uni.navigateTo({
				url: "/pages/shopsoso/index",
			})
		},
		fenleichange(e){
			var that=this;
			myRequest({
				url: "/api/MemberInfo/getFamilyMember",
				method:'post',
				data:{family_id:uni.getStorageSync("family_id")}
			}).then(res => {
				console.log(res.data)
				if (res.data.code == 200) {
					if(res.data.data.length != 0){
						var wu=0;
						for(let i=0;i<res.data.data.length;i++){
							if(res.data.data[i].checked==1){
								wu=1;
								that.itemuser=res.data.data[i];
							}
						}
						if(wu==0){
							that.itemuser=res.data.data[0];
						}
					}else{
						that.itemuser=0;
					}
				}else{
					that.itemuser=0;
				}
			})
		},
		getfenltext(){
			var that=this;
			myRequest({
				url: "/api/Category/list",
				method:'post',
				data:{}
			}).then(res => {
				console.log(res.data)
				if (res.data.code == 200) {
					if(res.data.data.length != 0){
						that.list=['全部'];
						for(let i=0;i<res.data.data.length;i++){
							that.list.push(res.data.data[i].category_name)
						}
						that.listlx=res.data.data;
					}
				}else{
					that.list=[];
					that.listlx=[];
				}
			})
		},
		yifu(index,item){
			
			item.aa=! item.aa
			console.log(item)
		},
		qiehuanFun(){
			uni.navigateTo({
				url: "/pages/qiehuan/index",
			})
		},
		randouh(){
			let list2 = [],that=this;
			for(let i=0;i<6;i++){
				list2.push({
					src:'/static/img/47.png',
					text:'大号版型夹克',
					type:'新品',
					aa:false
				})
			}
			this.quanbuList=this.quanbuList.concat(list2)
			console.log(this.quanbuList)
		},
		gengmore(){
			this.randouh()
		},
		change(e){
			uni.$tm.toast(`你选中了${e}`);
		},
		changece(e){
			uni.$tm.toast(`您选中了:${e}`)
		},
		dapei(item){
			console.log(item)
		},
		xiangqing(item){
			console.log(item)
		},
		ruku(){
			uni.navigateTo({
				url: "/pages/putstorage/index",
			})
		},
		tianjia(){
			uni.navigateTo({
				url: "/pages/chuanghome/index",
			})
		}
	},
}
</script>

<style lang="scss">
	/deep/ uni-scroll-view{
		height: auto !important;
	}
	/deep/ .tm-menubars .body{
		background-color: #1b1b1b !important;
	}
	.shangright{
		padding: 10px;
	}
	// 
	.xiangji image{
		width: 30px;
		height: 22px;
	}
	.suosou image{
		width: 40px;
	}
	/deep/ .icon-search{
		font-size: 23px !important;
		color: #8E8E93 !important;
	}
	/deep/ .tm-search{
		width: 94%;
		margin: 0 auto;
		background-color: #414141 !important;
		border-radius: 10px;
	}
	/deep/ .tm-search .grey-darken-5{
		background-color: #414141 !important;
	}
	.dingwei{padding-bottom: 20px;}
	.dingwei image{width: 25px;margin-right: 10px;	}
	.dingwei .touxiang{width: 50px;margin-right: 3px;	}
	/deep/ .lunbo1{margin:0 !important;padding: 4px !important;margin-top: 5px !important;width: 46.6% !important;}
	.tuijiantp{width: 100%;}
	.tuijiantp image{width: 97% !important;}
	.yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
	/deep/ .qiehuan .text-white{
		font-size: 14px;
		background: #303440;
		height: 28px;
		vertical-align: middle;
		line-height: 28px;
		border-radius: 20px;
		padding-left: 14px;
		padding-right: 14px;
		margin-top: 17%;
	}
	/deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
	.yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
	.yiguicla{width: 30%;border-radius: 10px;}
	.more{text-align: center;}
	.more image{margin-right: 10px;vertical-align: middle;width: 30px;}
	.fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
	border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
	.fudimg{width: 60px;height:60px}
	.anniu{width: 78%;margin: 0 auto;margin-top: 20px;padding-bottom: 30px;text-align: center;}
	/deep/ .tm-button .tm-button-btn uni-button{min-width: 120px !important;}
	/deep/ .tm-button .red{color: white !important;}
</style>
