<template>
    <div class="container">
        <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
            <view class="searchBox_add">
                <u-icon bold color="#fff" size="40" name="arrow-left" @click="back"></u-icon>
            </view>
        </view>
        <div class="text1">物业费公积金</div>
        <div class="text2">￥{{banlance}}</div>
        <div class="total">全部房源合计</div>
        <div class="text3">
            <span>全部房源</span>
            物业费公积金流水
        </div>

        <div class="orderList">
            <div class="orderItem" v-for="item in HomeMoneyList">
                <div class="row">
                    <div class="row_label">{{item.change_reason}}</div>
                    <div class="row_con2" v-if="false">+53.1</div>
                    <div class="row_con4" v-if="true">{{item.amount_change}}</div>
                </div>
                <div class="row">
                    <div class="row_label2">{{ item.create_time }}</div>
                </div>
                <div class="line"></div>
                <div class="row">
                    <div class="row_label">绑定房源</div>
                    <div class="row_con">{{item.room.name}}</div>
                </div>
                <div class="row">
                    <div class="row_label">消费用户</div>
                    <div class="row_con">
                        <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/user_ava.png" v-if="!item.user.avatar" mode="aspectFill"></image>
                        <image :src="picUrl + item.user.avatar" v-if="item.user.avatar" mode="aspectFill"></image>

                        {{ item.user.nick_name }}
                    </div>
                </div>
                <div class="row">
                    <div class="row_label">相关快捷支付单号</div>
                    <div class="row_con">{{item.id}}</div>
                </div>
                <div class="row">
                    <div class="row_label">备注</div>
                    <div class="row_con">{{item.remark}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import {
    request,
    picUrl,
    uniqueByField,
    menuButtonInfo,
    NavgateTo
} from '../../../utils';

import {
    apiArr
} from '../../../api/v2local';


export default {
    data() {
        return {
            picUrl,
            top: "",
            localHeight: "",
            page_num:1,
            page_size:10,
            flag:false,
            banlance:"0.00",
            HomeMoneyList:[]
        }
    },
    onLoad(options) {
        const meun = menuButtonInfo();
        this.top = meun.top;
        this.localHeight = meun.height;
        this.getUserHomeMoney()
        this.getHomeMoneyList() 
    },


    methods: {

        back() {
            NavgateTo("1")
        },

        async getUserHomeMoney() {
            let that = this
            await request(apiArr.getUserHomeMoney, "POST").then(res => {
                that.banlance = res.balance_after
            })
        },

        async getHomeMoneyList(){
            let that = this
            await request(apiArr.getHomeMoneyList,"POST",{
                page_num:that.page_num,
                page_size:that.page_size
            }).then(res=>{
                if(res.rows.length == that.page_size){
                    that.flag = true
                }else{
                    that.flag = false
                }
                that.HomeMoneyList = that.HomeMoneyList.concat(res.rows)
                that.page_num++
            })
        },
    },


}
</script>

<style>
@import url("./index.css");
</style>
