<wxs module="filters">
  var filters = {
    toFix: function (value) {
      return value.toFixed(2) // 此处2为保留两位小数，保留几位小数，这里写几    
    },
  }
  module.exports = {
    toFix: filters.toFix//暴露接口调用
  }
</wxs>

<!--tabs-->
<view class="speed-tab-line">
  <van-tabs active="{{ speed_pool }}" bind:change="onChangeSpeed">
    <van-tab title="加速池" name="speed_pool">
    </van-tab>
    <van-tab title="加速plus池" name="speed_plus_pool">
    </van-tab>
  </van-tabs>
</view>
<view class="love-speed-lease" wx:if="{{speed_pool=='speed_pool'}}">
  <view class="t-c love-speed-wrapper">
    <view class="title">
      待释放{{love_name}}
    </view>
    <view class="total-money f15353">{{ member_surplus ? filters.toFix(member_surplus) : 0}}</view>
    <view class="lease-btn">
      <van-button class="btn" color="#F65958" bind:click="onClickShow">领取释放{{love_name}}</van-button>
      <view class="play-shop" wx:if="{{member_surplus==0}}"><text catchtap="PayHandler">购买商品保留权益</text>
        <van-icon name="arrow" />
      </view>
    </view>
  </view>
  <view>
  </view>
</view>
<view class="love-speed-lease" wx:if="{{speed_pool=='speed_plus_pool'}}">
  <view class="t-c love-speed-wrapper">
    <view class="title">
      累计收入
    </view>
    <view class="total-money f15353">{{ amount_total ? filters.toFix(amount_total) : 0}}</view>
  </view>
</view>
<!--tabs-->
<view class="speed-tab-line  {{speed_pool=='speed_pool'?'':'fix_tabs_line'}}"  >
  <van-tabs active="{{ active }}" bind:change="onChange"  tab-active-class="aca" >
    <van-tab  wx:if="{{speed_pool=='speed_pool'}}"  title="加速池记录" name="speed_pool_record"/>
    <van-tab  wx:if="{{speed_pool=='speed_pool'}}" title="释放记录" name="released_rocord"/>
    <van-tab wx:if="{{speed_pool=='speed_plus_pool'}}"  title="收入明细" name="account_balance"/>
  </van-tabs>
</view>
<view wx:if="{{active == 'speed_pool_record'}}" class="speed-pool-box">
  <view class="speed-warpper" wx:for="{{speed_pool_record}}" wx:key="unique">
    <view class="speed-left">
      <view class="speed-order-id">{{item.remark}}</view>
      <view class="time">{{item.created_at}}</view>
    </view>
    <view class="speed-right {{item.value.includes('-')?'already':'no'}}">
      {{item.value.includes('-')?'':'+'}} {{item.value}}
    </view>
  </view>
</view>
<view wx:if="{{active == 'released_rocord'}}" class="p-b-25">
  <view class="lease-record" wx:for="{{released_rocord.data}}" wx:key="unique">
    <view class="lease-record-head">
      <text class="time">{{item.created_at}}</text>
      <text class="{{item.status_name=='未发放'?'no':'already'}}">{{item.status_name}}</text>
    </view>
    <view class="lease-record-footer">
      <view class="detailed">
        <text>{{item.love_name}}：{{item.speed_pool_total}}</text>
        <text class="m-5">激活比例：{{item.ratio}}</text>
        <text>通证单价：{{item.api_value}}</text>
        <text wx:if="{{item.fee_ratio!==0}}" class="m-5">手续费比例：{{item.fee_ratio}}%</text>
      </view>
      <view>
        <text class="no">+{{item.usable_love}}</text>
      </view>
    </view>
  </view>
</view>
<view wx:if="{{active == 'account_balance'}}" class="p-b-25">
  <view class="speed-pool-box">
    <view class="speed-warpper" wx:for="{{account_balance.data}}" wx:key="unique">
      <view class="speed-left">
        <view class="speed-order-id">{{item.order_sn}}</view>
        <view class="speed-order-price">订单金额：￥{{item.order_price}}</view>
        <view class="time">{{item.created_at}}</view>
      </view>
      <view class="speed-right">
        <view class="speed-right-plus f15353">￥{{item.amount}}</view>
        <view class="c-5c5c5c ">plus池抽取比例：{{item.ratio}}%</view>
      </view>
    </view>
  </view>
</view>
<!-- 遮罩层 -->
<van-overlay show="{{ show }}" bind:click="onClickHide">
  <view class="wrapper">
    <view class="block" catch:tap="noop">
      <view class="draw">
        <text class="draw-price">￥</text>
        <text class="f-60">{{ amount ? filters.toFix(amount) : 0}}</text>
      </view>
      <van-image width="638rpx" height="561rpx" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/plugin/love-speed-pool/redPacket.png" />
      <text class="tips">请点击确定领取释放的{{love_name}}</text>
      <view class="confirm" catch:tap="confirm">确认</view>
    </view>
  </view>
</van-overlay>