<template>
  <BasePage>
    <div class="merchantcashout">
      <div class="top">
        <span>
          提现中：
          <b class="red">￥{{ statistics.withdrawing?.toFixed(2) || '0.00' }}</b>
        </span>

        <span class="r">
          累计提现：
          <b>￥{{ statistics.withdrawtotal?.toFixed(2) || '0.00' }}</b>
        </span>
      </div>

      <BaseList ref="listRef" class="list" url="/v1/client/DShopsClient/withdraw">
        <template #default="{ item }">
          <div class="item">
            <div class="line">
              <b class="state">{{ item.statename }}</b>
              <b class="r money red">￥<span>{{ item.wdnums?.toFixed(2) }}</span>
              </b>
            </div>
            <div class="record">
              <div class="left">
                提现：{{ $formatGMT(item.addtime, 'yyyy-MM-dd HH:mm:ss') }}
              </div>
              <div class="right" v-if="item.trantime && !item.wdtime">
                {{ item.state === 5 ? '失败' : '发放' }}：{{ $formatGMT(item.trantime, 'yyyy-MM-dd HH:mm:ss') }}
              </div>
              <div class="right" v-if="item.wdtime">
                {{ item.state === 6 ? '失败' : '发放' }}：{{ $formatGMT(item.wdtime, 'yyyy-MM-dd HH:mm:ss') }}
              </div>
            </div>
          </div>
        </template>
      </BaseList>
    </div>
  </BasePage>
</template>

<script>
export default {
  name: 'MerchantCashout',
  data() {
    return {
      statistics: {}
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.$get('/v1/client/DShopsClient/withdrawstatistics').then(res => {
        this.statistics = res.data || {}
      })
    }
  }
}
</script>