<wxs src="../../../../utils/filter.wxs" module="filter"></wxs>
<wxs module="g_filter" src="g_filter.wxs"></wxs>
<view>
	<view class="head pr">
		<!-- 搜索 -->
		<view class="flex ai-center fs26 bg-white pd20">
			<view class="input-container f1">
				<input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" confirm-type="search" bindconfirm="search" />
				<text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text>
				<!-- 搜索输入框聚焦时显示关闭按钮，否则隐藏关闭按钮 -->
			</view>
			<view class="pd20 filter {{isHiddenDropdown ? '':'c-red'}}" bindtap="clickFilter">筛选</view>

			<view class="dropdown {{isHiddenDropdown ? '':'show'}}" hidden="{{isHiddenDropdown}}">
				<view class="dropdown-wrapper">
					<view class="pd20 bsbb" wx:if="{{nationList.length != 0}}">
						<view class="pdb20">国家</view>
						<view class="flex wrap t-c" bindtap="select">
							<view class="w25 pdt20" wx:for="{{nationList}}"><text class="label {{nationIndex == index ? 'selected':''}}" data-id="{{item.nation_id}}" data-name="nation" data-index="{{index}}">{{item.name}}</text></view>
						</view>
					</view>
					<view class="pd20 bsbb" wx:if="{{brandList.length != 0}}">
						<view class="pdb20">品牌</view>
						<view class="flex wrap t-c" bindtap="select">
							<view class="w25 pdt20" wx:for="{{brandList}}"><text class="label {{brandIndex == index ? 'selected':''}}" data-id="{{item.brand_id}}" data-name="brand" data-index="{{index}}">{{item.name}}</text></view>
						</view>
					</view>
					<view class="pd20 bsbb">
						<view class="pdb20">价格区间</view>
						<view class="flex t-c ai-center jc-center">
							<view class="w30 pdh20"><input type="number" value="{{price}}" placeholder="最低价" class="input-price" bindinput="getPrice" data-ismax="0" /></view>
							<view class="mgh20">-</view>
							<view class="w30 pdh20"><input type="number" value="{{price}}" placeholder="最高价" class="input-price" bindinput="getPrice" data-ismax="1" /></view>
							<!-- <view class="w25 pdt20"><text class="label">品牌一</text></view> -->
						</view>
					</view>
					<!-- <view>
						<view class="pd20 bold">价格</view>
						<view class="flex">
							<view>价格一</view>
							<view>价格二</view>
							<view>价格三</view>
						</view>
					</view> -->
				</view>
				<view class="flex t-c">
					<view class="pd30 f1 bg-f0" bindtap="reset">重置</view>
					<view class="pd30 f1 l-red white" bindtap="startFilter">确定</view>
				</view>
			</view>
			<view class="mask" bindtap="clickMask"></view>
		</view>


		<view class="flex t-c fs26 bg-white bdb" bindtap="clickTab">
			<block wx:for="{{tabArr}}">
				<view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}">{{item}}</view>
				<view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort">
					{{item}}<text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}" data-index="{{index}}"></text>
					<text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" data-index="{{index}}" wx:else></text>
				</view>
			</block>
			<view class="f1 pd20" catchtap="change">
				<text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text>
			</view>
		</view>

	</view>


	<view class="content {{(options.index == 1 && currentTabIndex ==1) ? 'pdb0':''}}">
		<checkbox-group class="fs26" wx:if="{{isShowRow}}" bindchange="checkboxChange">
   
			<view class="item bg-white flex ai-center pd16" wx:for="{{list.pageData}}">
				<!-- <label>
					
				</label> -->
				<checkbox value="{{item.goods_id}}" checked="{{item.checked}}" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}" />
				<view class="flex pdl10" bindtap="goto" data-url="{{g_filter.get_goods_url(item)}}">
					<view class="pdr20">
						<image class="img" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load />
					</view>
					<view class="flex fdc jc_sb">
						<view class="ellipsis-2">{{item.goods_name}}</view>
						<view>
							<!-- 判断是否有活动价 -->
							<block wx:if="{{(item.prom_price>0 || item.prom_integral>0) &&  item.prom_id>0 && item.prom_type!=7 && item.prom_type!=10 }}">
								<view class="flex xc-wc ai-center">
									<text wx:if="{{item.prom_integral}}"><text class="fs30">{{item.prom_integral}}</text>积分</text>
									<text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
									<!-- 活动价 -->
									<view class="flex xc-wc ai-center" wx:if="{{item.prom_price}}">
										<!-- <view class="fs24">￥</view> -->
										<view class="fs30 money">{{item.prom_price}}</view>
									</view>
								</view>
<!--								<view class="flex" style="line-height: 28rpx;">-->
<!--									&lt;!&ndash; 原价 &ndash;&gt;-->
<!--									<view class="price flex xc-ash line_th">-->
<!--										&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--										<view class="fs22 money">{{item.market_price}}</view>-->
<!--									</view>-->
<!--								</view>-->
							</block>
							<block wx:else>
								<!-- 商品价格,先判断下是后⼜等级价-->
								<block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
									<!-- 当会员是等级卡的时候 -->
									<block wx:if="{{card_field}}">
										<!-- 等级价>0 -->
										<block wx:if="{{item[card_field]>0}}">
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view>
													<view class="card_bg">
														<image src="{{imghost + 'miniapp/images/plus/dj_icon.png'}}"></image>
														<text class="card_name ellipsis-1">{{card_name}}</text>
													</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</block>
										<blocK wx:else>
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</blocK>
									</block>
									<block wx:else>
										<!-- 如果商品有设置等级价⼤于0的 -->
										<block wx:if="{{g_filter.get_card_price(item,card_list,0) && is_no_plus}}">
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
												<!-- 原价 -->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
											</view>
											<view class="flexr">
												<!-- 等级价 -->
												<view class="price flex ai-center">
													<!-- <view class="fs22">￥</view> -->
													<view class="fs28 money">{{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}}</view>
													<view class="card_bg">
														<image src="{{imghost + 'miniapp/images/plus/dj_icon.png'}}" class="badge">
															</ image>
															<text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
													</view>
												</view>
											</view>
										</block>
										<block wx:else>
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</block>
									</block>
								</block>
								<!-- 商品压根就没有等级价 -->
								<block wx:else>
									<view class="flex">
										<!-- 办卡价 -->
										<view class="flex xc-wc ai-center">
											<!-- <view class="fs24">￥</view> -->
											<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
										</view>
									</view>
<!--									<view class="flex" style="line-height: 28rpx;">-->
<!--										&lt;!&ndash; 原价 &ndash;&gt;-->
<!--										<view class="price flex xc-ash line_th">-->
<!--											&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--											<view class="fs22 money">{{item.market_price}}</view>-->
<!--										</view>-->
<!--									</view>-->
								</block>
							</block>
							<!-- <view class="money fs32 c-red">{{item.market_price}}</view> -->
							<view class="fs24 c-a">分成金额：<text class="money c-red">{{filter.toFix(item.commission, 2)}}</text></view>
						</view>
					</view>
				</view>
			</view>
		</checkbox-group>

		<checkbox-group class="fs26 flex pd16 wrap" catchchange="checkboxChange" wx:else>
			<view class="item2 bg-white" wx:for="{{list.pageData}}" bindtap="goto" data-url="{{g_filter.get_goods_url(item)}}">
				<image class="img2" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" mode="aspectFit" lazy-load />
				<view class="pd20 fs26 flex jc_sb fdc f1">
					<view class="ellipsis-2">{{item.goods_name}}</view>
					<view class="flex ai-center pdt20">
						<checkbox value="{{item.goods_id}}" checked="{{item.checked}}" data-name="checkbox" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}" />
						<view>
							<!-- 判断是否有活动价 -->
							<block wx:if="{{(item.prom_price>0 || item.prom_integral>0)  &&  item.prom_id>0 && item.prom_type!=7 && item.prom_type!=10 }}">
								<view class="flex xc-wc ai-center">
									<text wx:if="{{item.prom_integral}}"><text class="fs30">{{item.prom_integral}}</text>积分</text>
									<text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
									<!-- 活动价 -->
									<view class="flex xc-wc ai-center" wx:if="{{item.prom_price}}">
										<!-- <view class="fs24">￥</view> -->
										<view class="fs30 money">{{item.prom_price}}</view>
									</view>
								</view>
<!--								<view class="flex" style="line-height: 28rpx;">-->
<!--									&lt;!&ndash; 原价 &ndash;&gt;-->
<!--									<view class="price flex xc-ash line_th">-->
<!--										&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--										<view class="fs22 money">{{item.market_price}}</view>-->
<!--									</view>-->
<!--								</view>-->
							</block>
							<block wx:else>
								<!-- 商品价格,先判断下是后⼜等级价-->
								<block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
									<!-- 当会员是等级卡的时候 -->
									<block wx:if="{{card_field}}">
										<!-- 等级价>0 -->
										<block wx:if="{{item[card_field]>0}}">
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view>
													<view class="card_bg">
														<image src="{{imghost + 'miniapp/images/plus/dj_icon.png'}}" class="badge"></image>
														<text class="card_name ellipsis-1">{{card_name}}</text>
													</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</block>
										<blocK wx:else>
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</blocK>
									</block>
									<block wx:else>
										<!-- 如果商品有设置等级价⼤于0的 -->
										<block wx:if="{{g_filter.get_card_price(item,card_list,0) && is_no_plus}}">
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
												<!-- 原价 -->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
											</view>
											<view class="flexr">
												<!-- 等级价 -->
												<view class="price flex ai-center">
													<!-- <view class="fs22">￥</view> -->
													<view class="fs28 money">{{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}}</view>
													<view class="card_bg">
														<image src="{{imghost + 'miniapp/images/plus/dj_icon.png'}}">
															</ image>
															<text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
													</view>
												</view>
											</view>
										</block>
										<block wx:else>
											<view class="flex">
												<!-- 办卡价 -->
												<view class="flex xc-wc ai-center">
													<!-- <view class="fs24">￥</view> -->
													<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
												</view>
											</view>
<!--											<view class="flex" style="line-height: 28rpx;">-->
<!--												&lt;!&ndash; 原价 &ndash;&gt;-->
<!--												<view class="price flex xc-ash line_th">-->
<!--													&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--													<view class="fs22 money">{{item.market_price}}</view>-->
<!--												</view>-->
<!--											</view>-->
										</block>
									</block>
								</block>
								<!-- 商品压根就没有等级价 -->
								<block wx:else>
									<view class="flex">
										<!-- 办卡价 -->
										<view class="flex xc-wc ai-center">
											<!-- <view class="fs24">￥</view> -->
											<view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view>
										</view>
									</view>
<!--									<view class="flex" style="line-height: 28rpx;">-->
<!--										&lt;!&ndash; 原价 &ndash;&gt;-->
<!--										<view class="price flex xc-ash line_th">-->
<!--											&lt;!&ndash; <view class="fs22">￥</view> &ndash;&gt;-->
<!--											<view class="fs22 money">{{item.market_price}}</view>-->
<!--										</view>-->
<!--									</view>-->
								</block>
							</block>
							<!-- <view class="money c-red fs32">{{item.market_price}}</view> -->
							<view class="c-a fs24">分成金额：<text class="money c-red">{{filter.toFix(item.commission, 2)}}</text></view>
						</view>
					</view>
				</view>
			</view>
		</checkbox-group>

		<nodata class="t-c" wx:if="{{list.pageData.length == 0 || list == null}}"></nodata>
		<view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view>
	</view>
	<view class="bottomBar flex pd20 jc_sb fs26 ai-center" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}">
		<!-- <view> -->
		<label class="flex ai-center" bindtap="clickCheckAll" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}">
			<checkbox checked="{{isCheckAll}}" />全选
		</label>
		<!-- </view> -->
		<view class="pd20 btn" wx:if="{{options.index == 0}}" bindtap="putOn">一键上架</view>
		<view class="pd20 btn" wx:else bindtap="pullOff">一键下架</view>
	</view>
</view>