<!--pages/goodsList/goodsList.wxml-->
<wxs module="util">
  var toFixedNum = function (item) { if (item) { return (item.price - item.goods_love.love_coin.amountOfMoney).toFixed(2) + "+" + item.goods_love.love_coin.amountOfCoin } };
	module.exports.toFixedNum = toFixedNum;

	var isBigger = function (market_price, price) { return Number(market_price) > Number(price) };
  module.exports.isBigger = isBigger;

  var checkPrice = function (item){
	if(item.vip_level_status && item.vip_level_status.status == 1){
        return item.vip_level_status.word
	}else if(item.has_option == 1 && item.min_price){
		// 如果有规格，并且有区间价格就显示最低价格
		return item.min_price
	}else{
		return item.price
	}
  }
  module.exports.checkPrice = checkPrice;
</wxs>
<view class="goodslist" style="background-color: {{bg_color}};">
	<view class="mai">
		<view class="main" wx:if="{{classifyBol}}" style="background-color: {{bg_color}};">
			<view class="dl" wx:key="index" wx:for="{{goods}}" catchtap="gotoDetail" data-goodsid="{{item.goods_id}}">
				<view class="dt" wx:if="{{item.thumb}}">
					<yz-image src="{{item.thumb}}" data-goodsid="{{item.goods_id}}" catchtap="gotoDetail" mode='aspectFill' />
				</view>
				<view class="dt" wx:if="{{!item.thumb}}">
					<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/img_default.png" mode='aspectFill' />
				</view>
				<view class="dd m-text">
					{{ item.title }}
				</view>
				<view class="dd m-label" wx:if="{{item.label_list && item.label_list.length > 0}}">
					<text class="goods-label" wx:for="{{item.label_list}}" wx:for-item="labelItem" wx:for-index="labelIndex" wx:key="labelItem.id">{{labelItem.name}}</text>
				</view>
				<view class="s3 dd {{item.is_open_micro==1?'heightAuto':''}}" wx:if="{{!showprice}}" >
					<!-- item.point_goods积分商城   ==>  积分全抵扣  不显示其他价格或者爱心值-->
					<block wx:if="{{item.point_goods}}">
						<view class="point-good">
                <view  class="span point-good-price">
                  {{ item.point_goods.min_point }}
                </view>
							<view class="span point-text">{{integral}}</view>
						</view>
					</block>
					<block wx:else>
						<view class="s2" wx:if="{{item.notMarket_price && util.isBigger(item.market_price , item.price)}}">{{market_price}}{{language['money']}}{{ item.market_price }}</view>
						<view style="height:16px" wx:if="{{!item.notMarket_price || !util.isBigger(item.market_price , item.price)}}"></view>
						<view class="p s1">
							<view class="span" style="{{styleCon}} color: red;">
								<!-- <text style="font-size:24rpx;">{{price}}</text> -->
								<text class="small">{{language['money']}}</text>
								<!-- <text class="em1" wx:if="{{item.vip_level_status&&item.vip_level_status.status==1}}">{{item.vip_level_status.word}}</text>
								<text class="em2" wx:else>{{item.price }}</text> -->
								<text class="{{item.vip_level_status&&item.vip_level_status.status==1 ? 'em1' :'em2'}}">{{util.checkPrice(item) }}</text>
							</view>

							<view style="color: #888;font-size: 12px;padding-left: 9rpx;" wx:if="{{item.is_open_micro==1}}">会员价:{{language['money']}}{{item.vip_level_status && item.vip_level_status.status == 1
								? item.vip_level_status.word
								: (item.price_level==1?item.vip_price:item.vip_next_price)}}</view>
						<view wx:if="{{item.pass_price}}" class="pass_price pl-4">{{item.pass_price.name}}:{{item.pass_price.price}}</view>
						</view>
						<!--item.goods_love 爱心值兑换 商品列表模板03的时候显示-->
						<view class="daydayPrice-text" style="height: auto;" wx:if="{{item.goods_love}}">
							<view class="span">{{language['money']}}{{util.toFixedNum(item)}} {{item.goods_love.love_coin.name }}</view>
						</view>
					</block>
				</view>
				<view class="dd s3" wx:if="{{item.estimated_commission > 0}}">
					<text class="small">{{language['money']}}</text>
					<text class="em">预估收益：{{ item.estimated_commission }}</text>
				</view>
				<view class="give_integral_wrapper" style="padding-left:0.2rem;padding-top:0.5rem;" wx:if="{{item.goods_points}}">
					<view class="give_integral_text">送</view>
					<view class="give_integral_num">{{item.goods_points}} {{integral}}</view>
				</view>
			</view>
		</view>
		<view class="main2" wx:if="{{!classifyBol}}">
			<!-- 团队销售 -->
			<view class="list" wx:if="{{template == '02'}}" wx:key="index" wx:for-item="items" wx:for="{{goods}}" data-goodsid="{{items.goods_id}}" style="padding-left:0;flex-wrap:wrap;border-bottom:none;margin: 20rpx 0;padding-top:20rpx;padding-bottom:20rpx">
				<view class="imgss">
					<image src="{{items.thumb}}" wx:if="{{items.thumb}}" data-goodsid="{{items.goods_id}}" catchtap="gotoDetail" mode='widthFix' style="height:100%;" />
					<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/img_default.png" wx:if="{{!items.thumb}}" mode='widthFix' style="height:100%;" />
				</view>
				<view class="shop_info" catchtap="gotoDetail" data-goodsid="{{items.goods_id}}">
					<view class="ul">
						<view class="top">
							<view class="li title_two">
								{{ items.title }}
							</view>
						</view>
						<view class="goods-label-box" wx:if="{{items.label_list && items.label_list.length > 0}}">
							<text class="goods-label" wx:for="{{items.label_list}}" wx:for-item="labelItem" wx:for-index="labelIndex" wx:key="labelItem.id">{{labelItem.name}}</text>
						</view>
						<view class="bottom">
							<block wx:if="{{items.point_goods}}">
								<view class="point-good">
									<view  class="span point-good-price">
										{{ items.point_goods.min_point }}
									</view>
									<view class="span point-text">{{integral}}</view>
								</view>
							</block>
							<block wx:else>
								<view class="shareC" style="margin-bottom:29rpx;margin-top:27rpx;">
									<view class="shareC_left" style="margin:0;" wx:if="{{items.coupon.coupon_method==1}}">立减{{language['money']}}{{items.coupon.deduct}}</view>
									<view class="shareC_left" style="margin:0;" wx:if="{{items.coupon.coupon_method==2}}">优惠卷{{items.coupon.discount}}折</view>
									<view class="shareC_right" wx:if="{{items.first_dividend}}">推广赚{{language['money']}}{{items.first_dividend}}</view>
								</view>
								<view class="s2" wx:if="{{items.coupon.deduct_price}}" style="margin-bottom:10rpx;margin-left:10rpx;">{{price}}{{language['money']}}{{ items.price }}</view>
								<view class="li member" wx:if="{{!showprice && items.coupon.deduct_price}}" style="margin-left: 10rpx;">
									<text style="font-size:24rpx;">券后价</text><text class="small">{{language['money']}}</text>{{ items.coupon.deduct_price }}
								</view>
								<view class="li member" wx:if="{{!showprice  && !items.coupon.deduct_price}}" style="margin-left: 10rpx;">
									<text style="font-size:28rpx;">{{price}}</text>
									<text class="small">{{language['money']}}</text>
									{{ util.checkPrice(items) }}
								</view>
								<view style="margin-bottom:10rpx;margin-left:10rpx;font-size:20rpx;color:#999;line-height: 20rpx;" wx:if="{{items.is_open_micro == 1}}">会员价:{{language['money']}}{{items.vip_level_status && items.vip_level_status.status == 1
									? items.vip_level_status.word
									: (items.price_level==1?items.vip_price:items.vip_next_price)}}</view>
								<view wx:if="{{items.pass_price}}" class="pass_price">{{items.pass_price.name}}:{{items.pass_price.price}}</view>
								<view class="fit" wx:if="{{items.estimated_commission > 0}}">
									<text class="small">{{language['money']}}</text>预估收益：{{ items.estimated_commission }}
								</view>
							</block>
						</view>
					</view>
				</view>
				<view class="shareimg"  >
					<view class="copybtn" catchtap="copybtn" data-title="{{items.title}}" data-link="{{items.goods_link}}">复制标题</view>
					<view class="aImgBtn" data-goodsid="{{items.goods_id}}" catchtap="postShow" >分享海报</view>
				</view>
			</view>
			<view class="list" wx:key="index" wx:for-item="items" wx:for="{{goods}}" catchtap="gotoDetail" data-goodsid="{{items.goods_id}}" wx:if="{{template != '02'}}">
				<view class="imgs">
					<image src="{{items.thumb}}" wx:if="{{items.thumb}}" data-goodsid="{{items.goods_id}}" catchtap="gotoDetail" mode='widthFix' />
					<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/img_default.png" wx:if="{{!items.thumb}}" mode='widthFix' />
				</view>
				<view class="shop_info 2">
					<view class="ul">
						<view class="top">
							<view class="li title">
								{{ items.title }}
							</view>
						</view>
						<view class="goods-label-box" wx:if="{{items.label_list && items.label_list.length > 0}}">
							<text class="goods-label" wx:for="{{items.label_list}}" wx:for-item="labelItem" wx:for-index="labelIndex" wx:key="labelItem.id">{{labelItem.name}}</text>
						</view>
						<view class="bottom">
							<!-- <view class="s2" wx:if="{{items.notMarket_price}}">{{market_price}}{{language['money']}}{{ items.market_price }}</view> -->
							<block wx:if="{{items.point_goods}}">
								<view class="point-good">
									<view  class="span point-good-price">
										{{ items.point_goods.min_point }}
									</view>
									<view class="span point-text">{{integral}}</view>
								</view>
							</block>
							<block wx:else>
								<view class="li member" wx:if="{{!showprice}}">
									{{price}} <text class="small">{{language['money']}}</text>
									{{ util.checkPrice(items) }}
								</view>
							</block>
						</view>
						<view class="give_integral_wrapper" style="padding-left:0;padding-bottom:0.2rem;" wx:if="{{items.goods_points}}">
              <view class="give_integral_text">送</view>
              <view class="give_integral_num">{{items.goods_points}} {{integral}}</view>
            </view>
					</view>
					<view style="margin-bottom:10rpx;font-size:22rpx;color:#999;line-height: 16rpx;" wx:if="{{items.is_open_micro == 1}}">会员价:{{language['money']}}{{items.vip_level_status && items.vip_level_status.status == 1
						? items.vip_level_status.word
						: (items.price_level==1?items.vip_price:items.vip_next_price)}}</view>
					<view wx:if="{{items.pass_price}}" class="pass_price">{{items.pass_price.name}}:{{items.pass_price.price}}</view>
					<view class="fit" wx:if="{{items.estimated_commission > 0}}">
						<text class="small">{{language['money']}}</text>预估收益：{{ items.estimated_commission }}
					</view>
					<view class="daydayPrice-text" style="height: auto;" wx:if="{{!items.point_goods && items.goods_love}}">
						<view class="span">{{language['money']}}{{util.toFixedNum(items)}} {{items.goods_love.love_coin.name }}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="loadNomore" wx:if="{{loading}}">
			<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/no-more-product.png" mode='widthFix' />
		</view>
	</view>
</view>

<goods-qrcode isshow="{{posterShow}}" goodsId="{{posterId}}"></goods-qrcode>

<van-popup show="{{false}}" closeable close-on-click-overlay="true" bind:close="posterClose" custom-style="background:none;" class="posterPopup_style" position="bottom">
	<view class="code_box">
		<image wx:if="{{posterImg}}" src="{{'data:'+posterImg.mime+';base64,'+posterImg.base64Image}}" mode='widthFix' />
		<image wx:if="{{!posterImg}}" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/img_default.png" mode='widthFix' />
	</view>
	<view class="icon_btn">
		<!-- <view class="box" catchtap="share">
			<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/poster_share.png" />
			<text>分享好友</text>
			<button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
		</view> -->
		<view class="box" catchtap='saveImg'>
			<image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/poster_save.png" />
			<text>保存海报</text>
		</view>
	</view>
	<!-- 关闭图标 -->
	<view class="icon_close" style="{{iPnoneBottomBol?'padding-bottom: 34px;':''}}" catchtap="posterClose">取消</view>
</van-popup>
