|
@@ -613,6 +613,46 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
if (id == R.id.dishes_shop_cart_clear) {
|
|
|
showClearDialog();
|
|
|
} else if (id == R.id.dishes_shop_cart_pay) {
|
|
|
+ showChoosePay();
|
|
|
+ } else if (id == R.id.dishes_ice_cream) {
|
|
|
+ notifyAddShopCart();
|
|
|
+ } else if (id == R.id.dishes_add_shop_cart) {
|
|
|
+// if (App.app.payChannel == Constant.PAY_POS_DEVICE && !Global.MDBCreditCardSuccess && Global.MDBCreditCardSuccessNumber != 1) {
|
|
|
+// showToast(getString(R.string.credit_failed));
|
|
|
+// return;
|
|
|
+// }
|
|
|
+ if (!CommunicationHelper.getInstance().canGenerateOrder()) {
|
|
|
+ ToastUtil.getInstance().showText(CommunicationHelper.getInstance().getWhyCanOrderText());
|
|
|
+ return;//是否开机
|
|
|
+ }
|
|
|
+ if (Hawk.get(Name.SHOPPING_TROLLEY,true)){
|
|
|
+ addShopCart();
|
|
|
+ Log.d(TAG, "无购物车测试orderHelperonClick:2 "+currentDish);
|
|
|
+ }else {
|
|
|
+ orderHelper = OrderHelper.getInstance();
|
|
|
+ orderHelper.init(currentDish);
|
|
|
+ addItem(currentDish.selectSpecBeans);
|
|
|
+ initIceCream();
|
|
|
+ showChoosePay();
|
|
|
+ Log.d(TAG, "无购物车测试orderHelperonClick:1 "+orderHelper.getOrderList());
|
|
|
+ Log.d(TAG, "无购物车测试orderHelperonClick:2 "+currentDish);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (id == R.id.dishes_sauce_1) {
|
|
|
+ selectSauce(0);
|
|
|
+ } else if (id == R.id.dishes_sauce_2) {
|
|
|
+ selectSauce(1);
|
|
|
+ } else if (id == R.id.dishes_sauce_3) {
|
|
|
+ selectSauce(2);
|
|
|
+ } else if (id == R.id.dishes_kernel_1) {
|
|
|
+ selectKernel(0);
|
|
|
+ } else if (id == R.id.dishes_kernel_2) {
|
|
|
+ selectKernel(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showChoosePay() {
|
|
|
+ if (Hawk.get(Name.SHOPPING_TROLLEY,true)) {
|
|
|
if (Global.isVersions == 2) {
|
|
|
priceList = new ArrayList<>();
|
|
|
priceList1 = new ArrayList<>();
|
|
@@ -634,68 +674,50 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
priceList.add(totalSum); // 将单个商品的总价格添加 buyCount 次
|
|
|
}
|
|
|
Log.d(TAG, "onClick:orderHelper 商品名字:" + orderHelper.getOrderList().get(i).selectTag + " 单个商品价格:" + totalSum + " 数量:" + orderHelper.getOrderList().get(i).buyCount);
|
|
|
+ Log.d(TAG, "onClick:priceList " + priceList);
|
|
|
}
|
|
|
- Log.d(TAG, "onClick:priceList " + priceList);
|
|
|
}
|
|
|
- showLoading();
|
|
|
- if (App.app.payChannel == Constant.PAY_FREE || manualReason != null) {
|
|
|
- payType = 0;
|
|
|
- manualMake();
|
|
|
- LogUtils.logWrite("免费制作了");
|
|
|
- } else if (App.app.payChannel == Constant.PAY_ONLINE || manualReason != null) {
|
|
|
- if (Hawk.get("PRICEBEAN") != null) {
|
|
|
- priceBeans = Hawk.get("PRICEBEAN");
|
|
|
- } else {
|
|
|
- dismissLoading();
|
|
|
- showToast("请重新设置价格");
|
|
|
- return;
|
|
|
- }
|
|
|
- carsPay(str());//国内二码合一支付
|
|
|
- Log.d(TAG, "onClick: 二码合一");
|
|
|
- } else if (App.app.payChannel == Constant.PAY_ONLINE_AND_PRICE_MODEL || manualReason != null) {
|
|
|
- dismissLoading();
|
|
|
- showDialogChoosePay();
|
|
|
- Log.d(TAG, "onClick: 二码合一");
|
|
|
- } else if (App.app.payChannel == Constant.PAY_POS_DEVICE || manualReason != null) {
|
|
|
- Log.d(TAG, "onClick: MDB板信用卡支付");
|
|
|
- payType = 4;
|
|
|
- pay();//MDB板信用卡支付
|
|
|
- } else if (App.app.payChannel == Constant.PAY_PRICE_MODEL || manualReason != null) {
|
|
|
- showPayMixDialog();
|
|
|
-// manualMake();
|
|
|
- } else if (App.app.payChannel == Constant.PAY_NAYAX_PAY || manualReason != null) {
|
|
|
- payType = 4;
|
|
|
- showNayaxCreditCard();
|
|
|
- } else if (App.app.payChannel == Constant.PAY_NAYAX_PAY_MIX || manualReason != null) {
|
|
|
- dismissLoading();
|
|
|
- showDialogChoosePay();
|
|
|
- } else if (App.app.payChannel == Constant.PAY_POS_DEVICE_PAY_MIX || manualReason != null) {
|
|
|
+ }else{
|
|
|
+ priceList = new ArrayList<>();
|
|
|
+ priceList1 = new ArrayList<>();
|
|
|
+
|
|
|
+ pri = PriceUtil.getDishPriceOne(currentDish);
|
|
|
+ }
|
|
|
+ showLoading();
|
|
|
+ if (App.app.payChannel == Constant.PAY_FREE || manualReason != null) {
|
|
|
+ payType = 0;
|
|
|
+ manualMake();
|
|
|
+ LogUtils.logWrite("免费制作了");
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_ONLINE || manualReason != null) {
|
|
|
+ if (Hawk.get("PRICEBEAN") != null) {
|
|
|
+ priceBeans = Hawk.get("PRICEBEAN");
|
|
|
+ } else {
|
|
|
dismissLoading();
|
|
|
- showDialogChoosePay();
|
|
|
- }
|
|
|
- } else if (id == R.id.dishes_ice_cream) {
|
|
|
- notifyAddShopCart();
|
|
|
- } else if (id == R.id.dishes_add_shop_cart) {
|
|
|
-// if (App.app.payChannel == Constant.PAY_POS_DEVICE && !Global.MDBCreditCardSuccess && Global.MDBCreditCardSuccessNumber != 1) {
|
|
|
-// showToast(getString(R.string.credit_failed));
|
|
|
-// return;
|
|
|
-// }
|
|
|
- if (!CommunicationHelper.getInstance().canGenerateOrder()) {
|
|
|
- ToastUtil.getInstance().showText(CommunicationHelper.getInstance().getWhyCanOrderText());
|
|
|
- return;//是否开机
|
|
|
+ showToast("请重新设置价格");
|
|
|
+ return;
|
|
|
}
|
|
|
- addShopCart();
|
|
|
-
|
|
|
- } else if (id == R.id.dishes_sauce_1) {
|
|
|
- selectSauce(0);
|
|
|
- } else if (id == R.id.dishes_sauce_2) {
|
|
|
- selectSauce(1);
|
|
|
- } else if (id == R.id.dishes_sauce_3) {
|
|
|
- selectSauce(2);
|
|
|
- } else if (id == R.id.dishes_kernel_1) {
|
|
|
- selectKernel(0);
|
|
|
- } else if (id == R.id.dishes_kernel_2) {
|
|
|
- selectKernel(1);
|
|
|
+ carsPay(str());//国内二码合一支付
|
|
|
+ Log.d(TAG, "onClick: 二码合一");
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_ONLINE_AND_PRICE_MODEL || manualReason != null) {
|
|
|
+ dismissLoading();
|
|
|
+ showDialogChoosePay();
|
|
|
+ Log.d(TAG, "onClick: 二码合一");
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_POS_DEVICE || manualReason != null) {
|
|
|
+ Log.d(TAG, "onClick: MDB板信用卡支付");
|
|
|
+ payType = 4;
|
|
|
+ pay();//MDB板信用卡支付
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_PRICE_MODEL || manualReason != null) {
|
|
|
+ showPayMixDialog();
|
|
|
+// manualMake();
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_NAYAX_PAY || manualReason != null) {
|
|
|
+ payType = 4;
|
|
|
+ showNayaxCreditCard();
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_NAYAX_PAY_MIX || manualReason != null) {
|
|
|
+ dismissLoading();
|
|
|
+ showDialogChoosePay();
|
|
|
+ } else if (App.app.payChannel == Constant.PAY_POS_DEVICE_PAY_MIX || manualReason != null) {
|
|
|
+ dismissLoading();
|
|
|
+ showDialogChoosePay();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -755,7 +777,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
arrayCode = inputText.split("#");
|
|
|
combinationCount = arrayCode.length;
|
|
|
Log.d(TAG, "handlePaymentSelection: " + arrayCode);
|
|
|
- if (combinationCount > orderHelper.generateMakingIceCream().size()) {
|
|
|
+ if (combinationCount > orderHelper.generateMakingIceCream().size()&&Hawk.get(Name.SHOPPING_TROLLEY,true)) {
|
|
|
ToastUtil.getInstance().showText(UiUtil.getStringRes(R.string.only_one_code));
|
|
|
return; // 直接返回,不继续执行
|
|
|
} else {
|
|
@@ -1027,12 +1049,14 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
if (v.isSelected()) {
|
|
|
SpecBean sb = v.getSpecBean();
|
|
|
currentDish.selectSpecBeans.add(sb);
|
|
|
+ Log.d(TAG, "无购物车测试initIceCream1: "+currentDish.selectSpecBeans);
|
|
|
}
|
|
|
}
|
|
|
for (BatchingView v : kernelViews) {
|
|
|
if (v.isSelected()) {
|
|
|
SpecBean sb = v.getSpecBean();
|
|
|
currentDish.selectSpecBeans.add(sb);
|
|
|
+ Log.d(TAG, "无购物车测试initIceCream2: "+currentDish.selectSpecBeans);
|
|
|
}
|
|
|
}
|
|
|
initPrice();
|
|
@@ -1883,7 +1907,7 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
for (int j = 0; j < getPriceList.size(); j++) {
|
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
df.setRoundingMode(RoundingMode.HALF_UP);
|
|
|
- if (priceList1.size() > 0) {
|
|
|
+ if (!priceList1.isEmpty()) {
|
|
|
double newPri = getPriceList.get(j) - priceList1.get(0);
|
|
|
String roundedResult = df.format(newPri);
|
|
|
getPriceList.set(j, Double.valueOf(roundedResult));
|
|
@@ -1936,7 +1960,6 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
|
|
|
// 添加购物车
|
|
|
private void addShopCart() {
|
|
|
- Log.d(TAG, "addShopCart: " + currentDish.selectSpecBeans);
|
|
|
ResponseBean<Integer> result = addItem(currentDish.selectSpecBeans);
|
|
|
if (!result.success) {
|
|
|
return;
|
|
@@ -2125,7 +2148,9 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
// HashMap<String, String> strings1 = new HashMap<>();
|
|
|
|
|
|
ArrayList<String> strings = new ArrayList<>();
|
|
|
- for (int i = 0; i < shoppingCartBeanList.size(); i++) {
|
|
|
+ Log.d(TAG, "无购物车测试: "+currentDish);
|
|
|
+ if (Hawk.get(Name.SHOPPING_TROLLEY,true)){
|
|
|
+ for (int i = 0; i < shoppingCartBeanList.size(); i++) {
|
|
|
strings.clear();
|
|
|
//优惠码集合
|
|
|
for (int i1 = 0; i1 < shoppingCartBeanList.get(i).getCount(); i1++) {
|
|
@@ -2161,6 +2186,29 @@ public class IceCreamFragment extends BaseAutoExitFragment implements View.OnCli
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ }else {
|
|
|
+ if (arrayCode!=null){
|
|
|
+ strings.add(arrayCode[0]);
|
|
|
+ }else {
|
|
|
+ strings.add("0");
|
|
|
+ }
|
|
|
+ String s1 = new Gson().toJson(strings);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ if (currentDish.selectSpecBeans.size()>0){
|
|
|
+ Log.d(TAG, "无购物车测试1: "+currentDish.selectSpecBeans);
|
|
|
+ for (int i = 0; i < currentDish.selectSpecBeans.size(); i++) {
|
|
|
+ sb.append(currentDish.selectSpecBeans.get(i).name);
|
|
|
+ if (i < currentDish.selectSpecBeans.size() - 1) {
|
|
|
+ sb.append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ a.put(currentDish.name+"-"+sb+"-1",s1);
|
|
|
+ }else {
|
|
|
+ Log.d(TAG, "无购物车测试2: "+currentDish.selectSpecBeans);
|
|
|
+ a.put(currentDish.name+"-"+"1",s1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String str = gson.toJson(a);
|
|
|
Log.d(TAG, shoppingCartBeanList.size() + "showShoppingTrolleyDialog: " + str);
|
|
|
return str;
|