package com.android.jingdong.adaptor;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.android.jingdong.R;
import com.android.jingdong.model.JD;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * 下单页面购物车列表适配器
 */
public class PlaceOrderAdapter extends BaseQuickAdapter<JD, BaseViewHolder> {

    public PlaceOrderAdapter(List<JD> JDS) {
        super(R.layout.item_place_order, JDS);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, JD JD) {
        baseViewHolder.setImageResource(R.id.placeOrderImage, JD.getImage())
                .setText(R.id.placeOrderName, JD.getName())
                .setText(R.id.placeOrderPrice, "￥" + JD.getPrice())
                .setText(R.id.orderCountBtn, String.valueOf(JD.getCount()));
    }
}
