Commit 5a9abff9 by 宁斌

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	base-module/src/main/java/com/gingersoft/gsa/cloud/constans/HttpsConstans.java
parents f09f1d03 fa4aa8f8
......@@ -56,6 +56,6 @@ public class SwitchPrintAspect {
dialog.dismiss();
});
}
}.createDialogView().show();
}.show();
}
}
......@@ -4,6 +4,8 @@ import android.graphics.Color;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
......@@ -18,7 +20,6 @@ public class PayMethod {
* sysTime : 1582865195628
* data : [{"id":11,"payName":"服務員確認","createTime":"May 7, 2018 11:47:27 AM"},{"id":1019,"payName":"轉數快支付","remarks":"","createTime":"Jul 10, 2019 4:56:21 PM"},{"id":9,"payName":"微信","createTime":"Jun 29, 2018 4:34:26 PM"},{"id":10,"payName":"Apple pay","createTime":"Aug 9, 2018 3:59:05 PM"},{"id":1010,"payName":"YedPay支付宝"},{"id":6,"payName":"支付寶HK","createTime":"Sep 12, 2017 2:45:12 PM"},{"id":8,"payName":"支付寶","createTime":"Jan 5, 2018 10:55:06 AM"},{"id":1020,"payName":"PayMe","createTime":"Nov 29, 2019 6:07:56 PM"}]
*/
private int id;
private String payName;
private String createTime;
......@@ -36,9 +37,22 @@ public class PayMethod {
private int payMoneyTextColor = Color.parseColor("#000000");
private int payModeTextSelectColor = Color.parseColor("#000000");
private int payMoneyTextSelectColor = Color.parseColor("#000000");
private int payModeSize = 18;
private int payMoneySize = 18;
private int payModeSize = 14;
private int payMoneySize = 14;
public PayMethod(int id, String payName, String createTime, String remarks, String NAME, String NAME2, String NAME3, String PAYWAY) {
this.id = id;
this.payName = payName;
this.createTime = createTime;
this.remarks = remarks;
this.NAME = NAME;
this.NAME2 = NAME2;
this.NAME3 = NAME3;
this.PAYWAY = PAYWAY;
}
public PayMethod() {
}
public int getId() {
return id;
......@@ -167,4 +181,5 @@ public class PayMethod {
public void setPayMoneySize(int payMoneySize) {
this.payMoneySize = payMoneySize;
}
}
......@@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseArray;
......@@ -29,83 +30,123 @@ import com.gingersoft.gsa.cloud.base.R;
* Created by Wyh on 2019/11/1.
*/
public abstract class DialogUtils {
private Context mContext;
// private Context mContext;
private static Dialog dialog;
private View view;
private int style = R.style.PhotoDialog;
private int mWidth = WindowManager.LayoutParams.WRAP_CONTENT;
private int mHeight = WindowManager.LayoutParams.WRAP_CONTENT;
private int mMaxHeight;
// private int mWidth = WindowManager.LayoutParams.WRAP_CONTENT;
// private int mHeight = WindowManager.LayoutParams.WRAP_CONTENT;
private ViewHepler viewHepler;
public DialogUtils(Context mContext, int xmlLayout) {
this.mContext = mContext;
view = LayoutInflater.from(mContext).inflate(xmlLayout, null);
init(mContext);
}
private void init(Context context) {
if (dialog != null) {
dialog.dismiss();
}
dialog = new Dialog(context);
viewHepler = getViewHepler(context);
initLayout(viewHepler, dialog);
dialog.setContentView(viewHepler.getContentView());
public DialogUtils(Context mContext, View view) {
this.mContext = mContext;
this.view = view;
Window dialogWindow = dialog.getWindow();
if (dialogWindow != null) {
setGravity(Gravity.CENTER);
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
//将对话框的大小按屏幕大小的百分比设置
WindowManager.LayoutParams p = dialogWindow.getAttributes(); // 获取对话框当前的参数值
p.height = WindowManager.LayoutParams.WRAP_CONTENT;
p.width = WindowManager.LayoutParams.WRAP_CONTENT;
dialogWindow.setAttributes(p);
}
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
}
public DialogUtils setWidth(int width) {
mWidth = width;
if (dialog != null) {
Window window = dialog.getWindow();
if(window != null) {
WindowManager.LayoutParams p = window.getAttributes(); // 获取对话框当前的参数值
p.width = width;
window.setAttributes(p);
}
}
return this;
}
public DialogUtils setHeight(int height) {
mHeight = height;
if (dialog != null) {
Window window = dialog.getWindow();
if(window != null) {
WindowManager.LayoutParams p = window.getAttributes(); // 获取对话框当前的参数值
p.height = height;
window.setAttributes(p);
}
}
return this;
}
public DialogUtils setMaxHeight(int maxHeight) {
mMaxHeight = maxHeight;
public DialogUtils setBackgroundDrawable(Drawable drawable) {
if (dialog != null) {
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawable(drawable);
window.getDecorView().setBackgroundResource(android.R.color.transparent);
}
}
return this;
}
public DialogUtils createDialogView() {
if(dialog != null) {
dialog.dismiss();
}
dialog = new Dialog(mContext);
viewHepler = getViewHepler();
initLayout(viewHepler, dialog);
dialog.setContentView(viewHepler.getContentView());
Window dialogWindow = dialog.getWindow();
// WindowManager.LayoutParams lp = dialogWindow.getAttributes();
dialogWindow.setGravity(Gravity.CENTER);
//将对话框的大小按屏幕大小的百分比设置
// WindowManager m = activity.getWindowManager();
// Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
WindowManager.LayoutParams p = dialogWindow.getAttributes(); // 获取对话框当前的参数值
public DialogUtils setBackgroundResource(int resid){
if (dialog != null) {
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.getDecorView().setBackgroundResource(android.R.color.transparent);
window.getDecorView().setBackgroundResource(resid);
}
}
return this;
}
p.height = mHeight;
p.width = mWidth;
// WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
// DisplayMetrics metrics = new DisplayMetrics();
// wm.getDefaultDisplay().getMetrics(metrics);
// public DialogUtils createDialogView() {
// Window dialogWindow = dialog.getWindow();
//// WindowManager.LayoutParams lp = dialogWindow.getAttributes();
// dialogWindow.setGravity(Gravity.CENTER);
// //将对话框的大小按屏幕大小的百分比设置
//// WindowManager m = activity.getWindowManager();
//// Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
// WindowManager.LayoutParams p = dialogWindow.getAttributes(); // 获取对话框当前的参数值
// Window window = dialog.getWindow();
// if (window != null) {
// window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
// window.getDecorView().setBackgroundResource(android.R.color.transparent);
// }
// p.height = mHeight;
// p.width = mWidth;
//
//
// if (metrics.heightPixels < mMaxHeight) {
// dialog.getWindow().setLayout(mWidth, mHeight);
// } else {
// dialog.getWindow().setLayout(mWidth, mMaxHeight);
//// WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
//// DisplayMetrics metrics = new DisplayMetrics();
//// wm.getDefaultDisplay().getMetrics(metrics);
////
//// if (metrics.heightPixels < mMaxHeight) {
//// dialog.getWindow().setLayout(mWidth, mHeight);
//// } else {
//// dialog.getWindow().setLayout(mWidth, mMaxHeight);
//// }
//
// dialogWindow.setAttributes(p);
//// android Activity改成dialog样式后 怎设置点击空白处关闭窗体,点击窗体以外的地方关闭窗体
// dialog.setCanceledOnTouchOutside(true);
// dialog.setCancelable(true);
//// dialog.show();
// return this;
// }
dialogWindow.setAttributes(p);
// android Activity改成dialog样式后 怎设置点击空白处关闭窗体,点击窗体以外的地方关闭窗体
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
// dialog.show();
return this;
}
public Dialog getDialog() {
return dialog;
......@@ -118,7 +159,7 @@ public abstract class DialogUtils {
}
public DialogUtils setGravity(int gravity) {
if (dialog.getWindow() != null) {
if (dialog != null && dialog.getWindow() != null) {
dialog.getWindow().setGravity(gravity);
}
return this;
......@@ -149,8 +190,8 @@ public abstract class DialogUtils {
public abstract void initLayout(ViewHepler hepler, Dialog dialog);
private ViewHepler getViewHepler() {
return ViewHepler.get(mContext, view);
private ViewHepler getViewHepler(Context context) {
return ViewHepler.get(context, view);
}
......
......@@ -94,11 +94,13 @@ public class HttpsConstans {
//修改這個值,修改微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
public static String WECHAR_REPORT_SERVER_ADDRESS;// = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
public static void init(Context context,boolean isSwitchServer) {
public static void init(Context context, boolean isSwitchServer) {
isFormal = BuildConfig.DEBUG ? 2 : 1;
isFormal = (int) SPUtils.get(context, "isFormal", 1);
if (!BuildConfig.DEBUG && !isSwitchServer) {
isFormal = 1;
}
// if (!isSwitchServer) {
// }
// isFormal = 1;
// _SERVER_ADDRESS = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/";
// ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ==1 ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS;
// ROOT_SERVER_ADDRESS_FORMAL = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
......@@ -106,45 +108,45 @@ public class HttpsConstans {
// REPORT_SERVER_ADDRESS = (isFormal ==1 ? REPORT_FORMAL_ADDRESS : REPORT_TEST_ADDRESS) + REPORT_PATH;//測試:REPORT_FORMAL_ADDRESS 正式:REPORT_TEST_ADDRESS
// WECHAR_REPORT_SERVER_ADDRESS = (isFormal == 1 ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
switch (isFormal){
switch (isFormal) {
case 1:
_SERVER_ADDRESS = HTTP_ADDRESS_URL_FORMAL + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = HTTP_ADDRESS_URL_FORMAL ;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = HTTP_ADDRESS_URL_FORMAL;
ROOT_SERVER_ADDRESS_FORMAL = HTTP_ADDRESS_URL_FORMAL + PATH;
ROOT_URL = ROOT_FORMAL_URL ;
REPORT_SERVER_ADDRESS = REPORT_FORMAL_ADDRESS +REPORT_PATH;
ROOT_URL = ROOT_FORMAL_URL;
REPORT_SERVER_ADDRESS = REPORT_FORMAL_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_FORMAL_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
break;
case 2:
_SERVER_ADDRESS = "http://a.ricepon.com:61177" + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS ;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = HTTP_ADDRESS_URL_HK + PATH;
ROOT_URL = ROOT_HK_TEST_URL ;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS +REPORT_PATH;
ROOT_URL = ROOT_HK_TEST_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
break;
case 3:
_SERVER_ADDRESS = ROOT_SERVER_YOU_CHANG_HK + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS ;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_YOU_CHANG_HK;
ROOT_URL = ROOT_SZ_URL ;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS +REPORT_PATH;
ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
break;
case 4:
_SERVER_ADDRESS = ROOT_SERVER_SHI_WEI_HK + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS ;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_SHI_WEI_HK;
ROOT_URL = ROOT_SZ_URL ;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS +REPORT_PATH;
ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
break;
case 5:
_SERVER_ADDRESS = ROOT_SERVER_SHI_SHU_HK + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS ;
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_SHI_SHU_HK;
ROOT_URL = ROOT_SZ_URL ;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS +REPORT_PATH;
ROOT_URL = ROOT_SZ_URL;
REPORT_SERVER_ADDRESS = REPORT_TEST_ADDRESS + REPORT_PATH;
WECHAR_REPORT_SERVER_ADDRESS = WECHAR_REPORT_TEST_ADDRESS + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
break;
}
......
......@@ -28,9 +28,10 @@ public class PrinterDeviceDaoUtils {
/**
* 完成PrinterDeviceBean记录的插入,如果表未创建,先创建PrinterDeviceBean表
*
* @return
*/
public boolean insertPrinterDeviceBean(PrinterDeviceBean printerDevice){
public boolean insertPrinterDeviceBean(PrinterDeviceBean printerDevice) {
boolean flag = false;
flag = mManager.getDaoSession().getPrinterDeviceBeanDao().insert(printerDevice) == -1 ? false : true;
Log.i(TAG, "insert printerDevice :" + flag + "-->" + printerDevice.toString());
......@@ -39,6 +40,7 @@ public class PrinterDeviceDaoUtils {
/**
* 插入多条数据,在子线程操作
*
* @param printerDeviceList
* @return
*/
......@@ -62,15 +64,16 @@ public class PrinterDeviceDaoUtils {
/**
* 修改一条数据
*
* @param printerDevice
* @return
*/
public boolean updatePrinterDeviceBean(PrinterDeviceBean printerDevice){
public boolean updatePrinterDeviceBean(PrinterDeviceBean printerDevice) {
boolean flag = false;
try {
mManager.getDaoSession().update(printerDevice);
flag = true;
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
return flag;
......@@ -78,16 +81,17 @@ public class PrinterDeviceDaoUtils {
/**
* 删除单条记录
*
* @param printerDevice
* @return
*/
public boolean deletePrinterDeviceBean(PrinterDeviceBean printerDevice){
public boolean deletePrinterDeviceBean(PrinterDeviceBean printerDevice) {
boolean flag = false;
try {
//按照id删除
mManager.getDaoSession().delete(printerDevice);
flag = true;
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
return flag;
......@@ -95,15 +99,16 @@ public class PrinterDeviceDaoUtils {
/**
* 删除所有记录
*
* @return
*/
public boolean deleteAll(){
public boolean deleteAll() {
boolean flag = false;
try {
//按照id删除
mManager.getDaoSession().deleteAll(PrinterDeviceBean.class);
flag = true;
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
return flag;
......@@ -111,36 +116,42 @@ public class PrinterDeviceDaoUtils {
/**
* 查询所有记录
*
* @return
*/
public List<PrinterDeviceBean> queryAllPrinterDeviceBean(){
public List<PrinterDeviceBean> queryAllPrinterDeviceBean() {
return mManager.getDaoSession().loadAll(PrinterDeviceBean.class);
}
/**
* 根据主键id查询记录
*
* @param key
* @return
*/
public PrinterDeviceBean queryPrinterDeviceBeanById(long key){
public PrinterDeviceBean queryPrinterDeviceBeanById(long key) {
return mManager.getDaoSession().load(PrinterDeviceBean.class, key);
}
/**
* 使用native sql进行查询操作
*/
public List<PrinterDeviceBean> queryPrinterDeviceBeanByNativeSql(String sql, String[] conditions){
public List<PrinterDeviceBean> queryPrinterDeviceBeanByNativeSql(String sql, String[] conditions) {
return mManager.getDaoSession().queryRaw(PrinterDeviceBean.class, sql, conditions);
}
/**
* 使用queryBuilder进行查询
*
* @return
*/
public List<PrinterDeviceBean> queryPrinterDeviceBeanByQueryBuilder(long PrinterDeviceBeanId){
public List<PrinterDeviceBean> queryPrinterDeviceBeanByQueryBuilder(long PrinterDeviceBeanId) {
QueryBuilder<PrinterDeviceBean> queryBuilder = mManager.getDaoSession().queryBuilder(PrinterDeviceBean.class);
return queryBuilder.where(PrinterDeviceBeanDao.Properties.Id.eq(PrinterDeviceBeanId)).list();
}
public void closeConnection() {
mManager.closeConnection();
}
}
......@@ -18,6 +18,7 @@ package com.gingersoft.gsa.cloud.print;
import android.bluetooth.BluetoothDevice;
import android.os.AsyncTask;
import android.util.Log;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
......@@ -183,6 +184,7 @@ public class PrintExecutor {
protected Integer doInBackground(PrintDataMaker... makers) {
if (makers == null || makers.length < 1)
return PrintSocketHolder.ERROR_0;
Log.e("eee", "個數:" + makers.length);
return doRequest(makers[0]);
}
......
......@@ -481,6 +481,6 @@ public class PrinterUtils {
dialog.dismiss();
});
}
}.createDialogView().show();
}.show();
}
}
......@@ -19,7 +19,7 @@ package com.gingersoft.gsa.cloud.print;
import java.io.IOException;
/**
* 纸宽58mm的打印机
* 打印机
*/
@SuppressWarnings("unused")
public class PrinterWriterExecutor extends PrinterWriter {
......
package com.gingersoft.gsa.cloud.print.bean
import java.io.Serializable
class OrderDetails {
/**
......@@ -12,7 +14,7 @@ class OrderDetails {
var sysTime: Long = 0
var data: List<DataBean>? = null
class DataBean {
class DataBean : Serializable {
/**
* Order_ID : 50349
* NUMBER : 1
......@@ -89,7 +91,7 @@ class OrderDetails {
// * * Order Cancelled After Collection - 訂單已取消 - 取餐后 9
// * * Order Assigned To Another Delivery Man - 已指派另一位配送員 10
class PRODUCTNAMEBean {
class PRODUCTNAMEBean : Serializable{
/**
* odsId : 1654481
* PRICE : 760.0
......@@ -106,7 +108,7 @@ class OrderDetails {
var child: List<ChildBeanX>? = null
var printseting: String? = null
class ChildBeanX {
class ChildBeanX : Serializable{
/**
* odsId : 1654482
* PRICE : 0.0
......@@ -123,7 +125,7 @@ class OrderDetails {
var child: List<ChildBean>? = null
var printseting: String? = null
class ChildBean {
class ChildBean : Serializable{
/**
* odsId : 1654488
* PRICE : 0.0
......@@ -141,6 +143,6 @@ class OrderDetails {
}
}
data class CouponBean(val couponName: String, val discount_amount: Float)
data class CouponBean(val couponName: String, val discount_amount: Float) : Serializable
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
package com.gingersoft.gsa.cloud.ui.adapter;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import java.util.List;
import androidx.annotation.Nullable;
/**
* Created by Wyh on 2020/1/17.
*/
......@@ -22,7 +21,7 @@ public class BillMethodAdapter extends BaseQuickAdapter<PayMethod, BaseViewHolde
@Override
protected void convert(BaseViewHolder helper, PayMethod item) {
TextView tv_bill_method_name = helper.getView(R.id.tv_bill_method_name);
QMUIAlphaTextView tv_bill_method_name = helper.getView(R.id.tv_bill_method_name);
tv_bill_method_name.setText(item.getPayName());
tv_bill_method_name.setTextSize(item.getPayModeSize());
tv_bill_method_name.setTextColor(item.getPayModeTextColor());
......
package com.gingersoft.gsa.cloud.table.mvp.ui.adapter;
package com.gingersoft.gsa.cloud.ui.adapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -6,7 +6,7 @@ import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import java.util.List;
......
......@@ -36,7 +36,7 @@ public class AppDialog {
else
hepler.getView(R.id.tv_dialog_cancel).setOnClickListener(v -> dialog.dismiss());
}
}.createDialogView().show();
}.show();
}
......
......@@ -10,13 +10,33 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.R;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.VibratorUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.adapter.BillMethodAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.BillMoneyAdapter;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.GridDividerItemDecoration;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
import java.util.ArrayList;
import java.util.List;
public class OrderPayView extends LinearLayout {
// public OrderPayView(Context context) {
// this(context, null);
// }
private double totalAmount;
private List<PayMethod> mBillMoneyList;//用戶已選中的支付方式
private BillMoneyAdapter mBillMoneyAdapter;
private BillMethodAdapter mBillMethodAdapter;
private int foodCount;
private OnSureClickLisenter mOnSureClickLisenter;
private TextView tvDifferenceName;
private TextView tvDifferenceMoney;
private TextView btn_order_count;
private TextView tv_total;
public OrderPayView(Context context) {
this(context, null);
......@@ -28,25 +48,266 @@ public class OrderPayView extends LinearLayout {
public OrderPayView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
public void init(Context context) {
public void loadInfo(Context context, List<PayMethod> mBillMethodList, double totalAmount, int foodCount) {
this.totalAmount = totalAmount;
this.mBillMoneyList = new ArrayList<>();
this.foodCount = foodCount;
init(context, mBillMethodList);
}
public void init(Context context, List<PayMethod> mBillMethodList) {
View view = LayoutInflater.from(context).inflate(R.layout.layout_order_pay, null);
MaxHeightRecyclerView rv_bill_money = view.findViewById(R.id.rv_bill_money);
TextView tvDifferenceName = view.findViewById(R.id.tv_difference_name);
MaxHeightRecyclerView rv_bill_money = view.findViewById(R.id.rv_bill_money);
mBillMoneyAdapter = new BillMoneyAdapter(mBillMoneyList);
rv_bill_money.setAdapter(mBillMoneyAdapter);
TextView tvDifferenceMoney = view.findViewById(R.id.tv_difference_money);
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);
tv_total = view.findViewById(R.id.tv_total);
initOrderDetail();
setDifferenceText(context);
MaxHeightRecyclerView rv_bill_method = view.findViewById(R.id.rv_bill_method);
QMUIAlphaButton keypadBtn = view.findViewById(R.id.btn_keypad);
QMUIAlphaButton exactBtn = view.findViewById(R.id.btn_exact);
QMUIAlphaButton sureBtn = view.findViewById(R.id.btn_sure_pay);
mBillMethodAdapter = new BillMethodAdapter(mBillMethodList);
mBillMethodAdapter.setOnItemClickListener((adapter, view1, position) -> {
recordOperat(context);
PayMethod method = (PayMethod) adapter.getItem(position);
// if (!isCashPayMethod(method)) {
// PayMethod N5PayMethod = getSelectN5PayMethod();
// if (N5PayMethod != null) {
// //最多選擇2中支付方式(現金+其他)
// mBillMoneyList.remove(N5PayMethod);
// mBillMoneyAdapter.notifyDataSetChanged();
// }
// }
mBillMoneyList.clear();
// if (!mBillMoneyList.contains(method)) {
double differenceMoney = getDifferenceMoney();
if (differenceMoney > -1) {
//補足差額
method.setPayMoney(differenceMoney);
}
//添加選中支付方式
mBillMoneyList.add(method);
mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
mBillMoneyAdapter.notifyDataSetChanged();
rv_bill_money.scrollToPosition(mBillMoneyList.size() - 1);
//設置差額狀態
setDifferenceText(context);
// }
});
mBillMoneyAdapter.setOnItemClickListener(new BillMoneyAdapter.OnItemClickListener() {
@Override
public void onItemClick(PayMethod datasBean, int position) {
recordOperat(context);
mBillMoneyAdapter.setSelect_position(position);
mBillMoneyAdapter.notifyDataSetChanged();
}
@Override
public void onItemDeleteClick(PayMethod datasBean, int position) {
recordOperat(context);
//刪除當前付款方式
mBillMoneyList.remove(position);
mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
mBillMoneyAdapter.notifyDataSetChanged();
//設置差額狀態
setDifferenceText(context);
}
});
rv_bill_method.setAdapter(mBillMethodAdapter);
// rv_bill_method.addItemDecoration(new GridDividerItemDecoration(QMUIDisplayHelper.dpToPx(1), ArmsUtils.getColor(context, R.color.theme_hint_color)));
//Exact
view.findViewById(R.id.btn_exact).setOnClickListener(v -> {
if (getSelectBillMoney() == null) {
ToastUtils.show(context, "請選擇支付方式");
return;
}
pressExact();
setDifferenceText(context);
});
//sure
view.findViewById(R.id.btn_sure_pay).setOnClickListener(v -> {
if (mBillMoneyList.size() == 0) {
ToastUtils.show(context, "請選擇支付方式");
return;
}
if (!canPay()) {
tipMoneyInsufficient(context);
return;
}
if (mOnSureClickLisenter != null) {
mOnSureClickLisenter.onClick(mBillMoneyList);
}
});
//Keypad
view.findViewById(R.id.layout_keypad).setOnClickListener(v -> {
if (getSelectBillMoney() == null) {
ToastUtils.show(context, "請選擇支付方式");
return;
}
showPayKeypadDialog(context);
});
this.addView(view);
}
public void notifyBillMethodAdapter(List<PayMethod> mBillMethodList) {
if (mBillMethodAdapter != null)
mBillMethodAdapter.setNewData(mBillMethodList);
}
private void recordOperat(Context context) {
VibratorUtils.pressButtonSound(context);
}
private void tipMoneyInsufficient(Context context) {
QMUITipDialog tipDialog = new QMUITipDialog.Builder(context)
.setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
.setTipWord("金額不足!")
.create();
tipDialog.show();
this.postDelayed(tipDialog::dismiss, 1500);
}
/**
* Exact
*/
public void pressExact() {
double differenceMoney = getDifferenceMoney();
PayMethod billMoneyBean = getSelectBillMoney();
if (billMoneyBean != null && differenceMoney > 0) {
billMoneyBean.setPayMoney(billMoneyBean.getPayMoney() + differenceMoney);
mBillMoneyAdapter.notifyDataSetChanged();
}
}
/**
* 是否滿足支付條件
*
* @return
*/
public boolean canPay() {
double difference = getDifferenceMoney();
if (difference <= 0) {
return true;
}
return false;
}
/**
* 獲取當前選中的支付方式
*
* @return
*/
public PayMethod getSelectBillMoney() {
for (int i = 0; i < mBillMoneyList.size(); i++) {
if (i == mBillMoneyAdapter.getSelect_position())
return mBillMoneyList.get(i);
}
return null;
}
/**
* 獲取支付差額
*
* @return
*/
public double getDifferenceMoney() {
double differenceMoney = MoneyUtil.sub(totalAmount, getBillMoney());
return MoneyUtil.get_ItemDecimals_money(differenceMoney);
}
/**
* 獲取支付總額
*
* @return
*/
private double getBillMoney() {
double totalMoney = 0.0;
for (PayMethod method : mBillMoneyList) {
totalMoney = MoneyUtil.sum(totalMoney, method.getPayMoney());
}
return totalMoney;
}
public void showPayKeypadDialog(Context context) {
PayMethod method = getSelectBillMoney();
new PayKeypadDialog(context)
.setPayMethod(method.getPayName())
.builder()
.setComfirmListener(money -> {
PayMethod billMoneyBean = getSelectBillMoney();
billMoneyBean.setPayMoney(Double.parseDouble(money));
mBillMoneyAdapter.notifyDataSetChanged();
setDifferenceText(context);
})
.show();
}
/**
* 獲取超出的金額為找零還是貼士: linePayType 1 tipsPrice 为找零 2 tipsPrice为贴上
* 現金,掃碼QR = 找零
* 信用卡 = 貼士
*
* @return 第一階段默認為找零
*/
public int getLinePayType() {
return 1;
}
public void setDifferenceText(Context context) {
double difference = getDifferenceMoney();
if (difference < 0) {
//貼士
if (getLinePayType() == 1) {
tvDifferenceName.setText("找零");
tvDifferenceMoney.setTextColor(ArmsUtils.getColor(context, R.color.red));
} else {
tvDifferenceName.setText("貼士");
tvDifferenceMoney.setTextColor(ArmsUtils.getColor(context, R.color.Grass_green));
}
tvDifferenceMoney.setText("$" + Math.abs(difference));
} else {
//尚欠
tvDifferenceName.setText("尚欠金額");
tvDifferenceMoney.setTextColor(ArmsUtils.getColor(context, R.color.red));
if (difference == 0)
tvDifferenceMoney.setText("$" + Math.abs(difference));
else
tvDifferenceMoney.setText("-$" + Math.abs(difference));
}
}
public void initOrderDetail() {
if (foodCount > 0) {
btn_order_count.setText(String.valueOf(foodCount));
btn_order_count.setVisibility(View.VISIBLE);
} else {
btn_order_count.setVisibility(View.INVISIBLE);
}
tv_total.setText("$" + totalAmount);
}
public interface OnSureClickLisenter {
void onClick(List<PayMethod> mBillMoneyList);
}
public void setmOnSureClickLisenter(OnSureClickLisenter mOnSureClickLisenter) {
this.mOnSureClickLisenter = mOnSureClickLisenter;
}
}
package com.gingersoft.gsa.cloud.table.mvp.ui.widget;
package com.gingersoft.gsa.cloud.ui.view;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.text.Editable;
import android.text.InputType;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -16,9 +14,8 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.R2;
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;
......@@ -35,7 +32,7 @@ import butterknife.OnClick;
public class PayKeypadDialog {
private Activity mContext;
private Context mContext;
private Dialog dialog;
@BindView(R2.id.lLayout_bg)
......@@ -46,7 +43,7 @@ public class PayKeypadDialog {
@BindView(R2.id.ed_value)
EditText ed_value;
public PayKeypadDialog(Activity context) {
public PayKeypadDialog(Context context) {
this.mContext = context;
initView();
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="@dimen/dp_1"
android:color="#868686" />
</shape>
\ No newline at end of file
......@@ -3,12 +3,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="@drawable/shape_white_eight_corners_bg"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_select_print"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_white_eight_corners_bg" />
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
......@@ -221,7 +221,7 @@
android:background="@drawable/selector_input_number_keyboard"
android:focusable="true"
android:tag="0"
android:src="@mipmap/table_input_money_delete"
android:src="@drawable/table_input_money_delete"
android:text="@string/Key_0"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_30"
......@@ -252,6 +252,6 @@
android:background="@drawable/selector_paybill_keyboard"
android:focusable="true"
android:tag="98"
android:src="@mipmap/table_input_money_sure" />
android:src="@drawable/table_input_money_sure" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_bill_method_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_4"
android:layout_marginBottom="@dimen/dp_4"
android:background="@drawable/shape_pay_item_normal"
android:ellipsize="marquee"
android:gravity="center"
android:maxLines="2"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:background="@drawable/selector_item_background"
android:text="現金結賬"
android:textColor="@color/black"
android:textSize="@dimen/dp_18" />
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" />
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:background="#006666"
android:orientation="horizontal"
android:padding="@dimen/dp_5">
<LinearLayout
android:id="@+id/fl_order_content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:layout_width="@dimen/dp_40"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10">
<ImageView
android:id="@+id/iv_shop_car"
android:layout_width="@dimen/dp_32"
android:layout_height="@dimen/dp_32"
android:src="@drawable/ic_shoping_car" />
<Button
android:id="@+id/btn_order_count"
android:layout_width="@dimen/dp_16"
android:layout_height="@dimen/dp_16"
android:layout_gravity="end"
android:background="@drawable/ui_shape_red_oval"
android:gravity="center"
android:singleLine="true"
android:text="10"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/dp_12"
android:visibility="invisible" />
</FrameLayout>
<TextView
android:id="@+id/tv_total_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_marginLeft="@dimen/dp_5"
android:gravity="right|center_vertical"
android:paddingRight="@dimen/dp_10"
android:text="Total:"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_22"
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>
<TextView
android:id="@+id/tv_total"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:paddingRight="@dimen/dp_8"
android:text="$1328.0"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_22"
android:textStyle="bold" />
</LinearLayout>
<com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView
android:id="@+id/rv_bill_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_background_color"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:background="@color/theme_background_color"
app:maxHeight="@dimen/dp_80"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:maxHeight="@dimen/dp_80" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/yellow"
android:background="#FBF261"
android:padding="@dimen/dp_5">
<TextView
android:id="@+id/tv_difference_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="尚欠:"
android:text="尚欠金額:"
android:textSize="@dimen/sp_20"
android:textStyle="bold" />
......@@ -37,52 +107,73 @@
android:layout_alignParentRight="true"
android:textColor="@color/red"
android:textSize="@dimen/sp_20"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="-$140" />
</RelativeLayout>
<com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView
android:id="@+id/rv_bill_method"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/dp_120"
android:divider="@null"
android:fadeScrollbars="false"
android:scrollbars="vertical"
android:orientation="vertical"
app:maxHeight="@dimen/dp_100"
android:layout_marginTop="@dimen/dp_4"
android:layout_marginLeft="@dimen/dp_4"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="4"/>
app:maxHeight="@dimen/dp_120"
app:spanCount="4" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_1"
android:orientation="horizontal">
android:layout_height="@dimen/dp_42"
android:orientation="horizontal"
android:padding="@dimen/dp_1">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_keypad"
android:layout_width="@dimen/dp_100"
<LinearLayout
android:id="@+id/layout_keypad"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#2F6666"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:text="Keypad"
android:textColor="@color/theme_white_color"/>
android:textColor="@color/theme_white_color" />
</LinearLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_exact"
android:layout_width="@dimen/dp_100"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#315FC5"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="1"
android:background="#315FC5"
android:gravity="center"
android:text="Exact"
android:textColor="@color/theme_white_color"/>
android:textColor="@color/theme_white_color" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_sure_pay"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/dp_1"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_1"
android:layout_weight="1.2"
android:background="@color/Grass_green"
android:gravity="center"
android:text="確認"
android:textColor="@color/theme_white_color"/>
android:textColor="@color/theme_white_color" />
</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:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/lLayout_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -12,6 +12,7 @@
<color name="theme_color">#398BED</color>
<color name="transparent_sixty_theme_color">#99398BED</color>
<color name="discount_red">#E74E40</color>
<color name="normal_color">#333333</color>
<!-- 統一頁面背景色-->
......
<resources>
<string name="base_app_name">public-base</string>
<string name="base_loading">加載中...</string>
<string name="ui_loading">加載中...</string>
<string name="currency_unit">$</string>
<string name="Key_0">0</string>
<string name="Key_00">00</string>
<string name="Key_1">1</string>
......@@ -16,7 +12,10 @@
<string name="Key_7">7</string>
<string name="Key_8">8</string>
<string name="Key_9">9</string>
<string name="Key_100">100</string>
<string name="Key_200">200</string>
<string name="Key_500">500</string>
<string name="Key_1000">1000</string>
<string name="Key_add_5">+5</string>
<string name="Key_add_10">+10</string>
<string name="Key_add_20">+20</string>
......@@ -26,7 +25,12 @@
<string name="Key_clear">clr</string>
<string name="Key_s">numkey</string>
<string name="btnOK">OK</string>
<string name="input_pay_money">請輸入支付金額</string>
<string name="base_loading">加載中...</string>
<string name="ui_loading">加載中...</string>
<string name="currency_unit">$</string>
<string name="loading">加載中...</string>
<string name="meal_return">返回</string>
......
......@@ -269,6 +269,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
.categories(xData)
.yAxisLineWidth(0.5f)
.xAxisLineWidth(0.5f)
.yAxisAllowDecimals(false)
.yAxisTickInterval(yAxisTickInterval)
.gridLineColor("#8CA0B3")
.yAxisMin(0f)
......
......@@ -307,6 +307,7 @@ public class MainTopFragment extends BaseFragment<MainTopPresenter> implements M
.yAxisLineWidth(0.5f)
.xAxisLineWidth(0.5f)
.xAxisTickInterval(4)
.yAxisAllowDecimals(false)
.yAxisTickInterval(yAxisTickInterval)
.markerRadius(0f)
.yAxisMin(0f)
......
......@@ -15,6 +15,7 @@
android:value="ConfigModule" />
<activity android:name=".ui.activity.DeliverySettingActivity"/>
<activity android:name=".ui.activity.OrderDetailsActivity"/>
<activity android:name=".ui.activity.PayActivity"/>
</application>
</manifest>
\ No newline at end of file
......@@ -77,7 +77,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
suspend fun gsUpdateOrderStatus(orderId: String, status: Int, orderType: Int, type: Int, sendDate: String?,
sender: String, sendmobile: String, reasonId: String, reasonDesc: String,
confirmationType: Int, orderFrom: Int) = withContext(Dispatchers.IO) {
confirmationType: Int, orderFrom: Int,payTypeId:Int = 0) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)//訂單id
.add("status", status.toString())//订单状态#0:未支付;1:待確認(已支付, 待餐廳確認);2:制作中(餐廳确認);3:派送中;4:确認收貨(完成);5:是否評論;6:取消;
......@@ -88,6 +88,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
.add("sendmobile", sendmobile)//送餐員電話
.add("reasonId", reasonId)//原因id
.add("reasonDesc", reasonDesc)//原因描敘
.add("payTypeId", payTypeId.toString())
.add("confirmationType", confirmationType.toString())//接單類型,1 手動接單 2,自動接單
.add("orderFrom", orderFrom.toString())//订单来源#1:ios;2:安卓;3:gspos;4:web;5:第三方POS A;6:第三方POS B;
.build()
......@@ -145,6 +146,13 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.getCancelReason(requestBody)
}
suspend fun getPayMethod(orderId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)
.build()
network.getPayMethod(requestBody)
}
fun getBody(vararg pair: Pair1<String, String>): RequestBody {
val requestBody = FormBody.Builder()
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
class BillBean(var name: String = "", var amount: Double = 0.0, var isRed: Int = 0)
//isRed0默認顏色黑色,1為紅色
package com.gingersoft.gsa.other_order_mode.data.model.bean;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import java.util.ArrayList;
import java.util.List;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2018/7/10
* 修订历史:2018/7/10
* 描述:
*/
public class PayTypeInfo {
/**
* code : 1
* data : {"id":15558,"amount":0.05,"remain":161457,"status":0,"orderType":2,"payType":[{"id":6,"payName":"支付宝HK","isdefault":1,"remarks":null},{"id":11,"payName":"服务员确认","isdefault":0,"remarks":null},{"id":5,"payName":"TNG","isdefault":0,"remarks":null},{"id":8,"payName":"支付宝","isdefault":0,"remarks":null},{"id":9,"payName":"微信","isdefault":0,"remarks":null}],"restaurantId":26,"restaurantName":"Gingersoft"}
* errorMsg : 成功
* page : null
*/
private String code;
private DataBean data;
private String errorMsg;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public static class DataBean {
/**
* id : 15558
* amount : 0.05
* remain : 161457
* status : 0
* orderType : 2
* payType : [{"id":6,"payName":"支付宝HK","isdefault":1,"remarks":null},{"id":11,"payName":"服务员确认","isdefault":0,"remarks":null},{"id":5,"payName":"TNG","isdefault":0,"remarks":null},{"id":8,"payName":"支付宝","isdefault":0,"remarks":null},{"id":9,"payName":"微信","isdefault":0,"remarks":null}]
* restaurantId : 26
* restaurantName : Gingersoft
*/
private int id;
private double amount;
private int remain;
private String appleToken;
private int status;
private int orderType;
private int restaurantId;
private String restaurantName;
private List<PayTypeBean> payType;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public int getRemain() {
return remain;
}
public void setRemain(int remain) {
this.remain = remain;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getOrderType() {
return orderType;
}
public void setOrderType(int orderType) {
this.orderType = orderType;
}
public int getRestaurantId() {
return restaurantId;
}
public void setRestaurantId(int restaurantId) {
this.restaurantId = restaurantId;
}
public String getRestaurantName() {
return restaurantName;
}
public void setRestaurantName(String restaurantName) {
this.restaurantName = restaurantName;
}
public List<PayTypeBean> getPayType() {
return payType;
}
public void setPayType(List<PayTypeBean> payType) {
this.payType = payType;
}
public String getAppleToken() {
return appleToken;
}
public void setAppleToken(String appleToken) {
this.appleToken = appleToken;
}
public static class PayTypeBean {
/**
* id : 6
* payName : 支付宝HK
* isdefault : 1
* remarks : null
*/
private int id;
private long isdefault;
private String payName;
private String remarks;
private String payName3;
private String payName2;
private boolean checked;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getIsdefault() {
return isdefault;
}
public void setIsdefault(long isdefault) {
this.isdefault = isdefault;
}
public String getPayName() {
return payName;
}
public void setPayName(String payName) {
this.payName = payName;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getPayName3() {
return payName3;
}
public void setPayName3(String payName3) {
this.payName3 = payName3;
}
public String getPayName2() {
return payName2;
}
public void setPayName2(String payName2) {
this.payName2 = payName2;
}
}
}
public static List<PayMethod> getPayMethodByPayType(PayTypeInfo.DataBean payTypes) {
List<PayMethod> payMethods = new ArrayList<>();
if (payTypes == null) {
return payMethods;
}
if (payTypes.payType == null) {
return payMethods;
}
for (PayTypeInfo.DataBean.PayTypeBean payType : payTypes.payType) {
PayMethod payMethod = new PayMethod(payType.id, payType.payName, "", payType.remarks, payType.payName, payType.payName2, payType.payName3, "");
payMethods.add(payMethod);
}
return payMethods;
}
}
......@@ -62,6 +62,10 @@ class CoolWeatherNetwork {
//獲取商家配置的取消訂單的原因
suspend fun getCancelReason(requestBody: RequestBody) = service.getCancelReason(requestBody).await()
//獲取商家配置的支付方式
suspend fun getPayMethod(requestBody: RequestBody) = service.getPayMethod(requestBody).await()
private suspend fun <T> Call<T>.await(): T {
return suspendCoroutine { continuation ->
enqueue(object : Callback<T> {
......
......@@ -54,5 +54,6 @@ interface WeatherService {
@POST("restaurantFoodReason/config/list")
fun getCancelReason(@Body requestBody: RequestBody): Call<CancelReason>
@POST("order/confirmPay")
fun getPayMethod(@Body requestBody: RequestBody): Call<PayTypeInfo>
}
\ No newline at end of file
......@@ -31,7 +31,6 @@ import kotlinx.coroutines.withContext
class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
companion object {
var fragmentStatus = arrayOf("0,1,2,3", "0,1", "2", "3", "3")
var fragmentType = arrayOf("0", "0", "0", "2", "7")
......@@ -129,7 +128,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}, {
//出錯
listener.invoke(0)
})
}
......@@ -196,7 +195,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
dialog.dismiss()
}
}
}.createDialogView().show()
}.show()
}
}, {
......@@ -339,13 +338,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}, {
listener.invoke(0, false)
})
}
fun gsUpdateOrderStatus(orderId: String, orderType: Int, listener: (Int, Boolean) -> Unit) {
fun gsUpdateOrderStatus(orderId: String, orderType: Int, payTypeId: Int = 0, listener: (Int, Boolean) -> Unit) {
launch({
repository.gsUpdateOrderStatus(orderId, 4, orderType, 3, "", "", "", "0", "", 1, 0).apply {
repository.gsUpdateOrderStatus(orderId, 4, orderType, 3, "", "", "", "0", "", 1, 0, payTypeId).apply {
listener.invoke(OrderDelivery, code == "1")
}
}, {
......@@ -592,7 +591,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}.setWidth(WindowManager.LayoutParams.MATCH_PARENT)
.setHeight((ArmsUtils.getScreenHeidth(context) * 0.5).toInt())
.createDialogView()
.setGravity(Gravity.BOTTOM)
.show()
}
......@@ -649,7 +647,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}.setWidth(WindowManager.LayoutParams.MATCH_PARENT)
.setHeight((ArmsUtils.getScreenHeidth(context) * 0.5).toInt())
.createDialogView()
.setGravity(Gravity.BOTTOM)
.show()
}
......@@ -723,6 +720,26 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
var payTypeBean = MutableLiveData<PayTypeInfo.DataBean>()
/**
* 獲取支付方式
*/
fun getPayMethod(orderId: String) {
launch({
repository.getPayMethod(orderId).apply {
Log.e("eee", "獲取支付方式$this")
if (this.code == "1" && this.data != null) {
payTypeBean.postValue(this.data)
} else {
payTypeBean.postValue(null)
}
}
}, {
Log.e("eee", "獲取支付方式報錯${it.message}")
payTypeBean.postValue(null)
})
}
private fun launch(block: suspend () -> Unit, error: suspend (Throwable) -> Unit) = viewModelScope.launch {
try {
......
package com.gingersoft.gsa.other_order_mode.ui.activity
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.TextView
......@@ -173,22 +174,27 @@ class OrderDetailsActivity : BaseActivity() {
BtnBuilder.closingBtn ->
//結賬,彈窗確認是否結賬
// 自取結賬,外賣結賬,第三方物流沒有結賬
object : DialogUtils(this@OrderDetailsActivity, R.layout.other_order_pause_orders) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss()
showLoading()
gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type) { status, isSuccess ->
cancelDialogForLoading()
finish()
}
}
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
// object : DialogUtils(this@OrderDetailsActivity, R.layout.other_order_pause_orders) {
// override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
// hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
// hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
// dialog.dismiss()
// showLoading()
// gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type) { status, isSuccess ->
// cancelDialogForLoading()
// finish()
// }
// }
// hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
// dialog.dismiss()
// }
// }
// }.show()
{
val intent = Intent(this@OrderDetailsActivity, PayActivity::class.java)
intent.putExtra("orderDetails", orderDetails)
startActivityForResult(intent, 1001)
}
}.createDialogView().show()
else -> {
showLoading()
updateOrderStatusByBtn(btnList[position].type, orderDetails, GsaCloudApplication.getRestaurantId(this@OrderDetailsActivity).toString()) { status, isSuccess ->
......@@ -232,6 +238,10 @@ class OrderDetailsActivity : BaseActivity() {
})
getOrderDetails(orderId, binding)
}
else -> {
cancelDialogForLoading()
ToastUtils.show(this@OrderDetailsActivity, "修改訂單狀態失敗")
}
}
}
}
......@@ -330,4 +340,14 @@ class OrderDetailsActivity : BaseActivity() {
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(requestCode == 1001){
//結賬頁面
if(resultCode == RESULT_OK){
finish()
}
}
}
}
......@@ -260,10 +260,10 @@ class OtherOrderActivity : BaseActivity() {
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE)
}
// override fun onDestroy() {
// super.onDestroy()
// unbindService(serviceConnection)
// }
override fun onDestroy() {
super.onDestroy()
unbindService(serviceConnection)
}
private var serviceConnection = object : ServiceConnection {
override fun onServiceConnected(name: ComponentName, service: IBinder) {
......
package com.gingersoft.gsa.other_order_mode.ui.activity
import android.app.Dialog
import android.os.Bundle
import android.widget.TextView
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.print.bean.OrderDetails.DataBean
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.BillBean
import com.gingersoft.gsa.other_order_mode.data.model.bean.PayTypeInfo
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.ui.adapter.FoodListAdapter
import com.gingersoft.gsa.other_order_mode.ui.adapter.PayBillAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import kotlinx.android.synthetic.main.activity_pay.*
class PayActivity : BaseActivity() {
private lateinit var pageViewModel: PageViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_pay)
qm_order_pay_bar.setTitle("結賬")
qm_order_pay_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
qm_order_pay_bar.setBackgroundColor(resources.getColor(R.color.theme_color))
val orderDetails: DataBean = intent.getSerializableExtra("orderDetails") as DataBean
pageViewModel = ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java]
var foodCount = 0
orderDetails.PRODUCT_NAME?.let { it ->
rv_order_pay_food.layoutManager = LinearLayoutManager(this)
rv_order_pay_food.adapter = FoodListAdapter(this, it)
for (bean in it) {
bean.child?.let { it ->
for (child in it) {
child.child?.let {
for (childBean in it) {
foodCount += childBean.num!!.toInt()
}
}
foodCount += child.num!!.toInt()
}
}
foodCount += bean.num!!.toInt()
}
}
other_pay_view.loadInfo(this, ArrayList<PayMethod>(), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
pageViewModel.getPayMethod(orderDetails.ID.toString())
pageViewModel.payTypeBean.observe(this, Observer {
//獲取支付方式
// other_pay_view.loadInfo(this, PayTypeInfo.getPayMethodByPayType(it), MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount), foodCount)
other_pay_view.notifyBillMethodAdapter(PayTypeInfo.getPayMethodByPayType(it))
})
other_pay_view.setmOnSureClickLisenter {payMethods->
//確認結賬,調用結賬接口
object : DialogUtils(this, R.layout.other_order_pause_orders) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss()
showLoading()
pageViewModel.gsUpdateOrderStatus(orderDetails.ID.toString(), orderDetails.order_type, payMethods[0].id) { status, isSuccess ->
cancelDialogForLoading()
setResult(RESULT_OK)
finish()
}
}
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
}
}
}.show()
}
val billBeans = ArrayList<BillBean>()
billBeans.add(BillBean("合計:", MoneyUtil.sub(MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.Lunchbox), orderDetails.DELIVERY_CHARGE)))
if (orderDetails.Lunchbox > 0) {
billBeans.add(BillBean("餐盒費:", orderDetails.Lunchbox))
}
if (orderDetails.DELIVERY_CHARGE > 0) {
billBeans.add(BillBean("送貨費:", orderDetails.DELIVERY_CHARGE))
}
if (orderDetails.discount_amount > 0) {
billBeans.add(BillBean("折扣:", orderDetails.discount_amount, 1))
}
billBeans.add(BillBean("支付金額:", MoneyUtil.sub(orderDetails.TOTAL_AMOUNT!!.toDouble(), orderDetails.discount_amount)))
rv_order_pay_bill.layoutManager = LinearLayoutManager(this)
rv_order_pay_bill.adapter = PayBillAdapter(billBeans)
}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView.Adapter
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemBinding
import com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemNewBinding
import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.ViewHolder>() {
......@@ -34,7 +35,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_other_order_item, parent, false))
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_other_order_item_new, parent, false))
}
......@@ -168,7 +169,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
}
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var binding: LayoutOtherOrderItemBinding = DataBindingUtil.bind(itemView)!!
var binding: LayoutOtherOrderItemNewBinding = DataBindingUtil.bind(itemView)!!
var flBorder: FrameLayout = itemView.findViewById(R.id.fl_border)
}
......
package com.gingersoft.gsa.other_order_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.BillBean
class PayBillAdapter(billBeans: List<BillBean>) : BaseQuickAdapter<BillBean, BaseViewHolder>(R.layout.item_pay_bill, billBeans) {
override fun convert(helper: BaseViewHolder, item: BillBean) {
helper.setText(R.id.tv_item_pay_name, item.name)
helper.setText(R.id.tv_item_pay_amount, item.amount.toString())
if(item.isRed == 0){
helper.setTextColor(R.id.tv_item_pay_name, helper.itemView.context.resources.getColor(R.color.color_3c))
helper.setTextColor(R.id.tv_item_pay_name, helper.itemView.context.resources.getColor(R.color.color_3c))
} else {
helper.setTextColor(R.id.tv_item_pay_name, helper.itemView.context.resources.getColor(R.color.discount_red))
helper.setTextColor(R.id.tv_item_pay_name, helper.itemView.context.resources.getColor(R.color.discount_red))
}
}
}
\ No newline at end of file
......@@ -116,7 +116,6 @@ object OtherOrderUtils {
}
}.setWidth((ArmsUtils.getScreenWidth(context) * 0.9).toInt())
.setHeight((ArmsUtils.getScreenHeidth(context) * 0.9).toInt())
.createDialogView()
.show()
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="@dimen/dp_1"
android:color="#AAAAAA"
android:dashWidth="@dimen/dp_10"
android:dashGap="@dimen/dp_5" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/qm_order_pay_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<com.gingersoft.gsa.cloud.ui.view.OrderPayView
android:id="@+id/other_pay_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<!-- 訂單金額詳情view-->
<com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView
android:id="@+id/rv_order_pay_bill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/other_pay_view"
android:layout_marginBottom="@dimen/dp_10" />
<!-- 食品view-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_pay_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/line_food"
android:layout_below="@id/qm_order_pay_bar"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" />
<View
android:id="@+id/line_food"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_3"
android:layout_above="@id/rv_order_pay_bill"
android:background="@drawable/shape_dash_line"
android:layerType="software" />
</RelativeLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@
android:id="@+id/layout_btn_item"
android:layout_height="@dimen/dp_40"
android:gravity="center"
android:layout_marginStart="@dimen/dp_1"
android:orientation="horizontal">
<ImageView
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_item_pay_name"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="餐盒費:" />
<TextView
android:id="@+id/tv_item_pay_amount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_item_pay_name"
android:gravity="right" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
......@@ -70,6 +71,8 @@
android:background="@{orderingMethodBg}"
android:gravity="center"
android:text="@{orderingMethod}"
tools:text="外送"
tools:textColor="@color/theme_333_color"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -85,6 +88,8 @@
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_10"
tools:text="支付方式案發生的阿斯蒂芬阿薩德發送發送"
tools:textColor="@color/theme_333_color"
android:paddingBottom="@dimen/dp_2"
android:text="@{payMethod}"
android:textColor="@color/white"
......@@ -100,6 +105,8 @@
android:layout_marginRight="@dimen/dp_10"
android:gravity="right"
android:textSize="@dimen/dp_10"
tools:text="訂單時間水電費垃圾撒旦法阿斯蒂芬阿斯蒂芬"
tools:textColor="@color/theme_333_color"
android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintLeft_toRightOf="@id/tv_payment_method"
app:layout_constraintRight_toRightOf="parent"
......@@ -108,11 +115,13 @@
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginRight="@dimen/dp_10"
tools:text="用戶名+手機號啊實打實啊實打實大阿達"
tools:textColor="@color/theme_333_color"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:text="@{data.rECEIVER + @string/left_parenthesis+data.pHONE + @string/right_parenthesis}"
......@@ -129,8 +138,9 @@
android:layout_marginTop="@dimen/dp_18"
android:gravity="right"
android:text="@{delivery_state}"
tools:text="用戶名+手"
tools:textColor="@color/theme_333_color"
android:textColor="@color/color_3c"
app:layout_constraintLeft_toRightOf="@id/tv_order_user_name"
app:layout_constraintRight_toRightOf="@id/tv_order_time"
app:layout_constraintTop_toBottomOf="@id/tv_order_time" />
......@@ -140,7 +150,7 @@
android:layout_height="wrap_content"
android:orientation="vertical"
app:barrierDirection="left"
app:constraint_referenced_ids="tv_order_amount,tv_delivery_state,tv_order_state" />
app:constraint_referenced_ids="tv_order_time,tv_order_amount,tv_delivery_state,tv_order_state" />
<androidx.constraintlayout.widget.Barrier
......@@ -158,8 +168,11 @@
android:layout_marginTop="@dimen/dp_9"
android:text="@{data.sendTime}"
android:textColor="#EC2D2D"
tools:text="送達時間Adasd奧術大師大所多啊實打實大啊實打實大阿薩德"
tools:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12"
android:visibility="visible"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintRight_toLeftOf="@id/barrier_order_right_line"
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" />
......@@ -177,13 +190,17 @@
<TextView
android:id="@+id/tv_order_num"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
android:textSize="@dimen/dp_14"
tools:text="012121201阿達as244342313154446455443434242"
tools:textColor="@color/theme_333_color"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintBottom_toBottomOf="@id/tv_order_num_text"
app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
app:layout_constraintRight_toLeftOf="@id/barrier_order_right_line"
app:layout_constraintTop_toTopOf="@id/tv_order_num_text" />
......@@ -195,6 +212,8 @@
android:background="@{stateBg}"
android:padding="@dimen/dp_5"
android:text="@{state}"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
app:layout_constraintRight_toRightOf="@id/tv_order_time"
......@@ -206,6 +225,8 @@
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_9"
tools:text="地址"
tools:textColor="@color/theme_333_color"
android:text="@{@string/address}"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="@id/tv_address"
......@@ -215,17 +236,19 @@
<TextView
android:id="@+id/tv_address"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10"
android:text="@{data.aDDRESS_DETAIL}"
app:layout_constraintHorizontal_bias="0"
tools:text="地址安居客收到貨卡和山東傻了發哈連接阿斯蒂芬"
tools:textColor="@color/theme_333_color"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
app:layout_constraintRight_toLeftOf="@id/barrier_order_right_line"
app:layout_constraintTop_toTopOf="@id/tv_address_text"
app:layout_constraintVertical_chainStyle="packed" />
app:layout_constraintTop_toTopOf="@id/tv_address_text"/>
<TextView
android:id="@+id/tv_order_amount"
......@@ -236,6 +259,8 @@
android:text="@{@string/amount_unit + data.pAY_AMOUNT}"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
tools:text="$1412121331345643"
tools:textColor="@color/theme_333_color"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_state"
app:layout_constraintRight_toRightOf="@id/tv_order_time"
app:layout_constraintTop_toTopOf="@id/tv_address_text"/>
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.gingersoft.gsa.cloud.base.utils.time.TimeUtils" />
<import type="android.view.View" />
<variable
name="data"
type="com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList.DataBeanX.DataBean" />
<variable
name="delivery_state"
type="String" />
<variable
name="state"
type="String" />
<variable
name="orderingMethod"
type="String" />
<variable
name="payMethod"
type="String" />
<variable
name="orderingMethodBg"
type="android.graphics.drawable.Drawable" />
<variable
name="stateBg"
type="android.graphics.drawable.Drawable" />
<variable
name="payMethodBg"
type="android.graphics.drawable.Drawable" />
<!-- 是否自取-->
<variable
name="isSelf"
type="Boolean" />
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_3">
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_delivery_method"
android:layout_width="@dimen/dp_19"
android:layout_height="0dp"
android:background="@{orderingMethodBg}"
android:gravity="center"
android:text="@{orderingMethod}"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="外送"
tools:textColor="@color/theme_333_color" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="@dimen/dp_10"
android:paddingEnd="@dimen/dp_10"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_method"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_payment_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@{payMethodBg}"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_10"
android:layout_centerVertical="true"
android:paddingBottom="@dimen/dp_2"
android:text="@{payMethod}"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
tools:text="支付方式支付方式支付方式支付方式支付方式"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_time"
style="@style/otherOrder_item_create_time_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_toEndOf="@id/tv_payment_method"
android:layout_alignParentEnd="true"
android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
android:textSize="@dimen/dp_10"
tools:text="下單時間下單時間下單時間下單時間"
tools:textColor="@color/theme_333_color" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="@{data.rECEIVER + @string/left_parenthesis+data.pHONE + @string/right_parenthesis}"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
tools:text="用戶名+手機號啊實打實啊實打實大阿達"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_delivery_state"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="@id/tv_order_user_name"
android:gravity="end"
android:text="@{delivery_state}"
android:textColor="@color/color_3c"
tools:text="用戶名+手"
tools:textColor="@color/theme_333_color" />
</RelativeLayout>
<TextView
android:id="@+id/tv_delivery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9"
android:text="@{data.sendTime}"
android:textColor="#EC2D2D"
android:textSize="@dimen/dp_12"
android:visibility="visible"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintRight_toLeftOf="@id/barrier_order_right_line"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name"
tools:text="送達時間Adasd奧術大師大所多啊實打實大啊實打實大阿薩德"
tools:textColor="@color/theme_333_color" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8">
<TextView
android:id="@+id/tv_order_num_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:text="取餐碼:" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@{stateBg}"
android:padding="@dimen/dp_5"
android:text="@{state}"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_num"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/tv_order_state"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/tv_order_num_text"
android:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="012121201阿達as244342313154446455443434242"
tools:textColor="@color/theme_333_color" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9"
android:layout_marginBottom="@dimen/dp_10">
<TextView
android:id="@+id/tv_address_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{@string/address}"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
tools:text="地址:\u3000"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginStart="@dimen/dp_4"
android:text="@{@string/amount_unit + data.pAY_AMOUNT}"
android:textColor="@color/red_600"
android:layout_centerVertical="true"
android:textSize="@dimen/sp_16"
tools:text="$1412121"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_5"
android:layout_toEndOf="@id/tv_address_text"
android:layout_toStartOf="@id/tv_order_amount"
android:text="@{data.aDDRESS_DETAIL}"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
tools:text="地址安居客收到貨卡和山東傻了發哈連接阿斯蒂芬"
tools:textColor="@color/theme_333_color" />
</RelativeLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id="@+id/fl_border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
</FrameLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/layout_delivery_item"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/shape_delivery_item_btn_normal"
android:gravity="center"
android:orientation="vertical">
android:orientation="vertical"
android:padding="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_2">
<TextView
android:id="@+id/tv_delivery_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_5"
android:textColor="@color/color_c8"
android:textSize="@dimen/dp_17" />
......
......@@ -7,13 +7,14 @@
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_20">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_dialog_bg"
android:orientation="vertical">
<FrameLayout
android:id="@+id/layout_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10">
......@@ -37,23 +38,11 @@
android:textSize="@dimen/dp_17" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_delivery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_10" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/tv_delivery_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_16"
android:layout_marginBottom="@dimen/dp_10"
......@@ -65,5 +54,16 @@
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_delivery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/tv_delivery_confirm"
android:layout_below="@id/layout_title"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -25,11 +25,10 @@ public class IpPrintMaker implements PrintDataMaker {
private int width; // 打印的圖片寬度,紙張寬度
private List<Bitmap> bitmaps;
public IpPrintMaker(Context context, int width, Bitmap bitmap) {
public IpPrintMaker(Context context, int width, List<Bitmap> bitmaps) {
this.mContext = context;
this.width = width;
this.bitmaps = new ArrayList<>();
this.bitmaps.add(bitmap);
this.bitmaps = bitmaps;
}
@Override
......@@ -55,7 +54,6 @@ public class IpPrintMaker implements PrintDataMaker {
printer.feedPaperCutPartial();
data.add(printer.getDataAndReset());
}
// printer.openCashBox();
data.add(printer.getDataAndClose());
return data;
} catch (Exception e) {
......
......@@ -383,7 +383,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
showIpPrintDeviceList(printerDeviceBeans, bitmaps);
});
}
}.createDialogView().show();
}.show();
} else if (deftultPrint.equals(PrintConstans.LOCAL_PRINT)) {
// 默認打印方式為本地,進行本地打印
locationPrint(bitmaps, new PrintListener() {
......@@ -452,7 +452,6 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
}
}
.setHeight(ArmsUtils.getScreenHeidth(mContext) / 2)
.createDialogView()
.setOnDismissListener(dialog -> setPrintState(PrintActivity.DIMISS_LOADING))
.show();
}
......@@ -477,17 +476,20 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
if (printerDeviceBean.getPaperSpecification() != null) {
printWidth = Double.valueOf(printerDeviceBean.getPaperSpecification()).intValue();
} else {
printWidth = 540;
printWidth = 480;
printerDeviceBean.setPaperSpecification(printWidth + "");
}
PrintExecutor executor = new PrintExecutor(printerDeviceBean);
executor.setOnStateChangedListener(stateChangedListener);
executor.setOnPrintResultListener(resultListener);
if (bitmaps != null) {
for (int j = 0; j < printCount; j++) {
List<Bitmap> zoomBitmap = new ArrayList<>();
for (int i = 0; i < bitmaps.size(); i++) {
IpPrintMaker maker = new IpPrintMaker(mContext, printWidth, ImageUtils.zoomDrawable(bitmaps.get(i), printWidth));
executor.doPrinterRequestAsync(maker);
zoomBitmap.add(ImageUtils.zoomDrawable(bitmaps.get(i), printWidth));
}
for (int j = 0; j < printCount; j++) {
IpPrintMaker maker = new IpPrintMaker(mContext, printWidth, zoomBitmap);
executor.doPrinterRequestAsync(maker);
}
}
}
......
......@@ -123,6 +123,7 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
}
PrinterDeviceDaoUtils printerDeviceDaoUtils = new PrinterDeviceDaoUtils(this);
printerDeviceBeans = printerDeviceDaoUtils.queryAllPrinterDeviceBean();
printerDeviceDaoUtils.closeConnection();
if (type == PrinterRoot.PRINT_TEST) {
if (deviceBean != null) {
printerInIt.ipDevicePrint(deviceBean, printerInIt.getPrintBitmap(mContext).get(""));
......
......@@ -269,7 +269,6 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
}
}
.setWidth(WindowManager.LayoutParams.MATCH_PARENT)
.createDialogView()
.setGravity(Gravity.BOTTOM)
.show();
}
......@@ -295,9 +294,8 @@ public class PrinterAddActivity extends BaseActivity<PrinterAddPresenter> implem
rv.setLayoutManager(new LinearLayoutManager(mContext));
rv.setAdapter(adapter);
}
}.setWidth((int) (ArmsUtils.getScreenWidth(this) * 0.6))
.setHeight((int) (ArmsUtils.getScreenHeidth(this) * 0.4))
.createDialogView()
}.setWidth((int) (ArmsUtils.getScreenWidth(this) * 0.8))
.setHeight((int) (ArmsUtils.getScreenHeidth(this) * 0.6))
.setOnDismissListener(dialog -> {
if (viewId == R.id.layout_select_fail_one) {
if (oneFailPosition < devicess.size() && oneFailPosition >= 0) {
......
......@@ -3,11 +3,13 @@ package com.gingersoft.gsa.cloud.table.mvp.contract;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.PayMethod;
import com.gingersoft.gsa.cloud.table.app.payment.bean.RefundRespose;
import com.gingersoft.gsa.cloud.table.app.payment.bean.SaleRespose;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.BaseRespose;
import com.gingersoft.gsa.cloud.ui.widget.dialog.StatusLoadingDialog;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
......@@ -49,6 +51,8 @@ public interface OrderPayContract {
void paySuccess();
void onPayFailure(String status);
void loadPayMethodsSuccess(List<PayMethod> payMethods);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
......@@ -46,10 +46,11 @@ public interface MealService {
@POST("food/updateInvisible" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateInvisible(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"})
@POST("order/send" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> createOrder(@Body RequestBody requestBody);
// @Headers({"Domain-Name: yc_location"})
@POST("orderDetails/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addFood(@Body RequestBody requestBody);
......
......@@ -18,8 +18,8 @@ import com.gingersoft.gsa.cloud.table.mvp.contract.OrderPayContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderPayActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BillMethodAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BillMoneyAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.BillMethodAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.BillMoneyAdapter;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
......@@ -65,11 +65,11 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
private OrderPayActivity IActivity;
private BillMethodAdapter mBillMethodAdapter;
private ArrayList<PayMethod> mBillMethodList = new ArrayList<>();
private BillMoneyAdapter mBillMoneyAdapter;
private ArrayList<PayMethod> mBillMoneyList = new ArrayList<>();
// private BillMethodAdapter mBillMethodAdapter;
// private ArrayList<PayMethod> mBillMethodList = new ArrayList<>();
//
// private BillMoneyAdapter mBillMoneyAdapter;
private List<PayMethod> mBillMoneyList;
/**
* 0#店內支付
......@@ -110,70 +110,70 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
if (mOrderMoneyAdapter != null) {
mRootView.setOrderDetailAdapter(mOrderMoneyAdapter);
}
if (mBillMethodAdapter == null) {
mBillMethodAdapter = new BillMethodAdapter(mBillMethodList);
mRootView.setBillMethodAdapter(mBillMethodAdapter);
}
if (mBillMoneyAdapter == null) {
mBillMoneyAdapter = new BillMoneyAdapter(mBillMoneyList);
mRootView.setBillMoneyAdapter(mBillMoneyAdapter);
}
// if (mBillMethodAdapter == null) {
// mBillMethodAdapter = new BillMethodAdapter(mBillMethodList);
// mRootView.setBillMethodAdapter(mBillMethodAdapter);
// }
// if (mBillMoneyAdapter == null) {
// mBillMoneyAdapter = new BillMoneyAdapter(mBillMoneyList);
// mRootView.setBillMoneyAdapter(mBillMoneyAdapter);
// }
}
public void initBillListener() {
mBillMethodAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
mRootView.recordOperat(true);
PayMethod method = (PayMethod) adapter.getItem(position);
// if (!isCashPayMethod(method)) {
// PayMethod N5PayMethod = getSelectN5PayMethod();
// if (N5PayMethod != null) {
// //最多選擇2中支付方式(現金+其他)
// mBillMoneyList.remove(N5PayMethod);
// public void initBillListener() {
// mBillMethodAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
// @Override
// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//
// mRootView.recordOperat(true);
//
// PayMethod method = (PayMethod) adapter.getItem(position);
//// if (!isCashPayMethod(method)) {
//// PayMethod N5PayMethod = getSelectN5PayMethod();
//// if (N5PayMethod != null) {
//// //最多選擇2中支付方式(現金+其他)
//// mBillMoneyList.remove(N5PayMethod);
//// mBillMoneyAdapter.notifyDataSetChanged();
//// }
//// }
// mBillMoneyList.clear();
//// if (!mBillMoneyList.contains(method)) {
// double differenceMoney = getDifferenceMoney();
// if (differenceMoney > -1) {
// //補足差額
// method.setPayMoney(differenceMoney);
// }
// //添加選中支付方式
// mBillMoneyList.add(method);
// mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
// mBillMoneyAdapter.notifyDataSetChanged();
// mRootView.setBillMoneyRvScrollToPosition(mBillMoneyList.size() - 1);
// //設置差額狀態
// mRootView.setDifferenceText();
//// }
// }
// });
// mBillMoneyAdapter.setOnItemClickListener(new BillMoneyAdapter.OnItemClickListener() {
//
// @Override
// public void onItemClick(PayMethod datasBean, int position) {
// mRootView.recordOperat(true);
// mBillMoneyAdapter.setSelect_position(position);
// mBillMoneyAdapter.notifyDataSetChanged();
// }
mBillMoneyList.clear();
// if (!mBillMoneyList.contains(method)) {
double differenceMoney = getDifferenceMoney();
if (differenceMoney > -1) {
//補足差額
method.setPayMoney(differenceMoney);
}
//添加選中支付方式
mBillMoneyList.add(method);
mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
mBillMoneyAdapter.notifyDataSetChanged();
mRootView.setBillMoneyRvScrollToPosition(mBillMoneyList.size() - 1);
//設置差額狀態
mRootView.setDifferenceText();
//
// @Override
// public void onItemDeleteClick(PayMethod datasBean, int position) {
// mRootView.recordOperat(true);
// //刪除當前付款方式
// mBillMoneyList.remove(position);
// mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
// mBillMoneyAdapter.notifyDataSetChanged();
// //設置差額狀態
// mRootView.setDifferenceText();
// }
// });
// }
}
});
mBillMoneyAdapter.setOnItemClickListener(new BillMoneyAdapter.OnItemClickListener() {
@Override
public void onItemClick(PayMethod datasBean, int position) {
mRootView.recordOperat(true);
mBillMoneyAdapter.setSelect_position(position);
mBillMoneyAdapter.notifyDataSetChanged();
}
@Override
public void onItemDeleteClick(PayMethod datasBean, int position) {
mRootView.recordOperat(true);
//刪除當前付款方式
mBillMoneyList.remove(position);
mBillMoneyAdapter.setSelect_position(mBillMoneyList.size() - 1);
mBillMoneyAdapter.notifyDataSetChanged();
//設置差額狀態
mRootView.setDifferenceText();
}
});
}
public void getPayMethods() {
int brandId = GsaCloudApplication.getBrandId(mApplication);
......@@ -190,8 +190,9 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
List<PayMethod> payMethods = JsonUtils.parseArray(baseResult.getData(), PayMethod.class);
mBillMethodList.addAll(payMethods);
mBillMethodAdapter.notifyDataSetChanged();
mRootView.loadPayMethodsSuccess(payMethods);
// mBillMethodList.addAll(payMethods);
// mBillMethodAdapter.notifyDataSetChanged();
}
}
});
......@@ -241,30 +242,29 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
/**
* 修改訂單更新支付方式
*/
public void updateOrderPay() {
RequestBody requestBody = new FormBody.Builder()
.add("payType", String.valueOf(mBillMoneyList.get(0).getId()))
.add("orderId", String.valueOf(MyOrderManage.getInstance().getOrderId()))
.build();
mModel.updateOrderPay(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
//結賬成功
mRootView.paySuccess();
}
}
});
}
// public void updateOrderPay() {
// RequestBody requestBody = new FormBody.Builder()
// .add("payType", String.valueOf(mBillMoneyList.get(0).getId()))
// .add("orderId", String.valueOf(MyOrderManage.getInstance().getOrderId()))
// .build();
// mModel.updateOrderPay(requestBody)
// .subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading(null))
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .doAfterTerminate(() -> mRootView.hideLoading())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
//
// @Override
// public void onNext(BaseResult baseResult) {
// if (baseResult.isSuccess()) {
// //結賬成功
// mRootView.paySuccess();
// }
// }
// });
// }
protected void createOrder() {
CreateOrderRequest request = getCreateOrderRequest(getOrderFoodLists());
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(request));
......@@ -343,12 +343,12 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
}
public void pressExact() {
double differenceMoney = getDifferenceMoney();
PayMethod billMoneyBean = getSelectBillMoney();
if (billMoneyBean != null && differenceMoney > 0) {
billMoneyBean.setPayMoney(billMoneyBean.getPayMoney() + differenceMoney);
mBillMoneyAdapter.notifyDataSetChanged();
}
// double differenceMoney = getDifferenceMoney();
// PayMethod billMoneyBean = getSelectBillMoney();
// if (billMoneyBean != null && differenceMoney > 0) {
// billMoneyBean.setPayMoney(billMoneyBean.getPayMoney() + differenceMoney);
// mBillMoneyAdapter.notifyDataSetChanged();
// }
}
/**
......@@ -357,10 +357,10 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
* @return
*/
public PayMethod getSelectBillMoney() {
for (int i = 0; i < mBillMoneyList.size(); i++) {
if (i == mBillMoneyAdapter.getSelect_position())
return mBillMoneyList.get(i);
}
// for (int i = 0; i < mBillMoneyList.size(); i++) {
// if (i == mBillMoneyAdapter.getSelect_position())
// return mBillMoneyList.get(i);
// }
return null;
}
......@@ -370,12 +370,12 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
* @return
*/
private PayMethod getSelectN5PayMethod() {
for (int i = 0; i < mBillMoneyList.size(); i++) {
if (!TextUtils.isEmpty(mBillMoneyList.get(i).getPAYWAY()) &&
!mBillMoneyList.get(i).getPAYWAY().equals(PayConstant.PAY_WAY_CASH)) {
return mBillMoneyList.get(i);
}
}
// for (int i = 0; i < mBillMoneyList.size(); i++) {
// if (!TextUtils.isEmpty(mBillMoneyList.get(i).getPAYWAY()) &&
// !mBillMoneyList.get(i).getPAYWAY().equals(PayConstant.PAY_WAY_CASH)) {
// return mBillMoneyList.get(i);
// }
// }
return null;
}
......@@ -446,9 +446,9 @@ public class OrderPayPresenter extends BaseOrderPresenter<OrderPayContract.Model
*/
private double getBillMoney() {
double totalMoney = 0.0;
for (PayMethod method : mBillMoneyList) {
totalMoney = MoneyUtil.sum(totalMoney, method.getPayMoney());
}
// for (PayMethod method : mBillMoneyList) {
// totalMoney = MoneyUtil.sum(totalMoney, method.getPayMoney());
// }
return totalMoney;
}
......@@ -465,27 +465,27 @@ 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 ArrayList<PayMethod> getBillMoneyList() {
// public ArrayList<PayMethod> getBillMethodList() {
// return mBillMethodList;
// }
//
// public void setBillMethodList(ArrayList<PayMethod> mBillMethodList) {
// this.mBillMethodList = mBillMethodList;
// }
//
public List<PayMethod> getBillMoneyList() {
return mBillMoneyList;
}
public void setBillMoneyList(ArrayList<PayMethod> mBillMoneyList) {
public void setBillMoneyList(List<PayMethod> mBillMoneyList) {
this.mBillMoneyList = mBillMoneyList;
}
public BillMethodAdapter getBillMethodAdapter() {
return mBillMethodAdapter;
}
public BillMoneyAdapter getBillMoneyAdapter() {
return mBillMoneyAdapter;
}
//
// public BillMethodAdapter getBillMethodAdapter() {
// return mBillMethodAdapter;
// }
//
// public BillMoneyAdapter getBillMoneyAdapter() {
// return mBillMoneyAdapter;
// }
}
......@@ -39,7 +39,8 @@ import com.gingersoft.gsa.cloud.table.app.payment.contract.IN5Callback;
import com.gingersoft.gsa.cloud.table.di.component.DaggerOrderPayComponent;
import com.gingersoft.gsa.cloud.table.mvp.contract.OrderPayContract;
import com.gingersoft.gsa.cloud.table.mvp.presenter.OrderPayPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.PayKeypadDialog;
import com.gingersoft.gsa.cloud.ui.view.OrderPayView;
import com.gingersoft.gsa.cloud.ui.view.PayKeypadDialog;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.GridDividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
......@@ -59,6 +60,7 @@ import org.simple.eventbus.EventBus;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.inject.Inject;
......@@ -97,33 +99,34 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
@BindView(R2.id.tv_time)
TextView tv_time;
@BindView(R2.id.tv_difference_name)
TextView tv_difference_name;
@BindView(R2.id.tv_difference_money)
TextView tv_difference_money;
// @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.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.tv_total)
// TextView tv_total;
@BindView(R2.id.btn_order_count)
Button btn_order_count;
// @BindView(R2.id.btn_order_count)
// Button btn_order_count;
//支付狀態Dialog
private StatusLoadingDialog mStatusLoadingDialog;
private QMUITipDialog tipDialog;
// private QMUITipDialog tipDialog;
@BindView(R2.id.gsa_pay_view)
OrderPayView gsaPayView;
/**
* N5相关
*/
......@@ -184,9 +187,8 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.initAdapter();
mPresenter.initBillListener();
// mPresenter.initBillListener();
mPresenter.getPayMethods();
initTopInfo();
initOrderDetail();
......@@ -217,43 +219,43 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
}
public void initOrderDetail() {
int foodCount = mPresenter.getFoodCount();
if (foodCount > 0) {
btn_order_count.setText(String.valueOf(foodCount));
btn_order_count.setVisibility(View.VISIBLE);
} else {
btn_order_count.setVisibility(View.INVISIBLE);
}
tv_whole.setText("合計 $" + mPresenter.getFoodTotal());
tv_total.setText("$" + mPresenter.getTotalAmount());
setDifferenceText();
// int foodCount = mPresenter.getFoodCount();
// if (foodCount > 0) {
// btn_order_count.setText(String.valueOf(foodCount));
// btn_order_count.setVisibility(View.VISIBLE);
// } else {
// btn_order_count.setVisibility(View.INVISIBLE);
// }
// tv_whole.setText("合計 $" + mPresenter.getFoodTotal());
// tv_total.setText("$" + mPresenter.getTotalAmount());
// setDifferenceText();
}
@Override
public void setDifferenceText() {
double difference = mPresenter.getDifferenceMoney();
if (difference < 0) {
//貼士
if (mPresenter.getLinePayType() == 1) {
tv_difference_name.setText("找零");
tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.red));
} else {
tv_difference_name.setText("貼士");
tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.Grass_green));
}
tv_difference_money.setText("$" + Math.abs(difference));
} else {
//尚欠
tv_difference_name.setText("尚欠金額");
tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.red));
if (difference == 0)
tv_difference_money.setText("$" + Math.abs(difference));
else
tv_difference_money.setText("-$" + Math.abs(difference));
}
// double difference = mPresenter.getDifferenceMoney();
// if (difference < 0) {
// //貼士
// if (mPresenter.getLinePayType() == 1) {
// tv_difference_name.setText("找零");
// tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.red));
// } else {
// tv_difference_name.setText("貼士");
// tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.Grass_green));
// }
// tv_difference_money.setText("$" + Math.abs(difference));
// } else {
// //尚欠
// tv_difference_name.setText("尚欠金額");
// tv_difference_money.setTextColor(ArmsUtils.getColor(this, R.color.red));
// if (difference == 0)
// tv_difference_money.setText("$" + Math.abs(difference));
// else
// tv_difference_money.setText("-$" + Math.abs(difference));
// }
}
@OnClick({R2.id.btn_people_num, R2.id.btn_table, R2.id.btn_sure_pay, R2.id.btn_exact, R2.id.btn_keypad})
@OnClick({R2.id.btn_people_num, R2.id.btn_table, R2.id.btn_sure_pay, R2.id.btn_exact})
public void onClick(View v) {
recordOperat(true);
......@@ -263,15 +265,15 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
if (id == R.id.btn_table) {
backPressed();
} else if (id == R.id.btn_sure_pay) {
if (mPresenter.getBillMoneyList().size() == 0) {
showMessage("請選擇支付方式");
return;
}
if (!mPresenter.canPay()) {
tipMoneyInsufficient();
return;
}
mPresenter.sendOrderBefore();
// if (mPresenter.getBillMoneyList().size() == 0) {
// showMessage("請選擇支付方式");
// return;
// }
// if (!mPresenter.canPay()) {
// tipMoneyInsufficient();
// return;
// }
// mPresenter.sendOrderBefore();
} else if (id == R.id.btn_exact) {
if (mPresenter.getSelectBillMoney() == null) {
showMessage("請選擇支付方式");
......@@ -279,13 +281,14 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
}
mPresenter.pressExact();
setDifferenceText();
} else if (id == R.id.btn_keypad) {
if (mPresenter.getSelectBillMoney() == null) {
showMessage("請選擇支付方式");
return;
}
showPayKeypadDialog();
}
// else if (id == R.id.btn_keypad) {
// if (mPresenter.getSelectBillMoney() == null) {
// showMessage("請選擇支付方式");
// return;
// }
// showPayKeypadDialog();
// }
}
@Override
......@@ -322,21 +325,21 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
backPressed();
}
private void tipMoneyInsufficient() {
if (tipDialog == null) {
tipDialog = new QMUITipDialog.Builder(this)
.setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
.setTipWord("金額不足!")
.create();
}
tipDialog.show();
btn_order_count.postDelayed(new Runnable() {
@Override
public void run() {
tipDialog.dismiss();
}
}, 1500);
}
// private void tipMoneyInsufficient() {
// if (tipDialog == null) {
// tipDialog = new QMUITipDialog.Builder(this)
// .setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
// .setTipWord("金額不足!")
// .create();
// }
// tipDialog.show();
// btn_order_count.postDelayed(new Runnable() {
// @Override
// public void run() {
// tipDialog.dismiss();
// }
// }, 1500);
// }
@Override
public void initIntent() {
......@@ -474,7 +477,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
public void onComfirm(String money) {
PayMethod billMoneyBean = mPresenter.getSelectBillMoney();
billMoneyBean.setPayMoney(Double.parseDouble(money));
mPresenter.getBillMoneyAdapter().notifyDataSetChanged();
// mPresenter.getBillMoneyAdapter().notifyDataSetChanged();
setDifferenceText();
}
})
......@@ -521,13 +524,13 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
}
private void setBillMoney() {
ArrayList<PayMethod> billMoneyList = mPresenter.getBillMoneyList();
List<PayMethod> billMoneyList = mPresenter.getBillMoneyList();
if (mPresenter.getTipsPrice() != 0) {
//打印添加找零或貼士行
String linePayType = tv_difference_name.getText().toString();
// String linePayType = tv_difference_name.getText().toString();
PayMethod payMethod = new PayMethod();
//這裡打印退一格
payMethod.setPayName(" " + linePayType);
payMethod.setPayName(" " + (mPresenter.getLinePayType() == 1 ? "找零" : "貼士"));
payMethod.setPayMoney(mPresenter.getTipsPrice());
billMoneyList.add(payMethod);
}
......@@ -535,13 +538,13 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
}
public void setBillMethodAdapter(BaseQuickAdapter adapter) {
rv_bill_method.setAdapter(adapter);
rv_bill_method.addItemDecoration(new GridDividerItemDecoration(QMUIDisplayHelper.dpToPx(1), ArmsUtils.getColor(this, R.color.theme_hint_color)));
// rv_bill_method.setAdapter(adapter);
// rv_bill_method.addItemDecoration(new GridDividerItemDecoration(QMUIDisplayHelper.dpToPx(1), ArmsUtils.getColor(this, R.color.theme_hint_color)));
}
@Override
public void setBillMoneyAdapter(BaseQuickAdapter adapter) {
rv_bill_money.setAdapter(adapter);
// rv_bill_money.setAdapter(adapter);
}
@Override
......@@ -551,7 +554,7 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
@Override
public void setBillMoneyRvScrollToPosition(int position) {
rv_bill_money.scrollToPosition(position);
// rv_bill_money.scrollToPosition(position);
}
@Override
......@@ -626,6 +629,15 @@ public class OrderPayActivity extends BaseActivity<OrderPayPresenter> implements
});
}
@Override
public void loadPayMethodsSuccess(List<PayMethod> payMethods) {
gsaPayView.loadInfo(this, payMethods, mPresenter.getTotalAmount(), mPresenter.getFoodCount());
gsaPayView.setmOnSureClickLisenter(mBillMoneyList -> {
mPresenter.setBillMoneyList(mBillMoneyList);
mPresenter.sendOrderBefore();
});
}
public void returnTableActivityBefore() {
returnTableServiceAcivity(false);
}
......
......@@ -120,136 +120,140 @@
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
<com.gingersoft.gsa.cloud.ui.view.OrderPayView
android:id="@+id/gsa_pay_view"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_45"
android:orientation="horizontal"
android:background="#006666"
android:padding="@dimen/dp_5">
android:layout_height="wrap_content"/>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_45"-->
<!-- android:orientation="horizontal"-->
<!-- android:background="#006666"-->
<!-- android:padding="@dimen/dp_5">-->
<RelativeLayout
android:id="@+id/fl_order_content"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<!-- <RelativeLayout-->
<!-- android:id="@+id/fl_order_content"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="1">-->
<TextView
android:id="@+id/tv_total_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Total:"
android:textSize="@dimen/sp_22"
android:textStyle="bold"
android:layout_gravity="left"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_10"
android:gravity="right|center_vertical"/>
<!-- <TextView-->
<!-- android:id="@+id/tv_total_text"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="Total:"-->
<!-- android:textSize="@dimen/sp_22"-->
<!-- android:textStyle="bold"-->
<!-- android:layout_gravity="left"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:paddingRight="@dimen/dp_10"-->
<!-- android:gravity="right|center_vertical"/>-->
<Button
android:id="@+id/btn_order_count"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ui_shape_red_oval"
android:singleLine="true"
android:gravity="center"
android:text=""
android:layout_margin="@dimen/dp_2"
android:layout_toRightOf="@+id/tv_total_text"
android:visibility="invisible"
android:textColor="@color/theme_white_color" />
</RelativeLayout>
<!-- <Button-->
<!-- android:id="@+id/btn_order_count"-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:background="@drawable/ui_shape_red_oval"-->
<!-- android:singleLine="true"-->
<!-- android:gravity="center"-->
<!-- android:text=""-->
<!-- android:layout_margin="@dimen/dp_2"-->
<!-- android:layout_toRightOf="@+id/tv_total_text"-->
<!-- android:visibility="invisible"-->
<!-- android:textColor="@color/theme_white_color" />-->
<!-- </RelativeLayout>-->
<TextView
android:id="@+id/tv_total"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:text="$1328.0"
android:textSize="@dimen/sp_22"
android:textStyle="bold"
android:layout_gravity="right"
android:textColor="@color/theme_white_color"
android:paddingRight="@dimen/dp_8"
android:gravity="right|center_vertical"/>
</LinearLayout>
<!-- <TextView-->
<!-- android:id="@+id/tv_total"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_weight="1"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="$1328.0"-->
<!-- android:textSize="@dimen/sp_22"-->
<!-- android:textStyle="bold"-->
<!-- android:layout_gravity="right"-->
<!-- android:textColor="@color/theme_white_color"-->
<!-- android:paddingRight="@dimen/dp_8"-->
<!-- android:gravity="right|center_vertical"/>-->
<!-- </LinearLayout>-->
<com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView
android:id="@+id/rv_bill_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
android:background="@color/theme_background_color"
app:maxHeight="@dimen/dp_80"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<!-- <com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView-->
<!-- android:id="@+id/rv_bill_money"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@null"-->
<!-- android:fadeScrollbars="false"-->
<!-- android:orientation="vertical"-->
<!-- android:background="@color/theme_background_color"-->
<!-- app:maxHeight="@dimen/dp_80"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/yellow"
android:padding="@dimen/dp_5">
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@color/yellow"-->
<!-- android:padding="@dimen/dp_5">-->
<TextView
android:id="@+id/tv_difference_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="尚欠:"
android:textSize="@dimen/sp_20"
android:textStyle="bold" />
<!-- <TextView-->
<!-- android:id="@+id/tv_difference_name"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="尚欠:"-->
<!-- android:textSize="@dimen/sp_20"-->
<!-- android:textStyle="bold" />-->
<TextView
android:id="@+id/tv_difference_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textColor="@color/red"
android:textSize="@dimen/sp_20"
android:textStyle="bold" />
</RelativeLayout>
<!-- <TextView-->
<!-- android:id="@+id/tv_difference_money"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:textColor="@color/red"-->
<!-- android:textSize="@dimen/sp_20"-->
<!-- android:textStyle="bold" />-->
<!-- </RelativeLayout>-->
<com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView
android:id="@+id/rv_bill_method"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
android:fadeScrollbars="false"
android:orientation="vertical"
app:maxHeight="@dimen/dp_100"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="4"/>
<!-- <com.gingersoft.gsa.cloud.ui.view.MaxHeightRecyclerView-->
<!-- android:id="@+id/rv_bill_method"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:divider="@null"-->
<!-- android:fadeScrollbars="false"-->
<!-- android:orientation="vertical"-->
<!-- app:maxHeight="@dimen/dp_100"-->
<!-- app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"-->
<!-- app:spanCount="4"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_1"
android:orientation="horizontal">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:padding="@dimen/dp_1"-->
<!-- android:orientation="horizontal">-->
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_keypad"
android:layout_width="@dimen/dp_100"
android:layout_height="match_parent"
android:background="#2F6666"
android:text="Keypad"
android:textColor="@color/theme_white_color"/>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_keypad"-->
<!-- android:layout_width="@dimen/dp_100"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="#2F6666"-->
<!-- android:text="Keypad"-->
<!-- android:textColor="@color/theme_white_color"/>-->
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_exact"
android:layout_width="@dimen/dp_100"
android:layout_height="match_parent"
android:background="#315FC5"
android:layout_marginLeft="@dimen/dp_1"
android:text="Exact"
android:textColor="@color/theme_white_color"/>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_exact"-->
<!-- android:layout_width="@dimen/dp_100"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="#315FC5"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:text="Exact"-->
<!-- android:textColor="@color/theme_white_color"/>-->
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_sure_pay"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/dp_1"
android:layout_height="match_parent"
android:background="@color/Grass_green"
android:text="確認"
android:textColor="@color/theme_white_color"/>
</LinearLayout>
<!-- <com.qmuiteam.qmui.alpha.QMUIAlphaButton-->
<!-- android:id="@+id/btn_sure_pay"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_weight="1"-->
<!-- android:layout_marginLeft="@dimen/dp_1"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/Grass_green"-->
<!-- android:text="確認"-->
<!-- android:textColor="@color/theme_white_color"/>-->
<!-- </LinearLayout>-->
</LinearLayout>
\ No newline at end of file
......@@ -2,31 +2,6 @@
<string name="table_app_name">Component-table</string>
<string name="Key_0">0</string>
<string name="Key_00">00</string>
<string name="Key_1">1</string>
<string name="Key_2">2</string>
<string name="Key_3">3</string>
<string name="Key_4">4</string>
<string name="Key_5">5</string>
<string name="Key_6">6</string>
<string name="Key_7">7</string>
<string name="Key_8">8</string>
<string name="Key_9">9</string>
<string name="Key_100">100</string>
<string name="Key_200">200</string>
<string name="Key_500">500</string>
<string name="Key_1000">1000</string>
<string name="Key_add_5">+5</string>
<string name="Key_add_10">+10</string>
<string name="Key_add_20">+20</string>
<string name="Key_add_50">+50</string>
<string name="Key_right"></string>
<string name="Key_clear">clr</string>
<string name="Key_s">numkey</string>
<string name="btnOK">OK</string>
<string name="loading">加載中...</string>
<string name="meal_return">返回</string>
<string name="meal_discount">折扣</string>
......@@ -85,7 +60,6 @@
<string name="standmode">一般模式</string>
<string name="detailmode">细微模式</string>
<string name="malnumber">請選擇按鍵錄入數量</string>
<string name="input_pay_money">請輸入支付金額</string>
<string name="please_input_table_number">請輸入檯號</string>
<string name="please_input_cancel_number">請輸入取消數量</string>
<string name="please_select_table_number">請選擇檯號</string>
......
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