<script>
import {getTotalMoney, getWaterList} from "@/api/money";
  import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  import tools from "@/common/js/tools";
  import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";

  export default {
		name: "all-profit",
		components: {EnBlank},
		data() {
			return {
        address:'',
        revenueTotal:'',
        list:[],
        page:1
      };
		},
		mounted() {
      this.getTotalMoney()
      this.getWaterList()
    },
		methods: {
      async getAccount(){
        this.address= tokenpocketBnb.getMyAddress()

      },
      getWaterList(){
        getWaterList({'page':this.page,water_key:[4,5]}).then(res=>{
          if(res.code===1){
            ++this.page
            if(res.data.items.length>0){
              this.list.push(...res.data.items)
            }
          }
        })
      },
      getTotalMoney(){
        getTotalMoney().then(res=>{
          if (res.code===1){
            this.pledgeTotal=res.data.pledgeTotal
            this.revenueTotal=res.data.revenueTotal

          }
        })
      },
			returnBut() {
				uni.navigateBack({
					delta: 1
				});
			}
		},
	}
</script>

<template>
	<view class="flex-common-css box-sizing-border box-b">
		<view class="nav-box bgc-f box-sizing-border align-items-center">
			<!-- <i @click="returnBut" class="el-icon-arrow-left fw-b fs-20 mr-10"></i> -->
			<uni-icons @click="returnBut" type="left" size="20"></uni-icons>
			<view class="fs-28 fw-b">总收益</view>
		</view>
		<view class="head-box flex-direction-column align-items-center flex-justify-center b-rad-20 mb-10">
			<view class="fs-28 fc-f mb-16">
				总收益
			</view>
			<view class="fs-18 fc-f fw-b mb-16">
				{{revenueTotal}}
			</view>
<!--			<view class="fs-28 fc-f text-align-center tx-box b-rad-20">-->
<!--				提现-->
<!--			</view>-->
		</view>
		<view class="fs-28 fw-b mb-10">
			历史明细
		</view>
		<view class="scroll-view-css b-rad-20">
			<view v-for="item in list" :key="item.id"
				class="p-20 box-sizing-border bgc-f b-rad-20 align-items-center flex-justify-space">
				<view>
					<view class="fs-28 fw-b mb-16">
						{{item.status_str}}
					</view>
					<view class="fs-12 fc-858585">
            {{item.created_date}}
					</view>
				</view>
				<view class="fs-28 fw-b" v-if="item.price>=0.001">
          {{(item.price*1).toFixed(3)}}
				</view>
        <view class="fs-28 fw-b" v-else>
          {{(item.price*1).toFixed(6)}}
        </view>
			</view>
      <en-blank v-if="list.length<=0" message="~暂无记录"></en-blank>

		</view>
	</view>
</template>

<style scoped lang="scss">
	.box-b {
		padding: 120rpx 20rpx 20rpx;
	}

	.nav-box {
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		position: absolute;
		top: 0;
		left: 0;
		padding-left: 20rpx;
	}

	.tx-box {
		width: 30%;
		height: 80rpx;
		background: #ff952d;
		line-height: 80rpx;
	}

	.head-box {
		padding: 60rpx 0;
		background-image: linear-gradient(270deg, #ffc62c, #ffa954);
	}
</style>
