<template>
	<view class="container" :style="'margin-bottom:'+(tabStyle.marginBottom*2)+'rpx;' + 'background-color:'+ (currentTab==='dating' || tabParms.goods_type ==='dating'?'#ffffff':'#f7f7f7') +';'">
		<block v-if="controType==='options'">
			<view class="tabBar-box">
				<scroll-view class="scroll-view" scroll-x :style="'background-color:'+tabStyle.background+';'" :scroll-left="scroll_left">
					<view class="tabBar-list">
						<!-- currentTab===tabBarItem.type?'color:'+tabStyle.selectBg+';':+tabStyle.defaultBg+';' -->
						<view @click="selectTabBar(tabData[key],'','',index + 1)" class="tabBar-item p-r f-32 t-c onelist-hidden" v-for="(tabBarItem,key,index) in tabData"
						 :key="index" :style="{color:(currentTab===tabBarItem.type?tabStyle.selectBg:tabStyle.defaultBg)}">{{tabBarItem.nickname}}
							<!-- :style="'color:'+tabStyle.default,currentTab===tabBarItem.type?'background-color:'+tabStyle.selectBg+';':''" -->
							<view :class="{'selectTabBar':currentTab===tabBarItem.type}" :style="{'color':tabStyle.default,'background-color':currentTab===tabBarItem.type?tabStyle.selectBg:''}"></view>
						</view>
					</view>
				</scroll-view>
				<view class="b-f" v-if="currentTab==='pocket' && !!children &&  children.length > 0" style="padding: 0 30upx 30upx;">
					<v-tabs
					:color="'#333333'" 
					:bgColor="'#ffffff'" 
					:activeColor="'#ffffff'" 
					:height="'40rpx'" 
					:paddingItem="'2rpx 20rpx'" 
					:fontSize="'24rpx'" 
					:activeFontSize="'24rpx'"
					:pillsColor="'#ff4444'" 
					:pillsBorderRadius="'60rpx'" 
					v-model="sort" 
					:field="'title'" 
					:tabs="children" 
					:pills="true" 
					line-height="0" 
					:bold="false" 
					@change="vtabschange"></v-tabs>
				</view>
			</view>
		</block>
		<!-- 新加注释 - 技能培训等，第一版选项卡，第二版弃用 -->
		<block v-if="controType==='options2' && currentTab !=='rush' && tabParms.goods_type !=='rush'">
			<view class="tabBar-cn">
				<view class="tabBar-box">
					<scroll-view class="scroll-view" scroll-x :scroll-left="scroll_left">
						<view class="tabBar-list" :style="'background-color:'+tabStyle.background+';'">
							<view @click="selectTabBar_two(tabBarItem,index)" class="tabBar-item2 p-r f-32 t-c" v-for="(tabBarItem,index) in tabData"
							 :key="index" :style="{'color':currentTwoTab==index?tabStyle.selectBg:tabStyle.defaultBg,'width':tabParms.total>5?'20%': 100 / tabParms.total+'%'}">{{tabBarItem.name}}
								<view :class="{'selectTabBar':currentTwoTab==index}" :style="currentTwoTab==index?'background-color:'+tabStyle.selectBg+';':''"></view>
							</view>
						</view>
					</scroll-view>
				</view>
				<block v-if="!!tabParms.class_list&&tabParms.class_list.length>0">
					<view class="tabBar-listTwo-box b-e6">
						<scroll-view class="scroll-view" scroll-x="true" :scroll-left="scroll_left2">
							<view class="tabBar-Twolist">
								<view class="tabBar-Twolist-all m-right50 f-24 col-3 dis-il-block" :class="{tabClassiflySelect:classifly=='0'}"
								 @click="selectClassifly('0',1,false,-1,'全部')">全部</view>
								<view class="f-24 col-3 m-right50 dis-il-block" :class="{tabClassiflySelect:classifly===listItem.id}" v-for="(listItem,index) in tabParms.class_list"
								 @click="selectClassifly(listItem.id,1,false,index,listItem.name)" :key="index">{{listItem.name}}</view>
							</view>
						</scroll-view>
					</view>
				</block>
			</view>
		</block>
		<!--  商家信息  -->
		<block v-if="currentTab === 'store'">
			<view class="shop " style="background-color: #F8F8F8;">
				<view class="shangjia">
					<view class="shangjia-i" style="margin: 30upx;" :class="{shangjiaISty: item2.goods.length == 0}" v-for="(item2, key2) in tabDataList"
					 :key="key2">
						<view class="a shangjia-i-t" @click="navigateTo(item2.shop_url)">
							<view class="shangjia-i-l">
								<image class="image" :src="item2.logo" mode="aspectFill"></image>
							</view>
							<view class="shangjia-i-r">
								<view class="shangjia-i-r-d">
									<view class="dis-flex flex-y-center flex-x-between">
										<view class="shop3-title-width shangjia-i-r-t1 over-omit onelist-hidden">{{ item2.storename }}</view>
										<view class="store-containerIcon dis-flex flex-y-center">
											<image :src="imgfixUrls + 'homePage/home_logo2.png'" class="image30" v-if="item2['attestation']['attestation'] == 2" />
											<image :src="imgfixUrls + 'homePage/home_logo3.png'" class="image30" v-if="item2['attestation']['bondflag']?item2['attestation']['bondflag'] == 1:false" />
											<image :src="imgfixUrls + 'diypage/720icon.png'" mode="" class="m-right10" v-if="item2.panorama===1"></image>
											<image :src="imgfixUrls + 'diypage/videoicon.png'" mode="" v-if="item2.videourl===1"></image>
										</view>
									</view>
									<view class="shangjia-i-r-t2 over-omit dis-flex flex-x-between flex-y-center">
										<view class="dis-flex flex-y-center">
											<view class="shangjia-i-r-t2-icon">
												<view class="star star-dark">
													<view class="i icon iconfont icon-shoucangxiao" v-for="(item3, key3) in 5" :key="key3"></view>
												</view>
												<view class="star star-light">
													<view class="star-width" :style="'width:'+(item2.score / 5) * 100+'%;'">
														<view class="i icon iconfont icon-shoucangxiao" v-for="(item3, key3) in 5" :key="key3"></view>
													</view>
												</view>
											</view>
											<view class="f-28 col-6 star-grade">{{item2.score}}分</view>
										</view>
										<view class="shop3-distance f-24 col-6" v-if="!!item2.distance">{{item2.distance}}</view>
									</view>
									<view class="shangjia-i-r-t3 over-omit">
										<view class="p" v-html="item2.storehours"></view>
									</view>
									<view class="shangjia-i-r-t4 over-omit">
										<view v-for="(item3,index3) in item2.tags" class="tags_view" :key="index3">{{item3}}</view>
									</view>
								</view>
							</view>
						</view>
						<view class="shangjia-i-b" v-if="((shopFold && shopFoldIndex == key2) || (shopFoldIndex !== key2)) && item2.goods.length > 0">
							<view class="shangjia-i-b-t1" v-if="item2.goods.length <= 2">
								<view class="shangjia-i-b-i" v-for="(tag, key3) in item2.goods" :key="key3" v-if="key3 == 0">
									<view class="em" :class="tag.css">{{ tag.tag }}</view>
									<view class="span">{{ tag.name }}</view>
								</view>
							</view>
							<view class="shangjia-i-b-t1" @click="shangjiaFold(key2)" v-if="item2.goods.length > 2">
								<view class="i icon iconfont icon-unfold"></view>
								<view class="shangjia-i-b-i" v-for="(tag, key3) in item2.goods" :key="key3" v-if="key3 == 0">
									<view class="em" :class="tag.css">{{ tag.tag }}</view>
									<view class="span">{{ tag.name }}</view>
								</view>
							</view>
							<view class="shangjia-i-b-i" v-for="(tag, key3) in item2.goods" :key="key3" v-if="item2.goods.length == 2 && key3 == 1">
								<view class="em" :class="tag.css">{{ tag.tag }}</view>
								<view class="span">{{ tag.name }}</view>
							</view>
							<view class="shangjia-i-b-t2" v-if="item2.goods.length > 2">
								<view class="em" :class="tag.css" v-for="(tag, key3) in item2.goods" :key="key3" v-if="key3 > 0">{{ tag.tag }}</view>
							</view>
						</view>
						<view class="shangjia-i-b" v-if="!shopFold && shopFoldIndex == key2 &&  item2.goods.length > 2">
							<view class="shangjia-i-b-t1" @click="shangjiaUpFold(key2)">
								<view class="i icon iconfont icon-fold"></view>
								<view class="shangjia-i-b-i" v-for="(tag, key3) in item2.goods" :key="key3">
									<view class="em" :class="tag.css">{{ tag.tag }}</view>
									<view class="span">{{ tag.name }}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</block>
		<!-- 抢购 -->
		<block v-if="currentTab ==='rush' || tabParms.goods_type ==='rush'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<goods-style goodsStyleType="rush" :goodslistData="rush_goodsList" @remindSuccess="remindSuccess"
				 :cc_id="newCC_id" @cultivateClassChange="cultivateClassChange"></goods-style>
			</view>
		</block>
		<!-- 卡券 -->
		<block v-if="currentTab==='coupon' || tabParms.goods_type ==='coupon'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<goods-style goodsStyleType="coupon" :goodslistData="couponList"></goods-style>
			</view>
		</block>
		<!-- 折扣 -->
		<block v-if="currentTab==='halfcard'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<card-components :disCardData_two="tabDataList" disCardType="disCard1" :disType="2"></card-components>
			</view>
		</block>
		<!-- 拼团 -->
		<block v-if="currentTab==='fight' || tabParms.goods_type==='wlfightgroup'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<goods-style goodsStyleType="fight" :goodslistData="fightList"></goods-style>
			</view>
		</block>
		<!-- 同城 -->
		<block v-if="currentTab==='pocket'">
			<citywide :citywideList="tabDataList" @getaver="getaver"></citywide>
		</block>
		<!-- 团购 -->
		<block v-if="currentTab ==='groupon' || tabParms.goods_type ==='groupon'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<goods-style goodsStyleType="groupon" :goodslistData="gpOrbrList"></goods-style>
			</view>
		</block>
		<!-- 砍价 -->
		<block v-if="currentTab ==='bargain' || tabParms.goods_type ==='bargain'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<goods-style goodsStyleType="bargain" :goodslistData="gpOrbrList"></goods-style>
			</view>
		</block>
		<!-- 大礼包 -->
		<block v-if="currentTab==='package'">
			<view class="b-e6 padding-box-all" style="padding-bottom: 70upx;">
				<giftbag-components :giftData_two="tabDataList" giftType="gift_type1" :disType="2"></giftbag-components>
			</view>
		</block>
		<!-- 积分 -->
		<block v-if="currentTab==='consumption'">
			<integral :integralList="tabDataList"></integral>
		</block>
		<!-- 活动 -->
		<block v-if="currentTab==='activity' || tabParms.goods_type ==='activity'">
			<activity :tabDataList="activityList"></activity>
		</block>
		<!-- 招聘 -->
		<block v-if="currentTab==='recruit' || tabParms.goods_type ==='recruit'">
			<work-List :inviteList="inviteList" :tabStyle="true"></work-List>
		</block>
		<!-- 相亲 -->
		<block v-if="currentTab==='dating' || tabParms.goods_type ==='dating'">
			<view class="nav-content">
				<view class="nav-item" v-for="(items,indexs) in datingList" :key="indexs">
					<user :memberInfo="items"></user>
				</view>
			</view>
			
		</block>
		<!-- 家政 -->
		<block v-if="currentTab==='housekeep' && tabParms.goods_type ==='housekeep'">
			<view  style="padding: 30upx;">
				<view  v-for="(items,indexs) in tabDataTwoList" :key="indexs">
					<homemaking-item :items="items"></homemaking-item>
				</view>
			</view>
			
		</block>
		<block v-else-if="currentTab==='housekeep2'">
			<view  style="padding: 30upx;">
				<view  style="margin-bottom: 30upx;" v-for="(items,indexs) in tabDataTwoList" :key="indexs">
					<demand-item :demanItem="items"></demand-item>
				</view>
			</view>
			
		</block>
		<block v-else-if="currentTab==='housekeep3'">
			<view  style="padding: 30upx;">
				<view  style="margin-bottom: 30upx;" v-for="(items,indexs) in tabDataTwoList" :key="indexs">
					<myser-item :states="false" :serItem="items"></myser-item>
				</view>
			</view>
			
		</block>
		
		<view style="padding-bottom: 10px; background-color: #F8F8F8;">
			<load-more :isMore="loadingMore"></load-more>
		</view>
	</view>
</template>
<script>
	import App from '@/common/js/app.js'
	import demandItem from '@/components/template/demandItem.vue'
	import myserItem from '@/components/template/myserItem.vue'
	import cardComponents from '@/components/page/pageComponents/discountCard.vue'
	import giftbagComponents from '@/components/page/pageComponents/giftbag.vue'
	import citywide from '@/components/page/pageComponents/citywide.vue'
	import integral from '@/components/page/pageComponents/integral.vue'
	import goodsStyle from '@/components/page/pageComponents/goodsStyle.vue'
	import loadMore from '@/components/template/loadmore.vue'
	import activity from '@/components/template/activityData.vue'
	import workList from '@/components/template/workList.vue'
	import user from '@/components/template/user.vue'
	import homemakingItem from '@/components/template/homemakingItem.vue'
	import vTabs from '@/components/v-tabs/v-tabs.vue'
	export default {
		data() {
			return {
				scroll_left: 0,
				currentTab: null,
				currentTwoTab: 0,
				classifly: "0",
				tabDataList: null,
				tabDataTwoList: null,
				shopFold: true,
				shopFoldIndex: -1,
				Twotabtype: null,
				requestData: {},
				loadingMore: false,
				pageTotal: null,
				current_page: 1,
				currentTabItem: {},
				requestTwoSelectInfo: null,
				scroll_left2: 0,
				imgUrl:'',
				cate_id:'',
				onekey:'',
				sort:0,
				children:[],
				idIndex:'',
				cc_child_id: '',
			}
		},
		props: {
			tabData: {
				type: Object,
				default: function() {
					return {}
				}
			},
			tabStyle: {
				type: Object,
				default: function() {
					return {}
				}
			},
			tabParmsType: {
				type: Array,
				default: function() {
					return []
				}
			},
			controType: {
				type: String,
				default: function() {
					return ''
				}
			},
			city_id:{
				type:String,
				default:function(){
					return ''
				}
			},
			newCC_id: {
				type:String||Number,
				default: 1
			}
		},
		components: {
			cardComponents,
			giftbagComponents,
			citywide,
			integral,
			goodsStyle,
			loadMore,
			activity,
			workList,
			user,
			homemakingItem,
			demandItem,
			myserItem,
			vTabs
		},
		onShow() {

		},
		onLoad() {
	
		},
		mounted() {
			this.imgUrl = this.imgfixUrl;
			// debugger
			uni.$on('tabisBottomMore', this.tabInfomore);
		},
		destroyed() {
			uni.$off('tabisBottomMore', this.tabInfomore);
		},
		computed: {
			istabbarcontro() {
				return this.$store.state.istabcontro;
			},
			rush_goodsList: {
				get() {
					return this.currentTab === 'rush' ? this.tabDataList : this.tabDataTwoList;
				},
				set(val) {
					return val
				}
			},
			fightList() {
				return this.currentTab === 'fight' ? this.tabDataList : this.tabDataTwoList;
			},
			gpOrbrList() {
				return (this.currentTab === 'groupon' || this.currentTab === 'bargain') ? this.tabDataList : this.tabDataTwoList;
			},
			couponList() {
				return this.currentTab === 'coupon' ? this.tabDataList : this.tabDataTwoList;
			},
			activityList() {
				return this.currentTab === 'activity' ? this.tabDataList : this.tabDataTwoList;
			},
			inviteList() {
				return this.currentTab === 'recruit' ? this.tabDataList : this.tabDataTwoList;
			},
			datingList() {
				return this.currentTab === 'dating' ? this.tabDataList : this.tabDataTwoList;
			},
			tabParms() {
				return this.tabParmsType.length > 0 ? this.tabParmsType[0] : this.tabParmsType
			},
			curLoction() {
				return uni.getStorageSync('curLoction')
			}
		},
		watch: {
			'tabData': {
				handler(newData, oldData) {
					if (!!newData && Object.keys(newData)['length'] > 0) {
						// let tabItem = Object.keys(newData)[0];
						let tabItem = 0;//还给除了抢购首页其余模块一个this.selectTabBar_two(newData[tabItem],0)
						let arr112 = Object.keys(newData);
						for(let j = 0;j <arr112.length; j++){
							if(j+1 == this.newCC_id){
								tabItem = Object.keys(newData)[j];
							}
						}
						
						if (this.controType === 'options2') {
							if(this.onekey){
								this.selectTabBar_two(newData[this.onekey],0)
							}else{
								this.currentTabData = newData[tabItem],this.currentTabItem = tabItem;//切换子分类需要用到
								this.selectTabBar_two(newData[tabItem],tabItem)
								//首次打开抢购首页(技能培训等)执行这里
							}
							
						} else {
							this.selectTabBar(newData[tabItem])
						}
					}
				},
				immediate: true,
				deep: true
			},
		},
		methods: {
			vtabschange(e){
				this.sort = e;
				this.selectTabBar(this.currentTabItem,1,false,'',e)
			},
			handleMemberClick(item) {
				App.navigationTo({
					url: `pages/subPages2/blindDate/member/detail?id=${item.id}`
				})
			},
			getaver(id,bor){
				let _this = this;
				_this.tabDataList.forEach(item=>{
					if(item.id == id){
						if(bor){
							_this.$set(item,'fabulous_num',item.fabulous_num + 1);
							item.look++;
							_this.$set(item,'is_fabulous',1);
							item.fabulous_avatar.push(uni.getStorageSync('userinfo').avatar);
							// item.fabulous_avatar.forEach((items,index)=>{
							// 	if(items == uni.getStorageSync('userinfo').avatar){
							// 		item.fabulous_avatar.splice(index, 1);
							// 	}
							// })
						}else{
							_this.$set(item,'fabulous_num',item.fabulous_num - 1);
							item.look--;
							_this.$set(item,'is_fabulous',0);
							item.fabulous_avatar.forEach((items,index)=>{
								if(items == uni.getStorageSync('userinfo').avatar){
									item.fabulous_avatar.splice(index, 1);
								}
							})
						}
					}
				})
				
				// this.aolist = false;
				// this.aolist = true;
				
			},
			changeItem(tabItem ,index) {
				let _this = this
				let tabArrary = []
				for (let key in _this.tabData) {
					tabArrary.push(key)
				}
				if (index > 2 && index < (tabArrary.length - 1)) {
					if (index == 3) {
						_this.scroll_left = 0
					} else if (index == tabArrary.length - 2) {
						_this.scroll_left = uni.upx2px(150 * (tabArrary.length + 3))
					} else {
						_this.scroll_left = uni.upx2px(150 * (index - 3))
					}
				} else if (index < 3) {
					_this.scroll_left = 0
				} else if (index > (tabArrary.length - 2)) {
					_this.scroll_left = uni.upx2px(150 * (tabArrary.length + 3))
				}
			},
			selectTabBar(tabItem, page = 1, isPage = false,index,id) {
				//#ifdef H5
				let pageurl = location.href,
					pages = pageurl.split('/#/')[1].split('?')[0];
				// if(pages == 'pages/mainPages/index/diypage') return; 这里退出会导致自定义页面无法加载
				//#endif
				uni.showLoading({})
				let _this = this,
					requestUrl = '&' + tabItem.request_link,
					requestData = {
						page,
						is_total: "1",
						lat: !!_this.curLoction ? _this.curLoction.latitude : '',
						lng: !!_this.curLoction ? _this.curLoction.longitude : ''
					};
					// debugger
					if(tabItem.type == 'pocket'){
						requestData.homeflag = 1;
						if(id){
							requestData.id = _this.children[id].id;
						}
					}
				_this.changeItem(tabItem,index)
				App._post_form(requestUrl, requestData, res => {
					if (tabItem.type === 'store' || _this.currentTab === 'store') {
						for (let i = 0; i < res.data.list.length; i++) {
							let goodsList = [];
							for (let j in res.data.list[i].goods) {
								let goodsData = res.data.list[i].goods[j];
								if (goodsData !== '') {
									if (j == 'active') {
										goodsData.css = 'qiang'
										goodsData.tag = '抢'
									} else if (j == 'coupon') {
										goodsData.css = 'hui'
										goodsData.tag = '券'
									} else if (j == 'fightgroup') {
										goodsData.css = 'pin'
										goodsData.tag = '拼'
									} else if (j == 'groupon') {
										goodsData.css = 'tuan'
										goodsData.tag = '团'
									} else if (j == 'halfcard') {
										goodsData.css = 'ka'
										goodsData.tag = '卡'
									} else if (j == 'packages') {
										goodsData.css = 'li'
										goodsData.tag = '礼'
									} else if (j == 'bargain') {
										goodsData.css = 'kan'
										goodsData.tag = '砍'
									}else if(j == 'activity'){
										goodsData.css = 'huo'
										goodsData.tag = '活'
									}
									goodsList.push(goodsData);
								}
							}
							res.data.list[i].goods = goodsList;
						}
					}
					if (isPage) {
						if (res.data.list.length > 0) {
							_this["tabDataList"].push(...res.data.list);
						} else {
							_this.loadingMore = true;
						}
					} else {
						// debugger
						_this.setData({
							current_page: 1,
							currentTab: tabItem.type,
							tabDataList: res.data.list,
							pageTotal: res.data.total,
							loadingMore: res.data.list.length === 0 || _this.current_page === res.data.total,
							currentTabItem: tabItem
						})
						if(tabItem.type == 'pocket' && !!res.data.children && !id){
							_this.children = res.data.children;
						}
					}
					uni.hideLoading()
				}, false, () => {})
			},
			selectTabBar_two(tabItem,isindex, page = 1, isPage = false) {
				// console.log(tabItem,isindex, page, isPage, '======njkfsadsad')
				if(isindex){
					this.onekey = isindex
					// this.onekey = Object.keys(this.tabData)[isindex]
				}else if(!this.onekey){
					this.onekey = Object.keys(this.tabData)[0];//获取第一个key值，默认高亮
				}
				let cartid = uni.getStorageSync('cate_id');
				uni.showLoading({
					mask:true
				})
				let _this = this,
					requestUrl = '&' + tabItem.request_link,
					requestData = {
						page,
						is_total: "1",
						lat: _this.curLoction ? _this.curLoction.latitude : '',
						lng: _this.curLoction ? _this.curLoction.longitude : '',
						status: tabItem.status,
						sort: tabItem.orders || ''
						
					};
				if (tabItem.request_link === "p=dating&do=homeList") {
					Object.assign(requestData, {
						gneder: tabItem.gneder || '0'
					})
				}
				if (tabItem.request_link === "p=rush&do=homeList") {
					Object.assign(requestData, {
						cate_id: cartid || '0'
					})
				}
				if (tabItem.request_link === "p=rush&do=homeList") {
					Object.assign(requestData, {
						cate_id: cartid || '0'
					})
				}
				if(tabItem.request_link === "p=housekeep&do=getNewStorelist" || tabItem.request_link === "p=housekeep&do=getStorelist" || tabItem.request_link === "p=housekeep&do=getArtificerlist"){
					
					this.currentTab = 'housekeep';
					requestData.status = 1;
				}
				if(tabItem.request_link === "p=housekeep&do=getDemandlist"){
					this.currentTab = 'housekeep2';
					// requestData.status = 1;
				}
				if (tabItem.request_link === "p=housekeep&do=getServicelist") {
					requestData.status = 1;
					this.currentTab = 'housekeep3';
				}
				if(cartid){
					Object.assign(requestData, {
						cate_id: cartid
					})
				}else if(_this.cate_id){
					// _this.classifly = _this.cate_id;
					requestData.cate_id = _this.cate_id
				}else{
					_this.classifly = '0';
				}
				// debugger
				_this.changeItem(tabItem);
				//#ifdef H5
				let pageurl = location.href;
				//#endif
				
				// 抢购首页的商品列表需要添加参数
				if (tabItem.request_link === "p=rush&do=homeList") {
					Object.assign(requestData, {
						cc_id: tabItem.cc_id,
						sort: 3,
						cc_child_id: this.cc_child_id
					})
				}
				
				App._post_form(requestUrl, requestData, res => {
					
					if (isPage) {
						if (res.data.list.length > 0) {
							_this["tabDataTwoList"].push(...res.data.list);
							_this.loadingMore = true;
						} else {
							_this.loadingMore = true;
						}
					} else {
						// _this.tabDataTwoList = [];
						_this.setData({
							current_page: 1,
							currentTwoTab: isindex || this.onekey,
							tabDataTwoList: res.data.list,
							pageTotal: res.data.total,
							loadingMore: res.data.list.length === 0 || _this.current_page === res.data.total,
							Twotabtype: _this.tabParms.goods_type,
							requestData: requestData,
							currentTabItem: tabItem,
							requestTwoSelectInfo: requestUrl
						});
						// debugger
					}
					if(cartid){
						_this.classifly = cartid;
						let index;
						// debugger
						_this.tabParms.class_list.map((item,indexs)=>{
							if(item.id == cartid){
								index = indexs;
							}
						})
						const query = uni.createSelectorQuery().in(this);
						query.selectAll('.dis-il-block, .some-other-nodes').boundingClientRect(data => {
							let marinfo = uni.upx2px(50),
								padInfo = uni.upx2px(24),
								marWid = index * marinfo,
								itemWid = ((data[index].width) / 2) + padInfo, //当前选中大小
								windowWid = (uni.upx2px(690)) / 2, //当前容器大小
								arrlength = 0;
							for (let i = 0; i < index; i++) {
								arrlength = arrlength + data[i].width
							}
							arrlength = arrlength + marWid + itemWid //选中前全部选项大小
							_this.scroll_left2 = arrlength - windowWid
						}).exec();
					}
					// if(tabItem.request_link == "p=activity&do=homeList"){
					// 	_this.currentTab = 	'activity';
					// }
					_this.loadingMore = true;
				}, false, () => {
					uni.hideLoading()
				})
			},
			selectClassifly(cate_id, page = 1, isPage = false, index1, item) {
				uni.showLoading({})
				let _this = this,
					classRequestData = {
						..._this.requestData,
						cate_id,
						page
					},
					requestTwoSelectInfo = _this.requestTwoSelectInfo;
				let index = index1 + 1;
				_this.cate_id = cate_id;
				const query = uni.createSelectorQuery().in(this);
				query.selectAll('.dis-il-block, .some-other-nodes').boundingClientRect(data => {
					let marinfo = uni.upx2px(50),
						padInfo = uni.upx2px(24),
						marWid = index * marinfo,
						itemWid = ((data[index].width) / 2) + padInfo, //当前选中大小
						windowWid = (uni.upx2px(690)) / 2, //当前容器大小
						arrlength = 0;
					for (let i = 0; i < index; i++) {
						arrlength = arrlength + data[i].width
					}
					arrlength = arrlength + marWid + itemWid //选中前全部选项大小
					_this.scroll_left2 = arrlength - windowWid
				}).exec();

				App._post_form(requestTwoSelectInfo, classRequestData, res => {
					if (isPage) {
						if (res.data.list.length > 0) {
							_this["tabDataTwoList"].push(...res.data.list);
						} else {
							_this.loadingMore = true;
						}
					} else {
						_this.setData({
							current_page: 1,
							tabDataTwoList: res.data.list,
							pageTotal: res.data.total,
							loadingMore: res.data.list.length === 0 || _this.current_page === res.data.total,
							Twotabtype: _this.tabParms.goods_type,
							classifly: cate_id
						})
					}
				}, false, () => {
					uni.hideLoading()
				})
			},
			navigateTo(url) {
				let isHttpUrl = url.indexOf('https') !== -1;
				if (isHttpUrl) {
					location.href = url;
				} else {
					App.navigationTo({
						url: url
					})
				}
			},
			shangjiaFold(key2) {
				this.shopFold = false
				this.shopFoldIndex = key2
			},
			shangjiaUpFold(key2) {
				this.shopFold = true
				this.shopFoldIndex = key2
			},
			// 抢购关注事件
			remindSuccess(goodsData, goodsIndex) {
				this.rush_goodsList.splice(goodsIndex, 1, goodsData[goodsIndex]);
			},
			// 商品切换二级分类
			cultivateClassChange(e){
				this.cc_child_id = e;
				this.selectTabBar_two(this.currentTabData, this.currentTabItem);
			},
			tabInfomore() {
				let _this = this;
				if (_this.current_page >= _this.pageTotal) {
					_this.loadingMore = true;
					return false;
				}
				if(_this.city_id){
					_this.classifly = _this.city_id;
					
				}
				if (_this.controType === 'options2') {
					if (!!_this.tabParms.class_list && _this.tabParms.class_list.length > 0) {
						_this.selectClassifly(_this.classifly, ++_this.current_page, true)
					} else {
						// if(_this.currentTab == 'housekeep' || _this.currentTab == 'housekeep2' || _this.currentTab == 'housekeep3') return
						_this.selectTabBar_two(_this.currentTabItem,0, ++_this.current_page, true)
					}
				} else {
					_this.selectTabBar(_this.currentTabItem, ++_this.current_page, true,'',_this.sort);
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "../../../common/css/old_diyPages";

	.tabBar-list {
		height: 100upx;
		line-height: 100upx;
		white-space: nowrap;

		.tabBar-item2 {
			// width: 20%;
			display: inline-block;

			.selectTabBar {
				position: absolute;
				left: 50%;
				bottom: 0;
				width: 58upx;
				height: 8upx;
				background: rgba(255, 68, 68, 1);
				border-radius: 8upx 8upx 0 0;
				transform: translateX(-50%);
			}
		}

		.tabBar-item {
			width: 150upx;
			display: inline-block;

			.selectTabBar {
				position: absolute;
				left: 50%;
				bottom: 0;
				width: 58upx;
				height: 8upx;
				background: rgba(255, 68, 68, 1);
				border-radius: 8upx 8upx 0 0;
				transform: translateX(-50%);

			}
		}
	}

	.fui-groupon_goods-i-r-storeTitle {
		height: 2.6em;
		line-height: 1.3em;
	}

	.tabBar-listTwo-box {
		padding: 30upx 30upx 0;
	}

	.tabBar-Twolist {
		font-size: 0;
		white-space: nowrap;
	}

	.tabClassiflySelect {
		padding: 0 25upx;
		height: 50upx;
		line-height: 50upx;
		background-color: #FFEBEB;
		border-radius: 26upx;
		color: #FF4444;
		margin-right: 50upx;
	}
	.nav-content {
			width: 690rpx;
			margin: 30upx auto 0;
			display: flex;
			flex-wrap: wrap;
			justify-content:space-between;
	}
	.nav-item {
		width: 335rpx;
		height: auto;
		border-radius: 20rpx;
		overflow: hidden;
		background-color: #F8F8F8;
		margin-bottom: 20rpx;
	}
</style>
