<!--pages/discover/discover.wxml-->
<view>
  <auth bindlogin="onShow" />
	
  <lip-sync />

  <!-- <cover-view style="position: fixed; z-index:999; top: 0; left: 0; width: 100%;background:#000;color:#fff; white-space:pre-wrap;">{{showCommodity}}</cover-view> -->
  <block wx:if="{{webviewUrl}}">
    <!-- <cover-view style="position: fixed; background-color: rgba(0,0,0,0.5); color: #fff;white-space:pre-wrap;">
      {{webviewUrl}}
    </cover-view> -->
    <web-view src="{{webviewUrl}}" bindload="loadWeb" bindmessage="webMessage"></web-view>
  </block>
  
  
  <cover-view class="tabs {{currTab === 'live' ? 'live-tabs' : ''}}" wx:if="{{showTab}}">
    <cover-view class="{{currTab === 'webview' ? 'active' : ''}} item" data-tab="webview" bindtap="changeTab">
      空间<cover-view class="zw"></cover-view>
    </cover-view>
    <cover-view class="{{currTab === 'live' ? 'active' : ''}} item" data-tab="live" bindtap="changeTab">
      直播<cover-view class="zw"></cover-view>
    </cover-view>
  </cover-view>

  <cover-view class="live" wx:if="{{currTab === 'live'}}">
    <cover-view class="item" wx:for="{{roomList}}" bindtap="gotoLive" key="{{item.roomId}}" data-item="{{item}}">
      <cover-view class="cover">
        <cover-image src="{{item.coverImgOss}}" class="img"></cover-image>
        <cover-view class="count">
          <cover-image class="icon" src="/static/images/view_data@2x.png"></cover-image>
          <cover-view class="text">126观看</cover-view>
        </cover-view>
        <cover-view class="state" style="background-color: rgba(0,0,0,0.{{item.liveStatus === 101 ? '1' : '7'}});">
          <cover-image src="/static/images/{{item.liveStatus === 101 ? 'state_live@2x.png' : item.liveStatus === 102 ? 'state_comingsoon@2x.png' : 'state_end@2x.png'}}"></cover-image>
        </cover-view>
      </cover-view>
      <cover-view class="info">
        <cover-view class="title">{{item.name}}</cover-view>
        <cover-view class="goods">
          <cover-view class="good" wx:for="{{item.liveRoomGoodsVos}}" key="{{item.goodsId}}" catchtap="liveGotoGood" data-item="{{item}}">
            <cover-image class="good-cover" src="{{item.coverImg}}"></cover-image>
            <cover-view class="money">￥{{item.price}}</cover-view>
          </cover-view>
        </cover-view>
      </cover-view>
    </cover-view>
  </cover-view>




  <cover-view class="mo" bindtap="hideCS" wx:if="{{numCode && (showCoupon || showContact )}}"></cover-view>
  <cover-view class="bgd" wx:if="{{numCode && (sendShare)}}"></cover-view>

  <cover-view class="dialog concat-view" wx:if="{{numCode && showContact}}">
    <cover-view class="icon" bindtap="hideContact">
      <cover-image src="../../static/images/list_close.png"></cover-image>
    </cover-view>
    
    <cover-view class="title ">联系我们</cover-view>
    <cover-view class="item">
      <button class="btn"  open-type="contact" bindtap="contactKf">联系在线客服</button>
      <cover-view class="desc tp10">服务时间：24小时</cover-view>
    </cover-view>
    <cover-view class="item">
      <button class="btn" bindtap="callPhone">拨打电话</button>
      <cover-view class="desc tp10">客服热线：400-6066720</cover-view>
      <cover-view class="desc">服务时间：09:00 - 21:00</cover-view>
    </cover-view>
  </cover-view>
    
  <cover-view class="dialog invitation-view" wx:if="{{numCode && sendShare}}">
    <cover-view class="title">温馨提示</cover-view>
    <cover-view class="content">邀请好友一起逛，最多可邀请29位好友哦</cover-view>
    <cover-view class="btns">
      <button class="btn"  open-type="share">微信邀请</button>
      <button class="cancel btn" bindtap="calcShare">取消</button>
    </cover-view>
  </cover-view>



  <cover-view class="commodity-ctrl" bindtap="showCommodityFn" wx:if="{{!showCommodity && numCode && showCommodityCtrl && goodsCount > 0 }}">
    <cover-image src="../../static/images/scene_listbg@3x.png" class="bg"></cover-image>
    <cover-image src="../../static/images/scene_shop_list.png" class="ig"></cover-image>
    <cover-view>商品({{goodsCount > 100 ? '99+' : goodsCount}})</cover-view>
    <!-- <cover-view>商品({{goodsCount < 100 ? '99+' : goodsCount}})</cover-view> -->
  </cover-view>
  
  <!-- <cover-view class="bottom-dialog commodity-view" wx:if="{{numCode && showCommodity}}">
    <cover-view class="title">
      <cover-view class="text">店铺中的商品 </cover-view>
      <cover-view class="icon" bindtap="hideComodity">
        <cover-image  src="../../static/images/list_close.png" ></cover-image>
      </cover-view>
    </cover-view>
    <cover-view class="content">
      <cover-view class="c-tabs">
        <cover-view style="width: {{ comWidth + 20 }}px">
          <cover-view
            style="width: {{item.width }}px"
            wx:for="{{comtypes}}"
            wx:key="item.category_id"
            class="text {{currTypeId == item.category_id ? 'active': ''}}"
            data-item="{{item}}"
            bindtap="selectType">
            {{item.name}}{{'('+item.num+')'}}
            <cover-view></cover-view>
          </cover-view>
        </cover-view>

        
				<block wx:if="{{thumComtypes}}">
					<cover-view class="tabctrl" bindtap="changeShowComtypesAllTab" data-show="{{true}}">
						<cover-image src="/static/images/shoplist_open@3x.png"></cover-image>
					</cover-view>
				</block>
      </cover-view>

      
			<block wx:if="{{thumComtypes && showComtypesAllTab}}">
        <cover-view class="zz" bindtap="changeShowComtypesAllTab" data-show="{{false}}"></cover-view>
				<cover-view class="dialog-layer">
					<cover-view class="dialog-tabs">
						<cover-view wx:for="{{comtypes}}" wx:key="item.category_id" class="text {{currTypeId == item.category_id ? 'active': ''}}" data-item="{{item}}" bindtap="selectType">
							{{item.name}}{{'('+item.num+')'}}
							<cover-view></cover-view>
						</cover-view>
					</cover-view>
					<cover-view class="tabctrl"  bindtap="changeShowComtypesAllTab" data-show="{{false}}">
						<cover-image src="/static/images/shoplist_retract@3x.png"></cover-image>
					</cover-view>
				</cover-view>
			</block>

      <cover-view class="commoditys">
        <cover-view class="commodity-item" wx:for="{{goodsList}}" key="{{item.id}}" bindtap="gotoGoods" data-item="{{item}}">
          <cover-image class="cover" src="{{item.list_pic_url}}"></cover-image>
          <cover-image class="scene-icon" src="/static/images/img_shop_scene@2x.png"></cover-image>
          <cover-view class="item-content">
            <cover-view class="desc">{{item.name}}</cover-view>
            <cover-view class="item-info">
              <cover-view class="c-money">
                <cover-view class="text">¥</cover-view>
                <cover-view class="text">{{item.retail_price}}</cover-view>
              </cover-view>
              <cover-view class="oper">
                <cover-view class="oper-btn" catchtap="addCard" data-id="{{item.id}}" >加入购物车</cover-view>
                <cover-view class="oper-btn" catchtap="buyGoods" data-id="{{item.id}}" >立即购买</cover-view>
              </cover-view>
            </cover-view>
          </cover-view>
        </cover-view>
      </cover-view>
    </cover-view>
  </cover-view> -->

  <cover-view class="bottom-dialog coupon-view" wx:if="{{numCode && showCoupon}}">
    <cover-view class="title">
      <cover-view class="text">店铺中的优惠券</cover-view>
      <cover-view class="icon">
        <cover-image src="../../static/images/list_close.png" bindtap="hideCoupon"></cover-image>
      </cover-view>
    </cover-view>
    <cover-view class="layer">
      <cover-view class="content">
        <cover-view wx:if="{{coupons.length !== 0}}">
          <cover-view wx:for="{{coupons}}" wx:key="{{item.id}}" class="{{item.hasReceived ? 'coupon-item' : item.number <= item.receiveNumber ? 'coupon-item diswan' : 'coupon-item'}}">
            <cover-view class="item-before"></cover-view>
            <cover-view class="item-after"></cover-view>
            <cover-view class="info-before"></cover-view>
            <cover-view class="info-after"></cover-view>

            <cover-view class="{{item.hasReceived ? 'used' : ''}} "></cover-view>
            <cover-view class="o-money">
              <cover-view class="poa" style="{{'font-size:' + item.fontSize }}">
                <cover-view class="money-before">￥</cover-view>
                {{item.typeMoney}}
                <!-- <cover-view class="money-after"></cover-view> -->
              </cover-view>
            </cover-view>
            <cover-view class="info">
              <cover-view class="full">{{item.name}}</cover-view>
              <button>
                {{
                  item.sendType == 0 ? '全场赠券' : 
                  item.sendType == 1 ? '会员赠券' : 
                  item.sendType == 2 ? '购物赠券' : 
                  item.sendType == 3 ? '注册赠' : ''
                }}
              </button>
              <cover-view class="date">{{item.useStartDate}}-{{item.useEndDate}}</cover-view>
            </cover-view>
            <cover-view class="oper">
              <cover-image class="dotted" src="/static/images/img_cpline@3x.png"></cover-image>
              <cover-image src="/static/images/img_tabs_lack.png" wx:if="{{!item.hasReceived && item.number <= item.receiveNumber}}" class="lack"></cover-image>
              
              <cover-view wx:else bindtap="receive" data-item="{{item}}">{{item.hasReceived ? '已领取'  : item.number <= item.receiveNumber ? '' : '立即领取'}}</cover-view>
            </cover-view>
          </cover-view>
        </cover-view>
        <cover-view wx:else class="un-content">
          <cover-view class="lay">
            <cover-image src="/static/images/img_nocoupon@2x.png"></cover-image>
            <cover-view class="text">暂无优惠券</cover-view>
          </cover-view>
        </cover-view>
      </cover-view>
    </cover-view>
  </cover-view>
</view>
