<scroll-view class="container" style="height: {{winHeight}}rpx" scroll-y="true">
  <view wx:if="{{showNavList}}" class="modal-wrap"></view>
  <view class="fast-nav">
    <contact-button wx:if="{{!showNavList}}" class="contact" size="25" type="primary" session-from="weapp">
      <text>找客服</text>
    </contact-button>
    <view wx:if="{{!showNavList}}" class="nav" bindtap="toggleNav">
      <text>快捷</text>
      <text>导航</text>
    </view>
    <view class="nav-list" wx:if="{{showNavList}}">
      <view class="nav-item">
        <text class="nav-text">首页</text>
        <view class="nav-cell" bindtap="switchNav" data-name="index">
          <image src="../../static/images/nav-1.png"></image>
        </view>
      </view>
      <view class="nav-item">
        <text class="nav-text">足迹</text>
        <navigator class="nav-cell" url="../ucenter/footprint/footprint">
          <image src="../../static/images/nav-2.png"></image>
        </navigator>
      </view>
      <view class="nav-item">
        <text class="nav-text">搜索</text>
        <navigator class="nav-cell" url="../search/search">
          <image src="../../static/images/nav-3.png"></image>
        </navigator>
      </view>
      <view class="nav-item">
        <text class="nav-text">购物车</text>
        <view class="nav-cell" bindtap="switchNav" data-name="cart">
          <image src="../../static/images/nav-4.png"></image>
        </view>
      </view>
    </view>
    <view wx:if="{{showNavList}}" class="close" bindtap="toggleNav">X</view>
  </view>
  <view>
    <swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000" bindtap="hideSwitchAttrPop">
      <swiper-item wx:for="{{gallery}}" wx:key="{{item.id}}">
        <image src="{{item.img_url}}" background-size="cover"></image>
      </swiper-item>
    </swiper>
    <!-- <view class="service-policy">
      <view class="item">30分钟速达</view>
      <view class="item">每日优选生鲜</view>
      <view class="item">满88元免运费</view>
    </view> -->
    <view class="goods-info">
      <view class="c" bindtap="hideSwitchAttrPop">
        <view class="goods-do">
          <text class="price">{{goods.retail_price?"￥"+goods.retail_price:"￥0"}}</text>
          <text class="org-price line-through">{{goods.market_price?"￥"+goods.market_price:""}}</text>
        </view>
        <text class="name">{{goods.name?goods.name:""}}</text>
        <text class="desc">{{goods.goods_brief?goods.goods_brief:""}}</text>
        <!-- <view class="brand" wx:if="{{brand.name}}">
          <navigator url="../brandDetail/brandDetail?id={{brand.id}}">
            <text>{{brand.name}}</text>
          </navigator>
        </view> -->
        <view>
          <text class="desc">快递：{{defaultFreight==0?"免邮":"元"}}</text>
        </view>
      </view>
    </view>
    <view class="section-nav section-attr" bindtap="switchAttrPop"  wx:if="{{stockNum >0}}">
      <view class="t">{{checkedSpecText=="请选择规格数量"?"请选择规格数量":"已选：【"+checkedSpecText+"】"}}</view>
      <image class="i" src="../../static/images/address_right.png" background-size="cover"></image>
    </view>

    <view class="crash-goods" wx:if="{{crashList.length > 0}}" bindtap="hideSwitchAttrPop">
      <view class="h">
        <view class="line"></view>
        <text class="title">搭配减价</text>
      </view>
      <view class="b">
        <view class="item" wx:for="{{crashList}}" wx:key="{{item.id}}">
          <navigator url="/pages/goods/goods?id={{item.goods_crash_id}}">
            <image class="img" src="{{item.list_pic_url}}" background-size="cover"></image>
            <text class="name">{{item.name}}</text>
          </navigator>

          <view class="goods-do">
            <text class="price">￥{{item.market_price}}</text>
            <text class="org-price line-through">￥{{item.retail_price}}</text>
            <view class="add" data-goods-id="{{item.goods_crash_id}}" data-product-id="{{item.product_crash_id}}" bindtap="addCrashNumber">+</view>
          </view>
        </view>
      </view>
    </view>

    <!--<view class="section-nav section-act">
      <view class="t">
        <view class="label">1个促销:</view>
        <view class="tag">万圣趴</view>
        <view class="text">全场满499，额外送糖果</view>
      </view>
      <image class="i" src="../../static/images/address_right.png" background-size="cover"></image>
    </view>-->
    <view class="comments" bindtap="hideSwitchAttrPop">
      <view class="h">
        <navigator url='{{comment.count > 0?"../comment/comment?valueId={{goods.id}}&typeId=0":""}}'>
          <text class="t">评价({{comment.count > 999 ? '999+' : comment.count}})</text>
          <text class="i">查看全部</text>
        </navigator>
      </view>
      <view class="b">
        <view class="item" wx:if="{{comment.count == 0}}">
          <view class="info">
            暂无评论
          </view>
        </view>
        <view class="item" wx:if="{{comment.count > 0}}">
          <view class="info">
            <view class="user">
              <image src="{{comment.data.avatar}}"></image>
              <text>{{comment.data.nickname}}</text>
            </view>
            <view class="time">{{comment.data.add_time}}</view>
          </view>
          <view class="content">
            {{comment.data.content}}
          </view>
          <view class="imgs" wx:if="{{comment.data.pic_list.length > 0}}">
            <image class="img" data-url="{{item.pic_url}}" wx:for="{{comment.data.pic_list}}" wx:key="{{item.id}}" bindtap="previewPic" src="{{item.pic_url}}"></image>
          </view>
          <!-- <view class="spec">白色 2件</view> -->
        </view>
      </view>
    </view>
    <view class="goods-attr" bindtap="hideSwitchAttrPop">
      <view class="t">商品参数</view>
      <view class="l">
        <view class="item" wx:for="{{attribute}}" wx:key="{{item.name}}">
          <text class="left">{{item.name}}</text>
          <text class="right">{{item.value}}</text>
        </view>
      </view>
    </view>

    <view class="detail"  bindtap="hideSwitchAttrPop">
      <import src="../../lib/wxParse/wxParse.wxml" />
      <template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
    </view>


    <view class="common-problem" bindtap="hideSwitchAttrPop">
      <view class="h">
        <view class="line"></view>
        <text class="title">常见问题</text>
      </view>
      <view class="b">
        <view class="item" wx:for="{{issueList}}" wx:key="{{item.id}}">
          <view class="question-box">
            <text class="spot"></text>
            <text class="question">{{item.question}}</text>
          </view>
          <view class="answer">
            {{item.answer}}
          </view>
        </view>
      </view>
    </view>

    <view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
      <view class="h">
        <view class="line"></view>
        <text class="title">大家都在看</text>
      </view>
      <view class="b">
        <view class="item" wx:for="{{relatedGoods}}" wx:key="{{item.id}}">
          <navigator url="/pages/goods/goods?id={{item.id}}">
            <image class="img" src="{{item.list_pic_url}}" background-size="cover"></image>
            <text class="name">{{item.name}}</text>
            <view class="price">￥{{item.retail_price}}
              <image class="cart" data-goods-id="{{item.id}}" data-product-id="{{item.product_id}}" catchtap='addNumber2' src="/static/images/cart.png" background-size="cover"></image>
            </view>
          </navigator>
        </view>
      </view>
    </view>

  </view>
  <view wx:if="{{openAttr}}" class="attr-pop">
    <view class="attr-close" bindtap="switchAttrPop">X</view>
    <view class="img-info">
      <image class="img" src="{{goods.list_pic_url}}"></image>
      <view class="info">
        <view class="c">
          <view class="p">价格：￥{{goods.retail_price}}</view>
          <view class="a" wx:if="{{productList.length>0}}">已选择：{{checkedSpecText}}</view>
          <view class="a">库存{{stockNum}}件</view>
          
        </view>
      </view>
    </view>
    <view class="spec-con">
      <view class="spec-item" wx:for="{{specificationList}}" wx:key="{{item.specification_id}}">
        <view class="name">{{item.name}}</view>
        <view class="values">        
          <view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name-id="{{vitem.specification_id}}">{{vitem.value}}</view>
        </view>
      </view>

      <view class="number-item">
        <view class="name">数量</view>
        <view class="selnum">
          <view class="cut" bindtap="cutNumber">-</view>
          <input value="{{number}}" class="number" disabled="true" type="number" />
          <view class="{{number+cartNumber>= stockNum? 'addEnabel':'add'}}" bindtap="{{number+cartNumber>= stockNum ? '':'addNumber'}}">+</view>
        </view>
      </view>
    </view>
  </view>
</scroll-view>
  <view class='shelves-view' wx:if="{{stockNum ==0}}">
    <view class="shelves">
      <text class='shelves-text'>已下架</text>
    </view>
  </view>
  <view class="bottom-btn">
    <view class="l l-home" bindtap="switchNav">
      <image class="icon" src="/static/images/nav-1.png"></image>
    </view>
    <view class="l l-collect {{ openAttr ? 'back' : ''}}" bindtap="closeAttrOrCollect">
      <image class="icon" src="{{ collectBackImage }}"></image>
    </view>
    <view class="l l-cart">
      <view class="box">
        <text class="cart-count">{{cartGoodsCount}}</text>
        <image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
      </view>
    </view>
    <!-- <view class="c">立即购买</view> -->
    <view class='{{stockNum ==0?"r-disable":"r"}}' bindtap='{{stockNum ==0?"":"addToCart"}}'>加入购物车</view>
  </view>