<wxs src='../../../pages/wxs/util.wxs' module='filter' />
<view class="coin-head" ref="coinHead">
  <view class="head-user">
    <text class="tip" data-url="/pages/account/monetaryCenter/ruleInstract" bindtap="jumpPage">
      <text class='icon icon-exclamatory font18'></text>
    </text>
    <view class="headImg">
      <image src="{{avatar || '../../static/img/default_logo.jpg'}}" style="width:100%;height:100%"></image>
    </view>
    <text class="level"><text class='icon icon-vip'></text> <text>{{levelName}}</text></text>
    <view class="coin"><text class="con">宝贝币</text> {{stat.sumCoin}}</view>
    <view class="show-detail" data-url="/pages/account/monetaryCenter/monetaryDetail" bindtap="jumpPage">查看明细</view>
  </view>
  <swiper class="swipe" previous-margin="20px" next-margin="20px" current="{{initialSwipe}}">
    <swiper-item class="swipe-item" wx:for="{{BB_coin}}" wx:key="level">
      <view class="item-box" style="{{'background:url('+item.bg_url+') no-repeat;background-size:100%'}}">
        <view class="current-level" wx:if="{{initialSwipe<=index}}">{{index-initialSwipe>0?'未达成':'当前等级'}}</view>
        <view class="member">
          <text class="member-type">{{item.levelName}}会员</text>
          <text class="member-num">(累计获得{{item.min_num}})</text>
        </view>
        <view class="speed-rate">
          <view class="rate-ins" wx:if="{{(stat.allCoin>=item.max_num||(stat.allCoin>=item.min_num&&item.level==6))}}">{{item.level==6?'已达到最高等级':'已达成当前等级'}}</view>
          <view class="rate-ins" wx:else>再获得{{item.min_num-stat.allCoin<=0?item.max_num-stat.allCoin:item.min_num-stat.allCoin}}即可升级至{{item.min_num-stat.allCoin<=0? item.next_level:item.levelName}}</view>
          <view class="tate">
            <view class="rate-wid" style="{{(stat.allCoin>item.max_num||(item.level==6&&stat.allCoin>item.min_num))?'width:100%':(stat.allCoin<item.min_num?'width:0%':('width:'+((stat.allCoin-item.min_num)/(item.max_num-item.min_num)*100)+'%'))}}"></view>
          </view>
        </view>
      </view>
    </swiper-item>
  </swiper>
</view>

<view class="modular">
  <view class="modal-title">等级特权</view>
  <view style="padding:0 20rpx">
    <view class="privilege-type">
      <view class="type-item">
        <view class="type-item-box {{defaultLevel==1?'act_privilege':''}}" data-index="1" bindtap="checkOptions">
          <text class='icon icon-coin-goods' style="font-size:54rpx"></text>
          <view class="type-item-name">电商抵扣</view>
        </view>
      </view> 
      <view class="type-item">
        <view class="type-item-box {{defaultLevel==2?'act_privilege':''}}" data-index="2" bindtap="checkOptions">
          <text class='icon icon-coin-act' style="line-height: .8;font-size: 62rpx;"></text>
          <view class="type-item-name">活动抵扣</view>
        </view>
      </view>
      <view class="type-item">
        <view class="type-item-box {{defaultLevel==3?'act_privilege':''}}" data-index="3" bindtap="checkOptions">
          <!-- <text class='icon icon-lock font16 position-icon 'wx:if="{{initialSwipe<1}}"></text> -->
          <text class='icon icon-vip-privilege' style="line-height: .8;"></text>
          <view class="type-item-name">抢购特权</view>
        </view>
      </view>
      <view class="type-item">
        <view class="type-item-box {{defaultLevel==4?'act_privilege':''}}" data-index="4" bindtap="checkOptions">
          <text class='icon icon-more' style="font-size:54rpx"></text>
          <view class="type-item-name">敬请期待</view>
        </view>
      </view>
    </view>
    <view class="privilege-ins">
      <view class="arrow" style="{{'left:calc('+percent+' - 15rpx - 25%/2)'}}"></view>
      <view class="card" wx:if="{{defaultLevel==1}}">
        <view class="card-title">
          <view class="card-left">电商抵扣</view>
          <view class="card-right" data-url="/pages/product/goods/index" bindtap="jumpPage">更多</view>
        </view>
        <view class="card-content goods-fixed">
          <view class="good-item" wx:for="{{levelList.goods}}" wx:key="aid" data-aid="{{item.aid}}" data-type="goods" bindtap="jumpToDetail">
            <view class="item-top-img">
              <image src="{{item.logo}}" mode="widthFix" style="width:100%;display: block;;height: auto;"></image>
            </view>
            <view class="goods-title">
              {{item.title}}
            </view>
            <view class="sign subtitleColor">
              宝贝币最高可抵{{item.maxUserCoin/10}}元
            </view>
            <view class="good-price subtitleColor">
              <view class="btn-box">
                <view class="btn">￥{{item.finalPrice}}</view>
              </view>
              <text class="price-ins">抵扣后</text>
            </view>
          </view>
        </view>
      </view>
      <view class="card" wx:if="{{defaultLevel==2}}">
        <view class="card-title">
          <view class="card-left">活动抵扣</view>
          <view class="card-right" data-url="/pages/home/index" bindtap="jumpPage">更多</view>
        </view>
        <view class="card-content">
          <view class="act-item" wx:for="{{levelList.activite}}" wx:key="aid" data-aid="{{item.aid}}" data-type="act" bindtap="jumpToDetail">
            <view class="act-l">
              <image src="{{filter.formatImg(imgPath, item.logo)}}" mode="widthFix" style="width:100%;display: block;height: auto;"></image>
            </view>
            <view class="act-c">
              <view class="act-title">{{item.title}}</view>
              <view class="act-sign subtitleColor">宝贝币最高可抵{{item.maxUserCoin/10}}元</view>
            </view>
            <view class="act-r subtitleColor">
              <view class="btn-box">
                <view class="btn"><text class="font12">￥</text>{{item.finalPrice}}</view>
                </view>
              <view class="price-ins">抵扣后</view>
            </view>
          </view>
        </view>
      </view>
      <view class="card" wx:if="{{defaultLevel==3}}">
        <view class="card-title">
          <view class="card-left">抢购特权</view>
        </view>
        <view class="card-content">
          <view class="privilege-title">
          <view>在活动未开售时，可使用宝贝币来兑换抢购特权。</view>
          <view>兑换方法<text class="subtitleColor">详见每个未开售的活动详情。</text>每个等级可兑换特权不同，具体如下：</view> </view>
          <view class="privilege-content">
            <view class="table">
              <view class="tr">
                <view class="th">等级</view><view class="th">可兑换特权</view>
              </view>
              <view class="tr">
                <view class="td">普通</view><view class="td">无</view>
              </view>
              <view class="tr">
                <view class="td">白银</view><view class="td">提前5分钟</view>
              </view>
              <view class="tr">
                <view class="td">黄金</view><view class="td">提前5、10分钟</view>
              </view>
              <view class="tr">
                <view class="td">一钻</view><view class="td">提前5、10、15分钟</view>
              </view>
              <view class="tr">
                <view class="th">二钻</view><view class="th">提前5、10、15、20分钟</view>
              </view>
              <view class="tr">
                <view class="th">三钻</view><view class="th">提前5、10、15、20分钟</view>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="card" wx:if="{{defaultLevel==4}}">
        <view class="card-title">
          <view class="card-left">敬请期待</view>
        </view>
        <view class="card-content">
          <view class="privilege-title">更多特权正在筹备中，敬请期待~</view>
          <view class="privilege-content">
            <image src="https://img.bbztx.com/image_test/upload/thumbs/20220513/logo/1652434489715080641.png" mode="widthFix" style="width: 35%;display: block;margin: 0 auto;"></image>
          </view>
        </view>
      </view>
    </view>
  </view>
</view>
<view class="modular">
  <view class="modal-title">获取宝贝币</view>
  <view class="modal-label card" style="padding: 30rpx 20rpx 30rpx 34rpx;margin-top: 15rpx;">
    <view class="card-title coin-card-mar">
      <view class="card-left">推荐任务</view>
    </view>
    <!-- <view class="coin-list">
      <view class="coin-list-l">
        <view class="icon-box">
          <text class='icon icon-coin-consumption'></text>
        </view>
      </view>
      <view class="coin-list-c">
        <view class="get-method">
          <text>参加活动 </text>
          <text class="subtitleColor">至少+200宝贝币</text>
        </view>
        <view class="get-ins">若参与者的实付金额≥200,那么在参加活动后,可获得实付金额等额的宝贝币。</view>
      </view>
      <view class="coin-list-r" data-url="/pages/home/index" bindtap="jumpPage">去购买</view>
    </view>
    <view class="coin-list">
      <view class="coin-list-l">
        <view class="icon-box">
          <text class='icon icon-coin-comment'></text>
        </view>
      </view>
      <view class="coin-list-c">
        <view class="get-method">
          <text>评价活动 </text>
          <text class="subtitleColor">+ 50~100宝贝币</text>
        </view>
        <view class="get-ins">对活动进行评价后，可随机获得50~100枚不等的宝贝币。</view>
      </view>
      <view class="coin-list-r" data-url="/pages/order/index/order?otype=3" bindtap="jumpPage">
        去评价
      </view>
    </view> -->
    <view class="coin-list" wx:for="{{taskList.recommend_task}}" wx:key="id">
      <view class="coin-list-l">
        <view class="icon-box">
          <text class='icon {{filter.getIcon(item.code)}}'></text>
        </view>
      </view>
      <view class="coin-list-c">
        <view class="get-method">
          <text>{{item.title}} </text>
          <text wx:if="{{item.code=='browseArticle'}}">({{item.passCount+'/'+item.maxPassCount}}) </text>
          <text class="subtitleColor" wx:if="{{item.prizeDesc}}">{{item.prizeDesc}}</text>
          <text class="subtitleColor" wx:else>+{{item.prizeNum}}宝贝币</text>
        </view>
        <view class="get-ins">{{item.content}}</view>
      </view>
      <view class="coin-list-r {{(item.maxPassCount!=-1&&item.passCount>=item.maxPassCount)?'finished-task':''}}" data-code="{{item.code}}" data-id="{{item.id}}" bindtap="{{(item.maxPassCount!=-1&&item.passCount>=item.maxPassCount)?'':'checkTask'}}">
        {{item.maxPassCount==-1?item.btnText:(item.passCount>=item.maxPassCount?'已完成':item.btnText)}}
      </view>
    </view>
    <view class="card-title coin-card-mar">
      <view class="card-left">新人任务</view>
    </view>
    <view class="coin-list" wx:for="{{taskList.newUser_task}}" wx:key="id">
      <view class="coin-list-l">
        <view class="icon-box">
          <text class='icon {{filter.getIcon(item.code)}}'></text>
        </view>
      </view>
      <view class="coin-list-c">
        <view class="get-method">
          <text>{{item.title}} </text>
          <text class="subtitleColor" wx:if="{{item.prizeDesc}}">{{item.prizeDesc}}</text>
          <text class="subtitleColor" wx:else>+{{item.prizeNum}}宝贝币</text>
        </view>
        <view class="get-ins">{{item.content}}</view>
      </view>
      <view class="coin-list-r {{(item.maxPassCount!=-1&&item.passCount>=item.maxPassCount)?'finished-task':''}}" data-code="{{item.code}}" data-id="{{item.id}}" bindtap="{{(item.maxPassCount!=-1&&item.passCount>=item.maxPassCount)?'':'checkTask'}}">
        {{item.maxPassCount==-1?item.btnText:(item.passCount>=item.maxPassCount?'已完成':item.btnText)}}
      </view>
    </view>
  </view>
</view>