package com.wd.workoffice.ui.adapter;


import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.FinancialBean;
import com.wd.workoffice.bean.LogisticBean;
import com.wd.workoffice.util.MathUtils;
import com.wd.workoffice.util.WorkUtils;

import java.util.List;

/**
 * Created by flexible on 2018/8/13.
 */

public class FinancialAdapter extends BaseQuickAdapter<FinancialBean.RecordsBean, BaseViewHolder> {

    public FinancialAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, FinancialBean.RecordsBean item) {
        helper.setText(R.id.tv_name, item.getSerialNumber());
        helper.setText(R.id.tv_price, MathUtils.converData(item.getTotalMoney(),3));
        helper.setText(R.id.tv_status, WorkUtils.getFinancialStatus(Integer.valueOf(item.getStatus())));
        helper.setText(R.id.tv_time, item.getPayDate() + "");
        helper.setText(R.id.tv_people, item.getApplierName() );
        helper.setText(R.id.tv_dep, item.getPayDeptName() );
        if (TextUtils.equals("2", item.getStatus())) {
            helper.setGone(R.id.ll_btn, true);
            helper.addOnClickListener(R.id.tv_modify, R.id.tv_delete);
        }else {
            helper.setGone(R.id.ll_btn, false);
        }
    }
}

