<template>
  <view class="com-ward">
    <view class="com-ward-list">
      <view
        class="com-ward-list-item u-border-bottom"
        v-for="item in list"
        :key="item.id"
      >
        <view class="fl_b com-ward-list-item-top">
          <view class="title">{{
            item.applyTime | formate("yyyy-mm-dd hh:mm")
          }}</view>
          <view class="money">{{ item.cash }}</view>
        </view>
        <view class="com-ward-list-item-status"
          >{{
            [
              "已取消",
              "已拒绝",
              "未审核",
              "初审通过",
              "二审通过",
              "三审通过",
              "已打款",
            ][item.cwStatus + 2]
          }}
        </view>
      </view>
    </view>
    <view class="nomore" v-if="total && list.length == total">
      已显示全部
    </view>
    <view class="nomore" v-if="!total"> 暂无数据 </view>
  </view>
</template>

<script>
import { getWithdrawalList } from "@/utils/user";
export default {
  name: "commission",

  data() {
    return {
      list: [],
      param: {},
      total: 0,
    };
  },

  onShow() {
    this.reset();
    this.getWithdrawalList();
  },
  onReachBottom() {
    if (this.list.length >= this.total) {
      return;
    }
    this.param.pageNum++;
    this.getWithdrawalList();
  },
  methods: {
    reset() {
      this.list = [];
      this.param = {
        pageNum: 1,
        pageSize: 10,
      };
    },
    getWithdrawalList() {
      getWithdrawalList(this.param).then((res) => {
        this.list.push(...res.rows);
        this.total = res.total;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  background: #ffffff;
  padding: 20rpx 40rpx 0;
}
.com-ward {
  .com-ward-list {
    .com-ward-list-item {
      margin-top: 40rpx;
      .com-ward-list-item-top {
        image {
          width: 40rpx;
          height: 40rpx;
          margin-right: 12rpx;
        }
        .title {
          font-weight: bold;
          color: #24263d;
          font-size: 32rpx;
        }
        .money {
          color: #eb5757;
          font-size: 36rpx;
          font-weight: 500;
          text-align: right;
        }
      }
      .com-ward-list-item-status {
        margin: 24rpx 0 40rpx;
        color: #7e7d83;
        font-size: 28rpx;
      }
    }
  }
}
</style>
