导包:

  implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    implementation 'com.google.code.gson:gson:2.8.+'
    compile 'com.github.bumptech.glide:glide:3.6.1'
权限:联网


布局文件:

activity_main.xml:

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include layout="@layout/layout_title" />
    <ExpandableListView
        android:id="@+id/expandList"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </ExpandableListView>
    <View
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:layout_marginTop="2dp"
        android:background="#000000"/>
    <include layout="@layout/layout_bottom" />

</LinearLayout>

layout_title.java:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="返回"
        android:textSize="25sp"
        android:padding="10dp"
        android:textColor="@android:color/white"
        android:id="@+id/btnBack"/>
    
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="25sp"
        android:padding="10dp"
        android:textColor="@android:color/white"
        android:layout_weight="1"
        android:gravity="center"
        android:text="购物车"/>
    
    <TextView
        android:id="@+id/btnEditor"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="编辑"
        android:textColor="@android:color/white"
        android:textSize="25sp"
        android:padding="10dp"/>
    
</LinearLayout>

layout_bottom.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="全选"
        android:textSize="25sp"
        android:padding="10dp"
        android:id="@+id/btnCheckAll"/>

    <TextView
        android:id="@+id/tvTotalPrice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        android:padding="10dp"
        android:textColor="@android:color/black"
        android:layout_weight="1"
        android:gravity="center"
        android:text="合计:¥0.00"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="结算(0)"
        android:textColor="@android:color/white"
        android:textSize="25sp"
        android:padding="10dp"
        android:background="@android:color/holo_red_light"
        android:id="@+id/btnAmount"/>

</LinearLayout>

layout_child_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <CheckBox
        android:id="@+id/ck_child_choose"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:scaleX="0.6"
        android:scaleY="0.6" />

    <ImageView
        android:id="@+id/iv_show_pic"
        android:layout_width="70dp"
        android:layout_height="80dp"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:layout_toRightOf="@id/ck_child_choose"
        android:src="@mipmap/ic_launcher" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="15dp"
        android:layout_toRightOf="@id/iv_show_pic"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tv_commodity_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="酒红色纯红色纯羊毛西服套装"
            android:textColor="@android:color/black"
            android:textSize="12sp"
            android:textStyle="bold" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/tv_commodity_attr"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:text="属性:粉蓝色"
                android:textColor="@color/colorPrimary"
                android:textSize="12sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/tv_commodity_price"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="¥390"
                android:textColor="@android:color/holo_red_dark"
                android:textSize="12sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_commodity_num"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:text="x1"
                android:textColor="@android:color/darker_gray" />

            <LinearLayout
                android:id="@+id/rl_edit"
                android:layout_width="120dp"
                android:layout_height="30dp"
                android:layout_marginLeft="20dp"
                android:background="@android:color/holo_orange_light">

                <TextView
                    android:id="@+id/iv_sub"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_margin="1dp"
                    android:layout_weight="1"
                    android:background="@android:color/white"
                    android:gravity="center"
                    android:text=" - "
                    android:textColor="@android:color/black" />

                <TextView
                    android:id="@+id/tv_commodity_show_num"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_margin="1dp"
                    android:layout_weight="1"
                    android:background="@android:color/white"
                    android:gravity="center"
                    android:text="1" />

                <TextView
                    android:id="@+id/iv_add"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_margin="1dp"
                    android:layout_weight="1"
                    android:background="@android:color/white"
                    android:gravity="center"
                    android:text=" + " />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <Button
        android:id="@+id/btn_commodity_delete"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_margin="5dp"
        android:background="@android:color/holo_blue_light"
        android:gravity="center"
        android:text="x"
        android:textColor="@android:color/holo_green_dark"
        android:textSize="20sp"
        android:visibility="gone" />
</RelativeLayout>

layout_group_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <CheckBox
        android:id="@+id/ck_group_choosed"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="商家1"
        android:gravity="center_vertical"
        android:textSize="25sp"
        android:focusable="false"
        android:padding="10dp"/>
</LinearLayout>

建Bean类:

网址:

https://www.zhaoapi.cn/product/getCarts?uid=4582&source=android
ShoppCarBean.java
 
M.V.P.3个接口
IMainView
 
public interface IMainView {
    void onSuccess(List<ShoppCarBean.DataBean> data);
    void onFailed(String msg);
}

IShooppPrenster.java
 
public interface IShooppPrenster {
    void onSuccess(List<ShoppCarBean.DataBean> data);
    void onFailed(String msg);
    void onDestory();
    void getCarInfo(String uid);
}
 IShoppCarModel.java 
 
public interface IShoppCarModel {
    void getCarInfo(String uid, IShooppPrenster iShooppPrenster);
}

M.V.P 运算
ShoppCarModel.java
 
public class ShoppCarModel implements IShoppCarModel {
    private Handler handler = new Handler();

    @Override
    public void getCarInfo(String uid, final IShooppPrenster iShooppPrenster) {
        OkHttpClient okHttpClient = new OkHttpClient();

        Request request = new Request.Builder()
                .get()
                .url("https://www.zhaoapi.cn/product/getCarts?uid=" + uid + "&source=android")
                .build();

        Call call = okHttpClient.newCall(request);

        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, final IOException e) {
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        iShooppPrenster.onFailed(e.getMessage());
                    }
                });
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                if (response.isSuccessful()) {
                    String str = response.body().string();
                    Gson gson = new Gson();
                    final ShoppCarBean shoppCarBean = gson.fromJson(str, ShoppCarBean.class);
                    handler.post(new Runnable() {
                        @Override
                        public void run() {

                            iShooppPrenster.onSuccess(shoppCarBean.getData());

                        }
                    });
                }
            }
        });
    }
}

ShooppPrenster.java
 
public class ShooppPrenster implements IShooppPrenster{
    private IMainView iMainView;
    private ShoppCarModel shoppCarModel;

    public ShooppPrenster(IMainView iMainView) {
        this.iMainView = iMainView;
        shoppCarModel = new ShoppCarModel();
    }

    @Override
    public void onSuccess(List<ShoppCarBean.DataBean> data) {
        if(iMainView!=null){
            iMainView.onSuccess(data);
        }
    }

    @Override
    public void onFailed(String msg) {
        if(iMainView!=null){

            iMainView.onFailed(msg);
        }

    }

    @Override
    public void onDestory() {
        if(iMainView!=null){
            iMainView=null;
        }
    }

    @Override
    public void getCarInfo(String uid) {
        shoppCarModel.getCarInfo(uid,this);
    }
}

MainActivity和adapter
 
 
MainActivity.java
 
public class MainActivity extends AppCompatActivity  implements IMainView, MyExpandAdapter.ModifyGoodsItemNumberListener, MyExpandAdapter.CheckGroupItemListener {

    //默认是false
    private boolean flag;
    //购买商品的总数量
    private int totalNum = 0;
    //购买商品的总价
    private double totalPrice= 0.00;
    private List<ShoppCarBean.DataBean> list;
    /**
     * 返回
     */
    private TextView mBtnBack;
    /**
     * 编辑
     */
    private TextView mBtnEditor;
    private ExpandableListView mExpandList;
    /**
     * 全选
     */
    private CheckBox mBtnCheckAll;
    /**
     * 合计:¥0.00
     */
    private TextView mTvTotalPrice;
    /**
     * 结算(0)
     */
    private TextView mBtnAmount;
    private MyExpandAdapter adapter;
    private ShooppPrenster shooppPrenster;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        getSupportActionBar().hide();
        mExpandList.setGroupIndicator(null);

        shooppPrenster = new ShooppPrenster(this);
        shooppPrenster.getCarInfo("4582");

        adapter = new MyExpandAdapter(this);
        mExpandList.setAdapter(adapter);

        adapter.setModifyGoodsItemNumberListener(this);
        //设置商家以及商品是否被选中的监听
        adapter.setCheckGroupItemListener(this);

        mBtnCheckAll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                isChoosedAll(((CheckBox)view).isChecked());
                //计算商品总价
                statisticsPrice();

            }
        });
        mBtnEditor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if(!flag){//编辑 -> 完成\
                    flag = true;
                    mBtnEditor.setText("完成");
                    adapter.showDeleteButton(flag);
                }else{
                    flag = false;
                    mBtnEditor.setText("编辑");
                    adapter.showDeleteButton(flag);
                }

            }
        });

    }
    private void initView() {
        mBtnBack = (TextView) findViewById(R.id.btnBack);
        mBtnEditor = (TextView) findViewById(R.id.btnEditor);
        mExpandList = (ExpandableListView) findViewById(R.id.expandList);
        mBtnCheckAll = (CheckBox) findViewById(R.id.btnCheckAll);
        mTvTotalPrice = (TextView) findViewById(R.id.tvTotalPrice);
        mBtnAmount = (TextView) findViewById(R.id.btnAmount);
    }
    @Override
    public void onSuccess(List<ShoppCarBean.DataBean> data) {
        this.list=data;
        adapter.setList(list);
        defaultExpand();
    }
    private void defaultExpand() {
        for (int i=0;i<adapter.getGroupCount();i++){
            mExpandList.expandGroup(i);
        }
    }
    @Override
    public void onFailed(String msg) {

    }

    @Override
    public void checkGroupItem(int groupPosition, boolean isChecked) {
        //Toast.makeText(this, "商家", Toast.LENGTH_SHORT).show();
        //商家javabean
        ShoppCarBean.DataBean dataBean = list.get(groupPosition);
        dataBean.setGroupChoosed(isChecked);

        //遍历商家里面的商品,将其置为选中状态
        for (ShoppCarBean.DataBean.ListBean listBean : dataBean.getList()){
            listBean.setChildChoosed(isChecked);
        }

        //底部结算那个checkbox状态(全选)
        if(isCheckAll()){
            mBtnCheckAll.setChecked(true);
        }else{
            mBtnCheckAll.setChecked(false);
        }

        //刷新适配器
        adapter.notifyDataSetChanged();

        //计算价格
        statisticsPrice();
    }

    @Override
    public void checkChildItem(int groupPosition, int childPosition, boolean isChecked) {
        //Toast.makeText(this, "商品", Toast.LENGTH_SHORT).show();
        //ShoppCarBean.DataBean.ListBean listBean = list.get(groupPosition).getList().get(childPosition);

        ShoppCarBean.DataBean dataBean = list.get(groupPosition);//商家那一层
        List<ShoppCarBean.DataBean.ListBean> listBeans = dataBean.getList();
        ShoppCarBean.DataBean.ListBean listBean = listBeans.get(childPosition);

        //你点击商家的商品条目将其选中状态记录
        listBean.setChildChoosed(isChecked);

        //检测商家里面的每一个商品是否被选中,如果被选中,返回boolean
        boolean result = isGoodsCheckAll(groupPosition);
        if(result){
            dataBean.setGroupChoosed(result);
        }else{
            dataBean.setGroupChoosed(result);
        }

        //底部结算那个checkbox状态(全选)
        if(isCheckAll()){
            mBtnCheckAll.setChecked(true);
        }else{
            mBtnCheckAll.setChecked(false);
        }


        //刷新适配器
        adapter.notifyDataSetChanged();

        //计算总价
        statisticsPrice();

    }

    @Override
    public void doIncrease(int groupPosition, int childPosition, View view) {

        //Toast.makeText(this, "用户点击了商品添加操作", Toast.LENGTH_SHORT).show();

        ShoppCarBean.DataBean.ListBean listBean = list.get(groupPosition).getList().get(childPosition);
        //取出当前的商品数量
        int currentNum = listBean.getNum();
        //商品++
        currentNum++;
        //将商品数量设置javabean上
        listBean.setNum(currentNum);

        //刷新适配器
        adapter.notifyDataSetChanged();


        //计算商品价格
        statisticsPrice();
    }

    @Override
    public void doDecrease(int groupPosition, int childPosition, View view) {
        //Toast.makeText(this, "用户点击了商品减少操作", Toast.LENGTH_SHORT).show();

        ShoppCarBean.DataBean.ListBean listBean = list.get(groupPosition).getList().get(childPosition);
        //取出当前的商品数量
        int currentNum = listBean.getNum();
        //直接结束这个方法
        if(currentNum == 1){
            return;
        }

        currentNum--;
        listBean.setNum(currentNum);
        //刷新适配器
        adapter.notifyDataSetChanged();

        //计算商品价格
        statisticsPrice();

    }


    /**
     * 检测某个商家的商品是否都选中,如果都选中的话,商家CheckBox应该是选中状态
     * @param groupPosition
     * @return
     */
    private boolean isGoodsCheckAll(int groupPosition){
        List<ShoppCarBean.DataBean.ListBean> listBeans = this.list.get(groupPosition).getList();
        //遍历某一个商家的每个商品是否被选中
        for (ShoppCarBean.DataBean.ListBean listBean : listBeans){
            if(listBean.isChildChoosed()){//是选中状态
                continue;
            }else{
                return false;
            }
        }
        return true;
    }

    //购物车商品是否全部选中
    private boolean isCheckAll(){

        for (ShoppCarBean.DataBean dataBean : list){
            if(!dataBean.isGroupChoosed()){
                return false;
            }
        }
        return true;
    }

    //全选与反选
    private void isChoosedAll(boolean isChecked){

        for (ShoppCarBean.DataBean dataBean : list){
            dataBean.setGroupChoosed(isChecked);
            for (ShoppCarBean.DataBean.ListBean listBean : dataBean.getList()){
                listBean.setChildChoosed(isChecked);
            }
        }
        //刷新适配器
        adapter.notifyDataSetChanged();
    }
    /**
     * 计算你所选中的商品总价
     */
    private void statisticsPrice(){
        //初始化值
        totalNum = 0;
        totalPrice = 0.00;
        for (ShoppCarBean.DataBean dataBean : list){

            for (ShoppCarBean.DataBean.ListBean listBean : dataBean.getList()){
                if(listBean.isChildChoosed()){
                    totalNum++;
                    System.out.println("number : "+totalNum);
                    totalPrice += listBean.getNum()*listBean.getPrice();
                }
            }
        }
        //设置文本信息 合计、结算的商品数量
        mTvTotalPrice.setText("合计:¥"+totalPrice);
        mBtnAmount.setText("结算("+totalNum+")");
    }
}

MyExpandAdapter.java
 
public class MyExpandAdapter extends BaseExpandableListAdapter {
    private List<ShoppCarBean.DataBean> data;
    private Context context;
    private ModifyGoodsItemNumberListener modifyGoodsItemNumberListener;
    private CheckGroupItemListener checkGroupItemListener;
    //接收是否处于编辑状态的一个boolean值
    private boolean isEditor;

    //商家以及商品是否被选中的一个监听
    public void setCheckGroupItemListener(CheckGroupItemListener checkGroupItemListener){
        this.checkGroupItemListener = checkGroupItemListener;
    }

    //设置商品的加减监听
    public void setModifyGoodsItemNumberListener(ModifyGoodsItemNumberListener modifyGoodsItemNumberListener){
        this.modifyGoodsItemNumberListener = modifyGoodsItemNumberListener;
    }

    //是否显示删除按钮
    public void showDeleteButton(boolean isEditor){
        this.isEditor = isEditor;
        //刷新适配器
        notifyDataSetChanged();
    }

    public MyExpandAdapter(Context context) {
        this.context = context;
    }
    public void setList(List<ShoppCarBean.DataBean> data){
        this.data=data;
        notifyDataSetChanged();
    }
    @Override
    public int getGroupCount() {
        return data !=null?data.size() :0;
    }

    @Override
    public int getChildrenCount(int i) {
        return data!=null&&data.get(i).getList()!=null?data.get(i).getList().size() :0;
    }

    @Override
    public Object getGroup(int i) {
        return data.get(i);
    }

    @Override
    public Object getChild(int i, int i1) {
        return data.get(i).getList().get(i1);
    }

    @Override
    public long getGroupId(int i) {
        return i;
    }

    @Override
    public long getChildId(int i, int i1) {
        return i1;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public View getGroupView(final int groupPosition, boolean b, View view, ViewGroup viewGroup) {
        if(view==null){
            view= LayoutInflater.from(context).inflate(R.layout.layout_group_item,viewGroup,false);
        }
        CheckBox ck_group_choosed = view.findViewById(R.id.ck_group_choosed);
        ck_group_choosed.setText(data.get(groupPosition).getSellerName());

        if(data.get(groupPosition).isGroupChoosed()){
            ck_group_choosed.setChecked(true);
        }else{
            ck_group_choosed.setChecked(false);
        }

        //ck_group_choosed.setChan
        ck_group_choosed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                checkGroupItemListener.checkGroupItem(groupPosition,((CheckBox)view).isChecked());
            }
        });
        return view;
    }

    @Override
    public View getChildView(final int i, final int i1, boolean b, View view, ViewGroup viewGroup) {

        if(view==null){
            view=LayoutInflater.from(context).inflate(R.layout.layout_child_item,viewGroup,false);

        }
        //商品选择
        CheckBox ck_child_choosed = view.findViewById(R.id.ck_child_choose);
        //商品图片
        ImageView iv_show_pic = view.findViewById(R.id.iv_show_pic);
        //商品主标题
        TextView tv_commodity_name = view.findViewById(R.id.tv_commodity_name);
        //商品副标题
        TextView tv_commodity_attr = view.findViewById(R.id.tv_commodity_attr);
        //商品价格
        TextView tv_commodity_price = view.findViewById(R.id.tv_commodity_price);
        //商品数量
        TextView tv_commodity_num = view.findViewById(R.id.tv_commodity_num);
        //商品减
        TextView iv_sub = view.findViewById(R.id.iv_sub);
        //商品加减中的数量变化
        final TextView tv_commodity_show_num = view.findViewById(R.id.tv_commodity_show_num);
        //商品加
        TextView iv_add = view.findViewById(R.id.iv_add);
        //删除按钮
        Button btn_commodity_delete = view.findViewById(R.id.btn_commodity_delete);

        //设置文本信息
        tv_commodity_name.setText(data.get(i).getList().get(i1).getTitle());
        tv_commodity_attr.setText(data.get(i).getList().get(i1).getSubhead());
        tv_commodity_price.setText("¥"+data.get(i).getList().get(i1).getPrice());
        tv_commodity_num.setText("x"+data.get(i).getList().get(i1).getNum());
        tv_commodity_show_num.setText(data.get(i).getList().get(i1).getNum()+"");

        //分割图片地址
        String images = data.get(i).getList().get(i1).getImages();

        String[] urls = images.split("\\|");

        //加载商品图片
        Glide.with(context)
                .load(urls[0])
                .crossFade()
                .into(iv_show_pic);

//商品加
        iv_add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                modifyGoodsItemNumberListener.doIncrease(i,i1,tv_commodity_show_num);
            }
        });

        //设置商品加减的按钮
        //商品减
        iv_sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                modifyGoodsItemNumberListener.doDecrease(i,i1,tv_commodity_show_num);

            }
        });

        //商品复选框是否被选中
        ck_child_choosed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //isChecked false  true
                checkGroupItemListener.checkChildItem(i,i1,((CheckBox)view).isChecked());
            }
        });

        //处理商品的选中状态
        if(data.get(i).getList().get(i1).isChildChoosed()){
            ck_child_choosed.setChecked(true);
        }else{
            ck_child_choosed.setChecked(false);
        }

        //控制删除按钮的隐藏与显示
        if(isEditor){
            btn_commodity_delete.setVisibility(View.VISIBLE);
        }else{
            btn_commodity_delete.setVisibility(View.GONE);
        }
        return view;
    }

    @Override
    public boolean isChildSelectable(int i, int i1) {
        return false;
    }
    public interface CheckGroupItemListener{
        //商家的条目的复选框监听
        void checkGroupItem(int groupPosition, boolean isChecked);
        //商品的
        void checkChildItem(int groupPosition, int childPosition, boolean isChecked);

    }

    /**
     * 商品加减接口
     */
    public interface ModifyGoodsItemNumberListener{

        //商品添加操作
        void doIncrease(int groupPosition, int childPosition, View view);
        //商品减少操作
        void doDecrease(int groupPosition, int childPosition, View view);

    }
}


在MainActivity.java中,需要改变一些数据,直接ALT+回车键就OK了,但要把出现的this.去掉
 
 
private boolean isGroupChoosed;

public boolean isGroupChoosed() {
    return isGroupChoosed;
}
public void setGroupChoosed(boolean groupChoosed) {
    //需要变//this.isGroupChoosed = groupChoosed;
    isGroupChoosed = groupChoosed;
}



Bean类:

一些数值发生变化,如int变成double类型

public class ShoppCarBean {

    /**
     * msg : 请求成功
     * code : 0
     * data : */

    private String msg;
    private String code;
    private List<DataBean> data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * list :   * sellerName : 商家1
         * sellerid : 1
         */

        private String sellerName;
        private String sellerid;
        private List<ListBean> list;

        //商家是否被选中 组条目是否被选中
        private boolean isGroupChoosed;

        public boolean isGroupChoosed() {
            return isGroupChoosed;
        }

        public String getSellerName() {
            return sellerName;
        }

        public void setSellerName(String sellerName) {
            this.sellerName = sellerName;
        }

        public String getSellerid() {
            return sellerid;
        }

        public void setSellerid(String sellerid) {
            this.sellerid = sellerid;
        }

        public List<ListBean> getList() {
            return list;
        }

        public void setList(List<ListBean> list) {
            this.list = list;
        }

        public void setGroupChoosed(boolean groupChoosed) {
            isGroupChoosed = groupChoosed;
        }


        public static class ListBean {
            /**
             * bargainPrice : 99.0
             * createtime : 2017-10-14T21:38:26
             * detailUrl 
             * images :.jpg
             * num : 1
             * pid : 45
             * price : 2999.0
             * pscid : 39
             * selected : 0
             * sellerid : 1
             * subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!
             * title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机
             */

            private double bargainPrice;
            private String createtime;
            private String detailUrl;
            private String images;
            private int num;
            private int pid;
            private double price;
            private int pscid;
            private int selected;
            private int sellerid;
            private String subhead;
            private String title;

            //子条目商品是否被选中的一个字段状态
            private boolean isChildChoosed;

            public boolean isChildChoosed() {
                return isChildChoosed;
            }
            public double getBargainPrice() {
                return bargainPrice;
            }

            public void setBargainPrice(double bargainPrice) {
                this.bargainPrice = bargainPrice;
            }

            public String getCreatetime() {
                return createtime;
            }

            public void setCreatetime(String createtime) {
                this.createtime = createtime;
            }

            public String getDetailUrl() {
                return detailUrl;
            }

            public void setDetailUrl(String detailUrl) {
                this.detailUrl = detailUrl;
            }

            public String getImages() {
                return images;
            }

            public void setImages(String images) {
                this.images = images;
            }

            public int getNum() {
                return num;
            }

            public void setNum(int num) {
                this.num = num;
            }

            public int getPid() {
                return pid;
            }

            public void setPid(int pid) {
                this.pid = pid;
            }

            public double getPrice() {
                return price;
            }

            public void setPrice(double price) {
                this.price = price;
            }

            public int getPscid() {
                return pscid;
            }

            public void setPscid(int pscid) {
                this.pscid = pscid;
            }

            public int getSelected() {
                return selected;
            }

            public void setSelected(int selected) {
                this.selected = selected;
            }

            public int getSellerid() {
                return sellerid;
            }

            public void setSellerid(int sellerid) {
                this.sellerid = sellerid;
            }

            public String getSubhead() {
                return subhead;
            }

            public void setSubhead(String subhead) {
                this.subhead = subhead;
            }

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }


            public void setChildChoosed(boolean childChoosed) {
                isChildChoosed = childChoosed;
            }
        }
    }
}


 
 

 
 
 





Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐