Commit 1096728b by Wyh

1、凍鏈、外送、自取,使用多折扣問題

Signed-off-by: Wyh <1239658231>
parent 5b0327e5
...@@ -50,7 +50,7 @@ class OrderDetails { ...@@ -50,7 +50,7 @@ class OrderDetails {
var NUMBER: Int = 0 var NUMBER: Int = 0
var MEMBER_NAME: String? = null var MEMBER_NAME: String? = null
var PRICE: Double = 0.toDouble() var PRICE: Double = 0.toDouble()
var discount_amount: Double = 0.toDouble() // var discount_amount: Double = 0.toDouble()
var takeTime: String? = null var takeTime: String? = null
var PHONE: String? = null var PHONE: String? = null
var memberTypeId: Int = 0 var memberTypeId: Int = 0
...@@ -188,7 +188,7 @@ class OrderDetails { ...@@ -188,7 +188,7 @@ class OrderDetails {
} }
} }
data class CouponBean(val couponName: String, val discount_amount: Float) : Serializable data class CouponBean(val id: Int, val couponName: String, val discount_amount: Double) : Serializable
data class PayMultiple(val payTypeId: String, val amount: Double, val payName: String, val points: Double) : Serializable data class PayMultiple(val payTypeId: String, val amount: Double, val payName: String, val points: Double) : Serializable
} }
......
package com.gingersoft.gsa.cloud.common.core.print.bean.adapter; package com.gingersoft.gsa.cloud.common.core.print.bean.adapter;
import android.text.TextUtils;
import android.view.View;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.R;
import com.gingersoft.gsa.cloud.common.constans.AppConstans; import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintCleanMachineContent;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails; import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintCleanMachineContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayCheckoutContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayCheckoutContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayFormContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayFormContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintBillItem; import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintBillItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintFoodItem; import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintFoodItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintPayTypeItem; import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintPayTypeItem;
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils; import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport; import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.jess.arms.utils.ArmsUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -124,7 +116,13 @@ public class PrintContentAdapter implements AdaptationContent { ...@@ -124,7 +116,13 @@ public class PrintContentAdapter implements AdaptationContent {
takeawayPrintContent.setTotalAmountText("總金額: "); takeawayPrintContent.setTotalAmountText("總金額: ");
takeawayPrintContent.setTotalAmount(AppConstans.CARSH_STR + data.getTOTAL_AMOUNT()); takeawayPrintContent.setTotalAmount(AppConstans.CARSH_STR + data.getTOTAL_AMOUNT());
takeawayPrintContent.setPayAmountText("支付金額: "); takeawayPrintContent.setPayAmountText("支付金額: ");
takeawayPrintContent.setPayAmount(AppConstans.CARSH_STR + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())); double disCount = 0.0;
if (data.getCouponList() != null) {
for (OrderDetails.DataBean.CouponBean couponBean : data.getCouponList()) {
disCount = MoneyUtil.sum(disCount, couponBean.getDiscount_amount());
}
}
takeawayPrintContent.setPayAmount(AppConstans.CARSH_STR + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), disCount));
takeawayPrintContent.setMemberName("會員名稱: " + data.getMEMBER_NAME()); takeawayPrintContent.setMemberName("會員名稱: " + data.getMEMBER_NAME());
// takeawayPrintContent.setMemberNumber(data.getm); // takeawayPrintContent.setMemberNumber(data.getm);
takeawayPrintContent.setMemberPhone("會員電話: " + data.getPHONE()); takeawayPrintContent.setMemberPhone("會員電話: " + data.getPHONE());
......
...@@ -46,10 +46,12 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -46,10 +46,12 @@ public abstract class DialogUtils implements LifecycleObserver {
view = LayoutInflater.from(mContext).inflate(xmlLayout, null); view = LayoutInflater.from(mContext).inflate(xmlLayout, null);
init(mContext); init(mContext);
} }
public DialogUtils(Context mContext, View view) { public DialogUtils(Context mContext, View view) {
this.view = view; this.view = view;
init(mContext); init(mContext);
} }
private void init(Context context) { private void init(Context context) {
dialog = new Dialog(context); dialog = new Dialog(context);
viewHepler = getViewHepler(context); viewHepler = getViewHepler(context);
......
...@@ -38,7 +38,6 @@ public class LoadingDialog { ...@@ -38,7 +38,6 @@ public class LoadingDialog {
View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null); View view = LayoutInflater.from(context).inflate(R.layout.ui_dialog_loading, null);
TextView loadingText = view.findViewById(R.id.tv_loading_dialog_text); TextView loadingText = view.findViewById(R.id.tv_loading_dialog_text);
loadingText.setText(msg); loadingText.setText(msg);
if (mLoadingDialog == null) { if (mLoadingDialog == null) {
mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog); mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
} }
......
...@@ -218,6 +218,8 @@ public class OkHttp3Utils { ...@@ -218,6 +218,8 @@ public class OkHttp3Utils {
}); });
} }
/** /**
* 心跳接口報錯,推送給相關人員 * 心跳接口報錯,推送給相關人員
* 版本,時間,RP_HD001,Gingersoft,GS1,26ErrorMsg:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx * 版本,時間,RP_HD001,Gingersoft,GS1,26ErrorMsg:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
......
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/horizontal_dividing_line"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="@color/color_ef" />
...@@ -409,7 +409,13 @@ ...@@ -409,7 +409,13 @@
<item name="android:textColor">@color/white</item> <item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_14</item> <item name="android:textSize">@dimen/dp_14</item>
</style> </style>
<style name="AppEditTextStyle">
<item name="android:textColorHint">@color/color_c9</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:gravity">center_vertical|right</item>
<item name="android:textColor">@color/color_3c</item>
<item name="android:background">@null</item>
</style>
<style name="otherOrder_delivery_setting_layout_style"> <style name="otherOrder_delivery_setting_layout_style">
<item name="android:paddingRight">@dimen/dp_20</item> <item name="android:paddingRight">@dimen/dp_20</item>
</style> </style>
......
...@@ -10,13 +10,13 @@ import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean; ...@@ -10,13 +10,13 @@ import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem; import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean; import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.user.UserContext; import com.gingersoft.gsa.cloud.common.core.user.UserContext;
import com.gingersoft.gsa.cloud.common.utils.FileUtils; import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.log.LogUtil; import com.gingersoft.gsa.cloud.common.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
...@@ -70,6 +70,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -70,6 +70,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
this.mAppManager = null; this.mAppManager = null;
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
if (downloadDisposable != null) {
downloadDisposable.dispose();
downloadDisposable = null;
}
} }
public void findOrderDetails(int orderId, int isRead) { public void findOrderDetails(int orderId, int isRead) {
...@@ -275,10 +279,12 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -275,10 +279,12 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
} }
Disposable downloadDisposable;
public void download(int orderId, String url) { public void download(int orderId, String url) {
try { try {
updatePrintPdfStatus(orderId); updatePrintPdfStatus(orderId);
Disposable download_success = Observable.create((ObservableOnSubscribe<File>) emitter -> { downloadDisposable = Observable.create((ObservableOnSubscribe<File>) emitter -> {
OkHttpClient client = new OkHttpClient.Builder().build(); OkHttpClient client = new OkHttpClient.Builder().build();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(url) .url(url)
...@@ -308,6 +314,9 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -308,6 +314,9 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
fos.write(buf, 0, len); fos.write(buf, 0, len);
sum += len; sum += len;
int progress = (int) (sum * 1.0f / total * 100); int progress = (int) (sum * 1.0f / total * 100);
if (downloadDisposable == null || downloadDisposable.isDisposed()) {
return;
}
mRootView.showLoading("下載打印文檔中" + progress + "%"); mRootView.showLoading("下載打印文檔中" + progress + "%");
LogUtil.e(TAG, "download progress : " + progress); LogUtil.e(TAG, "download progress : " + progress);
} }
...@@ -319,14 +328,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -319,14 +328,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
LogUtil.e(TAG, "download failed : " + e.getMessage()); LogUtil.e(TAG, "download failed : " + e.getMessage());
} finally { } finally {
try { try {
if (is != null) if (is != null) {
is.close(); is.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
if (fos != null) if (fos != null) {
fos.close(); fos.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -443,7 +454,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -443,7 +454,8 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
.build(); .build();
mModel.updatePrintPdfStatus(requestBody) mModel.updatePrintPdfStatus(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> { }) .doOnSubscribe(disposable -> {
})
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......
...@@ -7,6 +7,8 @@ import android.os.Bundle; ...@@ -7,6 +7,8 @@ import android.os.Bundle;
import android.print.PrintManager; import android.print.PrintManager;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -96,8 +98,12 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -96,8 +98,12 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
TextView mTvLunchboxCost; TextView mTvLunchboxCost;
@BindView(R2.id.tv_delivery_fee) @BindView(R2.id.tv_delivery_fee)
TextView mTvDeliveryFee; TextView mTvDeliveryFee;
@BindView(R2.id.tv_discount) // @BindView(R2.id.tv_discount)
TextView mTvDiscount; // TextView mTvDiscount;
@BindView(R2.id.layout_discount)
LinearLayout layoutDiscount;
@BindView(R2.id.tv_total_amount2) @BindView(R2.id.tv_total_amount2)
TextView mTvTotalAmount2; TextView mTvTotalAmount2;
@BindView(R2.id.tv_pay_amount) @BindView(R2.id.tv_pay_amount)
...@@ -244,9 +250,19 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im ...@@ -244,9 +250,19 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> im
mTvTotalAmount.setText(amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getLunchbox()), bean.getDELIVERY_CHARGE())); mTvTotalAmount.setText(amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getLunchbox()), bean.getDELIVERY_CHARGE()));
mTvLunchboxCost.setText(amountUnit + bean.getLunchbox()); mTvLunchboxCost.setText(amountUnit + bean.getLunchbox());
mTvDeliveryFee.setText(amountUnit + bean.getDELIVERY_CHARGE()); mTvDeliveryFee.setText(amountUnit + bean.getDELIVERY_CHARGE());
mTvDiscount.setText(amountUnit + bean.getDiscount_amount());
mTvTotalAmount2.setText(amountUnit + MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getDiscount_amount())); double totalAmount = Double.parseDouble(bean.getTOTAL_AMOUNT());
mTvPayAmount.setText(amountUnit + MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getDiscount_amount())); if (bean.getCouponList() != null) {
for (OrderDetails.DataBean.CouponBean couponBean : bean.getCouponList()) {
View view = View.inflate(mContext, R.layout.item_discount, null);
((TextView) view.findViewById(R.id.tv_discount_text)).setText(couponBean.getCouponName() + ":");
((TextView) view.findViewById(R.id.tv_discount_amount)).setText("$" + couponBean.getDiscount_amount());
layoutDiscount.addView(view);
totalAmount = MoneyUtil.sub(totalAmount, couponBean.getDiscount_amount());
}
}
mTvTotalAmount2.setText(amountUnit + totalAmount);
mTvPayAmount.setText(amountUnit + totalAmount);
if (bean.getOrderPayType() == 2 && bean.getPayMultiple() != null) { if (bean.getOrderPayType() == 2 && bean.getPayMultiple() != null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10">
<TextView
android:id="@+id/tv_discount_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="折扣名:" />
<TextView
android:id="@+id/tv_discount_amount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
tools:text="折扣金額" />
</LinearLayout>
\ No newline at end of file
...@@ -17,17 +17,18 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -17,17 +17,18 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.ethanhua.skeleton.Skeleton import com.ethanhua.skeleton.Skeleton
import com.ethanhua.skeleton.ViewSkeletonScreen import com.ethanhua.skeleton.ViewSkeletonScreen
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.constans.FunctionManagerConstants
import com.gingersoft.gsa.cloud.common.function.FunctionManager import com.gingersoft.gsa.cloud.common.function.FunctionManager
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog
import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder import com.gingersoft.gsa.cloud.common.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.common.ui.view.AddKeyBoard import com.gingersoft.gsa.cloud.common.ui.view.AddKeyBoard
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.MessageBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.MessageBean
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.ServiceChargeRecordBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.ServiceChargeRecordBean
...@@ -51,7 +52,6 @@ import com.gingersoft.gsa.delivery_pick_mode.util.showWaringDialog ...@@ -51,7 +52,6 @@ import com.gingersoft.gsa.delivery_pick_mode.util.showWaringDialog
import com.jess.arms.mvp.IPresenter import com.jess.arms.mvp.IPresenter
import com.qmuiteam.qmui.widget.QMUITopBar import com.qmuiteam.qmui.widget.QMUITopBar
import kotlinx.android.synthetic.main.activity_order_details.* import kotlinx.android.synthetic.main.activity_order_details.*
import java.lang.StringBuilder
import java.util.* import java.util.*
class OrderDetailsActivity : BaseActivity<IPresenter>() { class OrderDetailsActivity : BaseActivity<IPresenter>() {
...@@ -135,9 +135,18 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -135,9 +135,18 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
orderDetails.order_type = orderType orderDetails.order_type = orderType
orderDetails.orderPayType = orderPayType orderDetails.orderPayType = orderPayType
binding.data = orderDetails binding.data = orderDetails
binding.totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble()
binding.isSelf = orderDetails.order_type == 7 binding.isSelf = orderDetails.order_type == 7
var totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble()
orderDetails.couponList?.let {
for (coupon in it) {
val view = View.inflate(mContext, R.layout.item_discount, null)
view.findViewById<TextView>(R.id.tv_discount_text).text = coupon.couponName + ":"
view.findViewById<TextView>(R.id.tv_discount_amount).text = "$" + coupon.discount_amount
layout_takeaway_discount.addView(view)
totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount)
}
}
binding.totalAmount = totalAmount
val btnList = ArrayList<BtnBuilder.BtnBean>() val btnList = ArrayList<BtnBuilder.BtnBean>()
val orderStatusText: String val orderStatusText: String
......
...@@ -7,12 +7,12 @@ import androidx.core.content.ContextCompat ...@@ -7,12 +7,12 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod import com.gingersoft.gsa.cloud.common.core.pay.PayMethod
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel
...@@ -57,7 +57,13 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -57,7 +57,13 @@ class PayActivity : BaseActivity<IPresenter>() {
foodCount += bean.num!!.toInt() foodCount += bean.num!!.toInt()
} }
} }
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount) var totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble()
orderDetails.couponList?.let {
for (coupon in it){
totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount)
}
}
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), totalAmount, foodCount)
pageViewModel.getPayMethod(ResturantInfoManager.newInstance().getBrandId(), ResturantInfoManager.newInstance().getRestaurantId()) pageViewModel.getPayMethod(ResturantInfoManager.newInstance().getBrandId(), ResturantInfoManager.newInstance().getRestaurantId())
pageViewModel.payTypeBean.observe(this, Observer { pageViewModel.payTypeBean.observe(this, Observer {
...@@ -106,10 +112,12 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -106,10 +112,12 @@ class PayActivity : BaseActivity<IPresenter>() {
if (orderDetails.DELIVERY_CHARGE > 0) { if (orderDetails.DELIVERY_CHARGE > 0) {
billBeans.add(BillBean("送貨費:", orderDetails.DELIVERY_CHARGE)) billBeans.add(BillBean("送貨費:", orderDetails.DELIVERY_CHARGE))
} }
if (orderDetails.discount_amount > 0) { orderDetails.couponList?.let {
billBeans.add(BillBean("折扣:", orderDetails.discount_amount, 1)) for (coupon in it){
billBeans.add(BillBean(coupon.couponName+":", coupon.discount_amount, 1))
}
} }
billBeans.add(BillBean("支付金額:", MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount))) billBeans.add(BillBean("支付金額:", totalAmount))
rv_order_pay_bill.layoutManager = LinearLayoutManager(this) rv_order_pay_bill.layoutManager = LinearLayoutManager(this)
rv_order_pay_bill.adapter = PayBillAdapter(R.layout.item_pay_bill, billBeans) rv_order_pay_bill.adapter = PayBillAdapter(R.layout.item_pay_bill, billBeans)
} }
......
...@@ -13,10 +13,10 @@ import androidx.core.content.ContextCompat ...@@ -13,10 +13,10 @@ import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil import com.gingersoft.gsa.cloud.common.utils.other.TextUtil
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.BillBean
import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutOrderInfoDialogNewBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.LayoutOrderInfoDialogNewBinding
...@@ -34,8 +34,12 @@ object OtherOrderUtils { ...@@ -34,8 +34,12 @@ object OtherOrderUtils {
val tvStatus = hepler.getView<TextView>(R.id.tv_order_state) val tvStatus = hepler.getView<TextView>(R.id.tv_order_state)
val orderData = data.data!![0] val orderData = data.data!![0]
val layoutOrderInfoDialogBinding: LayoutOrderInfoDialogNewBinding = DataBindingUtil.bind(hepler.contentView)!! val layoutOrderInfoDialogBinding: LayoutOrderInfoDialogNewBinding = DataBindingUtil.bind(hepler.contentView)!!
val totalAmount = orderData.TOTAL_AMOUNT!!.toDouble() var totalAmount = orderData.TOTAL_AMOUNT!!.toDouble()
orderData.couponList?.let {
for(coupon in it){
totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount)
}
}
layoutOrderInfoDialogBinding.data = orderData layoutOrderInfoDialogBinding.data = orderData
layoutOrderInfoDialogBinding.isSelf = orderType == 7 layoutOrderInfoDialogBinding.isSelf = orderType == 7
layoutOrderInfoDialogBinding.totalAmount = totalAmount layoutOrderInfoDialogBinding.totalAmount = totalAmount
...@@ -131,7 +135,7 @@ object OtherOrderUtils { ...@@ -131,7 +135,7 @@ object OtherOrderUtils {
} }
} }
} }
billBeans.add(BillBean("支付金額:", MoneyUtil.sub(totalAmount, orderData.discount_amount), 1)) billBeans.add(BillBean("支付金額:", totalAmount, 1))
orderData.payMultiple?.let { orderData.payMultiple?.let {
for (payMultiple in it) { for (payMultiple in it) {
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<variable <variable
name="totalAmount" name="totalAmount"
type="Double" /> type="Double" />
<variable <variable
name="data" name="data"
type="com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean" /> type="com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean" />
...@@ -531,32 +530,13 @@ ...@@ -531,32 +530,13 @@
android:text="@{@string/amount_unit + data.dELIVERY_CHARGE}" /> android:text="@{@string/amount_unit + data.dELIVERY_CHARGE}" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <LinearLayout
android:id="@+id/layout_takeaway_discount"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft" android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft" android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft"/>
android:visibility="@{data.discount_amount==0?View.GONE:View.VISIBLE}">
<TextView
android:id="@+id/tv_discount_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="折扣:" />
<TextView
android:id="@+id/tv_discount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_discount_text"
android:gravity="right"
android:text="@{@string/minus_amount_unit + data.discount_amount}" />
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -580,7 +560,7 @@ ...@@ -580,7 +560,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_total_amount_text2" android:layout_toRightOf="@id/tv_total_amount_text2"
android:gravity="right" android:gravity="right"
android:text="@{@string/amount_unit + MoneyUtil.sub(totalAmount, data.discount_amount)}" /> android:text="@{@string/amount_unit + totalAmount}" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
...@@ -605,7 +585,7 @@ ...@@ -605,7 +585,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_pay_amount_text" android:layout_toRightOf="@id/tv_pay_amount_text"
android:gravity="right" android:gravity="right"
android:text="@{@string/amount_unit + MoneyUtil.sub(totalAmount, data.discount_amount)}" android:text="@{@string/amount_unit + totalAmount}"
android:textColor="#FF0000" /> android:textColor="#FF0000" />
</RelativeLayout> </RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10">
<TextView
android:id="@+id/tv_discount_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="折扣名:" />
<TextView
android:id="@+id/tv_discount_amount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
tools:text="折扣金額" />
</LinearLayout>
\ No newline at end of file
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/amount_unit + MoneyUtil.sub(total_amount, data.discount_amount)}" android:text="@{@string/amount_unit + total_amount}"
android:textColor="#BE1C42" android:textColor="#BE1C42"
android:textSize="@dimen/dp_24" android:textSize="@dimen/dp_24"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
......
...@@ -448,16 +448,18 @@ public class PrintInfoBean { ...@@ -448,16 +448,18 @@ public class PrintInfoBean {
if (data.getDELIVERY_CHARGE() != 0) { if (data.getDELIVERY_CHARGE() != 0) {
printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText("送貨費啊啥的和發哈是打飛機:", "$" + data.getDELIVERY_CHARGE(), paperWidth)}, new Boolean[]{false}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText("送貨費啊啥的和發哈是打飛機:", "$" + data.getDELIVERY_CHARGE(), paperWidth)}, new Boolean[]{false}, new Double[]{1d}));
} }
double totalAmount = Double.parseDouble(data.getTOTAL_AMOUNT());
if (data.getCouponList() != null && data.getCouponList().size() > 0) { if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) { for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText(coupon.getCouponName() + ":", "-$" + coupon.getDiscount_amount(), paperWidth)}, new Boolean[]{false}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText(coupon.getCouponName() + ":", "-$" + coupon.getDiscount_amount(), paperWidth)}, new Boolean[]{false}, new Double[]{1d}));
totalAmount = MoneyUtil.sub(totalAmount, coupon.getDiscount_amount());
} }
} }
printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText("總金額啊啥的和發哈是打飛機:", "$" + data.getTOTAL_AMOUNT(), paperWidth / 2)}, new Boolean[]{true}, new Double[]{2d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLeftRightText("總金額啊啥的和發哈是打飛機:", "$" + data.getTOTAL_AMOUNT(), paperWidth / 2)}, new Boolean[]{true}, new Double[]{2d}));
printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d}));
printInfoBeans.add(new PrintInfoBean(new String[]{"支付金額:", "$" + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())}, new Boolean[]{true}, new Double[]{2d}, 0)); printInfoBeans.add(new PrintInfoBean(new String[]{"支付金額:", "$" + totalAmount}, new Boolean[]{true}, new Double[]{2d}, 0));
printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d})); printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1, paperWidth)}, new Double[]{1d}));
......
...@@ -96,9 +96,11 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> { ...@@ -96,9 +96,11 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
if (data.getDELIVERY_CHARGE() != 0) { if (data.getDELIVERY_CHARGE() != 0) {
billData.add(getBillBean("送貨費:", MONETARY_UNIT + data.getDELIVERY_CHARGE())); billData.add(getBillBean("送貨費:", MONETARY_UNIT + data.getDELIVERY_CHARGE()));
} }
double totalAmount = Double.parseDouble(data.getTOTAL_AMOUNT());
if (data.getCouponList() != null && data.getCouponList().size() > 0) { if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) { for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
billData.add(getBillBean(coupon.getCouponName() + ":", "-" + MONETARY_UNIT + coupon.getDiscount_amount())); billData.add(getBillBean(coupon.getCouponName() + ":", "-" + MONETARY_UNIT + coupon.getDiscount_amount()));
totalAmount = MoneyUtil.sub(totalAmount, coupon.getDiscount_amount());
} }
} }
layout.addView(getTakeawayBillInfoView(mContext, billData)); layout.addView(getTakeawayBillInfoView(mContext, billData));
...@@ -107,7 +109,7 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> { ...@@ -107,7 +109,7 @@ public class PrintOtherOrder extends PrinterRoot<PrintTakeawayFormContent> {
layout.addView(getTakeawayLargeAmount(mContext, "總金額:", MONETARY_UNIT + data.getTOTAL_AMOUNT())); layout.addView(getTakeawayLargeAmount(mContext, "總金額:", MONETARY_UNIT + data.getTOTAL_AMOUNT()));
layout.addView(getLine(mContext)); layout.addView(getLine(mContext));
//支付信息 //支付信息
addTakeawayPayViews(mContext, layout, data.getPayMultiple(), MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())); addTakeawayPayViews(mContext, layout, data.getPayMultiple(), totalAmount);
//用戶信息 //用戶信息
getTakeawayReceiver(mContext, data, layout); getTakeawayReceiver(mContext, data, layout);
//尾部 //尾部
......
...@@ -227,9 +227,11 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon ...@@ -227,9 +227,11 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon
if (data.getDELIVERY_CHARGE() != 0) { if (data.getDELIVERY_CHARGE() != 0) {
billData.add(getBillBean("送貨費:", MONETARY_UNIT + data.getDELIVERY_CHARGE())); billData.add(getBillBean("送貨費:", MONETARY_UNIT + data.getDELIVERY_CHARGE()));
} }
double totalAmount = Double.parseDouble(data.getTOTAL_AMOUNT());
if (data.getCouponList() != null && data.getCouponList().size() > 0) { if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) { for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
billData.add(getBillBean(coupon.getCouponName() + ":", "-" + MONETARY_UNIT + coupon.getDiscount_amount())); billData.add(getBillBean(coupon.getCouponName() + ":", "-" + MONETARY_UNIT + coupon.getDiscount_amount()));
totalAmount = MoneyUtil.sub(totalAmount, coupon.getDiscount_amount());
} }
} }
layout.addView(getTakeawayBillInfoView(mContext, billData)); layout.addView(getTakeawayBillInfoView(mContext, billData));
...@@ -237,17 +239,7 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon ...@@ -237,17 +239,7 @@ public class PrintOtherOrderClosing extends PrinterRoot<PrintTakeawayCheckoutCon
//總金額34sp //總金額34sp
layout.addView(getTakeawayLargeAmount(mContext, "總金額:", MONETARY_UNIT + data.getTOTAL_AMOUNT())); layout.addView(getTakeawayLargeAmount(mContext, "總金額:", MONETARY_UNIT + data.getTOTAL_AMOUNT()));
layout.addView(getLine(mContext)); layout.addView(getLine(mContext));
// if (data.getPayMultiple() != null && data.getPayMultiple().size() > 0) { addTakeawayPayViews(mContext, layout, data.getPayMultiple(), totalAmount);
// for (OrderDetails.DataBean.PayMultiple payMultiple : data.getPayMultiple()) {
// if (!TextUtil.isEmptyOrNullOrUndefined(payMultiple.getPayName())) {
// layout.addView(getTakeawayLargeAmount(mContext, payMultiple.getPayName(), MONETARY_UNIT + payMultiple.getAmount()));
// }
// }
// layout.addView(getLine(mContext));
// } else {
// layout.addView(getTakeawayLargeAmount(mContext, "支付金額:", MONETARY_UNIT + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()) + ""));
// }
addTakeawayPayViews(mContext, layout, data.getPayMultiple(), MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
//會員信息 //會員信息
layout.addView(getTakeawayMemberIntegerView(mContext, data)); layout.addView(getTakeawayMemberIntegerView(mContext, data));
......
...@@ -25,30 +25,14 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -25,30 +25,14 @@ import androidx.recyclerview.widget.RecyclerView;
import com.epson.epos2.printer.Printer; import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo; import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener; import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.joe.print.mvp.ui.adapter.BillAdapter;
import com.joe.print.mvp.ui.adapter.BillTypeAdapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication; import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.joe.print.mvp.model.bean.BillingBean; import com.gingersoft.gsa.cloud.common.constans.AppConstans;
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod; import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.joe.print.mvp.ui.adapter.FoodAdapter; import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.core.order.billItem.BillItem; import com.gingersoft.gsa.cloud.common.core.order.billItem.BillItem;
import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail; import com.gingersoft.gsa.cloud.common.core.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.common.core.order.order.DoshokuOrder; import com.gingersoft.gsa.cloud.common.core.order.order.DoshokuOrder;
import com.gingersoft.gsa.cloud.common.core.table.TableBean; import com.gingersoft.gsa.cloud.common.core.pay.PayMethod;
import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.common.utils.AidlUtil;
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.common.utils.StringUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils;
import com.gingersoft.gsa.cloud.common.utils.view.QRCodeUtil;
import com.gingersoft.gsa.cloud.common.constans.ExpandConstant;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.common.core.print.PrintExecutor; import com.gingersoft.gsa.cloud.common.core.print.PrintExecutor;
import com.gingersoft.gsa.cloud.common.core.print.PrintSocketHolder; import com.gingersoft.gsa.cloud.common.core.print.PrintSocketHolder;
import com.gingersoft.gsa.cloud.common.core.print.PrinterWriter58mm; import com.gingersoft.gsa.cloud.common.core.print.PrinterWriter58mm;
...@@ -56,16 +40,28 @@ import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails; ...@@ -56,16 +40,28 @@ import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayCheckoutContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayCheckoutContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayFormContent; import com.gingersoft.gsa.cloud.common.core.print.bean.PrintTakeawayFormContent;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintBillItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintFoodItem; import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintFoodItem;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintPayTypeItem; import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintPayTypeItem;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
import com.gingersoft.gsa.cloud.common.utils.AidlUtil;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.view.ImageUtils;
import com.gingersoft.gsa.cloud.common.utils.view.LayoutToBitmapUtils;
import com.gingersoft.gsa.cloud.common.utils.view.QRCodeUtil;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.google.zxing.WriterException; import com.google.zxing.WriterException;
import com.hyweb.n5.lib.constant.PrinterConstant; import com.hyweb.n5.lib.constant.PrinterConstant;
import com.hyweb.n5.lib.util.PrinterUtil; import com.hyweb.n5.lib.util.PrinterUtil;
import com.hyweb.n5.server.aidl.IOnPrintCallback; import com.hyweb.n5.server.aidl.IOnPrintCallback;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.joe.print.R; import com.joe.print.R;
import com.joe.print.mvp.model.bean.BillingBean;
import com.joe.print.mvp.model.bean.HtmlLable; import com.joe.print.mvp.model.bean.HtmlLable;
import com.gingersoft.gsa.cloud.common.core.print.bean.base.PrintBillItem;
import com.joe.print.mvp.print.common.HtmlContract; import com.joe.print.mvp.print.common.HtmlContract;
import com.joe.print.mvp.print.common.PrinterFinderCallback; import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
...@@ -74,7 +70,10 @@ import com.joe.print.mvp.print.usb.UsbPrint; ...@@ -74,7 +70,10 @@ import com.joe.print.mvp.print.usb.UsbPrint;
import com.joe.print.mvp.print.usb.UsbPrinter; import com.joe.print.mvp.print.usb.UsbPrinter;
import com.joe.print.mvp.print.usb.UsbPrinterFinder; import com.joe.print.mvp.print.usb.UsbPrinterFinder;
import com.joe.print.mvp.print.utils.BBposPrint; import com.joe.print.mvp.print.utils.BBposPrint;
import com.joe.print.mvp.ui.adapter.BillAdapter;
import com.joe.print.mvp.ui.adapter.BillItemAdapter; import com.joe.print.mvp.ui.adapter.BillItemAdapter;
import com.joe.print.mvp.ui.adapter.BillTypeAdapter;
import com.joe.print.mvp.ui.adapter.FoodAdapter;
import com.sunmi.peripheral.printer.InnerResultCallbcak; import com.sunmi.peripheral.printer.InnerResultCallbcak;
import java.io.IOException; import java.io.IOException;
...@@ -90,8 +89,6 @@ import lombok.Getter; ...@@ -90,8 +89,6 @@ import lombok.Getter;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_COLUMN; import static com.joe.print.mvp.print.common.HtmlContract.LABLE_COLUMN;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV; import static com.joe.print.mvp.print.common.HtmlContract.LABLE_DIV;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_H2;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_H3;
import static com.joe.print.mvp.print.common.HtmlContract.LABLE_P; import static com.joe.print.mvp.print.common.HtmlContract.LABLE_P;
@Getter @Getter
......
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.ConfirmOrderModule;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.ConfirmOrderFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = ConfirmOrderModule.class, dependencies = AppComponent.class)
public interface ConfirmOrderComponent {
void inject(ConfirmOrderFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
ConfirmOrderComponent.Builder view(ConfirmOrderContract.View view);
ConfirmOrderComponent.Builder appComponent(AppComponent appComponent);
ConfirmOrderComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.gingersoft.supply_chain.mvp.model.ConfirmOrderModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class ConfirmOrderModule {
@Binds
abstract ConfirmOrderContract.Model bindConfirmOrderModel(ConfirmOrderModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/17
* Time: 11:36
* Use:
*/
@Data
public class ConfirmOrderBean {
private static class purchaseOrder{
}
private String supplierName;
private String sendAddress;
private String sendTime;
private String totalAmount;
private String freight;
private String payAmount;
private String remarks;
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface ConfirmOrderContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel{
}
}
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class ConfirmOrderModel extends BaseModel implements ConfirmOrderContract.Model{
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public ConfirmOrderModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Model, ConfirmOrderContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
private List<List<PurchaseFoodListVosBean>> supplierFoods;
@Inject
public ConfirmOrderPresenter(ConfirmOrderContract.Model model, ConfirmOrderContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void organizeShopCartData() {
Map<Integer, List<PurchaseFoodListVosBean>> listMap = new HashMap<>(4);
double totalPrice = 0;
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//計算總價
if (cartFood.isChecked()) {
totalPrice = MoneyUtil.sum(totalPrice, MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodCount()));
totalTypeNumber++;
}
List<PurchaseFoodListVosBean> foodListVosBeans = listMap.get(cartFood.getSupplierId());
if (foodListVosBeans == null) {
foodListVosBeans = new ArrayList<>();
foodListVosBeans.add(cartFood);
listMap.put(cartFood.getSupplierId(), foodListVosBeans);
} else {
foodListVosBeans.add(cartFood);
}
}
supplierFoods = new ArrayList<>();
supplierFoods.addAll(listMap.values());
mRootView.loadAdapter(supplierFoods);
}
}
...@@ -212,6 +212,11 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr ...@@ -212,6 +212,11 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
* @param integerMap 存放食品id和數量的map * @param integerMap 存放食品id和數量的map
*/ */
public void getSelectFood(Map<Integer, PurchaseFoodListVosBean> integerMap) { public void getSelectFood(Map<Integer, PurchaseFoodListVosBean> integerMap) {
for (PurchaseFoodListVosBean purchaseFoodListVosBean : integerMap.values()) {
if (purchaseFoodListVosBean.getFoodCount() <= 0) {
integerMap.remove(purchaseFoodListVosBean);
}
}
//把購物車的食品取出來 //把購物車的食品取出來
List<PurchaseFoodListVosBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods(); List<PurchaseFoodListVosBean> cartFoods = SupplyShoppingCart.getInstance().getCartFoods();
//清空 //清空
......
package com.gingersoft.supply_chain.mvp.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.supply_chain.R
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean
/**
* @author 宇航.
* User: admin
* Date: 2020/12/17
* Time: 11:35
* Use:
*/
class ConfirmOrderAdapter : BaseQuickAdapter<ConfirmOrderBean, BaseViewHolder>(R.layout.item_confirm_order) {
override fun convert(holder: BaseViewHolder, item: ConfirmOrderBean) {
holder.setText(R.id.tv_confirm_order_item_supplier_name, item.supplierName)
holder.setText(R.id.tv_confirm_order_item_supplier_address, item.sendAddress)
holder.setText(R.id.tv_confirm_order_item_send_time, TimeUtils.getNextDay(1))
holder.setText(R.id.tv_confirm_order_item_total_amount, item.totalAmount.toString())
holder.setText(R.id.tv_confirm_order_item_freight, item.freight)
holder.setText(R.id.tv_confirm_order_item_pay_amount, item.payAmount.toString())
holder.setText(R.id.ed_confirm_order_item_remark, item.remarks)
}
}
\ No newline at end of file
...@@ -32,7 +32,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.FoodIngredientsFragmen ...@@ -32,7 +32,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.FoodIngredientsFragmen
* Time: 10:05 * Time: 10:05
* Use: 供應鏈食品列表 * Use: 供應鏈食品列表
*/ */
public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, BaseViewHolder> { public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, FoodListAdapter.ViewHolder> {
private Context context; private Context context;
/** /**
* 編輯或者下單 * 編輯或者下單
...@@ -66,7 +66,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -66,7 +66,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) { protected void convert(@NotNull ViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) {
viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName()); viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName());
ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img); ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) { if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) {
...@@ -110,7 +110,6 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -110,7 +110,6 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
private OnCheckedChangeListener onCheckedChangeListener; private OnCheckedChangeListener onCheckedChangeListener;
private OnNumberChangeListener onNumberChangeListener; private OnNumberChangeListener onNumberChangeListener;
private TextWatcher foodNumTextWatcher;
public interface OnCheckedChangeListener { public interface OnCheckedChangeListener {
/** /**
...@@ -143,21 +142,20 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -143,21 +142,20 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
* @param viewHolder * @param viewHolder
* @param foodInfoBean * @param foodInfoBean
*/ */
private void setEdit(@NotNull BaseViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) { private void setEdit(@NotNull ViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) {
EditText editText = viewHolder.getView(R.id.ed_food_ingredient_number); EditText editText = viewHolder.getView(R.id.ed_food_ingredient_number);
PurchaseFoodListVosBean food = integerMap.get(foodInfoBean.getId()); PurchaseFoodListVosBean food = integerMap.get(foodInfoBean.getId());
if (viewHolder.textWatcher != null) {
editText.removeTextChangedListener(viewHolder.textWatcher);
}
if (food == null) { if (food == null) {
editText.setText(String.valueOf(0)); editText.setText(String.valueOf(0));
} else { } else {
editText.setText(String.valueOf(food.getFoodCount())); editText.setText(String.valueOf(food.getFoodCount()));
} }
viewHolder.getView(R.id.btn_food_operation_sub).setOnClickListener(v -> { viewHolder.getView(R.id.btn_food_operation_sub).setOnClickListener(v -> subNumber(editText, foodInfoBean));
subNumber(editText, foodInfoBean);
});
viewHolder.getView(R.id.btn_food_operation_add).setOnClickListener(v -> { viewHolder.getView(R.id.btn_food_operation_add).setOnClickListener(v -> addNumber(editText, foodInfoBean));
addNumber(editText, foodInfoBean);
});
// viewHolder.getView(R.id.btn_food_operation_sub).setOnLongClickListener(v -> { // viewHolder.getView(R.id.btn_food_operation_sub).setOnLongClickListener(v -> {
// ThreadFactory namedThreadFactory = r -> null; // ThreadFactory namedThreadFactory = r -> null;
// ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(1, namedThreadFactory); // ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(1, namedThreadFactory);
...@@ -174,7 +172,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -174,7 +172,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
// addNumber(editText, foodInfoBean); // addNumber(editText, foodInfoBean);
// return true; // return true;
// }); // });
foodNumTextWatcher = new TextWatcher() { TextWatcher foodNumTextWatcher = new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
...@@ -189,7 +187,6 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -189,7 +187,6 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
PurchaseFoodListVosBean purchaseFoodListVosBean = getData().get(viewHolder.getAdapterPosition()); PurchaseFoodListVosBean purchaseFoodListVosBean = getData().get(viewHolder.getAdapterPosition());
if (s == null || TextUtil.isEmptyOrNullOrUndefined(s.toString())) { if (s == null || TextUtil.isEmptyOrNullOrUndefined(s.toString())) {
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean);
editText.setText(String.valueOf(0)); editText.setText(String.valueOf(0));
editText.setSelection(editText.getText().length()); editText.setSelection(editText.getText().length());
if (onNumberChangeListener != null) { if (onNumberChangeListener != null) {
...@@ -197,15 +194,17 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -197,15 +194,17 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
} }
} else { } else {
purchaseFoodListVosBean.setFoodCount(Integer.parseInt(s.toString())); purchaseFoodListVosBean.setFoodCount(Integer.parseInt(s.toString()));
if (purchaseFoodListVosBean.getFoodCount() > 0) {
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean); integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean);
}
if (onNumberChangeListener != null) { if (onNumberChangeListener != null) {
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), Integer.parseInt(s.toString()), viewHolder.getAdapterPosition()); onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), Integer.parseInt(s.toString()), viewHolder.getAdapterPosition());
} }
} }
} }
}; };
editText.removeTextChangedListener(foodNumTextWatcher);
editText.addTextChangedListener(foodNumTextWatcher); editText.addTextChangedListener(foodNumTextWatcher);
viewHolder.textWatcher = foodNumTextWatcher;
} }
public void setOnNumberChangeListener(OnNumberChangeListener onNumberChangeListener) { public void setOnNumberChangeListener(OnNumberChangeListener onNumberChangeListener) {
...@@ -229,13 +228,13 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -229,13 +228,13 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
private void subNumber(EditText editText, PurchaseFoodListVosBean foodInfoBean) { private void subNumber(EditText editText, PurchaseFoodListVosBean foodInfoBean) {
PurchaseFoodListVosBean purchaseFoodListVosBean = integerMap.get(foodInfoBean.getId()); PurchaseFoodListVosBean purchaseFoodListVosBean = integerMap.get(foodInfoBean.getId());
if (purchaseFoodListVosBean != null && purchaseFoodListVosBean.getFoodCount() > 0) { if (purchaseFoodListVosBean != null) {
purchaseFoodListVosBean.setFoodCount(purchaseFoodListVosBean.getFoodCount() - 1); purchaseFoodListVosBean.setFoodCount(Math.max(purchaseFoodListVosBean.getFoodCount() - 1, 0));
editText.setText(String.valueOf(purchaseFoodListVosBean.getFoodCount()));
editText.setSelection(editText.getText().length());
if (purchaseFoodListVosBean.getFoodCount() <= 0) { if (purchaseFoodListVosBean.getFoodCount() <= 0) {
integerMap.remove(foodInfoBean.getId()); integerMap.remove(foodInfoBean.getId());
} }
editText.setText(String.valueOf(purchaseFoodListVosBean.getFoodCount()));
editText.setSelection(editText.getText().length());
} else { } else {
integerMap.remove(foodInfoBean.getId()); integerMap.remove(foodInfoBean.getId());
} }
...@@ -244,4 +243,12 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B ...@@ -244,4 +243,12 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
public Map<Integer, PurchaseFoodListVosBean> getIntegerMap() { public Map<Integer, PurchaseFoodListVosBean> getIntegerMap() {
return integerMap; return integerMap;
} }
public static class ViewHolder extends BaseViewHolder {
public TextWatcher textWatcher;
public ViewHolder(@NotNull View view) {
super(view);
}
}
} }
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerConfirmOrderComponent;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.gingersoft.supply_chain.mvp.presenter.ConfirmOrderPresenter;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import butterknife.BindView;
import butterknife.OnClick;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/17/2020 10:24
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class ConfirmOrderFragment extends BaseSupplyChainFragment<ConfirmOrderPresenter> implements ConfirmOrderContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.rv_confirm_order)
RecyclerView rvConfirmOrder;
@BindView(R2.id.btn_confirm_order)
QMUIAlphaTextView btnConfirmOrder;
@BindView(R2.id.btn_cancel_order)
QMUIAlphaTextView btnCancelOrder;
public static ConfirmOrderFragment newInstance() {
ConfirmOrderFragment fragment = new ConfirmOrderFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerConfirmOrderComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_confirm_order, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "採購單確認");
// ConfirmOrderAdapter adapter = new ConfirmOrderAdapter();
// rvConfirmOrder.setAdapter(adapter);
// adapter.setList();
}
@OnClick({R2.id.btn_confirm_order,R2.id.btn_cancel_order})
public void onClick(View view){
}
}
...@@ -77,7 +77,6 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr ...@@ -77,7 +77,6 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(topBar, "採購單"); initTopBar(topBar, "採購單");
mPresenter.organizeShopCartData(); mPresenter.organizeShopCartData();
cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> { cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> {
//全選 //全選
...@@ -108,9 +107,9 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr ...@@ -108,9 +107,9 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
if (viewId == R.id.tv_order_content_complete) { if (viewId == R.id.tv_order_content_complete) {
//完成 //完成
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans(); List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans();
mPresenter.addNewPurchaseOrder(purchaseFoodListVosBeans, edOrderContentRemark.getText() + ""); // mPresenter.addNewPurchaseOrder(purchaseFoodListVosBeans, edOrderContentRemark.getText() + "");
//去到訂單確認頁面 //去到訂單確認頁面
startWithPop(SendMsgFragment.newInstance()); startWithPop(ConfirmOrderFragment.newInstance());
} else if (viewId == R.id.btn_order_content_order_template) { } else if (viewId == R.id.btn_order_content_order_template) {
//訂單模板 //訂單模板
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_confirm_order"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_confirm_order"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_cancel_order"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_weight="1"
android:background="@drawable/shape_black_border_small_radius"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="取消"
android:textColor="@color/color_3c" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical">
<TextView
android:id="@+id/tv_confirm_order_item_supplier_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:textColor="@color/color_222"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
tools:text="供應商名稱" />
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="送貨地址:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_confirm_order_item_supplier_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
tools:text="供應商地址" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="發送時間:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_confirm_order_item_send_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
tools:text="默認為第二天的時間" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="訂單合計($):"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_confirm_order_item_total_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical"
android:text="900"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="運費($):"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_confirm_order_item_freight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical"
android:text="100"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="實際應付($):"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_confirm_order_item_pay_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
tools:text="1000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_8"
android:paddingRight="@dimen/dp_12">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:text="備註:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
<EditText
android:id="@+id/ed_confirm_order_item_remark"
style="@style/AppEditTextStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:gravity="right|center_vertical"
android:hint="請輸入備註"
android:textColor="@color/color_3c"
android:textColorHint="@color/color_c9"
android:textSize="@dimen/dp_15" />
</LinearLayout>
</LinearLayout>
\ 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