<!--packageA/mycomponent/goodsComponent/priceTitleRepertorySales/priceTitleRepertorySales.wxml-->
<wxs module="util">
  var isBigger = function (market_price, price) { return Number(market_price) > Number(price) };
  module.exports.isBigger = isBigger;

  var couponText = function (coupon) { return coupon.coupon_method == 1 ? '满'+coupon.enough + '减' + coupon.deduct: '满'+coupon.enough+'打'+coupon.discount + '折' };
  module.exports.couponText = couponText;
</wxs>

<!--普通商品新样式-->
<block wx:if="{{ goodsType != 'hotelGoods' && goodsType != 'group_goods' && goodsType != 'grabGroup'&& goodsType != 'groupwork' && goodsType != 'zhpGroup' }}">
  <view class="goods-price panel">
    <view class="goods-price-info">
      <!--价格显示-->

      <block wx:if="{{goods_plugin.point_goods}}">
        <!-- goods_plugin.point_goods积分商城   ==>  积分全抵扣  不显示其他价格或者爱心值-->
        <view class="goods-price-box">
          <!-- 金额 -->
          <view style="display:inline-block;" wx:if="{{goods_plugin.point_goods.use_money > 0}}">
            <text class="goods-price-num" style="margin-right:0 !important;">
              <text class="goods-price-num-style-2">{{ goods_plugin.point_goods.use_money }}</text>
            </text>
            <text class="goods-price-text">元</text>
          </view>
          <!-- 加号 -->
          <text class="goods-price-num" wx:if="{{goods_plugin.point_goods.use_money > 0 && goods_plugin.point_goods.point > 0}}" style="margin: 0 10rpx !important;">
            <text class="goods-price-num-style-2">+</text>
          </text>
          <!-- 积分 -->
          <view style="display:inline-block;" wx:if="{{goods_plugin.point_goods.point > 0}}">
            <text class="goods-price-num" style="margin-right:0 !important;">
              <text class="goods-price-num-style-2">{{ goods_plugin.point_goods.point }}</text>
            </text>
            <text class="goods-price-text">{{integral}}</text>
<!--            <text class="goods-price-num" style="margin-right:0 !important;">
              <text class="goods-price-num-style-2">
                {{ goodsInfo.has_option == 1 ? (goods_plugin.point_goods.min_point == goods_plugin.point_goods.max_point ? goods_plugin.point_goods.min_point : goods_plugin.point_goods.min_point + "~" + goods_plugin.point_goods.max_point) : goods_plugin.point_goods.point }}
              </text>
            </text>
            <text class="goods-price-text">{{integral}}</text>
            <text class="goods-price-text" wx:if="{{isRent}}">/天</text>-->
          </view>
        </view>
      
      </block>

      <block wx:else>
        <!--普通商品价格  券后价格-->
        <view class="goods-price-box">
          <text class="goods-price-text" wx:if="{{!goodsInfo.coupon && getprice}}">{{getprice}}：</text>
          <text class="goods-price-text" wx:if="{{goodsInfo.coupon}}">券后价：</text>
          <text class="goods-price-num">
            <text class="goods-price-num-style-1">{{language['money']}}</text>
            <text class="goods-price-num-style-2" style="font-size: 18px;" wx:if="{{goodsInfo.vip_level_status&&goodsInfo.vip_level_status.status==1}}">{{
              goodsInfo.vip_level_status.word }}</text>
            <text class="goods-price-num-style-2" wx:elif="{{goodsInfo.coupon}}">{{goodsInfo.coupon.deduct_price }}</text>
        
            <text class="goods-price-num-style-2" wx:else>{{ goodsInfo.has_option == 1 ? goodsInfo.min_price == goodsInfo.max_price ? goodsInfo.min_price :
              goodsInfo.min_price + "-" + goodsInfo.max_price : goodsInfo.price }}</text> <text class="goods-price-text" wx:if="{{isRent}}">/天</text>
          </text>
          <text class="pass_price" wx:if="{{plugin.pass_price}}">
            {{plugin.pass_price.name}}:{{plugin.pass_price.price}}
          </text>
          <text class="goods-original-price" wx:if="{{goodsInfo.market_price && goodsInfo.notMarket_price && util.isBigger(goodsInfo.market_price,goodsInfo.price)}}"><block wx:if="{{getMarketPrice}}">{{getMarketPrice}}：</block>{{language['money']}}{{goodsInfo.market_price}}</text>
        </view>
      </block>


      <view class="goods-price-shareButton" wx:if="{{fromStock != 2 && !activityid && (wechatcircle_open == 1||wx_video_link == 1)}}" catchtap="openShare">
        <icon class="iconfont icon-fenxiang"></icon>
        <text>分享</text>
      </view>
      <view class="goods-price-shareButton" wx:if="{{fromStock != 2 && !activityid && (wechatcircle_open == 0&&wx_video_link == 0)}}">
        <icon class="iconfont icon-fenxiang"></icon>
        <text>分享</text>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>

      <view class="goods-price-collectionButton" catchtap="onFavorite">
        <icon class="iconfont icon-bc_like_normal" wx:if="{{!favorite}}"></icon>
        <icon class="iconfont icon-zb_all_like" wx:if="{{favorite}}"></icon>
        <text>收藏</text>
      </view>
    </view>
    <view class="goods-member-level" wx:if="{{openVip == 1}}" data-flag="{{goodsInfo.member_discount.display_page}}" catchtap="gotoMemberGradeList">
      <view class="container">
        <icon class="iconfont icon-huiyuanguanli-copy"></icon>
        <view class="level-name">会员</view>
        <view class="level-list">
          <view class="level-item level-item-style-1">{{goodsInfo.member_discount.level_name}}专享价{{language['money']}}
            {{ goodsInfo.vip_level_status && goodsInfo.vip_level_status.status == 1 ? '暂无权限' : goodsInfo.member_discount.discount_value}}
          </view>
          <view class="level-item level-item-style-2" wx:if="{{goodsInfo.member_discount.next_level_price!=goodsInfo.member_discount.discount_value&&goodsInfo.member_discount.next_level_price>0.00}}">加入{{ goodsInfo.member_discount.next_level_name }}专享价{{language['money']}}
            {{ goodsInfo.vip_level_status && goodsInfo.vip_level_status.status == 1 ? '暂无权限' : goodsInfo.member_discount.next_level_price }}
          </view>
        </view>
        <view class="level-button" wx:if="{{goodsInfo.member_discount.display_page=='1'}}">立即开通</view>
        <icon class="iconfont icon-advertise-next" wx:if="{{goodsInfo.member_discount.display_page=='1'}}"></icon>
      </view>
    </view>

    <!--优惠券显示-->
    <view class="goods-coupon" wx:if="{{available_coupon.length > 0 && goods_type != 'supplierGoods'}}">
      <view class="goods-coupon-list">
        <view class="goods-coupon-label" wx:for="{{available_coupon}}" wx:key="index" wx:for-item="coupon">{{ util.couponText(coupon)}}</view>
      </view>
      <view class="goods-coupon-button" bindtap="gotoCoupon">领券</view>
      <icon class="iconfont icon-advertise-next" style="margin-top: -3px;"></icon>
    </view>
  </view>

  <view class="love-reward panel" wx:if="{{isGoodsLove || goods_plugin.love_shoppin_gift || goods_plugin.team_sales_first || (goods_plugin.goods_show&&goods_plugin.goods_show.goods_detail_style==1 && goods_plugin.goods_show.data.length > 0)}}">
    <view class="daily-price" wx:if="{{isGoodsLove}}">
      <view class="daily-price-text">天天兑价</view>
      <view class="daily-price-num">{{language['money']}}{{goods_love_cash+" + "+goods_love_deduction}}</view>
      <view class="daily-price-company">{{goods_love_name}}</view>
    </view>
    <view class="love-reward-items">
      <!--爱心值奖励-->
      <view class="love-reward-item" wx:if="{{goods_plugin.love_shoppin_gift}}">
        <view class="love-reward-item-name">购买奖励：</view>
        <view class="love-reward-item-proportion">{{ goods_plugin.love_shoppin_gift }}</view>
      </view>

      <!--推广赚-->
      <view class="love-reward-item" wx:if="{{goods_plugin.team_sales_first}}">
        <view class="love-reward-item-name">推广赚：</view>
        <view class="love-reward-item-proportion">{{language['money']}}{{ goods_plugin.team_sales_first }}</view>
      </view>

      <!--特权省-->
      <block wx:if="{{goods_plugin.goods_show&&goods_plugin.goods_show.goods_detail_style==1 && goods_plugin.goods_show.data.length > 0}}">
        <view class="love-reward-item" wx:for="{{goods_plugin.goods_show.data}}" wx:key="index">
          <view class="love-reward-item-name">{{ item.name }}：</view>
          <view class="love-reward-item-proportion">{{ item.value }}</view>
        </view>
      </block>

    </view>
  </view>

  <!-- 让利涨粉 -->
  <view class="rise-fans" wx:if="{{goods_plugin.discountHarvestFans}}">
    <view class="rise-fans-icons">
      <i class="iconfont icon-fontclass-jiahaoyou"></i>
      <text class="text">加好友</text> 
    </view>
    <view class="rise-fans-texts">
      下单满{{goods_plugin.discountHarvestFans.order_amount}}元{{goods_plugin.discountHarvestFans.type=='numerical_type' ? '立减' : '优惠'}}  <text style="color:#f14e4e;">
        <text wx:if="{{goods_plugin.discountHarvestFans.type=='numerical_type'}}">{{goods_plugin.discountHarvestFans.discount_amount}}元</text>
        <text wx:else>{{goods_plugin.discountHarvestFans.discount_amount}}%</text>
      </text>
    </view>
    <view class="rise-fans-btn" bindtap="getFriendQrCode">去添加
      <i class="iconfont icon-advertise-next"></i>
    </view>
  </view>

  <view class="goods-title-box panel">

    <view class="goods-advertisement" wx:if="{{ goodsInfo.with_slogan }}">
      <view class="goods-advertisement-wrapper">
        <view class="goods-advertisement-text">
          <view class="advertisement-text displayBlock" style="color: {{goodsInfo.has_one_goods_advertising.font_color || '#797979'}}; font-size: {{goodsInfo.has_one_goods_advertising.font_size || '14'}}px;" bindtap="goAdvtState">
            {{goodsInfo.slogan}} <text class="more-advertisement" wx:if="{{ goodsInfo.has_one_goods_advertising.min_link }}">查看></text>
          </view>
        </view>
      </view>
    </view>

    <view class="goods-title-wrapper">
      <view class="goods-title-text {{showmoreTitle ? 'displayBlock' : ''}}" bindtap="setTitleState">
        <text>{{goodsInfo.title}}</text>
      </view>
      <view class="goods-label-box">
        <text class="goods-label-text" wx:for="{{goodsInfo.has_many_search_filter}}"
         wx:for-item="labelItem"
         wx:key="labelItem.id">{{labelItem.name}}</text>
      </view>
    </view>

    <view class="goods-desc-info">
      <view class="goods-stock">库存 {{goodsInfo.show_stock ? goodsInfo.show_stock : goods_info.stock ? goods_info.stock : goodsInfo.stock}}</view>
      <view class="goods-sales" wx:if="{{goodsInfo.is_month_sales == 1}}">{{isRent?"月租次数":"月销量"}}:{{goodsInfo.month_sales ? goodsInfo.month_sales : 0}}</view>
      <view class="goods-count-sales">
      {{isRent?"租赁次数":(goodsInfo.is_month_sales == 1?"总销量":"销量")}}:
      {{ goodsInfo.show_sales + ( goodsInfo.virtual_sales ? goodsInfo.virtual_sales : 0 ) }}
      </view>
    </view>

  </view>
</block>

<block wx:if="{{ goodsType == 'zhpGroup'  }}">
  <!-- 价格 -->
  <view class="inof_box">
    <view class="loveprice" wx:if="{{isGoodsLove}}">
      <view class="left">
        <view class="price-num">天天兑价</view>
      </view>
      <view class="right">
        <view class="pic_top">{{language['money']}}{{goods_love_cash+" + "+goods_love_deduction+goods_love_name}}</view>
      </view>
    </view>
    <view class="top-box">
      <view class="h2" style="color:#000;font-size: 16px;" wx:if="{{goodsType == 'zhpGroup'}}">
        {{gooddatas.title}}
      </view>
      <view class="right" wx:if="{{!activityid}}">
        <icon class="iconfont icon-erweima" catchtap="postShow"></icon>
      </view>
      <view class="right" wx:if="{{!activityid && (wechatcircle_open == 1||wx_video_link == 1)}}" catchtap="openShare">
        <icon class="iconfont icon-fenxiang"></icon>
      </view>
      <view class="right share_text" wx:if="{{!activityid && (wechatcircle_open == 1||wx_video_link == 1)}}"
        catchtap="openShare">分享</view>
      <view class="right" wx:if="{{!activityid && (wechatcircle_open == 0&&wx_video_link == 0)}}">
        <icon class="iconfont icon-fenxiang"></icon>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
      <view wx:if="{{!activityid && (wechatcircle_open == 0&&wx_video_link == 0)}}" class="right share_text">
        <view>分享</view>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
    </view>
  </view>


  <!-- 优惠券  折扣  推广赚 start -->

  <view style="display:flex;background:#fff;">
    <view class="goods-dicount" wx:if="{{goodsInfo.coupon&&goodsInfo.coupon.coupon_method==1}}">
      优惠券{{language['money']}}:{{goodsInfo.coupon.deduct}}</view>
    <view class="goods-dicount" wx:if="{{goodsInfo.coupon&&goodsInfo.coupon.coupon_method==2}}">
      折扣:{{goodsInfo.coupon.discount}}折</view>
    <view class="pub-price" wx:if="{{goods_plugin.team_sales_first}}">
      推广赚{{language['money']}}:{{goods_plugin.team_sales_first}}</view>
  </view>


  <!-- 优惠券  折扣  推广赚 end -->

  <!-- 限时购 -->
  <view class="title-box goods-slogan" wx:if="{{ goodsInfo.with_slogan }}">
    <view class="h1" >{{goodsInfo.slogan}}</view>
  </view>
  <!-- 领券  start -->
  <view class="title-box {{ goodsInfo.with_slogan?'title-box_with-slogan':'' }}" wx:if="{{goodsType != 'zhpGroup'}}">
    <view class="h1">{{goodsInfo.title}}</view>
    <view class="Coupon_b" wx:if="{{goodsInfo.availability==1 ? true : false}}" bindtap="gotoCoupon">
      领券
      <van-icon class="arrow" name="arrow" size='32rpx' />
    </view>
  </view>
  <!-- 领券 end -->

  <view class="rowContent" wx:if="{{goods_plugin.love_shoppin_gift}}">
    <view class="loveprice_b" wx:if="{{goods_plugin.love_shoppin_gift}}">
      <view class="span" style="text-align: left;width: 100%">{{goods_plugin.love_shoppin_gift}}</view>
    </view>
  </view>


  <!-- 销量  start -->
  <view class="rowContent">
    <view class="stockcontainer">
      <view class="left">库存:{{goodsInfo.show_stock ? goodsInfo.show_stock : goodsInfo.stock}}</view>
      <view class="right" wx:if="{{goodsType != 'zhpGroup'}}">
        {{isRent?"租赁次数":"销量"}}:{{ goodsInfo.show_sales + ( goodsInfo.virtual_sales ? goodsInfo.virtual_sales : 0 ) }}
      </view>
    </view>
  </view>
  <!-- 销量库存 end -->
</block>

<!-- 拼团 -->
<block wx:if="{{goodsType == 'group_goods'|| goodsType == 'groupwork'}}">
  <view class="title_number pt">
    <view style="display:flex;font-size:40rpx;">
      <view class="h1 good_title" style="width:85%;" hidden="{{!gooddatas.title}}">
        {{gooddatas.title}}
      </view>
      <view class="right" catchtap="postShow">
        <icon class="iconfont icon-erweima"></icon>
      </view>
      <view class="right" style="position:relative;">
        <icon class="iconfont icon-fenxiang" style="margin-left:20px;"></icon>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
      <view class="right share_text">
        <view style="line-height: 80rpx;">分享</view>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
    </view>
    <view class="number ul">
      <view class="li">
        <text class="span">库存{{gooddatas.stock}}</text>
        <view class="span">销量{{goodsInfo.show_sales + goodsInfo.virtual_sales}}件</view>
      </view>
    </view>
  </view>
</block>

<!-- 酒店 -->
<block wx:if="{{goodsType == 'hotelGoods'}}">
  <view class="info_a">
    <view class="title-box">
      <view class="h1 ">{{language['money']}}<text class="font">{{ goods_info.price }}</text> <text style="color:#999;">
          房价以当天价格为准</text></view>
      <view class="right">
        <icon class="iconfont icon-erweima" catchtap="postShow"></icon>
      </view>
      <view class="right">
        <icon class="iconfont icon-fenxiang"></icon>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
      <view class="right share_text">
        <view style="line-height: 60rpx;">分享</view>
        <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;" open-type="share"></button>
      </view>
    </view>
    <view class="price ul">
      <view class="li">
        {{ goods_info.title}}
      </view>
      <view class="Coupon_b" bindtap="gotoCoupon">领券
        <van-icon class="arrow" name="arrow" size='32rpx' />
      </view>
    </view>
  </view>
  <view class="ul info_b">
    <view class="li">
      <view class="left">
        <icon class="iconfont icon-service_l"></icon>
      </view>
      <view class="right">
        <view class="span">{{ hotel_info.hotel_name }}</view>
      </view>
    </view>
    <view class="li">
      <view class="left">
        <icon class="iconfont icon-service_m"></icon>
      </view>
      <view class="right" bindtap='callhotelphone'>
        <view class="span">联系{{ PageNameList.hotels }}:{{ hotel_info.hotel_mobile }}</view>
      </view>
    </view>
  </view>
</block>

<!-- 抢团 -->
<view wx:if="{{goodsType == 'grabGroup'}}" class="group_good">
  <view class="title_number">
      <view class="good_title_one">{{gooddatas.title}}</view>
      <view style="display:flex;font-size:40rpx;">
        <view class="h1 good_title" style="-webkit-box-orient: vertical;flex:1;color: #f15353;">
          <text>{{language['money']}}</text>{{gooddatas.price}}<text class="market-price">{{getMarketPrice}}:{{language['money']}}{{gooddatas.market_price}}</text>
        </view>
        <view class="grab-group-box" wx:if="{{gooddatas.transport_reward>0}}">
          <view class="cc c1">未拼中得</view>
          <view class="cc c2" wx:if="{{gooddatas}}">{{gooddatas.transport_reward}}红包</view>
        </view>
        <view class="right" catchtap="postShow">
          <icon class="iconfont icon-erweima"></icon>
        </view>
        <view class="right" style="position:relative;">
          <icon class="iconfont icon-fenxiang" style="margin-left:20px;"></icon>
          <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;"
            open-type="share"></button>
        </view>
        <view class="right share_text">
          <view style="line-height: 80rpx;">分享</view>
          <button style="position:absolute;width:100%;height:100%;opacity:0;top: 0;right: 0;"
            open-type="share"></button>
        </view>
      </view>
      <view class="number ul">
        <view class="li">
          <text class="span">库存: {{gooddatas.stock}}</text>
          <view class="span">销量: {{gooddatas.show_sales}}件</view>
        </view>
      </view>
    </view>
</view>


<!-- 让利涨粉弹窗 -->
<van-popup show="{{ riseFansPopup }}"  custom-style="background:transparent;">
     <view class="riseFansWrapper">
          <view class="riseFansContainer">
            <view class="text">添加好友</view>
            <view class="img">
              <image show-menu-by-longpress src="{{riseFansQrCode}}" />
            </view>
            <view class="small-text" style="margin-top:1rem;">长按识别添加</view>
            <view class="small-text">添加后您将获得专属优惠！</view>
          </view>
          <view class="close">
            <i bindtap="setExplainFlag" bindtap="setRiseFansPop" class="iconfont icon-adsystem_icon_cancle"></i>
          </view>
          
     </view>
</van-popup>
