提交 3ba36dd6 authored 作者: lgd's avatar lgd

1.修改购物车删除逻辑

上级 8410b4df
...@@ -713,7 +713,12 @@ public class ChooseInfoActivity extends WorkToolBarActivity implements BatChoose ...@@ -713,7 +713,12 @@ public class ChooseInfoActivity extends WorkToolBarActivity implements BatChoose
if (TextUtils.equals("6", type)) { if (TextUtils.equals("6", type)) {
tradingCarList.clear(); tradingCarList.clear();
tradingCarList.addAll(JSON.parseArray(pro, TradingBean.RecordsBean.class)); tradingCarList.addAll(JSON.parseArray(pro, TradingBean.RecordsBean.class));
for (TradingBean.RecordsBean recordsBean : tradingCarList) { for (TradingBean.RecordsBean tradingPro : tradingProductList) {//购物车信息置空
tradingPro.setChooseNum(null);
tradingPro.setChooseName(null);
tradingPro.setChangePro(null);
}
for (TradingBean.RecordsBean recordsBean : tradingCarList) {//判断购物车信息,添加信息
for (TradingBean.RecordsBean bean : tradingProductList) { for (TradingBean.RecordsBean bean : tradingProductList) {
if (bean.getId() == recordsBean.getId()) { if (bean.getId() == recordsBean.getId()) {
bean.setChooseNum(recordsBean.getChooseNum()); bean.setChooseNum(recordsBean.getChooseNum());
...@@ -727,6 +732,10 @@ public class ChooseInfoActivity extends WorkToolBarActivity implements BatChoose ...@@ -727,6 +732,10 @@ public class ChooseInfoActivity extends WorkToolBarActivity implements BatChoose
} else { } else {
carList.clear(); carList.clear();
carList.addAll(JSON.parseArray(pro, ProductBean.RecordsBean.class)); carList.addAll(JSON.parseArray(pro, ProductBean.RecordsBean.class));
for (ProductBean.RecordsBean proInfo : proList) {//购物车信息置空
proInfo.setCarNum(null);
proInfo.setCarPrice(null);
}
for (ProductBean.RecordsBean recordsBean : carList) { for (ProductBean.RecordsBean recordsBean : carList) {
for (ProductBean.RecordsBean bean : proList) { for (ProductBean.RecordsBean bean : proList) {
if (bean.getId() == recordsBean.getId()) { if (bean.getId() == recordsBean.getId()) {
......
...@@ -96,6 +96,10 @@ public class StoreTradingCarActivity extends WorkToolBarActivity { ...@@ -96,6 +96,10 @@ public class StoreTradingCarActivity extends WorkToolBarActivity {
@OnClick(R.id.tv_ok) @OnClick(R.id.tv_ok)
public void onViewClicked() { public void onViewClicked() {
if (productList.size() == 0) {
toast("购物车里没有产品哦");
return;
}
String allPrice = ""; String allPrice = "";
for (TradingBean.RecordsBean recordsBean : productList) { for (TradingBean.RecordsBean recordsBean : productList) {
allPrice = MathUtils.add(allPrice, MathUtils.multiply(recordsBean.getChangePro().getCarNum() allPrice = MathUtils.add(allPrice, MathUtils.multiply(recordsBean.getChangePro().getCarNum()
......
...@@ -31,6 +31,7 @@ public class TradingProCarAdapter extends BaseQuickAdapter<TradingBean.RecordsBe ...@@ -31,6 +31,7 @@ public class TradingProCarAdapter extends BaseQuickAdapter<TradingBean.RecordsBe
helper.setText(R.id.tv_top_card_name, item.getProductSimpleCode()); helper.setText(R.id.tv_top_card_name, item.getProductSimpleCode());
helper.setText(R.id.tv_apply_num, MathUtils.converData(item.getQuantity(),3)); helper.setText(R.id.tv_apply_num, MathUtils.converData(item.getQuantity(),3));
helper.setText(R.id.tv_dept, item.getStockName()); helper.setText(R.id.tv_dept, item.getStockName());
helper.addOnClickListener(R.id.tv_delete);
AddAndReduceView userNum = helper.getView(R.id.ar_use_num); AddAndReduceView userNum = helper.getView(R.id.ar_use_num);
userNum.setNumber(item.getChooseNum()); userNum.setNumber(item.getChooseNum());
userNum.setMaxNum(item.getQuantity()); userNum.setMaxNum(item.getQuantity());
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginTop="10mm"
android:paddingHorizontal="20mm" android:paddingHorizontal="20mm"
android:paddingVertical="10mm"> android:paddingVertical="10mm">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -15,6 +16,10 @@ ...@@ -15,6 +16,10 @@
android:paddingHorizontal="20mm" android:paddingHorizontal="20mm"
android:paddingVertical="10mm"> android:paddingVertical="10mm">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/tv_top_name" android:id="@+id/tv_top_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -22,6 +27,17 @@ ...@@ -22,6 +27,17 @@
android:text="图号TH82739857" android:text="图号TH82739857"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="删除"
android:layout_alignParentRight="true"
android:paddingHorizontal="5mm"
android:textColor="@color/red"
android:textSize="14sp" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -146,11 +162,12 @@ ...@@ -146,11 +162,12 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="置换产品信息"
android:layout_marginTop="10mm" android:layout_marginTop="10mm"
android:text="置换产品信息"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="16sp" /> android:textSize="16sp" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论