import { TCashList } from "../../data/module/CashNormalData";

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

    @property({ displayName: 'lbl提现类型', type: cc.Label })
    private lbl_cash_type: cc.Label = null;
    @property({ displayName: 'lbl提现时间', type: cc.Label })
    private lbl_cash_time: cc.Label = null;
    @property({ displayName: 'lbl红包码', type: cc.Label })
    private lbl_red_ma: cc.Label = null;
    @property({ displayName: 'lbl毛币数量', type: cc.Label })
    private lbl_rmb_value: cc.Label = null;

    // onLoad () {}

    // start () {

    // }

    /**
     * 初始化数据
     */
    public async setItemData(item_data) {
        await this.initStyle(item_data);
    }
    private initStyle(item_data: TCashList) {

        this.lbl_cash_type.string = gData.cashNormal.cash_type[item_data.cashType];
        this.lbl_cash_time.string = mk.time.getNowDayString(item_data.applyTime * 1000);
        this.lbl_red_ma.string = item_data.withdrawalCode ? '红包码：' + item_data.withdrawalCode : '';
        this.lbl_rmb_value.string = '￥' + item_data.amount + '元';
    }
}
