Commit e067cdd1 authored by 王海's avatar 王海

Merge remote-tracking branch 'origin/master'

parents 95915c36 c644f5b9
...@@ -481,6 +481,15 @@ public class C { ...@@ -481,6 +481,15 @@ public class C {
public static final int VIP = 6; public static final int VIP = 6;
} }
public final class DIS_TYPE {
//打折
public static final int DIS = 1;
//促销
public static final int PROMOTION = 2;
//满减
public static final int MONEY_OFF = 4;
}
public final class MS_GROUP {//MS_TOUCH_TAG_2 public final class MS_GROUP {//MS_TOUCH_TAG_2
//全部 //全部
public static final int ALL = 1; public static final int ALL = 1;
......
...@@ -9,7 +9,6 @@ import com.chad.library.adapter.base.entity.SectionEntity; ...@@ -9,7 +9,6 @@ import com.chad.library.adapter.base.entity.SectionEntity;
import com.xingdata.api.print.entity.BaseGoodPrint; import com.xingdata.api.print.entity.BaseGoodPrint;
import com.xingdata.api.print.entity.BaseOrderPrint; import com.xingdata.api.print.entity.BaseOrderPrint;
import com.xingdata.zzdpos.C; import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseBean; import com.xingdata.zzdpos.base.BaseBean;
import com.xingdata.zzdpos.base.BaseModel; import com.xingdata.zzdpos.base.BaseModel;
import com.xingdata.zzdpos.util.ConvertUtil; import com.xingdata.zzdpos.util.ConvertUtil;
...@@ -939,45 +938,6 @@ public class Saleorder extends SectionEntity<MediaStore.Video> implements BaseMo ...@@ -939,45 +938,6 @@ public class Saleorder extends SectionEntity<MediaStore.Video> implements BaseMo
return saleorder; return saleorder;
} }
public List<PreferentialProject> getPreferentialProject() {
List<PreferentialProject> preferentialProjects = new ArrayList<>();
if (this.vipOffAmt > 0) {
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_zhe, this.vipOffAmt));
}
if (this.ticketAmt > 0) {
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_quan, this.ticketAmt));
}
if (this.boundNum > 0) {
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_ji, this.boundNum));
}
if (this.cutAmt > 0) {
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_ling, this.cutAmt));
}
for (Map.Entry<Long, Ms> entry : msMap.entrySet()) {
if (entry.getValue().getDisAmt() > 0) {
switch (entry.getValue().getMsTools()) {
case C.MS_TYPE.DIS:
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_zhe, entry.getValue().getDisAmt()));
break;
case C.MS_TYPE.GIFT:
break;
case C.MS_TYPE.MONEY_OFF:
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_man, entry.getValue().getDisAmt()));
break;
case C.MS_TYPE.PROMOTION:
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_cu, entry.getValue().getDisAmt()));
break;
case C.MS_TYPE.SECOND:
preferentialProjects.add(new PreferentialProject(R.mipmap.cart_fragment_zhe, entry.getValue().getDisAmt()));
break;
}
}
}
return preferentialProjects;
}
@Override @Override
public String getOrderTime() { public String getOrderTime() {
...@@ -1104,32 +1064,70 @@ public class Saleorder extends SectionEntity<MediaStore.Video> implements BaseMo ...@@ -1104,32 +1064,70 @@ public class Saleorder extends SectionEntity<MediaStore.Video> implements BaseMo
/** /**
* 优惠项目实体类 * 优惠项目实体类
*/ */
public class PreferentialProject { public class Dis {
public PreferentialProject(Integer bitmapRes, Long money) { private Integer disType;
this.imgRes = bitmapRes; private Long disAmt;
this.money = money;
Dis(Integer disType) {
this.disType = disType;
this.disAmt = 0L;
} }
private Integer imgRes; public Integer getDisType() {
private Long money; return disType;
}
public Integer getImgRes() { public void setDisType(Integer disType) {
return imgRes; this.disType = disType;
} }
public void setImgRes(Integer imgRes) { public Long getDisAmt() {
this.imgRes = imgRes; return disAmt;
} }
public Long getMoney() { public void setDisAmt(Long disAmt) {
return money; this.disAmt = disAmt;
} }
}
public List<Dis> getPreferentialProject() {
Dis dis = new Dis(C.DIS_TYPE.DIS);
Dis moneyOff = new Dis(C.DIS_TYPE.MONEY_OFF);
Dis promotion = new Dis(C.DIS_TYPE.PROMOTION);
public void setMoney(Long money) { if (this.vipOffAmt > 0) dis.setDisAmt(dis.getDisAmt() + this.vipOffAmt);
this.money = money;
for (Map.Entry<Long, Ms> entry : msMap.entrySet()) {
if (entry.getValue().getDisAmt() > 0) {
switch (entry.getValue().getMsTools()) {
case C.MS_TYPE.DIS:
dis.setDisAmt(dis.getDisAmt() + entry.getValue().getDisAmt());
break;
case C.MS_TYPE.GIFT:
break;
case C.MS_TYPE.MONEY_OFF:
moneyOff.setDisAmt(entry.getValue().getDisAmt());
break;
case C.MS_TYPE.PROMOTION:
promotion.setDisAmt(entry.getValue().getDisAmt());
break;
case C.MS_TYPE.SECOND:
dis.setDisAmt(dis.getDisAmt() + entry.getValue().getDisAmt());
break;
}
}
}
List<Dis> disList = new ArrayList<>();
if (dis.getDisAmt() > 0) {
} }
return disList;
} }
public String getFirstName() { public String getFirstName() {
return firstName; return firstName;
} }
......
package com.xingdata.zzdpos.ui.settle.adapter;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseAdapter;
import com.xingdata.zzdpos.databinding.ItemSettleDisBinding;
import com.xingdata.zzdpos.model.Saleorder;
import java.util.ArrayList;
public class DisAdapter extends BaseAdapter<Saleorder.Dis, ItemSettleDisBinding> {
public DisAdapter() {
super(R.layout.item_settle_dis, new ArrayList<>());
}
@Override
protected void convert(ItemSettleDisBinding mViewBinding, Saleorder.Dis item) {
mViewBinding.setAmt(item.getDisAmt());
mViewBinding.setType(item.getDisType());
}
}
package com.xingdata.zzdpos.ui.settle.adapter; package com.xingdata.zzdpos.ui.settle.adapter;
import android.graphics.Paint;
import android.view.View;
import com.xingdata.zzdpos.R; import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseAdapter; import com.xingdata.zzdpos.base.BaseAdapter;
import com.xingdata.zzdpos.databinding.ItemSettleSaledetailBinding; import com.xingdata.zzdpos.databinding.ItemSettleSaledetailBinding;
import com.xingdata.zzdpos.model.Saledetail; import com.xingdata.zzdpos.model.Saledetail;
import com.xingdata.zzdpos.util.ConvertUtil;
import java.util.ArrayList; import java.util.ArrayList;
public class SaledetailAdapter extends BaseAdapter<Saledetail, ItemSettleSaledetailBinding> { public class SaledetailAdapter extends BaseAdapter<Saledetail, ItemSettleSaledetailBinding> {
public SaledetailAdapter() { public SaledetailAdapter() {
super(R.layout.item_store_saledetail, new ArrayList<>()); super(R.layout.item_settle_saledetail, new ArrayList<>());
} }
@Override @Override
protected void convert(ItemSettleSaledetailBinding mViewBinding, Saledetail item) { protected void convert(ItemSettleSaledetailBinding mViewBinding, Saledetail item) {
mViewBinding.tvName.setText(item.getMsId() > 0 ? "【换购】" + item.getSpuName() : item.getSpuName());
mViewBinding.tvCount.setText(String.valueOf(item.getDetailCnt()));
mViewBinding.tvPrice.setText(ConvertUtil.fenToYuan(item.getSkuPricePay(), true));
mViewBinding.tvAmt.setText(ConvertUtil.fenToYuan(item.getDetailAmt(), true));
if (item.isDiscount()) {
mViewBinding.tvInitialPrice.setText(ConvertUtil.fenToYuan(item.getSkuPrice(), true));
mViewBinding.tvInitialPrice.setVisibility(View.VISIBLE);
mViewBinding.tvInitialPrice.setPaintFlags(mViewBinding.tvPrice.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
mViewBinding.tvInitialPrice.setVisibility(View.GONE);
}
} }
} }
package com.xingdata.zzdpos.ui.settle.fragment; package com.xingdata.zzdpos.ui.settle.fragment;
import android.support.design.widget.BottomSheetBehavior; import android.support.design.widget.BottomSheetBehavior;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.StaggeredGridLayoutManager; import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.View; import android.view.View;
...@@ -13,6 +14,7 @@ import com.xingdata.zzdpos.model.Saleorder; ...@@ -13,6 +14,7 @@ import com.xingdata.zzdpos.model.Saleorder;
import com.xingdata.zzdpos.model.Vip; import com.xingdata.zzdpos.model.Vip;
import com.xingdata.zzdpos.ui.settle.SettlePresenter; import com.xingdata.zzdpos.ui.settle.SettlePresenter;
import com.xingdata.zzdpos.ui.settle.adapter.PayAdapter; import com.xingdata.zzdpos.ui.settle.adapter.PayAdapter;
import com.xingdata.zzdpos.ui.settle.adapter.SaledetailAdapter;
import com.xingdata.zzdpos.util.ConvertUtil; import com.xingdata.zzdpos.util.ConvertUtil;
import com.xingdata.zzdpos.util.RecyclerViewUtil; import com.xingdata.zzdpos.util.RecyclerViewUtil;
...@@ -24,6 +26,8 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle ...@@ -24,6 +26,8 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle
private PayAdapter mPayAdapter; private PayAdapter mPayAdapter;
private List<Pay> mPays; private List<Pay> mPays;
private SaledetailAdapter mSaledetailAdapter;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.fragment_settle; return R.layout.fragment_settle;
...@@ -86,6 +90,12 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle ...@@ -86,6 +90,12 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle
* 初始化 * 初始化
*/ */
private void initStoreView() { private void initStoreView() {
//init s
mSaledetailAdapter = new SaledetailAdapter();
mViewBinding.rlSaledetail.setAdapter(mPayAdapter);
mViewBinding.rlSaledetail.setLayoutManager(new LinearLayoutManager(mContext));
//set other listener
mViewBinding.llSaledetail.setOnClickListener(view -> mViewBinding.cbSaledetail.setChecked(!mViewBinding.cbSaledetail.isChecked())); mViewBinding.llSaledetail.setOnClickListener(view -> mViewBinding.cbSaledetail.setChecked(!mViewBinding.cbSaledetail.isChecked()));
mViewBinding.llMs.setOnClickListener(view -> mViewBinding.cbMs.setChecked(!mViewBinding.cbMs.isChecked())); mViewBinding.llMs.setOnClickListener(view -> mViewBinding.cbMs.setChecked(!mViewBinding.cbMs.isChecked()));
...@@ -97,6 +107,8 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle ...@@ -97,6 +107,8 @@ public class SettleFragment extends BaseFragment<SettlePresenter, FragmentSettle
mViewBinding.cbMs.setButtonDrawable(b ? R.mipmap.but_up : R.mipmap.but_unfurled); mViewBinding.cbMs.setButtonDrawable(b ? R.mipmap.but_up : R.mipmap.but_unfurled);
mViewBinding.rlMs.setVisibility(b ? View.VISIBLE : View.GONE); mViewBinding.rlMs.setVisibility(b ? View.VISIBLE : View.GONE);
}); });
//init
} }
......
...@@ -215,12 +215,10 @@ ...@@ -215,12 +215,10 @@
android:foreground="?android:attr/actionBarItemBackground" /> android:foreground="?android:attr/actionBarItemBackground" />
</LinearLayout> </LinearLayout>
<android.support.v7.widget.RecyclerView
<View
android:id="@+id/rl_saledetail" android:id="@+id/rl_saledetail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="wrap_content"
android:background="@color/red_xishi"
android:visibility="gone" /> android:visibility="gone" />
<View <View
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="com.xingdata.zzdpos.util.ConvertUtil" />
<import type="com.xingdata.zzdpos.C.DIS_TYPE" />
<variable
name="type"
type="int" />
<variable
name="amt"
type="long" />
</data>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="0dp"
android:layout_height="0dp"
app:backgroundImage="@color/green_chengyaojin"
app:layout_constraintBottom_toBottomOf="@id/tv_type"
app:layout_constraintLeft_toLeftOf="@id/tv_type"
app:layout_constraintRight_toRightOf="@id/tv_type"
app:layout_constraintTop_toTopOf="@id/tv_type"
app:roundAsCircle="true" />
<TextView
android:id="@+id/tv_type"
android:layout_width="@dimen/all_margin_big"
android:layout_height="@dimen/all_margin_big"
android:layout_marginStart="@dimen/all_margin"
android:gravity="center"
android:text="满"
android:textColor="@color/white_caocao"
android:textSize="@dimen/all_text_size"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
<TextView
android:id="@+id/tv_dis_amt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/all_spacing"
android:text="@{ConvertUtil.fenToYuan(amt,true)}"
android:textColor="@color/black_zhangfei"
app:layout_constraintBottom_toBottomOf="@id/tv_type"
app:layout_constraintLeft_toRightOf="@id/tv_type"
app:layout_constraintTop_toTopOf="@id/tv_type" />
</android.support.constraint.ConstraintLayout>
</layout>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<android.support.constraint.ConstraintLayout <android.support.constraint.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:orientation="vertical" android:background="@color/white_caocao"
android:paddingEnd="@dimen/all_margin" android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin"> android:paddingStart="@dimen/all_margin">
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
app:layout_constraintBottom_toTopOf="@+id/tv_price" app:layout_constraintBottom_toTopOf="@+id/tv_price"
app:layout_constraintLeft_toRightOf="@+id/tv_count" app:layout_constraintLeft_toRightOf="@+id/tv_count"
app:layout_constraintRight_toLeftOf="@+id/tv_amt" app:layout_constraintRight_toLeftOf="@+id/tv_amt"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView <TextView
android:id="@+id/tv_price" android:id="@+id/tv_price"
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:gravity="start"
android:text="@string/cart_amt"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="12"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:gravity="end"
android:text="$40.0"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/white_caocao"
android:gravity="center_vertical"
android:paddingEnd="@dimen/all_margin"
android:paddingStart="@dimen/all_margin">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:gravity="start"
android:text="@string/cart_product_name"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="@string/cart_product_count"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="end"
android:text="@string/cart_product_price"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="end"
android:text="@string/cart_product_amt"
android:textColor="@color/black_baozheng"
android:textSize="@dimen/all_text_size" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:layout_marginEnd="@dimen/all_margin"
android:layout_marginStart="@dimen/all_margin"
android:background="@color/gray_kongming" />
</LinearLayout>
</layout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment