<template>
	<view class="container">
		<!-- 明细列表 -->
		<view class="list" v-for="(item,index) in list" :key="index">
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>提</text><text>现</text><text>订</text><text>单</text><text>号</text><text>：</text></view>
				<view class="list_text">{{item.order_sn}}</view>
			</view>
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>结</text><text>算</text><text>状</text><text>态</text><text>：</text></view>
				<!-- <view class="list_text" :class="item.status == 3 ? 'r_color' : 'g_color'">{{item.status == 0 ? '审核中' : item.status == 2 ? '审核成功' : '审核失败'}}</view> -->
        <view class="list_text g_color" v-if="item.status ==0">审核中</view>
        <view class="list_text g_color" v-else-if="item.status ==1">审核通过</view>
        <view class="list_text g_color" v-else-if="item.status ==2">付款通过</view>
        <view class="list_text r_color" v-else-if="item.status ==3">付款失败</view>
        <view class="list_text r_color" v-else-if="item.status ==4">审核失败</view>
        <view class="list_text r_color"  v-else-if="item.status ==5">删除作废</view>
			</view>
			<!-- <view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>申</text><text>请</text><text>人</text><text>：</text></view>
				<view class="list_text">{{userinfo.nickname}}</view>
			</view> -->
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>提</text><text>现</text><text>金</text><text>额</text>：</text></view>
				<view class="list_text y_color">￥{{item.money}}</view>
			</view>
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>提</text><text>现</text><text>类</text><text>型</text>：</text></view>
				<view class="list_text y_color">余额提现</view>
			</view>
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>申</text><text>请</text><text>时</text><text>间</text>：</text></view>
				<view class="list_text">{{item.create_time}}</view>
			</view>
			<view class="list_con flex_r flex_ac">
				<view class="list_name flex_r flex_ac flex_jb"><text>处</text><text>理</text><text>时</text><text>间</text>：</text></view>
				<view class="list_text" v-if="item.status != 0">{{item.check_time}}</view>
			</view>
			<view class="list_hint flex_r flex_ac">
				<image class="hint_img" src="/static/notice.png" mode=""></image>
				<view class="hint_msg r_color">{{item.remark}}</view>
			</view>
		</view>
		<!-- 明细列表-end -->
		
		<not-goods v-if="haveGoods" textStr="暂无提现信息"></not-goods>
	</view>
</template>

<script>
let page = 1;
let app = getApp();
var appEv = app.$vm.$options;
import { post } from "@/request/api.js";
import notGoods from "@/components/not-goods/index.vue";

export default {
  components: {
    notGoods,
  },
  data() {
    return {
      haveGoods: false,
      status: 0,
      list: [],
      rows: 20,
      page: 1,
      userinfo:undefined
    };
  },
  onShow: function () {
    this.userinfo = uni.getStorageSync("userinfo");
    this.page = 1;
    this.loadData();
  },
  methods: {
    loadData() {
      let data = {
        page: this.page,
        rows: this.rows,
      };
      uni.showLoading({ mask: true });
      post("v1/my/withdraw", data).then((res) => {
        uni.hideLoading();
        if (res.code === 0) {
          if (res.data.data.data.length > 0) {
            this.list = this.list.concat(res.data.data.data);
          } else {
            if (this.page == 1) {
              this.haveGoods = true;
              this.page = -1;
            } else {
              this.page = -1;
              appEv.errTips("暂无更多");
            }
          }
        } else {
          if (page == 1) {
            this.haveGoods = true;
            this.page = -1;
          } else {
            this.page = -1;
            appEv.errTips("暂无更多");
          }
        }
      });
    },
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    if (this.page != -1) {
      setTimeout(function () {
        ++this.page;
        this.loadData();
      }, 800);
    }
  },
};
</script>

<style lang="scss">
// 页面配置
page {
  background: #f4f4f4;
}
.container {
  padding-top: 16rpx;
}
// 页面配置-end

// 明细列表
.hint_msg {
  font-size: 22rpx;
}
.list_name {
  width: 180rpx;
  overflow: hidden;
}
.hint_img {
  width: 24rpx;
  height: 25rpx;
  margin-right: 36rpx;
}
.list_hint {
  width: 100%;
  overflow: hidden;
  margin-top: 12rpx;
}
.list_text {
  color: #7c7c7c;
  font-size: 26rpx;
  font-family: "SourceHanSansCN-Medium";
}
.list_name text {
  font-size: 30rpx;
  color: #404142;
  font-family: "SourceHanSansCN-Medium";
}
.list {
  width: 100%;
  overflow: hidden;
  padding: 30rpx 60rpx;
  box-sizing: border-box;
  background: #fff;
  margin-bottom: 20rpx;
}
// 明细列表-end

// 状态颜色
.g_color {
  color: #1bbd89;
}
.y_color {
  color: #fd9f33;
}
.r_color {
  color: #ec421a;
}
// 状态颜色-end
</style>
