package com.wd.workoffice.ui.adapter;


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

import java.util.List;

import androidx.annotation.Nullable;

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

public class ContactsGetMoneyAdapter extends BaseQuickAdapter<ContactsMoneyBean.RecordsBean, BaseViewHolder> {
    int type;

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

    public ContactsGetMoneyAdapter(int layoutResId, @Nullable List<ContactsMoneyBean.RecordsBean> data, int type) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, ContactsMoneyBean.RecordsBean item) {

        helper.setText(R.id.tv_get, MathUtils.divide(String.valueOf(item.getExpectAmount()), "10000", 3));
        helper.setText(R.id.tv_apply, MathUtils.divide(String.valueOf(item.getApplyAmount()), "10000", 3));
        helper.setText(R.id.tv_back, MathUtils.divide(String.valueOf(item.getFinishAmount()), "10000", 3));
        if (type == 3) {
            helper.setVisible(R.id.tv_dep, true);
            helper.setText(R.id.tv_process, WorkUtils.getOrderName(item.getProcessCode()));
            helper.setText(R.id.tv_dep, item.getReceiveDeptName());
        }else {
            helper.setText(R.id.tv_process, item.getProcessCodeName());
        }
    }
}

