<wxs src="../../../../utils/filter.wxs" module="filter"></wxs>
<wxs module="g_filter" src="g_filter.wxs"></wxs>
<view>
	<view class="head pr">
		<view class="bdb">
			<!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> -->
			<view>
				<image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner" />
			</view>
			<view class="flex bg-white pdh20 jc_sb pr">
				<!-- 分享人的头像 -->
				<view class="avatar-container" wx:if="{{userInfo2}}">
					<image class="avatar" src="{{userInfo2.head_pic}}" />
					<view class="pdt20">
						<text class="nickname">{{userInfo2.nickname}}</text>
					</view>
				</view>
				<!-- 自己的头像 -->
				<view class="avatar-container" wx:else>
					<image class="avatar" src="{{userInfo.head_pic}}" />
					<view class="pdt20">
						<text class="nickname">{{userInfo.nickname}}</text>
					</view>
				</view>
				<view class="flex t-c fs24 f1 jc_fe">
					<view class="pdv20 pdh40 {{isAll ? 'selected':''}}" bindtap="clickAll">
						<view class="fs30">{{filter.show_default(total)}}</view>
						<view>全部商品</view>
					</view>
					<view class="pdv20 pdh40 {{!isAll ? 'selected':''}}" bindtap="clickNew">
						<view class="fs30">{{filter.show_default(newListTotal)}}</view>
						<view>新品</view>
					</view>
					<view class="pdv20 pdh40" bindtap="goto" data-url="/pages/user/index/index">
						<view class="fs26">
							<text class="iconfont icon-ren1 bold"></text>
						</view>
						<view>会员中心</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 搜索 -->
		<view class="flex ai-center fs26 bg-white pd20">
			<text class="pdr20 c-a iconfont icon-fenlei" catch:tap="goto" data-url="/packageC/pages/goods/distributionCategoryList/index"></text>
			<view class="input-container f1">
				<input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" placeholder-style="color:#aaa;" confirm-type="search" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" bindconfirm="search" />
				<text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text>
				<!-- 搜索输入框聚焦时显示关闭按钮，否则隐藏关闭按钮 -->
			</view>
			<view class="pdl20 c-a" bindtap="search">搜索</view>
		</view>
	</view>

	<view class="flex t-c fs26 bg-white bdb sticky c-a" 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 catchtap="clickSort">
				{{item}}
				<text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}"></text>
				<text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" wx:else></text>
			</view>
		</block>
		<view class="f1 pd20" catchtap="change">
			<text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text>
		</view>
	</view>
	<view class="content">
		<view class="fs26" wx:if="{{isShowRow}}">
			<view class="item bg-white flex ai-center pd20" wx:for="{{list}}">
				<view class="flex pdl10" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_type={{item.prom_type}}&prom_id={{item.prom_id}}">
					<view class="img-container pdr20" data-txt="已售:{{item.sales_sum}}">
						<image class="img" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load mode="aspectFit" />
					</view>
					<view class="flex fdc jc_sb">
						<view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</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 pdt20">
								<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_and" 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_and">
												<!-- <view class="fs24">￥</view> -->
												<view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view>
												<view class="card_bg">
													<image src="{{url + 'miniapp/images/plus/dj_icon.png'}}" />
													<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">
												<!-- <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">
												<!-- <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="{{url}}/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">
												<!-- <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">
										<!-- <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 hidden="{{ishidden_comise}}" class="fs24 c-a">
							分成金额：
							<text class="money c-red">{{filter.toFix(item.commission,2)}}</text> 
						</view> -->
            <view wx:if="{{is_distribut || (!is_distribut && storeDistribut && storeDistribut.is_commission_displayed==1)}}">
              <view class="fs24 c-a" wx:if="{{item.distribut_level >= 1 && item.new_fir_rate !=0}}">
                一级分成：
                <text class="money c-red">{{filter.toFix(item.new_fir_rate,2)}}</text>
              </view>
              <view class="fs24 c-a" wx:if="{{item.distribut_level >= 2 && item.new_sec_rate !=0}}">
                二级分成：
                <text class="money c-red">{{filter.toFix(item.new_sec_rate,2)}}</text>
              </view>
              <view class="fs24 c-a" wx:if="{{item.distribut_level >= 3 && item.new_thi_rate !=0}}">
                三级分成：
                <text class="money c-red">{{filter.toFix(item.new_thi_rate,2)}}</text>
              </view>
            </view>
					</view>
				</view>
			</view>
		</view>
		<view class="fs26 flex pd20 wrap" wx:else>
			<view class="item2 bg-white" wx:for="{{list}}" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_type={{item.prom_type}}&prom_id={{item.prom_id}}">
				<view class="img-container" data-txt="已售:{{item.sales_sum}}">
					<image class="img2" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load="true" />
				</view>
				<view class="pd20 fs26">
					<view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</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">
							<text wx:if="{{item.prom_integral}}">
								<text class="fs30" style="font-weight: bold;">{{item.prom_integral}}</text>
								积分
							</text>
							<text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
							<!-- 活动价 -->
							<view class="flex xc-wc" 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_and">
											<!-- <view class="fs24">￥</view> -->
											<view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view>
											<view class="card_bg">
												<image src="{{url}}/miniapp/images/plus/dj_icon.png" />
												<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_and">
											<!-- <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_and">
											<!-- <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="{{url}}/miniapp/images/plus/dj_icon.png" />
												<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_and">
											<!-- <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_and">
									<!-- <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="fs24 c-a">
						分成金额：
						<text class="money c-red">{{filter.toFix(item.commission,2)}}</text>
					</view> -->
          <block wx:if="{{is_distribut || (!is_distribut && storeDistribut && storeDistribut.is_commission_displayed==1)}}">        
            <view class="fs24 c-a" wx:if="{{item.distribut_level >= 1 && item.new_fir_rate !=0}}">
              一级分成：
              <text class="money c-red">{{filter.toFix(item.new_fir_rate,2)}}</text>
            </view>
            <view class="fs24 c-a" wx:if="{{item.distribut_level >= 2 && item.new_sec_rate !=0}}">
              二级分成：
              <text class="money c-red">{{filter.toFix(item.new_sec_rate,2)}}</text>
            </view>
            <view class="fs24 c-a" wx:if="{{item.distribut_level >= 3 && item.new_thi_rate !=0}}">
              三级分成：
              <text class="money c-red">{{filter.toFix(item.new_thi_rate,2)}}</text>
            </view>
          </block>
				</view>
			</view>
		</view>
		<nodata class="t-c" wx:if="{{list.length == 0 && list}}"></nodata>
		<view class="noMore" hidden="{{!noMore}}" wx:if="{{list.length !== 0}}">
			- 已经到底了 -
		</view>
	</view>
</view>