
const { ccclass, property } = cc._decorator;
/**
 * 提现记录
 * @author 薛鸿潇
 */
@ccclass
export default class CashNormal extends cc.Component {

    @property({ displayName: '滚动视图', type: cc.ScrollView })
    private scroll_view: cc.ScrollView = null!;
    @property({ displayName: 'lbl累计提现', type: cc.Label })
    private lbl_rmb_total: cc.Label = null;
    @property({ displayName: 'lbl暂无提现', type: cc.Label })
    private lbl_none: cc.Label = null;

    // onLoad () {}

    start() {
        this.initTotal();
        this.initScrollView();
        this.initNoneItem();
    }

    // update (dt) {}

    /**
     * 初始化滚动视图
     */
    private initScrollView() {
        this.scroll_view.node.emit('srollview-init', gData.cashNormal.list_data);
    }

    /**
     * 初始化累计提现
     */
    private initTotal() {
        this.lbl_rmb_total.string = '￥' + gData.cashNormal.receip_total_rmb + '元';
    }

    /**
     * 初始化无条目时的提示
     */
    private initNoneItem() {
        const count = gData.cashNormal.list_data.length;
        if (count) {
            this.lbl_none.node.active = false;
        } else {
            this.lbl_none.node.active = true;
        }
    }
}
