<template>
<view>
<!--promote/withdrawal/record/record.wxml-->
<view class="list mt20" v-if="data.length>0">
	<!-- <block wx:for="{{pageList}}" wx:key="index"> -->
		<view v-for="(item, index) in data" :key="index" class="li dflex">
			<view class="dizhi flex">
				<view>{{item.remark}}<text class="shenghe" v-if="item.state==1">审核中</text><text class="success" v-if="item.state==2">提取成功</text><text class="file" v-if="item.state==3">审核失败</text></view>
				<text class="reason" v-if="item.state==3">失败原因：<text class="colorred">{{item.reason}}</text></text>
				<view class="time"><text>{{item.time}}</text></view>
			</view>
			<view class="yue">
      <view class="money">-{{item.money}}</view>
      <text>余额{{item.balance}}</text>
			</view>
		</view>
	<!-- </block> -->
</view>
<view class="nodata" v-if="ishow">
	<image :src="picUrlss+'empty_dd.png'"></image>
	<text>暂无提现记录</text>
</view>
</view>
</template>

<script>
// promote/withdrawal/record/record.js
const app = getApp();
const req = require("../../../utils/request.js");

export default {
  data() {
    return {
		picUrlss: req.public.picUrls,
      isLoad: true,
      form: {
        page: 1,
        limit: 10
      },
      data: "",
      ishow: false
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getRecord();
  },

  onReachBottom() {
    console.log("=============--------------");
    this.form.page++;
    this.getRecord();
  },

  methods: {
    getRecord() {
      let isShowLoading = false;

      if (this.form.page == 1 && !isShowLoading) {
        req.loadIng('加载中');
        isShowLoading = true;
      }

      let that = this;
      console.log("===============", that.isLoad);
      if (!that.isLoad) return false;
      console.log("11111111111111111");
      that.isLoad = false;
      req.getRequest('/api/withdraw/list', that.form, data => {
        if (data && data.length >= 10) that.isLoad = true;
        if (that.form.page > 1) data = that.data.concat(data);
        this.setData({
          data: data
        });

        if (this.data && this.data.length <= 0) {
          that.setData({
            ishow: true
          });
        } else {
          that.setData({
            ishow: false
          });
        }

        if (isShowLoading) {
          uni.hideLoading();
          isShowLoading = false;
        }

        console.log(data);
      });
    }

  }
};
</script>
<style>
@import "./record.css";
</style>