Commit 1019d223 by 宁斌

1、dev分支 1.0.7正式代码

parent 5ff59c46
......@@ -176,6 +176,49 @@ public class PayMethod {
this.nameThird = nameThird;
}
public PayMethod(PayMethod method) {
this.id = method.id;
this.brandId = method.brandId;
this.restaurantId = method.restaurantId;
this.nameFirst = method.nameFirst;
this.nameSecond = method.nameSecond;
this.nameThird = method.nameThird;
this.whetherSales = method.whetherSales;
this.whetherManagerAuthority = method.whetherManagerAuthority;
this.color = method.color;
this.font_color = method.font_color;
this.whetherReportCount = method.whetherReportCount;
this.interactiveType = method.interactiveType;
this.whetherFixedAmount = method.whetherFixedAmount;
this.amountValue = method.amountValue;
this.payType = method.payType;
this.minPayAmount = method.minPayAmount;
this.whetherFreeService =method. whetherFreeService;
this.whetherTaxExemption = method.whetherTaxExemption;
this.whetherSignatureLine =method. whetherSignatureLine;
this.paySeq = method.paySeq;
this.whetherOpenBox = method.whetherOpenBox;
this.getIntegral = method.getIntegral;
this.integralMultiple =method. integralMultiple;
this.deductionIntegral =method. deductionIntegral;
this.dockingType =method. dockingType;
this.billType = method.billType;
this.tablePrintingAmount = method.tablePrintingAmount;
this.takeOutPrintingAmount =method. takeOutPrintingAmount;
this.updateTime = method.updateTime;
this.createTimeX = method.createTimeX;
this.updateUid = method.updateUid;
this.createUid = method.createUid;
this.payMoney =method. payMoney;
this. TipsPrice = method.TipsPrice;
this.payModeTextColor = method.payModeTextColor;
this.payMoneyTextColor =method. payMoneyTextColor;
this.payModeTextSelectColor =method. payModeTextSelectColor;
this.payMoneyTextSelectColor =method. payMoneyTextSelectColor;
this.payModeSize =method. payModeSize;
this.payMoneySize =method. payMoneySize;
}
public String getPayName() {
if (!TextUtils.isEmpty(nameFirst))
return nameFirst;
......
package com.gingersoft.gsa.cloud.base.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-09-28
* 修订历史:2020-09-28
* 描述:
*/
public class BigDecimalUtils {
public static final int DEFALUT_POINT = 2; // 默认保留二位
/**
* 格式化精度
*
* @param v
* @param point
* 小数位数
* @return double
*/
public static Double format(double v, int point) {
BigDecimal b = new BigDecimal(v);
return b.setScale(point, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
* 格式化精度
*
* @param v
* @return double
*/
public static Double format(double v) {
BigDecimal b = new BigDecimal(v);
return b.setScale(DEFALUT_POINT, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
*
* @param v
* @param point
* @return
*/
public static Double formatRoundUp(double v, int point) {
NumberFormat nf = NumberFormat.getInstance();
nf.setRoundingMode(RoundingMode.HALF_UP);//设置四舍五入
nf.setMinimumFractionDigits(point);//设置最小保留几位小数
nf.setMaximumFractionDigits(point);//设置最大保留几位小数
return Double.valueOf(nf.format(v));
}
/**
* 格式化金额。带千位符
*
* @param v
* @return
*/
public static String moneyFormat(Double v) {
DecimalFormat formater = new DecimalFormat();
formater.setMaximumFractionDigits(2);
formater.setGroupingSize(3);
formater.setRoundingMode(RoundingMode.FLOOR);
return formater.format(v.doubleValue());
}
/**
* 带小数的显示小数。不带小数的显示整数
* @param d
* @return
*/
public static String doubleTrans(Double d) {
if (Math.round(d) - d == 0) {
return String.valueOf((long) d.doubleValue());
}
return String.valueOf(d);
}
/**
* BigDecimal 相加
*
* @param v1
* @param v2
* @return double
*/
public static Double add(double v1, double v2) {
BigDecimal n1 = new BigDecimal(Double.toString(v1));
BigDecimal n2 = new BigDecimal(Double.toString(v2));
return n1.add(n2).doubleValue();
}
/**
* BigDecimal 相减
*
* @param v1
* @param v2
* @return double
*/
public static Double subtract(double v1, double v2) {
BigDecimal n1 = new BigDecimal(Double.toString(v1));
BigDecimal n2 = new BigDecimal(Double.toString(v2));
return n1.subtract(n2).doubleValue();
}
/**
* BigDecimal 相乘
*
* @param v1
* @param v2
* @return double
*/
public static Double multiply(double v1, double v2) {
BigDecimal n1 = new BigDecimal(Double.toString(v1));
BigDecimal n2 = new BigDecimal(Double.toString(v2));
return n1.multiply(n2).doubleValue();
}
/**
* BigDecimal 相除
*
* @param v1
* @param v2
* @return double
*/
public static Double divide(double v1, double v2) {
BigDecimal n1 = new BigDecimal(Double.toString(v1));
BigDecimal n2 = new BigDecimal(Double.toString(v2));
return n1.divide(n2, 10, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
* 比较大小 小于0:v1 < v2 大于0:v1 > v2 等于0:v1 = v2
*
* @param v1
* @param v2
* @return
*/
public static int compare(double v1, double v2) {
BigDecimal n1 = new BigDecimal(Double.toString(v1));
BigDecimal n2 = new BigDecimal(Double.toString(v2));
return n1.compareTo(n2);
}
}
......@@ -19,7 +19,6 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
@Override
public Response onHttpResultResponse(String httpResult, Interceptor.Chain chain, Response response) {
// 统一处理http响应。eg:状态码不是200时,根据状态码做相应的处理。
e(httpResult);
return response;
}
......@@ -27,7 +26,6 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
public Request onHttpRequestBefore(Interceptor.Chain chain, Request request) {
// 统一处理http请求。eg:给request统一添加token或者header以及参数加密等操作
String requestBody = request.toString();
e(requestBody);
String token = "";
if (GsaCloudApplication.isLogin) {
......@@ -37,7 +35,7 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
token = token.replaceAll("\r|\n", "");
}
Headers.Builder builder = new Headers.Builder();
builder.set("mobileVersion", android.os.Build.VERSION.RELEASE);//set表示name1是唯一的,会覆盖掉已经存在的,add不会覆盖已经存在的头,可以存在多个
builder.set("mobileVersion", android.os.Build.VERSION.RELEASE);
builder.set("mobielModel", android.os.Build.MODEL);
builder.set("apptype", AppConstans.APP_TYPE);
builder.set("appinfo", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()));
......@@ -57,21 +55,6 @@ public class MyGlobalHttpHandler implements GlobalHttpHandler {
}
private void e(String msg) {
// if (msg == null) {
// return;
// }
//因为String的length是字符数量不是字节数量所以为了防止中文字符过多,
//把4*1024的MAX字节打印长度改为2001字符数
// int max_str_length = 2001 - TAG.length();
//大于4000时
// while (msg.length() > max_str_length) {
// LogUtil.e(TAG, msg);
// msg = msg.substring(max_str_length);
// }
//剩余部分
// LogUtil.e(TAG, msg);
}
}
package com.gingersoft.gsa.cloud.ui.view;
import android.app.Dialog;
import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.R2;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.ThirdViewUtil;
import butterknife.BindView;
import butterknife.OnClick;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2018/5/24
* 修订历史:2018/5/24
* 描述:
*/
public class IntergralKeypadDialog {
private Context mContext;
private Dialog dialog;
@BindView(R2.id.lLayout_bg)
LinearLayout lLayout_bg;
@BindView(R2.id.tv_pay_method)
TextView tv_pay_method;
@BindView(R2.id.ed_value)
EditText ed_value;
@BindView(R2.id.btn_point)
Button btn_point;
public IntergralKeypadDialog(Context context) {
this.mContext = context;
initView();
}
private void initView() {
// 获取Dialog布局
View view = LayoutInflater.from(mContext).inflate(R.layout.table_dialog_intergral_keypad, null);
ThirdViewUtil.bindTarget(this, view);//绑定
// 定义Dialog布局和参数
dialog = new Dialog(mContext, R.style.AlertDialogStyle);
dialog.setContentView(view);
dialog.setCancelable(true);
// 调整dialog背景大小
lLayout_bg.setLayoutParams(
new FrameLayout.LayoutParams((int) (ArmsUtils.getScreenWidth(mContext) * 0.9), ViewGroup.LayoutParams.WRAP_CONTENT));
btn_point.setVisibility(View.GONE);
}
public IntergralKeypadDialog builder() {
return this;
}
@OnClick({R2.id.btn_add_0, R2.id.btn_add_10, R2.id.btn_add_20, R2.id.btn_add_50,
R2.id.btn_100, R2.id.btn_200, R2.id.btn_500, R2.id.btn_1000,
R2.id.btn_0, R2.id.btn_00, R2.id.btn_1, R2.id.btn_2, R2.id.btn_3,
R2.id.btn_4, R2.id.btn_5, R2.id.btn_6, R2.id.btn_7,
R2.id.btn_8, R2.id.btn_9, R2.id.btn_point, R2.id.btn_delete, R2.id.btn_sure})
public void onClick(View v) {
int id = v.getId();
if (id == R.id.btn_0 || id == R.id.btn_00 || id == R.id.btn_1 || id == R.id.btn_2 || id == R.id.btn_3 || id == R.id.btn_4 || id == R.id.btn_5 ||
id == R.id.btn_6 || id == R.id.btn_7 || id == R.id.btn_8 || id == R.id.btn_9) {
String values = v.getTag().toString();
String number = "0";
if (!getInputNumber().isEmpty()) {
number = getInputNumber();
}
if (!number.equals("0")) {
ed_value.setText(number + values);
} else {
ed_value.setText(values);
}
ed_value.setSelection(0, number.length());
} else if (id == R.id.btn_add_10 || id == R.id.btn_add_20 || id == R.id.btn_add_50) {
int i2 = Integer.parseInt(v.getTag().toString());
String valueOf = String.valueOf(i2);
if (!TextUtils.isEmpty(getInputNumber())) {
valueOf = String.valueOf(Double.parseDouble(getInputNumber()) + i2);
}
String[] spvalue = valueOf.split("[.]");
if (spvalue.length > 1 && Integer.parseInt(spvalue[1]) == 0) {
valueOf = spvalue[0];
}
ed_value.setText(valueOf);
} else if (id == R.id.btn_add_0) {
ed_value.setText("0");
} else if (id == R.id.btn_100 || id == R.id.btn_200 || id == R.id.btn_500 || id == R.id.btn_1000) {
int i3 = Integer.parseInt(v.getTag().toString());
String values3 = String.valueOf(i3);
ed_value.setText(values3);
} else if (id == R.id.btn_point) {
String intputStr = getInputNumber();
if (!TextUtils.isEmpty(intputStr) && !intputStr.contains(".")) {
ed_value.setText(intputStr + ".");
}
} else if (id == R.id.btn_delete) {
Editable editable = ed_value.getText();
if (editable.toString().length() > 0) {
editable.delete(ed_value.getText().length() - 1, ed_value.getText().length());
}
} else if (id == R.id.btn_sure) {
if (onComfirmListener != null && !TextUtils.isEmpty(getInputNumber())) {
onComfirmListener.onComfirm(getInputNumber());
}
cancel();
}
}
public IntergralKeypadDialog setCancelable(boolean cancelable) {
dialog.setCancelable(cancelable);
return this;
}
public String getInputNumber() {
return ed_value.getText().toString().trim();
}
public IntergralKeypadDialog setPayMethod(String method) {
tv_pay_method.setText(method);
return this;
}
public void show() {
dialog.show();
}
public void cancel() {
dialog.dismiss();
}
private OnComfirmListener onComfirmListener;
public IntergralKeypadDialog setComfirmListener(OnComfirmListener onComfirmListener) {
this.onComfirmListener = onComfirmListener;
return this;
}
public interface OnComfirmListener {
void onComfirm(String money);
}
}
......@@ -5,10 +5,13 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.common.bean.MemberInfo;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.gingersoft.gsa.cloud.base.utils.BigDecimalUtils;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
......@@ -17,12 +20,15 @@ import com.gingersoft.gsa.cloud.ui.adapter.BillMethodAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.BillMoneyAdapter;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.Nullable;
public class OrderPayView extends LinearLayout {
private Context mContext;
/**
* 用戶已選中的支付方式
*/
......@@ -45,6 +51,7 @@ public class OrderPayView extends LinearLayout {
private MemberInfo memberInfo;
private RelativeLayout rl_difference;
private TextView tvDifferenceName;
private TextView tvDifferenceMoney;
private TextView btn_order_count;
......@@ -81,6 +88,7 @@ public class OrderPayView extends LinearLayout {
public OrderPayView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mContext = context;
}
public void setMemberInfo(MemberInfo memberInfo) {
......@@ -109,6 +117,7 @@ public class OrderPayView extends LinearLayout {
mBillMoneyAdapter = new BillMoneyAdapter(mBillMoneyList);
rv_bill_money.setAdapter(mBillMoneyAdapter);
rl_difference = view.findViewById(R.id.rl_difference);
tvDifferenceName = view.findViewById(R.id.tv_difference_name);
tvDifferenceMoney = view.findViewById(R.id.tv_difference_money);
btn_order_count = view.findViewById(R.id.btn_order_count);
......@@ -120,12 +129,15 @@ public class OrderPayView extends LinearLayout {
mBillMethodAdapter = new BillMethodAdapter(mBillMethodList);
mBillMethodAdapter.setOnItemClickListener((adapter, view1, position) -> {
recordOperat(context);
PayMethod method = (PayMethod) adapter.getItem(position);
method.setPayMoney(0);
if (!mBillMoneyList.contains(method)) {
double differenceMoney = getDifferenceMoney();
double differenceMoney = getAddPayDifferenceMoney();
boolean isIntegralPayMethod = isIntegralPayMethod(method);
if (isIntegralPayMethod) {
......@@ -135,7 +147,8 @@ public class OrderPayView extends LinearLayout {
showTipWord(LanguageUtils.get_language_system(context, "member.not.logged.cannot.be.used", "會員尚未登錄,不能使用") + method.getPayName());
return;
}
if (!setIntergralPayMoney(method, memberInfo.getMemberPoint(), memberInfo.getPointRedeemCash(), differenceMoney)) {
boolean verifyStatus = verifyIntergralNumber(method, memberInfo.getMemberPoint(), memberInfo.getPointRedeemCash(), differenceMoney, true);
if (!verifyStatus) {
return;
}
}
......@@ -150,31 +163,33 @@ public class OrderPayView extends LinearLayout {
if (isUseFreeServicePayMethod) {
//有使用免服務費支付方式 重新獲取一遍尚欠金額
differenceMoney = getDifferenceMoney();
differenceMoney = getAddPayDifferenceMoney();
}
//是否同步金額
//固定金額 (0:否 1:是)
if (method.getWhetherFixedAmount() == 1) {
//直接补足余额
if (Double.doubleToLongBits(method.getMinPayAmount()) != 0) {
//補足最小支付金額
if (differenceMoney > method.getMinPayAmount()) {
method.setPayMoney(differenceMoney);
if (!isIntegralPayMethod) {
//是否同步金額
//固定金額 (0:否 1:是)
if (method.getWhetherFixedAmount() == 1) {
//直接补足余额
if (Double.doubleToLongBits(method.getMinPayAmount()) != 0) {
//補足最小支付金額
if (differenceMoney > method.getMinPayAmount()) {
method.setPayMoney(differenceMoney);
} else {
method.setPayMoney(method.getMinPayAmount());
}
} else {
method.setPayMoney(method.getMinPayAmount());
//補足差額
if (differenceMoney > -1 && Double.doubleToLongBits(differenceMoney) != totalAmount) {
method.setPayMoney(differenceMoney);
}
}
} else {
//補足差額
if (differenceMoney > -1 && Double.doubleToLongBits(differenceMoney) != totalAmount) {
method.setPayMoney(differenceMoney);
if (Double.doubleToLongBits(method.getMinPayAmount()) != 0) {
//補足最小支付金額
method.setPayMoney(method.getMinPayAmount());
}
}
} else {
if (Double.doubleToLongBits(method.getMinPayAmount()) != 0) {
//補足最小支付金額
method.setPayMoney(method.getMinPayAmount());
}
}
//添加選中支付方式
......@@ -249,11 +264,16 @@ public class OrderPayView extends LinearLayout {
//Keypad
view.findViewById(R.id.layout_keypad).setOnClickListener(v -> {
if (getSelectBillMoney() == null) {
PayMethod payMethod = getSelectBillMoney();
if (payMethod == null) {
ToastUtils.show(context, "請選擇支付方式");
return;
}
showPayKeypadDialog(context);
if (isIntegralPayMethod(payMethod)) {
showIntergralKeypadDialog(context, payMethod);
} else {
showPayKeypadDialog(context, payMethod);
}
});
this.addView(view);
}
......@@ -328,17 +348,23 @@ public class OrderPayView extends LinearLayout {
* Exact
*/
public void pressExact() {
double differenceMoney = getDifferenceMoney();
PayMethod billMoneyBean = getSelectBillMoney();
double differenceMoney = getDifferenceMoney();
if (billMoneyBean != null && differenceMoney > 0) {
//這裡需要加上現有的金額
differenceMoney = MoneyUtil.sum(differenceMoney, billMoneyBean.getPayMoney());
boolean isIntegralPayMethod = isIntegralPayMethod(billMoneyBean);
if (isIntegralPayMethod) {
//積分支付
if (!setIntergralPayMoney(billMoneyBean, memberInfo.getMemberPoint(), memberInfo.getPointRedeemCash(), differenceMoney)) {
boolean verifyStatus = verifyIntergralNumber(billMoneyBean, memberInfo.getMemberPoint(), memberInfo.getPointRedeemCash(), differenceMoney, false);
if (!verifyStatus) {
return;
}
if (onSelectPayClickLisenter != null) {
onSelectPayClickLisenter.updateIntergralInfo();
}
} else {
billMoneyBean.setPayMoney(MoneyUtil.sum(billMoneyBean.getPayMoney(), differenceMoney));
billMoneyBean.setPayMoney(differenceMoney);
}
mBillMoneyAdapter.notifyDataSetChanged();
}
......@@ -350,8 +376,8 @@ public class OrderPayView extends LinearLayout {
* @return
*/
public boolean canPay() {
double difference = getDifferenceMoney();
if (difference <= 0) {
double difference = MoneyUtil.sub(totalAmount, getBillMoney());
if (Double.doubleToLongBits(difference) <= 0) {
return true;
}
return false;
......@@ -371,7 +397,6 @@ public class OrderPayView extends LinearLayout {
return null;
}
/**
* 獲取找零或貼士金額
*
......@@ -391,6 +416,21 @@ public class OrderPayView extends LinearLayout {
*
* @return
*/
public double getAddPayDifferenceMoney() {
double differenceMoney = 0.0;
if (mBillMoneyList.size() == 0) {
differenceMoney = totalAmount;
} else {
differenceMoney = MoneyUtil.sub(totalAmount, getBillMoney());
}
return MoneyUtil.get_ItemDecimals_money(differenceMoney);
}
/**
* 獲取總差額
*
* @return
*/
public double getDifferenceMoney() {
double differenceMoney = MoneyUtil.sub(totalAmount, getBillMoney());
return MoneyUtil.get_ItemDecimals_money(differenceMoney);
......@@ -427,6 +467,23 @@ public class OrderPayView extends LinearLayout {
}
/**
* 獲取積分支付金額
*
* @return
*/
public double getIntegralPayMoney(PayMethod filterPayMethod) {
double totalMoney = 0.0;
if (mBillMoneyList != null) {
for (PayMethod method : mBillMoneyList) {
if (filterPayMethod != method && isIntegralPayMethod(method)) {
totalMoney = MoneyUtil.sum(totalMoney, method.getPayMoney());
}
}
}
return totalMoney;
}
/**
* 獲取積分支付抵扣金額
*
* @param memberIntegral 當前會員積分數
......@@ -446,13 +503,19 @@ public class OrderPayView extends LinearLayout {
}
/**
* 獲取消費積分
* 獲取積分支付消費積分
*
* @param filterPayMethod 需要過濾掉的支付方式
* @param memberPointRedeemCash 積分兌換金額比例 MemberPointRedeemCash=2 (理解為每2分=1元)
* @return
*/
public double getConsumptionPoints(double memberPointRedeemCash) {
double consumptionPoints = MoneyUtil.multiply(getIntegralPayMoney(), memberPointRedeemCash);
public double getPayForConsumptionPoints(PayMethod filterPayMethod, double memberPointRedeemCash) {
double consumptionPoints;
if (filterPayMethod != null) {
consumptionPoints = MoneyUtil.multiply(getIntegralPayMoney(filterPayMethod), memberPointRedeemCash);
} else {
consumptionPoints = MoneyUtil.multiply(getIntegralPayMoney(), memberPointRedeemCash);
}
if (consumptionPoints > 0) {
return MoneyUtil.get_ItemDecimals_money(consumptionPoints);
} else {
......@@ -461,15 +524,6 @@ public class OrderPayView extends LinearLayout {
}
/**
* 扣除積分需付金額
*
* @return
*/
private double getDeductPointsNeedPay() {
return MoneyUtil.sub(getBillMoney(), getIntegralPayMoney());
}
/**
* 是不是积分支付方式
*
* @param method
......@@ -482,34 +536,82 @@ public class OrderPayView extends LinearLayout {
return false;
}
private boolean setIntergralPayMoney(PayMethod method, double memberIntegral, double memberPointRedeemCash, double differenceMoney) {
/**
* @param payMethod
* @param memberIntegral 會員積分
* @param memberPointRedeemCash 積分兌換現金比率
* @param differenceMoney 還差多少錢
* @param addPayMethod 新增積分支付
* @return
*/
public boolean verifyIntergralNumber(PayMethod payMethod, double memberIntegral, double memberPointRedeemCash, double differenceMoney, boolean addPayMethod) {
//總積分可兌換金額
double deductionAmount = getIntegralDeductionAmount(memberIntegral, memberPointRedeemCash);
if (Double.doubleToLongBits(differenceMoney) == 0 || Double.doubleToLongBits(deductionAmount) == 0) {
double consumptionPoints = 0;
if (!addPayMethod) {
consumptionPoints = getPayForConsumptionPoints(payMethod, memberPointRedeemCash);
}
//積分支付總額
double totalIntegralPayMoney;
double integralPayMoney = 0;
if (!addPayMethod) {
integralPayMoney = getIntegralPayMoney(deductionAmount, differenceMoney);
}
totalIntegralPayMoney = integralPayMoney + getIntegralPayMoney(payMethod);
if (deductionAmount == 0 || deductionAmount < totalIntegralPayMoney || memberIntegral < consumptionPoints) {
ArmsUtils.makeText(mContext, "積分不足!");
return false;
}
if (!addPayMethod) {
payMethod.setPayMoney(integralPayMoney);
}
return true;
}
public double getIntegralPayMoney(double deductionAmount, double differenceMoney) {
if (deductionAmount > differenceMoney) {
//補足差額
method.setPayMoney(differenceMoney);
return differenceMoney;
} else {
method.setPayMoney(deductionAmount);
return deductionAmount;
}
return true;
}
public void showPayKeypadDialog(Context context) {
PayMethod method = getSelectBillMoney();
public void showPayKeypadDialog(Context context, PayMethod method) {
new PayKeypadDialog(context)
.setPayMethod(method.getPayName())
.builder()
.setComfirmListener(money -> {
PayMethod billMoneyBean = getSelectBillMoney();
billMoneyBean.setPayMoney(Double.parseDouble(money));
method.setPayMoney(Double.parseDouble(money));
mBillMoneyAdapter.notifyDataSetChanged();
setDifferenceText(context);
})
.show();
}
public void showIntergralKeypadDialog(Context context, PayMethod method) {
new IntergralKeypadDialog(context)
.setPayMethod(method.getPayName())
.builder()
.setComfirmListener(money -> {
boolean verifyStatus = verifyIntergralNumber(method, memberInfo.getMemberPoint(), memberInfo.getPointRedeemCash(), Double.parseDouble(money), false);
if (!verifyStatus) {
return;
}
mBillMoneyAdapter.notifyDataSetChanged();
setDifferenceText(context);
if (onSelectPayClickLisenter != null) {
onSelectPayClickLisenter.updateIntergralInfo();
}
})
.show();
}
/**
* 獲取超出的金額為找零還是貼士: linePayType 1 tipsPrice 为找零 2 tipsPrice为贴上
* 現金,掃碼QR = 找零
......@@ -526,6 +628,7 @@ public class OrderPayView extends LinearLayout {
}
public void setDifferenceText(Context context) {
//還需付多少金額
double difference = getDifferenceMoney();
if (difference < 0) {
//貼士
......@@ -541,7 +644,7 @@ public class OrderPayView extends LinearLayout {
//尚欠
tvDifferenceName.setText("尚欠金額");
tvDifferenceMoney.setTextColor(ArmsUtils.getColor(context, R.color.red));
if (difference == 0) {
if (Double.doubleToLongBits(difference) == 0) {
tvDifferenceMoney.setText("$" + Math.abs(difference));
} else {
tvDifferenceMoney.setText("-$" + Math.abs(difference));
......@@ -580,6 +683,8 @@ public class OrderPayView extends LinearLayout {
void addClick(PayMethod method);
void delClick(PayMethod method);
void updateIntergralInfo();
}
public interface OnSureClickLisenter {
......
......@@ -87,6 +87,7 @@
app:maxHeight="@dimen/dp_80" />
<RelativeLayout
android:id="@+id/rl_difference"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FBF261"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lLayout_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_rect_fillet_theme_black_5"
android:orientation="vertical"
android:paddingBottom="@dimen/normal_space"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="@dimen/normal_space">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<EditText
android:id="@+id/ed_value"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_15"
android:layout_below="@+id/tv_pay_method"
android:layout_centerInParent="true"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/shape_rect_fillet_white_5"
android:ems="10"
android:focusable="false"
android:gravity="right|center_vertical"
android:hint="@string/input_pay_intergral"
android:inputType="numberDecimal"
android:paddingRight="@dimen/normal_space"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="#FF0000"
android:textSize="@dimen/sp_24"
android:textStyle="bold">
<requestFocus />
</EditText>
<TextView
android:id="@+id/tv_pay_method"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="VISA"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/font_large"
android:textStyle="bold" />
</RelativeLayout>
<include layout="@layout/include_pay_fast_keyboard" />
<include layout="@layout/include_pay_keyboard" />
</LinearLayout>
\ No newline at end of file
......@@ -26,6 +26,7 @@
<string name="Key_s">numkey</string>
<string name="btnOK">OK</string>
<string name="input_pay_money">請輸入支付金額</string>
<string name="input_pay_intergral">請輸入支付積分數</string>
<string name="base_loading">加載中...</string>
<string name="ui_loading">加載中...</string>
......
......@@ -19,6 +19,9 @@ dependencies {
project.name == 'coldchain-module'|| project.name == 'delivery_pick_module' || project.name == 'order-advance-module')) {
api project(':order-base')
}
if (project.name == 'table-module' ) {
api project(':pay-module')
}
if (project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':arms')
}
......
......@@ -26,9 +26,9 @@ android {
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
ndk{
abiFilters "armeabi","armeabi-v7a"
}
// ndk{
// abiFilters "armeabi-v7a"
// }
}
resourcePrefix "user_login"
......
......@@ -14,8 +14,10 @@ import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;
import com.gingersoft.gsa.cloud.manager.mvp.contract.TableManageContract;
import com.jess.arms.utils.ArmsUtils;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.functions.Function;
import okhttp3.FormBody;
import okhttp3.RequestBody;
......@@ -62,7 +64,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryAreas();
}
return null;
return Observable.just(info);
}
});
}
......@@ -77,7 +79,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryAreas();
}
return null;
return Observable.just(info);
}
});
}
......@@ -92,7 +94,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryAreas();
}
return null;
return Observable.just(info);
}
});
}
......@@ -114,7 +116,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
return Observable.just(info);
}
});
}
......@@ -129,7 +131,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
return Observable.just(info);
}
});
}
......@@ -144,7 +146,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
return Observable.just(info);
}
});
}
......@@ -166,7 +168,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryAreas();
}
return null;
return Observable.just(info);
}
});
}
......@@ -181,7 +183,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
return Observable.just(info);
}
});
}
......@@ -196,7 +198,7 @@ public class TableManageModel extends BaseModel implements TableManageContract.M
if (info != null && info.isSuccess()) {
return queryTables();
}
return null;
return Observable.just(info);
}
});
}
......
......@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.manager.mvp.presenter;
import android.app.Application;
import android.os.CountDownTimer;
import android.text.TextUtils;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.table.bean.TableArea;
......@@ -99,7 +101,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.queryAreasSuccess(tableAreas, TableManageActivity.ADD_AREA_SUCCESS);
}
} else {
mRootView.showMessage("添加失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("添加失敗");
}
}
}
});
......@@ -126,7 +132,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.queryAreasSuccess(tableAreas, TableManageActivity.DELETE_AREA_SUCCESS);
}
} else {
mRootView.showMessage("刪除失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("刪除失敗");
}
}
}
});
......@@ -152,7 +162,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.queryAreasSuccess(tableAreas, TableManageActivity.UPDATE_AREA_SUCCESS);
}
} else {
mRootView.showMessage("添加失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("添加失敗");
}
}
}
});
......@@ -234,7 +248,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.queryTablesSuccess(tableItems, TableManageActivity.ADD_TABLE_SUCCESS);
}
} else {
mRootView.showMessage("添加失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("添加失敗");
}
}
}
});
......@@ -261,7 +279,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.queryTablesSuccess(tableItems, TableManageActivity.DELETE_TABLE_SUCCESS);
}
} else {
mRootView.showMessage("刪除失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("刪除失敗");
}
}
}
});
......@@ -291,7 +313,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
} else {
}
} else {
mRootView.showMessage("更新失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("更新失敗");
}
}
}
});
......@@ -363,7 +389,7 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
.add("restaurantId", String.valueOf(GsaCloudApplication.getRestaurantId()))
.add("ids", ids)
.build();
LogUtil.d(TAG, "changeAreaSort " + " ids:" + ids );
LogUtil.d(TAG, "changeAreaSort " + " ids:" + ids);
mModel.changeAreaSort(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
......@@ -387,7 +413,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("更新失敗");
}
}
}
});
......@@ -398,7 +428,7 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
.add("restaurantId", String.valueOf(GsaCloudApplication.getRestaurantId()))
.add("ids", ids)
.build();
LogUtil.d(TAG, "changeTableSort " + " ids:" + ids );
LogUtil.d(TAG, "changeTableSort " + " ids:" + ids);
mModel.changeTableSort(requestBody)
.subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading(null))
......@@ -422,7 +452,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("更新失敗");
}
}
}
});
......@@ -454,7 +488,11 @@ public class TableManagePresenter extends BasePresenter<TableManageContract.Mode
mRootView.showEmptyView(true, 0, null);
}
} else {
mRootView.showMessage("更新失敗");
if (!TextUtils.isEmpty(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("更新失敗");
}
}
}
});
......
......@@ -98,7 +98,10 @@ public class MyOrderManage {
*/
private String integralQrcode;
/**
* 是否需要更新會員信息(如開台有然後清除: "true:false" 這種情況需要重新送單更新會員信息)
*/
private String memberUpdateStatus = true + "-" + true;
/**
* 記錄修改訂單操作
* false#送單
......@@ -170,7 +173,7 @@ public class MyOrderManage {
this.deleteOrders = deleteOrders;
}
public void addDeleteOrder(DeleteOrderRequest orderRequest){
public void addDeleteOrder(DeleteOrderRequest orderRequest) {
getDeleteOrders().add(orderRequest);
}
......@@ -305,9 +308,7 @@ public class MyOrderManage {
}
public void clear() {
if (memberInfo != null) {
memberInfo = null;
}
setMemberInfo(null);
if (orderFoodList != null) {
orderFoodList.clear();
}
......@@ -331,6 +332,7 @@ public class MyOrderManage {
totalAmount = 0.0;
orderBean = null;
modifyOrder = false;
memberUpdateStatus = "";
}
public int getSelpostion() {
......@@ -475,6 +477,27 @@ public class MyOrderManage {
this.modifyOrder = modifyOrder;
}
public String getMemberUpdateStatus() {
return memberUpdateStatus;
}
public void setMemberUpdateStatus(String memberUpdateStatus) {
this.memberUpdateStatus = memberUpdateStatus;
}
public boolean needUpdateMemberInfo() {
String[] status = memberUpdateStatus.split("-");
if (status.length == 2) {
if (Boolean.parseBoolean(status[0]) != Boolean.parseBoolean(status[1])) {
return true;
} else {
return false;
}
} else {
return false;
}
}
public List<PayMethod> getBillMoney() {
return billMoney;
}
......
ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
useLibrary 'org.apache.http.legacy'
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
}
buildTypes {
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
// buildConfigField "boolean", "USE_CANARY", "false"
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled false
// proguardFiles 'proguard-rules.pro'
// }
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled true
// shrinkResources true
zipAlignEnabled true
proguardFiles 'proguard-rules.pro'
}
}
}
buildscript {
repositories {
jcenter()
}
}
dependencies {
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.gingersoft.runtime.pay_module;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.gingersoft.runtime.pay_module.test", appContext.getPackageName());
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.runtime.pay_module" />
<resources>
<string name="app_name">pay-module</string>
</resources>
package com.gingersoft.runtime.pay_module;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
......@@ -18,21 +18,16 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.epson.epos2.printer.Printer;
import com.epson.epos2.printer.PrinterStatusInfo;
import com.epson.epos2.printer.ReceiveListener;
import com.gingersoft.gsa.cloud.base.adapter.print.BillAdapter;
import com.gingersoft.gsa.cloud.base.adapter.print.BillTypeAdapter;
import com.gingersoft.gsa.cloud.base.adapter.print.FoodAdapter;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BillingBean;
import com.gingersoft.gsa.cloud.base.common.bean.OrderDetail;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.gingersoft.gsa.cloud.base.order.adapter.print.FoodAdapter;
import com.gingersoft.gsa.cloud.base.order.bean.OrderDetail;
import com.gingersoft.gsa.cloud.base.threadPool.ThreadPoolManager;
import com.gingersoft.gsa.cloud.base.utils.AidlUtil;
import com.gingersoft.gsa.cloud.base.utils.RestaurantExpandInfoUtils;
......@@ -81,6 +76,10 @@ import java.util.Objects;
import javax.inject.Inject;
import androidx.annotation.ColorRes;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
......
......@@ -12,6 +12,7 @@ include 'cc-register',
'updateApk',
'base-module',
'pay-module',
'table-base',
'order-base',
'login-module',
......
......@@ -152,7 +152,10 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
if (info != null && info.isSuccess()) {
return loadOrder(MyOrderManage.getInstance().getOrderId());
}
return null;
BaseOrderRespose baseOrderRespose = new BaseOrderRespose();
baseOrderRespose.setSuccess(info.isSuccess());
baseOrderRespose.setErrMsg(info.getErrMsg());
return Observable.just(baseOrderRespose);
}
});
return ob;
......
......@@ -65,7 +65,7 @@ public class OrderCenterModel extends BaseModel implements OrderCenterContract.M
if (info != null && info.isSuccess()) {
return loadOrderList(restaurantId, orderType,0, 10);
}
return null;
return Observable.just(info);
}
});
}
......
......@@ -93,7 +93,10 @@ public class OrderContentModel extends BaseModel implements OrderContentContract
}
return loadOrder(MyOrderManage.getInstance().getOrderId());
}
return null;
BaseOrderRespose baseOrderRespose = new BaseOrderRespose();
baseOrderRespose.setSuccess(info.isSuccess());
baseOrderRespose.setErrMsg(info.getErrMsg());
return Observable.just(baseOrderRespose);
}
});
return ob;
......@@ -110,7 +113,10 @@ public class OrderContentModel extends BaseModel implements OrderContentContract
saveCreateTime(info.getSysTime());
return loadOrder(MyOrderManage.getInstance().getOrderId());
}
return null;
BaseOrderRespose baseOrderRespose = new BaseOrderRespose();
baseOrderRespose.setSuccess(info.isSuccess());
baseOrderRespose.setErrMsg(info.getErrMsg());
return Observable.just(baseOrderRespose);
}
});
return ob;
......@@ -144,7 +150,7 @@ public class OrderContentModel extends BaseModel implements OrderContentContract
if (info != null && info.isSuccess()) {
return loadOrder(MyOrderManage.getInstance().getOrderId());
}
return null;
return Observable.just(info);
}
});
return ob;
......
......@@ -63,7 +63,7 @@ public class OrderDetailModel extends BaseModel implements OrderDetailContract.M
if (info != null && info.isSuccess()) {
return getOrderDetailItem(orderId);
}
return null;
return Observable.just(info);
}
});
}
......
......@@ -4,6 +4,7 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
import com.gingersoft.gsa.cloud.bean.mvp.model.bean.BaseOrderRespose;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.utils.FoodDaoUtils;
import com.gingersoft.gsa.cloud.bean.mvp.contract.SoldoutCtrlContract;
......@@ -108,7 +109,7 @@ public class SoldoutCtrlModel extends BaseModel implements SoldoutCtrlContract.M
// }
// }
// }
// return null;
// return Observable.just(info);
// }
// });
}
......
......@@ -76,6 +76,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
protected M mModel;
protected V mRootView;
protected BaseOrderPresenter mBaseOrderPresenter;
private Activity IActivity;
private OrderContentActivity mOrderContentActivity;
private MealStandPresenter mMealStandPresenter;
......@@ -118,6 +119,8 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
super(model, rootView);
this.mModel = (M) model;
this.mRootView = (V) rootView;
this.mBaseOrderPresenter = this;
this.IActivity = (Activity) mRootView;
this.openTableManage = OpenTableManage.getDefault();
this.myOrderManage = MyOrderManage.getInstance();
......@@ -439,7 +442,7 @@ public abstract class BaseOrderPresenter<M extends BaseOrderContract.Model, V ex
MemberInfo memberInfo = myOrderManage.getMemberInfo();
if (memberInfo != null) {
addCouponDiscount(couponDiscount, myOrderManage.getMemberInfo().getId(), BillOrderMoney.BILL_ITEM_NO_ORDER_STATUS);
addCouponDiscount(couponDiscount, myOrderManage.getMemberInfo().getId(), BillOrderMoney.BILL_ITEM_ORDER_SENT_STATUS);
}
}
}
......
......@@ -120,18 +120,18 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
private ComboAdapter mComboAdapter;
private ModifierAdapter mModifierAdapter;
private DiscountAdapter mDiscountAdapter;
//食品数据
/**食品数据*/
private List<Food> mFoodGroupList = new ArrayList<>();
//當前食品組下食品
/**當前食品組下食品*/
private List<Food> mFoodList = new ArrayList<>();
//套餐细项数据
/**套餐细项数据*/
private List<ComboItem> mFoodComboList = new ArrayList<>();
private List<Modifier> mModifierList = new ArrayList<>();
//折扣数据
/**折扣数据*/
private List<Discount> mDiscountList = new ArrayList<>();
//沽清食品數據
/**沽清食品數據*/
private List<SoldoutCtrFood> mSoldoutCtrList = new ArrayList<>();
private boolean RvMealClicked;
......
......@@ -206,9 +206,13 @@ public class OrderContentPresenter extends BaseOrderPresenter<OrderContentContra
// if (!canPay()) {
// return;
// }
if (hasNesOrderFoods() || getNewDiscount() != null) {
if (hasNesOrderFoods() || getNewDiscount() != null || myOrderManage.needUpdateMemberInfo()) {
Class[] parameterTypes = {boolean.class,Class.class};
Object[] parameters = {false,OrderPayActivity.class};
CommonTipDialog.showDoubtDialog(IActivity, "賬單已變化,是否送單后去結賬", BaseOrderPresenter.class, mBaseOrderPresenter,
"sendOrder", parameterTypes, parameters);
//有未送單食品先送單
sendOrder(false, OrderPayActivity.class);
// sendOrder(false, OrderPayActivity.class);
} else {
mRootView.startActivityForResult(OrderContentActivity.BILL_CODE, OrderPayActivity.class, null);
}
......
......@@ -307,7 +307,7 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
orderPay.setTipsPrice(orderPayView.getTipsPrice());
}
if (orderPay.getPayType() == PayMethod.PAY_TYPE_INTEGRAL) {
double consumptionPoints = orderPayView.getConsumptionPoints(memberInfo.getPointRedeemCash());
double consumptionPoints = orderPayView.getPayForConsumptionPoints(null,memberInfo.getPointRedeemCash());
orderPay.setConsumptionPoints(consumptionPoints);
// //減去積分支付所用的積分
// payRequest.setPointsUse(MoneyUtil.sum(payRequest.getPointsUse(), consumptionPoints));
......@@ -468,7 +468,6 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
return pointsAdd;
}
/**
* 換購食品所需積分
*
......@@ -496,14 +495,6 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
}
return false;
}
// public ArrayList<PayMethod> getBillMethodList() {
// return mBillMethodList;
// }
//
// public void setBillMethodList(ArrayList<PayMethod> mBillMethodList) {
// this.mBillMethodList = mBillMethodList;
// }
//
public List<PayMethod> getBillMoneyList() {
return mBillMoneyList;
......@@ -512,12 +503,4 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
public void setBillMoneyList(List<PayMethod> mBillMoneyList) {
this.mBillMoneyList = mBillMoneyList;
}
//
// public BillMethodAdapter getBillMethodAdapter() {
// return mBillMethodAdapter;
// }
//
// public BillMoneyAdapter getBillMoneyAdapter() {
// return mBillMoneyAdapter;
// }
}
......@@ -5,6 +5,7 @@ import android.content.Context;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.view.View;
import com.billy.cc.core.component.CC;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
......@@ -51,11 +52,14 @@ import com.jess.arms.utils.RxLifecycleUtils;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
......@@ -127,16 +131,28 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
super(model, rootView);
this.IActivity = (TableActivity) rootView;
initTableActions(IActivity);
initGetTableTimer();
}
private void initTableActions(Context context) {
mTableActions.add(new ResetTableAction(context));
mTableActions.add(new MoveTableAction(context));
mTableActions.add(new SplitTableAction(context));
mTableActions.add(new PrintServingPaperAction(context));
mTableActions.add(new PrintSkyOrderAction(context));
private void initTableActions(Context context, List<Function> functions) {
for (Function function : functions) {
if (function.getResUrl().endsWith("init")) {
mTableActions.add(new ResetTableAction(context));
} else if (function.getResUrl().endsWith("move")) {
mTableActions.add(new MoveTableAction(context));
} else if (function.getResUrl().endsWith("splite")) {
mTableActions.add(new SplitTableAction(context));
} else if (function.getResUrl().endsWith("parper")) {
mTableActions.add(new PrintServingPaperAction(context));
} else if (function.getResUrl().endsWith("skyorder")) {
mTableActions.add(new PrintSkyOrderAction(context));
}
}
// mTableActions.add(new ResetTableAction(context));
// mTableActions.add(new MoveTableAction(context));
// mTableActions.add(new SplitTableAction(context));
// mTableActions.add(new PrintServingPaperAction(context));
// mTableActions.add(new PrintSkyOrderAction(context));
}
@Override
......@@ -208,6 +224,7 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
} else {
mRootView.setBottomFunctionVisibility(false);
}
initTableActions(IActivity, functions);
// mBottomFunctionList.add(new Function((long) 1, "重置檯號", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_init));
// mBottomFunctionList.add(new Function((long) 2, "轉檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_move));
// mBottomFunctionList.add(new Function((long) 3, "分檯", ArmsUtils.getColor(IActivity, R.color.theme_black), ArmsUtils.getDimens(IActivity, R.dimen.sp_14), R.mipmap.table_splite));
......@@ -424,6 +441,9 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
if (orderBean.getMemberInfo() != null) {
//设置会员信息
MyOrderManage.getInstance().setMemberInfo(orderBean.getMemberInfo());
MyOrderManage.getInstance().setMemberUpdateStatus(true + "-" + true);
}else {
MyOrderManage.getInstance().setMemberUpdateStatus(false + "-" + false);
}
} else {
MyOrderManage.getInstance().setOrderBean(null);
......@@ -829,15 +849,15 @@ public class TablePresenter extends BasePresenter<TableContract.Model, TableCont
@Override
public void resetTable(TableBean.DataBean tableBean) {
initTable(tableBean.getId(),tableBean.getTableNumber(),true);
initTable(tableBean.getId(), tableBean.getTableNumber(), true);
}
@Override
public void moveTable(TableBean.DataBean tableBean) {
if(dataBean.getId() == tableBean.getId()){
CommonTipDialog.showSurpisedDialog(IActivity, "相同檯不能轉移", null, null, null, null, null);
return;
}
// if (dataBean.getId() == tableBean.getId()) {
// CommonTipDialog.showSurpisedDialog(IActivity, "相同檯不能轉移", null, null, null, null, null);
// return;
// }
getTableToMove(tableBean);
}
......
......@@ -182,7 +182,9 @@ public class AllOrderPresenter extends BasePresenter<AllOrderContract.Model, All
OpenTableManage.getDefault().setPeopleNumber(orderDetailItem.getPerson());
TableBean.DataBean dataBean = new TableBean.DataBean();
dataBean.setTableName(orderDetailItem.getTableName());
dataBean.setCreateTime(TimeUtil.getStringByFormat(new Date(orderDetailItem.getCreateTime()), TimeUtil.dateFormatYMDHM));
if(!TextUtils.isEmpty(orderDetailItem.getCreateTime())) {
dataBean.setCreateTime(TimeUtil.getStringByFormat(new Date(orderDetailItem.getCreateTime()), TimeUtil.dateFormatYMDHM));
}
OpenTableManage.getDefault().setTableBean(dataBean);
if (orderDetailItem.getMemberInfo() != null) {
......
......@@ -574,11 +574,19 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
@Override
public void onUseMember(UseMemberDialog dialog) {
if (mMemberInfo != null) {
mUseMemberDialog.cancel();
mUseMemberDialog.dismiss();
MyOrderManage.getInstance().setMemberInfo(mMemberInfo);
//添加会员折扣行
mPresenter.addMemberDiscount(mMemberInfo.getId(), mMemberInfo.getMemberDiscount(), mMemberInfo.getMemberName(), mMemberInfo.getLevelName1(), BillOrderMoney.BILL_ITEM_NO_ORDER_STATUS);
useMember();
if (MyOrderManage.getInstance().needUpdateMemberInfo()) {
return;
}
String[] updateMemberStatus = MyOrderManage.getInstance().getMemberUpdateStatus().split("-");
if (Boolean.parseBoolean(updateMemberStatus[0]) == true) {
MyOrderManage.getInstance().setMemberUpdateStatus(updateMemberStatus[0] + "-" + true);
}
} else {
showMessage("請輸入正確的會員號碼!");
}
......@@ -591,6 +599,14 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
//刪除會員折扣行
mPresenter.removeMemberDiscountItem();
mPresenter.updateBillOrderItem();
if (MyOrderManage.getInstance().needUpdateMemberInfo()) {
return;
}
String[] updateMemberStatus = MyOrderManage.getInstance().getMemberUpdateStatus().split("-");
if (Boolean.parseBoolean(updateMemberStatus[0]) == true) {
MyOrderManage.getInstance().setMemberUpdateStatus(updateMemberStatus[0] + "-" + false);
}
}
});
}
......@@ -798,8 +814,9 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
@Override
public void recordOperat(boolean isPressButtonSound) {
if (isPressButtonSound)
if (isPressButtonSound) {
VibratorUtils.pressButtonSound(this);
}
//关闭倒计时
if (chronometer != null) {
chronometer.stop();
......@@ -1223,7 +1240,7 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
}
} else if (requestCode == MipcaCaptureActivity.CALL_BACK_QR_RESULT) {
String qrCodeResult = data.getStringExtra("qrCodeResult");
if(TextUtils.isEmpty(qrCodeResult)){
if (TextUtils.isEmpty(qrCodeResult)) {
return;
}
mPresenter.queryMember(1, qrCodeResult, GsaCloudApplication.getGsPosShopId(), OpenTableManage.getDefault().getTableBean().getId(), OpenTableManage.getDefault().getTableBean().getTableNumber());
......
......@@ -17,7 +17,9 @@ import com.gingersoft.gsa.cloud.base.common.bean.MemberInfo;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.gingersoft.gsa.cloud.base.order.bean.mealManger.MyOrderManage;
import com.gingersoft.gsa.cloud.base.order.bean.mealManger.OpenTableManage;
import com.gingersoft.gsa.cloud.base.utils.BigDecimalUtils;
import com.gingersoft.gsa.cloud.base.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.print.PrinterUtils;
......@@ -90,30 +92,14 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
@BindView(R2.id.tv_member_info)
TextView tv_member_info;
// @BindView(R2.id.tv_difference_name)
// TextView tv_difference_name;
// @BindView(R2.id.tv_difference_money)
// TextView tv_difference_money;
@BindView(R2.id.rv_food)
RecyclerView rv_food;
@BindView(R2.id.rv_order_detail)
RecyclerView rv_order_detail;
// @BindView(R2.id.rv_bill_method)
// MaxHeightRecyclerView rv_bill_method;
// @BindView(R2.id.rv_bill_money)
// MaxHeightRecyclerView rv_bill_money;
@BindView(R2.id.tv_whole)
TextView tv_whole;
// @BindView(R2.id.tv_total)
// TextView tv_total;
// @BindView(R2.id.btn_order_count)
// Button btn_order_count;
// private QMUITipDialog tipDialog;
@BindView(R2.id.gsa_pay_view)
OrderPayView gsaPayView;
......@@ -138,7 +124,6 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
*/
private int pointRule;
private int mWhetherFreeService = 0;
public static void startOrderPayActivityFormSale(Context context, String response) {
......@@ -197,6 +182,11 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
updateMemberInfo();
}
}
@Override
public void updateIntergralInfo() {
updateMemberInfo();
}
});
gsaPayView.setOnFreeServiceStatusChangeLisenter(new OrderPayView.OnFreeServiceStatusChangeLisenter() {
@Override
......@@ -239,9 +229,11 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
private void initMemberInfo() {
//会员信息
if (MyOrderManage.getInstance().getMemberInfo() != null) {
MemberInfo memberInfo = MyOrderManage.getInstance().getMemberInfo();
if (memberInfo != null) {
tv_member_info.setVisibility(View.VISIBLE);
tv_member_info.setText(getMemberInfo());
gsaPayView.setMemberInfo(memberInfo);
} else {
tv_member_info.setVisibility(View.GONE);
}
......@@ -256,13 +248,13 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
String memberInfo;
String memberName = memberBean.getMemberName();
String LevelName1 = memberBean.getLevelName1();
if (!TextUtils.isEmpty(LevelName1)) {
memberInfo = LanguageUtils.get_language_system(this, "meal.info.member.name", "會員名稱:")
+ memberName
+ "(" + LevelName1 + ")";
} else {
memberInfo = LanguageUtils.get_language_system(this, "meal.info.member.name", "會員:") + memberName;
}
// if (!TextUtils.isEmpty(LevelName1)) {
// memberInfo = LanguageUtils.get_language_system(this, "meal.info.member.name", "會員名稱:")
// + memberName
// + "(" + LevelName1 + ")";
// } else {
memberInfo = LanguageUtils.get_language_system(this, "meal.info.member.name", "會員:") + memberName;
// }
// boolean showPoints = false;
// if (mPresenter.getPointsAdd() != 0 && mPresenter.getPointsRedeem() != 0) {
// memberInfo = memberInfo + ":" + memberBean.getMemberPoint() + " +" + mPresenter.getPointsAdd() + " -" + mPresenter.getPointsRedeem();
......@@ -283,11 +275,13 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
memberIntegral = memberBean.getMemberPoint();
memberPointRedeemCash = memberBean.getPointRedeemCash();
//獲取積分支付抵扣金額
double consumptionPoints = gsaPayView.getConsumptionPoints(memberPointRedeemCash);
if (consumptionPoints > 0) {
memberInfo = memberInfo + ": " + memberIntegral + " " + "-" + consumptionPoints;
double consumptionPoints = gsaPayView.getPayForConsumptionPoints(null,memberPointRedeemCash);
//本次積分消耗(積分支付 + 食品獲得積分 + 食品消費積分)
double thisTimePoints = BigDecimalUtils.add(BigDecimalUtils.add(consumptionPoints, mPresenter.getPointsAdd()), mPresenter.getPointsRedeem());
if (thisTimePoints > 0) {
memberInfo = memberInfo + ": " + BigDecimalUtils.format(memberIntegral) + " " + "-" + BigDecimalUtils.format(thisTimePoints);
} else {
memberInfo = memberInfo + ": " + memberIntegral;
memberInfo = memberInfo + ": " + BigDecimalUtils.format(memberIntegral);
}
return memberInfo;
}
......@@ -597,4 +591,6 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
public OrderPayView getGsaPayView() {
return gsaPayView;
}
}
......@@ -494,7 +494,9 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
TableBean.DataBean dataBean = new TableBean.DataBean();
dataBean.setTableName(orderDetailItem.getTableName());
dataBean.setCreateTime(TimeUtil.getStringByFormat(new Date(orderDetailItem.getCreateTime()), TimeUtil.dateFormatYMDHM));
if(!TextUtils.isEmpty(orderDetailItem.getCreateTime())){
dataBean.setCreateTime(TimeUtil.getStringByFormat(new Date(orderDetailItem.getCreateTime()), TimeUtil.dateFormatYMDHM));
}
OpenTableManage.getDefault().setTableBean(dataBean);
List<PayMethod> payMethodList = getPayMethodList(orderDetailItem.getOrderPays());
......@@ -507,6 +509,7 @@ public class OrderDetailActivity extends BaseActivity<OrderDetailPresenter> impl
}else {
MyOrderManage.getInstance().setIntegralQrcode(orderDetailItem.getVerifyCode());
}
CC.obtainBuilder("Component.Print")
.setActionName("printActivity")
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_BILL)
......
......@@ -215,7 +215,6 @@ public class UseMemberDialog extends Dialog {
View contentView = buildViews();
mDialog.setContentView(contentView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (QMUIDisplayHelper.getScreenHeight(mContext) * 0.65)));
updateMemberInfo(MyOrderManage.getInstance().getMemberInfo());
// AndroidWorkaround.assistActivity(contentView);
return mDialog;
}
......
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