Commit 98072f89 by Wyh

1、外送、自取、凍鏈加入金額驗證

2、供應鏈確認訂單功能
3、供應鏈發送消息功能

Signed-off-by: Wyh <1239658231>
parent 1096728b
...@@ -43,8 +43,7 @@ import android.view.View; ...@@ -43,8 +43,7 @@ import android.view.View;
import android.view.ViewConfiguration; import android.view.ViewConfiguration;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import com.jess.arms.mvp.IView;
import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -996,30 +995,31 @@ public class DeviceUtils { ...@@ -996,30 +995,31 @@ public class DeviceUtils {
/** /**
* 取SHA1 * 取SHA1
*
* @param data 数据 * @param data 数据
* @return 对应的hash值 * @return 对应的hash值
*/ */
private static byte[] getHashByString(String data) private static byte[] getHashByString(String data) {
{ try {
try{
MessageDigest messageDigest = MessageDigest.getInstance("SHA1"); MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
messageDigest.reset(); messageDigest.reset();
messageDigest.update(data.getBytes("UTF-8")); messageDigest.update(data.getBytes("UTF-8"));
return messageDigest.digest(); return messageDigest.digest();
} catch (Exception e){ } catch (Exception e) {
return "".getBytes(); return "".getBytes();
} }
} }
/** /**
* 转16进制字符串 * 转16进制字符串
*
* @param data 数据 * @param data 数据
* @return 16进制字符串 * @return 16进制字符串
*/ */
private static String bytesToHex(byte[] data){ private static String bytesToHex(byte[] data) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String stmp; String stmp;
for (int n = 0; n < data.length; n++){ for (int n = 0; n < data.length; n++) {
stmp = (Integer.toHexString(data[n] & 0xFF)); stmp = (Integer.toHexString(data[n] & 0xFF));
if (stmp.length() == 1) if (stmp.length() == 1)
sb.append("0"); sb.append("0");
...@@ -1027,6 +1027,113 @@ public class DeviceUtils { ...@@ -1027,6 +1027,113 @@ public class DeviceUtils {
} }
return sb.toString().toUpperCase(Locale.CHINA); return sb.toString().toUpperCase(Locale.CHINA);
} }
public static void openWeChat(Context context) {
try {
Intent intent = new Intent(Intent.ACTION_MAIN);
ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(context, "檢測到未安裝微信,請安裝後重試", Toast.LENGTH_LONG).show();
}
}
public static final String PACKAGE_WECHAT = "com.tencent.mm";
public static final String PACKAGE_LINE = "jp.naver.line.android";
public static final String PACKAGE_WHATSAPP = "com.whatsapp";
public static final String PACKAGE_MOBILE_QQ = "com.tencent.mobileqq";
public static final String PACKAGE_QZONE = "com.qzone";
public static final String PACKAGE_SINA = "com.sina.weibo";
// 判断是否安装指定app
public static boolean isInstallApp(Context context, String app_package) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pInfo = packageManager.getInstalledPackages(0);
for (int i = 0; i < pInfo.size(); i++) {
String pn = pInfo.get(i).packageName;
if (app_package.equals(pn)){
return true;
}
}
return false;
}
/**
* 直接分享文本到WhatsApp
*
* @param context 上下文
*/
public static void shareWhatsApp(Context context, String content) {
if (isInstallApp(context, PACKAGE_WHATSAPP)) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, content);
sendIntent.setType("text/plain");
sendIntent.setPackage(PACKAGE_WHATSAPP);
context.startActivity(Intent.createChooser(sendIntent, ""));
// startActivity(sendIntent);
} else {
Toast.makeText(context, "檢測到未安裝WhatsApp,請安裝後重試", Toast.LENGTH_LONG).show();
}
}
/**
* 直接分享文本到微信好友
*
* @param context 上下文
*/
public static void shareWeChatFriend(Context context, String content) {
if (isInstallApp(context, PACKAGE_WECHAT)) {
Intent intent = new Intent();
ComponentName cop = new ComponentName(PACKAGE_WECHAT, "com.tencent.mm.ui.tools.ShareImgUI");
intent.setComponent(cop);
intent.setAction(Intent.ACTION_SEND);
intent.putExtra("android.intent.extra.TEXT", content);
// intent.putExtra("sms_body", content);
intent.putExtra("Kdescription", !TextUtils.isEmpty(content) ? content : "");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} else {
Toast.makeText(context, "檢測到未安裝微信,請安裝後重試", Toast.LENGTH_LONG).show();
}
}
/**
* <intent-filter android:label="@string/app_name" >
* <action android:name="android.intent.action.SEND" />
* <data android:mimeType="image/*" /> 可接收的数据类型图片视频文字
* <data android:mimeType="video/*" />
* <data android:mimeType="text/plain" />
* 分享功能
* LINE
* ComponentName(String pkg, String cls)
* line的包名,line的接收资料的类名--》 </intent-filter> MainFist里面
*/
public static void shareLine(Context context, String title, String content) {
if(isInstallApp(context, PACKAGE_LINE)) {
ComponentName cn = new ComponentName(PACKAGE_LINE
, "jp.naver.line.android.activity.selectchat.SelectChatActivity");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
// Uri uri = Uri.parse(MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, null,null));
// shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
// shareIntent.setType("image/jpeg"); //图片分享
shareIntent.setType("text/plain"); // 纯文本
shareIntent.putExtra(Intent.EXTRA_SUBJECT, title);
shareIntent.putExtra(Intent.EXTRA_TEXT, content);
shareIntent.setComponent(cn);//跳到指定APP的Activity
context.startActivity(Intent.createChooser(shareIntent, ""));
} else {
Toast.makeText(context, "未安裝Line,請安裝後重試", Toast.LENGTH_LONG).show();
}
}
} }
package com.gingersoft.gsa.cloud.common.core.print.bean package com.gingersoft.gsa.cloud.common.core.print.bean
import android.util.Log
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil
import java.io.Serializable import java.io.Serializable
class OrderDetails { class OrderDetails {
...@@ -50,7 +52,8 @@ class OrderDetails { ...@@ -50,7 +52,8 @@ class OrderDetails {
var NUMBER: Int = 0 var NUMBER: Int = 0
var MEMBER_NAME: String? = null var MEMBER_NAME: String? = null
var PRICE: Double = 0.toDouble() var PRICE: Double = 0.toDouble()
// var discount_amount: Double = 0.toDouble()
// var discount_amount: Double = 0.toDouble()
var takeTime: String? = null var takeTime: String? = null
var PHONE: String? = null var PHONE: String? = null
var memberTypeId: Int = 0 var memberTypeId: Int = 0
...@@ -192,4 +195,59 @@ class OrderDetails { ...@@ -192,4 +195,59 @@ class OrderDetails {
data class PayMultiple(val payTypeId: String, val amount: Double, val payName: String, val points: Double) : Serializable data class PayMultiple(val payTypeId: String, val amount: Double, val payName: String, val points: Double) : Serializable
} }
/**
* 驗證金額是否正確
*/
companion object {
//允許的金額誤差
val allowableError = 0.01
@JvmStatic
fun verificationAmount(orderDetail: DataBean): Boolean {
val totalAmount = orderDetail.TOTAL_AMOUNT!!.toDouble()
//遍歷所有商品,算出所有食品金額
var foodAmount = 0.0
orderDetail.PRODUCT_NAME?.let { produces ->
for (product in produces) {
foodAmount = MoneyUtil.sum(foodAmount, product.PRICE!!.toDouble())
product.child?.let { childs ->
for (child in childs) {
foodAmount = MoneyUtil.sum(foodAmount, child.PRICE!!.toDouble())
child.child?.let { thirds ->
for (third in thirds) {
foodAmount = MoneyUtil.sum(foodAmount, third.PRICE!!.toDouble())
}
}
}
}
}
}
Log.e("eee", "食品總金額$foodAmount")
//食品金額加上餐盒費,配送費,應該等於總金額
foodAmount = MoneyUtil.sum(MoneyUtil.sum(foodAmount, orderDetail.Lunchbox), orderDetail.DELIVERY_CHARGE)
Log.e("eee", "總金額$foodAmount")
//後台返回的總金額與計算的總金額相減,如果不等於0,則是金額有問題,攔截
var differenceAmount = MoneyUtil.sub(MoneyUtil.sub(totalAmount, foodAmount), allowableError)
Log.e("eee", "金額差$differenceAmount")
if (differenceAmount > 0.0) {
return true
}
var payAmount = foodAmount
//遍歷計算優惠券與折扣,用總金額減去所有折扣,如果不等於支付金額,則是有問題
orderDetail.couponList?.let {
for (coupon in it) {
payAmount = MoneyUtil.sub(payAmount, coupon.discount_amount)
}
}
Log.e("eee", "減去折扣之後的總金額$payAmount")
//計算折扣後的金額,減去支付金額,如果不為0,則是有問題
differenceAmount = MoneyUtil.sub(MoneyUtil.sub(payAmount, orderDetail.PAY_AMOUNT), allowableError)
Log.e("eee", "支付金額差$differenceAmount")
if (differenceAmount > 0) {
return true
}
return false
}
}
} }
\ No newline at end of file
...@@ -26,6 +26,10 @@ public class RadioListAdapter extends BaseQuickAdapter<String, BaseViewHolder> { ...@@ -26,6 +26,10 @@ public class RadioListAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
super(R.layout.item_radio, data); super(R.layout.item_radio, data);
} }
public RadioListAdapter(int layoutId, @Nullable List<String> data) {
super(layoutId, data);
}
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, String s) { protected void convert(@NotNull BaseViewHolder viewHolder, String s) {
RadioButton radioButton = viewHolder.getView(R.id.rb_select_dialog_list_radio); RadioButton radioButton = viewHolder.getView(R.id.rb_select_dialog_list_radio);
......
...@@ -153,7 +153,6 @@ public class AppCrashHandler implements UncaughtExceptionHandler { ...@@ -153,7 +153,6 @@ public class AppCrashHandler implements UncaughtExceptionHandler {
.subscribe(new Consumer<Integer>() { .subscribe(new Consumer<Integer>() {
@Override @Override
public void accept(@io.reactivex.annotations.NonNull Integer integer) throws Exception { public void accept(@io.reactivex.annotations.NonNull Integer integer) throws Exception {
Looper.prepare();
String showText = ErrorStr; String showText = ErrorStr;
Throwable cause = ex.getCause(); Throwable cause = ex.getCause();
if (cause != null && BuildConfig.DEBUG) { if (cause != null && BuildConfig.DEBUG) {
......
...@@ -350,12 +350,25 @@ public class TimeUtils { ...@@ -350,12 +350,25 @@ public class TimeUtils {
Calendar c = new GregorianCalendar(); Calendar c = new GregorianCalendar();
c.add(Calendar.DAY_OF_MONTH, i); c.add(Calendar.DAY_OF_MONTH, i);
curDateTime = DEFAULT_DATE_FORMAT_YMDHM.format(c.getTime()); curDateTime = DEFAULT_DATE_FORMAT_YMDHM.format(c.getTime());
c.getTimeInMillis();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return curDateTime; return curDateTime;
} }
//获取当前系统前后第几天
public static long getNextDayLong(int i) {
long curDateTime = 0;
try {
Calendar c = new GregorianCalendar();
c.add(Calendar.DAY_OF_MONTH, i);
return c.getTimeInMillis();
} catch (Exception e) {
e.printStackTrace();
}
return curDateTime;
}
//获取当前系统前后第几小时 //获取当前系统前后第几小时
public static String getNextHour(int i) { public static String getNextHour(int i) {
String curDateTime = null; String curDateTime = null;
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:descendantFocusability="blocksDescendants"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<RadioButton
android:id="@+id/rb_select_dialog_list_radio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:button="@drawable/selector_radio_circle_bg" />
<TextView
android:id="@+id/tv_select_dialog_list_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16"
tools:text="重量" />
</LinearLayout>
\ No newline at end of file
...@@ -474,6 +474,7 @@ ...@@ -474,6 +474,7 @@
<color name="color_da">#DADADA</color> <color name="color_da">#DADADA</color>
<color name="color_68">#686868</color> <color name="color_68">#686868</color>
<color name="color_42">#424242</color> <color name="color_42">#424242</color>
<color name="color_ee">#eee</color>
<color name="color_222">#222222</color> <color name="color_222">#222222</color>
<color name="tran_twenty_send_order_btn_bg_color">#331196DB</color> <color name="tran_twenty_send_order_btn_bg_color">#331196DB</color>
<color name="tran_fifty_order_state0_color">#7F009788</color> <color name="tran_fifty_order_state0_color">#7F009788</color>
......
...@@ -262,7 +262,6 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -262,7 +262,6 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
if (info.getData().getData() != null && info.getData().getData().size() > 0) { if (info.getData().getData() != null && info.getData().getData().size() > 0) {
List<OrderList.DataBeanX.DataBean> dataBeans = info.getData().getData(); List<OrderList.DataBeanX.DataBean> dataBeans = info.getData().getData();
dataBeans.remove(dataBeans.size() - 1); dataBeans.remove(dataBeans.size() - 1);
ids = new ArrayList<>(); ids = new ArrayList<>();
for (int i = 0; i < dataBeans.size(); i++) { for (int i = 0; i < dataBeans.size(); i++) {
ids.add(dataBeans.get(i).getId()); ids.add(dataBeans.get(i).getId());
...@@ -306,7 +305,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -306,7 +305,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
if (info != null && info.getData() != null && info.getData().size() > 0) { if (info != null && info.getData() != null && info.getData().size() > 0) {
thirdDelivery(info.getData().get(0)); thirdDelivery(info.getData().get(0));
} else { } else {
if (errorCount < 5) { if (errorCount < maxErrorCount) {
startToBeConfirmedOrderList(ResturantInfoManager.newInstance().getRestaurantId()); startToBeConfirmedOrderList(ResturantInfoManager.newInstance().getRestaurantId());
errorCount++; errorCount++;
} }
...@@ -316,11 +315,20 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -316,11 +315,20 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
} }
private int errorCount = 0; private int errorCount = 0;
private int maxErrorCount = 5;
/**
* 指派到第三方物流配送
* @param dataBean
*/
public void thirdDelivery(OrderDetails.DataBean dataBean) { public void thirdDelivery(OrderDetails.DataBean dataBean) {
if (!isAutoReceiving) { if (!isAutoReceiving) {
return; return;
} }
//驗證訂單金額是否正確
if(OrderDetails.verificationAmount(dataBean)){
return;
}
ThirdItem third = new ThirdItem(); ThirdItem third = new ThirdItem();
if (dataBean.getPRODUCT_NAME() != null) { if (dataBean.getPRODUCT_NAME() != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) { for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) {
...@@ -374,6 +382,10 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract. ...@@ -374,6 +382,10 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
if (!isAutoReceiving) { if (!isAutoReceiving) {
return; return;
} }
//驗證訂單金額是否正確
if(OrderDetails.verificationAmount(dataBean)){
return;
}
//添加PRJ //添加PRJ
addPrj(dataBean); addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
......
...@@ -146,6 +146,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -146,6 +146,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
public void thirdDelivery(OrderDetails.DataBean dataBean) { public void thirdDelivery(OrderDetails.DataBean dataBean) {
//驗證訂單金額是否正確
if(OrderDetails.verificationAmount(dataBean)){
mRootView.showMessage("訂單金額不正確,請檢查");
return;
}
ThirdItem third = new ThirdItem(); ThirdItem third = new ThirdItem();
if (dataBean.getPRODUCT_NAME() != null) { if (dataBean.getPRODUCT_NAME() != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) { for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) {
...@@ -203,6 +208,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -203,6 +208,11 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
public void updateOrderState(OrderDetails.DataBean dataBean, int status, String labUrl) { public void updateOrderState(OrderDetails.DataBean dataBean, int status, String labUrl) {
//驗證訂單金額是否正確
if(OrderDetails.verificationAmount(dataBean)){
mRootView.showMessage("訂單金額不正確,請檢查");
return;
}
//添加PRJ //添加PRJ
addPrj(dataBean); addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
......
...@@ -19,6 +19,7 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans ...@@ -19,6 +19,7 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans
import com.gingersoft.gsa.cloud.common.core.order.order.TakeawayOrder import com.gingersoft.gsa.cloud.common.core.order.order.TakeawayOrder
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod import com.gingersoft.gsa.cloud.common.core.pay.PayMethod
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.Companion.verificationAmount
import com.gingersoft.gsa.cloud.common.core.print.bean.adapter.PrintContentAdapter import com.gingersoft.gsa.cloud.common.core.print.bean.adapter.PrintContentAdapter
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext import com.gingersoft.gsa.cloud.common.core.user.UserContext
...@@ -55,6 +56,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -55,6 +56,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val ProductionComplete = 1007//製作完成 val ProductionComplete = 1007//製作完成
val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調 val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調
val Transportation = 1009//修改運輸工具成功 val Transportation = 1009//修改運輸工具成功
val AmountError = 1010//訂單金額有錯
} }
val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() } val restaurantId by lazy { ResturantInfoManager.newInstance().getRestaurantId() }
...@@ -192,29 +194,34 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -192,29 +194,34 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//確認訂單之前得先獲取訂單詳情 //確認訂單之前得先獲取訂單詳情
val orderInfo = repository.getOrderInfo(dataList[0].Id.toString()) val orderInfo = repository.getOrderInfo(dataList[0].Id.toString())
if (orderInfo.data != null && orderInfo.data!!.isNotEmpty()) { if (orderInfo.data != null && orderInfo.data!!.isNotEmpty()) {
orderInfo.data!![0].order_type = dataList[0].order_type orderInfo.data?.let { it ->
orderInfo.data!![0].orderPayType = dataList[0].orderPayType val orderDetail = it[0]
val orderDetail = orderInfo.data!![0] if (verificationAmount(orderDetail)) return@launch
if (orderDetail.order_type == 7) { orderDetail.order_type = dataList[0].order_type
//如果是自取單,將物流類型改為本店 orderDetail.orderPayType = dataList[0].orderPayType
orderDetail.companyType = 0 if (orderDetail.order_type == 7) {
} //如果是自取單,將物流類型改為本店
var trafficType = "" orderDetail.companyType = 0
if (orderDetail.companyType == 2) { }
//lalamove var trafficType = ""
val transportationBean = getTransportationConfig(restaurantId) if (orderDetail.companyType == 2) {
if (transportationBean.success && transportationBean.data != null && transportationBean.data.list != null) { //lalamove
for (value in transportationBean.data.list) { val transportationBean = getTransportationConfig(restaurantId)
if (value.status == 1) { if (transportationBean.success && transportationBean.data != null && transportationBean.data.list != null) {
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具 for (value in transportationBean.data.list) {
trafficType = value.type.toString() if (value.status == 1) {
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
trafficType = value.type.toString()
}
} }
} }
} }
} confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) {
confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) { //確認之後,刷新列表
//確認之後,刷新列表 refreshState.postValue(0)
refreshState.postValue(0) }
} }
} }
} else { } else {
...@@ -239,6 +246,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -239,6 +246,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val orderInfo = repository.getOrderInfo(dataList[0].Id.toString()) val orderInfo = repository.getOrderInfo(dataList[0].Id.toString())
if (orderInfo.data != null && orderInfo.data!!.isNotEmpty()) { if (orderInfo.data != null && orderInfo.data!!.isNotEmpty()) {
val orderDetail = orderInfo.data!![0] val orderDetail = orderInfo.data!![0]
if (verificationAmount(orderDetail)) return@launch
updateOrderAndPrint(restaurantId, orderDetail, 8, false) { updateOrderAndPrint(restaurantId, orderDetail, 8, false) {
refreshState.postValue(0) refreshState.postValue(0)
} }
...@@ -397,6 +405,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -397,6 +405,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
fun confirmOrder(dataBean: OrderDetails.DataBean, status: Int, trafficType: String = "", restaurantId: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) { fun confirmOrder(dataBean: OrderDetails.DataBean, status: Int, trafficType: String = "", restaurantId: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) {
if (verificationAmount(dataBean)) {
listener.invoke(getMsgBean(0, "訂單金額不正確,請取消", false))
return
}
launch({ launch({
when (dataBean.companyType) { when (dataBean.companyType) {
0 -> { 0 -> {
...@@ -490,6 +502,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -490,6 +502,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun gsUpdateOrderStatus(orderDetails: OrderDetails.DataBean, orderPayInfoVO: List<OrderDetails.DataBean.PayMultiple>?, listener: (Int, Boolean) -> Unit) { fun gsUpdateOrderStatus(orderDetails: OrderDetails.DataBean, orderPayInfoVO: List<OrderDetails.DataBean.PayMultiple>?, listener: (Int, Boolean) -> Unit) {
//驗證訂單金額是否正確
if (verificationAmount(orderDetails)) {
listener.invoke(AmountError, false)
return
}
launch({ launch({
repository.gsUpdateOrderStatus(orderDetails.ID, 4, orderDetails.order_type, 3, orderFrom = 0).apply { repository.gsUpdateOrderStatus(orderDetails.ID, 4, orderDetails.order_type, 3, orderFrom = 0).apply {
orderDetails.payMultiple = orderPayInfoVO orderDetails.payMultiple = orderPayInfoVO
...@@ -517,6 +534,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -517,6 +534,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
* 修改訂單狀態並打印,狀態為0,1,2才打印 * 修改訂單狀態並打印,狀態為0,1,2才打印
*/ */
fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) { fun updateOrderAndPrint(restaurantId: Int, dataBean: OrderDetails.DataBean, status: Int, isPrintPrj: Boolean = true, isPrintBill: Boolean = true, listener: (MessageBean) -> Unit) {
if (verificationAmount(dataBean)) {
listener.invoke(getMsgBean(0, "訂單金額不正確,請取消", false))
return
}
launch({ launch({
repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", "", "", "0", "", 1, 0).apply { repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", "", "", "0", "", 1, 0).apply {
if (status == 0 || status == 1 || status == 2 || status == 8) { if (status == 0 || status == 1 || status == 2 || status == 8) {
...@@ -782,6 +803,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -782,6 +803,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
confirmBtn.setOnClickListener { confirmBtn.setOnClickListener {
if (selectIndex != -1) { if (selectIndex != -1) {
//驗證訂單金額是否正確
if (verificationAmount(dataBean)) {
ToastUtils.show(context, "訂單金額不正確,請檢查")
return@setOnClickListener
}
launch({ launch({
repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", deliveryBean!!.data[deliveryAdapter.selectIndex].userName, deliveryBean!!.data[deliveryAdapter.selectIndex].mobile, "0", "", 1, 0).apply { repository.gsUpdateOrderStatus(dataBean.ID, status, dataBean.order_type, 1, "", deliveryBean!!.data[deliveryAdapter.selectIndex].userName, deliveryBean!!.data[deliveryAdapter.selectIndex].mobile, "0", "", 1, 0).apply {
if (code == "1") { if (code == "1") {
......
...@@ -35,6 +35,7 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.ServiceChargeRecord ...@@ -35,6 +35,7 @@ import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.ServiceChargeRecord
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.TransportationBean import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.TransportationBean
import com.gingersoft.gsa.delivery_pick_mode.databinding.ActivityOrderDetailsBinding import com.gingersoft.gsa.delivery_pick_mode.databinding.ActivityOrderDetailsBinding
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.AmountError
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.OrderDelivery import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.OrderDelivery
import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.PrintCode import com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel.Companion.PrintCode
...@@ -114,10 +115,9 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -114,10 +115,9 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
private fun initTopBar(topbar: QMUITopBar) { private fun initTopBar(topbar: QMUITopBar) {
topbar.setTitle(ResturantInfoManager.newInstance().getRestaurantName()) topbar.setTitle(ResturantInfoManager.newInstance().restaurantName)
topbar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() } topbar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color)) topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
} }
private fun PageViewModel.getOrderDetails(orderId: String, binding: ActivityOrderDetailsBinding) { private fun PageViewModel.getOrderDetails(orderId: String, binding: ActivityOrderDetailsBinding) {
...@@ -134,9 +134,11 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -134,9 +134,11 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
orderDetails.order_type = orderType orderDetails.order_type = orderType
orderDetails.orderPayType = orderPayType orderDetails.orderPayType = orderPayType
binding.data = orderDetails //總金額
binding.isSelf = orderDetails.order_type == 7
var totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble() var totalAmount = orderDetails.TOTAL_AMOUNT!!.toDouble()
//合計:總金額減去餐盒費,配送費
val total = MoneyUtil.sub(MoneyUtil.sub(totalAmount, orderDetails.Lunchbox), orderDetails.DELIVERY_CHARGE)
//總金額減去折扣
orderDetails.couponList?.let { orderDetails.couponList?.let {
for (coupon in it) { for (coupon in it) {
val view = View.inflate(mContext, R.layout.item_discount, null) val view = View.inflate(mContext, R.layout.item_discount, null)
...@@ -146,9 +148,13 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -146,9 +148,13 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount) totalAmount = MoneyUtil.sub(totalAmount, coupon.discount_amount)
} }
} }
binding.total = total
binding.totalAmount = totalAmount binding.totalAmount = totalAmount
val btnList = ArrayList<BtnBuilder.BtnBean>() binding.data = orderDetails
binding.isSelf = orderDetails.order_type == 7
val btnList = ArrayList<BtnBuilder.BtnBean>()
val orderStatusText: String val orderStatusText: String
val type = if (orderDetails.order_type == 7) "自取" else "外送" val type = if (orderDetails.order_type == 7) "自取" else "外送"
when (orderDetails.orderStatus) { when (orderDetails.orderStatus) {
...@@ -293,7 +299,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -293,7 +299,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} else { } else {
GridLayoutManager(this@OrderDetailsActivity, spanCount) GridLayoutManager(this@OrderDetailsActivity, spanCount)
} }
gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int { override fun getSpanSize(position: Int): Int {
//5個按鈕,第五個的position=4. 4 //5個按鈕,第五個的position=4. 4
...@@ -352,6 +357,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -352,6 +357,10 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
} }
} else { } else {
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@OrderDetailsActivity, "訂單金額不正確,請檢查")
return@setOnItemClickListener
}
val intent = Intent(this@OrderDetailsActivity, PayActivity::class.java) val intent = Intent(this@OrderDetailsActivity, PayActivity::class.java)
intent.putExtra("orderDetails", orderDetails) intent.putExtra("orderDetails", orderDetails)
startActivityForResult(intent, 1001) startActivityForResult(intent, 1001)
...@@ -428,14 +437,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -428,14 +437,6 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
} }
}) })
// getAdditionalByOrderId(orderId) {
// if (it != null && it.data.isNotEmpty()) {
// thirdExpensesLayout.visibility = View.VISIBLE
// it.data.add(0, ServiceChargeRecordBean.DataX(0, 0, 0, 0, 0, 0, 0.0, 0, 0, 0, 0, 0, "", ""))
// rvThirdExpenses.adapter = ThirdExpensesAdapter(it.data)
// rvThirdExpenses.layoutManager = LinearLayoutManager(this@OrderDetailsActivity)
// }
// }
serviceChargeRecordBeans.observe(this@OrderDetailsActivity, Observer { serviceChargeRecordBeans.observe(this@OrderDetailsActivity, Observer {
if (it != null && it.data.isNotEmpty()) { if (it != null && it.data.isNotEmpty()) {
for (value in it.data) { for (value in it.data) {
...@@ -596,7 +597,13 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() { ...@@ -596,7 +597,13 @@ class OrderDetailsActivity : BaseActivity<IPresenter>() {
} }
finish() finish()
} }
AmountError.toString() -> {
ToastUtils.show(this@OrderDetailsActivity, "訂單金額錯誤,請檢查")
}
else -> { else -> {
if (TextUtil.isNotEmptyOrNullOrUndefined(msg.errorMsg)) {
ToastUtils.show(this@OrderDetailsActivity, msg.errorMsg)
}
cancelDialogForLoading() cancelDialogForLoading()
} }
} }
......
...@@ -8,6 +8,7 @@ import androidx.lifecycle.Observer ...@@ -8,6 +8,7 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.common.core.pay.PayMethod import com.gingersoft.gsa.cloud.common.core.pay.PayMethod
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean import com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils
...@@ -84,6 +85,10 @@ class PayActivity : BaseActivity<IPresenter>() { ...@@ -84,6 +85,10 @@ class PayActivity : BaseActivity<IPresenter>() {
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener { hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
dialog.dismiss() dialog.dismiss()
showLoading() showLoading()
if (OrderDetails.verificationAmount(orderDetails)) {
ToastUtils.show(this@PayActivity, "訂單金額不正確,請檢查")
return@setOnClickListener
}
pageViewModel.closingBill(orderDetails, payMethods) { _, _ -> pageViewModel.closingBill(orderDetails, payMethods) { _, _ ->
cancelDialogForLoading() cancelDialogForLoading()
setResult(RESULT_OK) setResult(RESULT_OK)
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
<variable <variable
name="totalAmount" name="totalAmount"
type="Double" /> type="Double" />
<variable
name="total"
type="Double" />
<variable <variable
name="data" name="data"
type="com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean" /> type="com.gingersoft.gsa.cloud.common.core.print.bean.OrderDetails.DataBean" />
...@@ -474,7 +478,7 @@ ...@@ -474,7 +478,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_total_text" android:layout_toRightOf="@id/tv_total_text"
android:gravity="right" android:gravity="right"
android:text="@{@string/amount_unit + MoneyUtil.sub(MoneyUtil.sub(totalAmount, data.lunchbox),data.dELIVERY_CHARGE)}" /> android:text="@{@string/amount_unit + total}" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
...@@ -585,7 +589,7 @@ ...@@ -585,7 +589,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_pay_amount_text" android:layout_toRightOf="@id/tv_pay_amount_text"
android:gravity="right" android:gravity="right"
android:text="@{@string/amount_unit + totalAmount}" android:text="@{@string/amount_unit + data.PAY_AMOUNT}"
android:textColor="#FF0000" /> android:textColor="#FF0000" />
</RelativeLayout> </RelativeLayout>
......
...@@ -80,7 +80,6 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -80,7 +80,6 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
private boolean passwrodVisibility = false; private boolean passwrodVisibility = false;
@Override @Override
public void setupActivityComponent(@NonNull AppComponent appComponent) { public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerLoginComponent //如找不到该类,请编译一下项目 DaggerLoginComponent //如找不到该类,请编译一下项目
...@@ -102,7 +101,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -102,7 +101,7 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
((ImageView) findViewById(R.id.iv_top_bg)).setAdjustViewBounds(true); ((ImageView) findViewById(R.id.iv_top_bg)).setAdjustViewBounds(true);
mPresenter.requestExternalStoragePermission(); mPresenter.requestExternalStoragePermission();
//顯示記住的登錄名 //顯示記住的登錄名
if (!Objects.equals(SPUtils.get( UserConstans.LOGIN_USERNAME, ""), "")) { if (!Objects.equals(SPUtils.get(UserConstans.LOGIN_USERNAME, ""), "")) {
edAccount.setText("" + SPUtils.get(UserConstans.LOGIN_USERNAME, "")); edAccount.setText("" + SPUtils.get(UserConstans.LOGIN_USERNAME, ""));
mRbRememberPwd.setChecked(true); mRbRememberPwd.setChecked(true);
} }
...@@ -324,7 +323,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -324,7 +323,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
SPUtils.put(UserConstans.AUTO_LOGIN, mRbAutoLogin.isChecked()); SPUtils.put(UserConstans.AUTO_LOGIN, mRbAutoLogin.isChecked());
} }
@OnClick({R2.id.btn_gsa_user_login, R2.id.iv_clear_pwd, R2.id.iv_clear_account, R2.id.tv_remember_pwd_text, R2.id.ic_look_pwd, R2.id.tv_auto_login_text, R2.id.tv_forget_pwd}) @Override
@OnClick({R2.id.btn_gsa_user_login, R2.id.iv_clear_pwd, R2.id.iv_clear_account, R2.id.ic_look_pwd, R2.id.tv_forget_pwd})
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.ic_look_pwd: case R.id.ic_look_pwd:
...@@ -340,17 +340,17 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -340,17 +340,17 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
} }
edPwd.setSelection(edPwd.getText() == null ? 0 : edPwd.getText().toString().length()); edPwd.setSelection(edPwd.getText() == null ? 0 : edPwd.getText().toString().length());
break; break;
case R.id.tv_remember_pwd_text: // case R.id.tv_remember_pwd_text:
//記住密碼 // //記住密碼
mRbRememberPwd.toggle(); // mRbRememberPwd.toggle();
break; // break;
case R.id.tv_auto_login_text: // case R.id.tv_auto_login_text:
//自動登陸 // //自動登陸
mRbAutoLogin.toggle(); // mRbAutoLogin.toggle();
if (mRbAutoLogin.isChecked()) { // if (mRbAutoLogin.isChecked()) {
mRbRememberPwd.setChecked(true); // mRbRememberPwd.setChecked(true);
} // }
break; // break;
case R.id.btn_gsa_user_login: case R.id.btn_gsa_user_login:
//登陸 //登陸
if (edPwd.getText() == null || edPwd.getText().length() < 6) { if (edPwd.getText() == null || edPwd.getText().length() < 6) {
...@@ -375,6 +375,9 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -375,6 +375,9 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
//忘記密碼 //忘記密碼
startActivity(new Intent(this, RecoverPasswordActivity.class)); startActivity(new Intent(this, RecoverPasswordActivity.class));
break; break;
default:
break;
} }
} }
......
...@@ -153,46 +153,24 @@ ...@@ -153,46 +153,24 @@
<CheckBox <CheckBox
android:id="@+id/rb_auto_login" android:id="@+id/rb_auto_login"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:background="@drawable/selector_checkbox"
android:button="@null" />
<TextView
android:id="@+id/tv_auto_login_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_11" android:button="@drawable/selector_checkbox"
android:gravity="center_vertical"
android:text="自動登陸" android:text="自動登陸"
android:textColor="@color/color_86" android:textColor="@color/color_86"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14" />
app:layout_constraintBottom_toBottomOf="@id/rb_auto_login"
app:layout_constraintLeft_toRightOf="@id/rb_auto_login"
app:layout_constraintTop_toTopOf="@id/rb_auto_login" />
<CheckBox <CheckBox
android:id="@+id/rb_remember_password" android:id="@+id/rb_remember_password"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_15"
android:background="@drawable/selector_checkbox"
android:button="@null"
app:layout_constraintLeft_toRightOf="@id/tv_auto_login_text"
app:layout_constraintTop_toTopOf="@id/rb_auto_login" />
<TextView
android:id="@+id/tv_remember_pwd_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_11" android:layout_marginLeft="@dimen/dp_15"
android:button="@drawable/selector_checkbox"
android:gravity="center_vertical"
android:text="記住密碼" android:text="記住密碼"
android:textColor="@color/color_86" android:textColor="@color/color_86"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14" />
app:layout_constraintBottom_toBottomOf="@id/rb_remember_password"
app:layout_constraintLeft_toRightOf="@id/rb_remember_password"
app:layout_constraintTop_toTopOf="@id/rb_remember_password" />
<TextView <TextView
android:id="@+id/tv_forget_pwd" android:id="@+id/tv_forget_pwd"
......
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import java.io.Serializable;
import java.util.List;
import lombok.Data; import lombok.Data;
/** /**
...@@ -11,17 +18,53 @@ import lombok.Data; ...@@ -11,17 +18,53 @@ import lombok.Data;
*/ */
@Data @Data
public class ConfirmOrderBean { public class ConfirmOrderBean {
private PurchaseOrder purchaseOrder;
private List<PurchaseOrderDetails> purchaseOrderDetails;
@Data
public static class PurchaseOrder implements Serializable {
private static final long serialVersionUID = -8777410033061311699L;
private int id;
private int supplierId;
private String supplierName;
private int brandId;
private int restaurantId;
private String sendingAddress;
//默認第二天
private long initialShippingTime;
private double totalAmount;
private int shipping;
private double actualPayment;
private String remarks;
}
private static class purchaseOrder{ public static PurchaseOrder conversionPurchaseOrder(PurchaseFoodListVosBean cartFood) {
PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(cartFood.getSupplierId());
purchaseOrder.setSupplierName(cartFood.getSupplierName());
purchaseOrder.setBrandId(ResturantInfoManager.newInstance().getBrandId());
purchaseOrder.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
purchaseOrder.setInitialShippingTime(TimeUtils.getNextDayLong(1));
purchaseOrder.setTotalAmount(MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodCount()));
purchaseOrder.setActualPayment(MoneyUtil.sum(purchaseOrder.getTotalAmount(), purchaseOrder.getShipping()));
return purchaseOrder;
}
@Data
public static class PurchaseOrderDetails {
private int purchaseFoodId;
private int foodQuantity;
private double foodPrice;
private int orderId;
}
public static PurchaseOrderDetails conversionPurchaseOrderDetails(PurchaseFoodListVosBean cartFood) {
PurchaseOrderDetails purchaseOrderDetails = new PurchaseOrderDetails();
purchaseOrderDetails.setPurchaseFoodId(cartFood.getId());
purchaseOrderDetails.setFoodQuantity(cartFood.getFoodCount());
purchaseOrderDetails.setFoodPrice(cartFood.getUnitPrice());
return purchaseOrderDetails;
} }
private String supplierName;
private String sendAddress;
private String sendTime;
private String totalAmount;
private String freight;
private String payAmount;
private String remarks;
} }
package com.gingersoft.supply_chain.mvp.bean;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/18
* Time: 16:41
* Use:
*/
public class ConfirmOrderResultBean {
}
package com.gingersoft.supply_chain.mvp.contract; package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -19,10 +26,13 @@ import com.jess.arms.mvp.IModel; ...@@ -19,10 +26,13 @@ import com.jess.arms.mvp.IModel;
public interface ConfirmOrderContract { public interface ConfirmOrderContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadInfo(List<ConfirmOrderBean> confirmOrderBeans);
void addOrderSuccess(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel{
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<BaseResult> addPurchaseOrder(RequestBody requestBody);
} }
} }
package com.gingersoft.supply_chain.mvp.contract; package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -19,11 +23,13 @@ import com.jess.arms.mvp.IModel; ...@@ -19,11 +23,13 @@ import com.jess.arms.mvp.IModel;
public interface SendMsgContract { public interface SendMsgContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadQrCode(String url);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel { interface Model extends IModel {
Observable<BaseResult> getPurchaseOrderQrCode(String orderId);
Observable<BaseResult> senMsg(RequestBody requestBody);
} }
} }
package com.gingersoft.supply_chain.mvp.model; package com.gingersoft.supply_chain.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract; import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -41,4 +46,9 @@ public class ConfirmOrderModel extends BaseModel implements ConfirmOrderContract ...@@ -41,4 +46,9 @@ public class ConfirmOrderModel extends BaseModel implements ConfirmOrderContract
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BaseResult> addPurchaseOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addNewPurchaseOrder(requestBody);
}
} }
\ No newline at end of file
...@@ -2,15 +2,18 @@ package com.gingersoft.supply_chain.mvp.model; ...@@ -2,15 +2,18 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; import io.reactivex.Observable;
import okhttp3.RequestBody;
/** /**
...@@ -43,4 +46,14 @@ public class SendMsgModel extends BaseModel implements SendMsgContract.Model { ...@@ -43,4 +46,14 @@ public class SendMsgModel extends BaseModel implements SendMsgContract.Model {
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BaseResult> getPurchaseOrderQrCode(String orderId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getPurchaseOrderQrCode(orderId);
}
@Override
public Observable<BaseResult> senMsg(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).sendMsg(requestBody);
}
} }
\ No newline at end of file
...@@ -2,7 +2,12 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,7 +2,12 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart; import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract; import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
...@@ -10,15 +15,22 @@ import com.jess.arms.di.scope.FragmentScope; ...@@ -10,15 +15,22 @@ import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
...@@ -43,7 +55,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo ...@@ -43,7 +55,7 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo
ImageLoader mImageLoader; ImageLoader mImageLoader;
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
private List<List<PurchaseFoodListVosBean>> supplierFoods; private List<ConfirmOrderBean> confirmOrderBeans;
@Inject @Inject
public ConfirmOrderPresenter(ConfirmOrderContract.Model model, ConfirmOrderContract.View rootView) { public ConfirmOrderPresenter(ConfirmOrderContract.Model model, ConfirmOrderContract.View rootView) {
...@@ -60,26 +72,79 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo ...@@ -60,26 +72,79 @@ public class ConfirmOrderPresenter extends BasePresenter<ConfirmOrderContract.Mo
} }
public void organizeShopCartData() { public void organizeShopCartData() {
Map<Integer, List<PurchaseFoodListVosBean>> listMap = new HashMap<>(4); Map<Integer, ConfirmOrderBean> listMap = new HashMap<>(4);
double totalPrice = 0;
for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) { for (PurchaseFoodListVosBean cartFood : SupplyShoppingCart.getInstance().getCartFoods()) {
//計算總價 //計算總價
if (cartFood.isChecked()) { if (cartFood.isChecked()) {
totalPrice = MoneyUtil.sum(totalPrice, MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodCount())); ConfirmOrderBean confirmOrderBean = listMap.get(cartFood.getSupplierId());
totalTypeNumber++; if (confirmOrderBean == null) {
} confirmOrderBean = new ConfirmOrderBean();
List<PurchaseFoodListVosBean> foodListVosBeans = listMap.get(cartFood.getSupplierId()); confirmOrderBean.setPurchaseOrder(ConfirmOrderBean.conversionPurchaseOrder(cartFood));
if (foodListVosBeans == null) {
foodListVosBeans = new ArrayList<>(); List<ConfirmOrderBean.PurchaseOrderDetails> purchaseOrderDetails = new ArrayList<>();
foodListVosBeans.add(cartFood); purchaseOrderDetails.add(ConfirmOrderBean.conversionPurchaseOrderDetails(cartFood));
listMap.put(cartFood.getSupplierId(), foodListVosBeans); confirmOrderBean.setPurchaseOrderDetails(purchaseOrderDetails);
} else { listMap.put(cartFood.getSupplierId(), confirmOrderBean);
foodListVosBeans.add(cartFood); } else {
ConfirmOrderBean.PurchaseOrder purchaseOrder = confirmOrderBean.getPurchaseOrder();
//重新計算總價
purchaseOrder.setTotalAmount(MoneyUtil.sum(purchaseOrder.getTotalAmount(), MoneyUtil.priceCalculation(cartFood.getUnitPrice(), cartFood.getFoodCount())));
//計算加上運費之後的實際應付金額
purchaseOrder.setActualPayment(MoneyUtil.sum(purchaseOrder.getTotalAmount(), purchaseOrder.getShipping()));
//食品列表添加當前食品
List<ConfirmOrderBean.PurchaseOrderDetails> purchaseOrderDetails = confirmOrderBean.getPurchaseOrderDetails();
purchaseOrderDetails.add(ConfirmOrderBean.conversionPurchaseOrderDetails(cartFood));
}
} }
} }
supplierFoods = new ArrayList<>(); confirmOrderBeans = new ArrayList<>();
supplierFoods.addAll(listMap.values()); confirmOrderBeans.addAll(listMap.values());
mRootView.loadAdapter(supplierFoods); mRootView.loadInfo(confirmOrderBeans);
}
public void addPurchaseOrder() {
mModel.addPurchaseOrder(RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(confirmOrderBeans)))
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("訂單創建中..."))
.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()) {
List<ConfirmOrderBean> confirmOrderBeanList = GsonUtils.jsonToList(baseResult.getData().toString(), ConfirmOrderBean.class);
List<ConfirmOrderBean.PurchaseOrder> purchaseOrders = new ArrayList<>();
for (ConfirmOrderBean confirmOrderBean : confirmOrderBeanList) {
for (ConfirmOrderBean confirmOrderBean1 : confirmOrderBeans) {
if (confirmOrderBean.getPurchaseOrder().getSupplierId() == confirmOrderBean1.getPurchaseOrder().getSupplierId()) {
confirmOrderBean.getPurchaseOrder().setSupplierName(confirmOrderBean1.getPurchaseOrder().getSupplierName());
break;
}
}
purchaseOrders.add(confirmOrderBean.getPurchaseOrder());
}
//訂單添加成功,將購物車中這些食品移除
Iterator<PurchaseFoodListVosBean> iterator = SupplyShoppingCart.getInstance().getCartFoods().iterator();
while (iterator.hasNext()) {
if (iterator.next().isChecked()) {
iterator.remove();
}
}
mRootView.addOrderSuccess(purchaseOrders);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage("創建訂單失敗,請稍後重試");
}
}
});
} }
......
...@@ -2,15 +2,28 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -2,15 +2,28 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/** /**
...@@ -36,6 +49,8 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -36,6 +49,8 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
private Map<String, String> qrCodeMap = new HashMap<>();
@Inject @Inject
public SendMsgPresenter(SendMsgContract.Model model, SendMsgContract.View rootView) { public SendMsgPresenter(SendMsgContract.Model model, SendMsgContract.View rootView) {
super(model, rootView); super(model, rootView);
...@@ -49,4 +64,56 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM ...@@ -49,4 +64,56 @@ public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendM
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void getPurchaseOrderQrCode(String orderId) {
if (TextUtil.isNotEmptyOrNullOrUndefined(qrCodeMap.get(orderId))) {
mRootView.loadQrCode(qrCodeMap.get(orderId));
return;
}
mModel.getPurchaseOrderQrCode(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
qrCodeMap.put(orderId, info.getData().toString());
mRootView.loadQrCode(qrCodeMap.get(orderId));
}
}
});
}
class PurchaseMsgBean {
private int orderId;
private int type;
private String configText;
}
public void sendMsg(int orderId, int type) {
PurchaseMsgBean purchaseMsgBean = new PurchaseMsgBean();
purchaseMsgBean.orderId = orderId;
purchaseMsgBean.type = type;
//configText
mModel.senMsg(RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseMsgBean)))
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("正在發送..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess() && info.getData() != null) {
}
}
});
}
} }
...@@ -17,6 +17,8 @@ import me.jessyan.retrofiturlmanager.RetrofitUrlManager; ...@@ -17,6 +17,8 @@ import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.MultipartBody; import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Headers; import retrofit2.http.Headers;
import retrofit2.http.Multipart; import retrofit2.http.Multipart;
...@@ -212,4 +214,26 @@ public interface SupplierServer { ...@@ -212,4 +214,26 @@ public interface SupplierServer {
@Headers({"Domain-Name: ricepon-purchase"}) @Headers({"Domain-Name: ricepon-purchase"})
@GET("foodCategory/subset/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @GET("foodCategory/subset/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<FoodByCategoryResultBean> getFoodByCategory(@QueryMap Map<String, Object> map); Observable<FoodByCategoryResultBean> getFoodByCategory(@QueryMap Map<String, Object> map);
/**
* 獲取訂單生成後用於展示的鏈接
* @param orderId
* @return
*/
@FormUrlEncoded
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseOrder/upload" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getPurchaseOrderQrCode(@Field("orderId") String orderId);
/**
* 根據用戶選擇的類型發送消息
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseOrderSend/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> sendMsg(@Body RequestBody requestBody);
} }
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import org.jetbrains.annotations.NotNull;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/18
* Time: 16:00
* Use:
*/
public class ConfirmOrderAdapter extends BaseQuickAdapter<ConfirmOrderBean, BaseViewHolder> {
public ConfirmOrderAdapter() {
super(R.layout.item_confirm_order);
}
@Override
protected void convert(@NotNull BaseViewHolder holder, ConfirmOrderBean confirmOrderBean) {
ConfirmOrderBean.PurchaseOrder purchaseOrder = confirmOrderBean.getPurchaseOrder();
holder.setText(R.id.tv_confirm_order_item_supplier_name, purchaseOrder.getSupplierName());
holder.setText(R.id.tv_confirm_order_item_supplier_address, purchaseOrder.getSendingAddress());
holder.setText(R.id.tv_confirm_order_item_send_time, TimeUtils.getStringByFormat(purchaseOrder.getInitialShippingTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM));
holder.setText(R.id.tv_confirm_order_item_total_amount, purchaseOrder.getTotalAmount() + "");
holder.setText(R.id.tv_confirm_order_item_freight, purchaseOrder.getShipping() + "");
holder.setText(R.id.tv_confirm_order_item_pay_amount, purchaseOrder.getActualPayment() + "");
EditText editText = holder.getView(R.id.ed_confirm_order_item_remark);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
getData().get(holder.getAdapterPosition()).getPurchaseOrder().setRemarks(s + "");
}
});
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.supply_chain.R
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean
/**
* @author 宇航.
* User: admin
* Date: 2020/12/17
* Time: 11:35
* Use:
*/
class ConfirmOrderAdapter : BaseQuickAdapter<ConfirmOrderBean, BaseViewHolder>(R.layout.item_confirm_order) {
override fun convert(holder: BaseViewHolder, item: ConfirmOrderBean) {
holder.setText(R.id.tv_confirm_order_item_supplier_name, item.supplierName)
holder.setText(R.id.tv_confirm_order_item_supplier_address, item.sendAddress)
holder.setText(R.id.tv_confirm_order_item_send_time, TimeUtils.getNextDay(1))
holder.setText(R.id.tv_confirm_order_item_total_amount, item.totalAmount.toString())
holder.setText(R.id.tv_confirm_order_item_freight, item.freight)
holder.setText(R.id.tv_confirm_order_item_pay_amount, item.payAmount.toString())
holder.setText(R.id.ed_confirm_order_item_remark, item.remarks)
}
}
\ No newline at end of file
...@@ -39,6 +39,24 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV ...@@ -39,6 +39,24 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV
super(R.layout.item_shopping_cart, data); super(R.layout.item_shopping_cart, data);
this.context = context; this.context = context;
selectFoods = new ArrayList<>(); selectFoods = new ArrayList<>();
addChecked(data);
}
/**
* 將集合中已選中的食品添加到 用於操作的集合中
* @param data
*/
public void addChecked(@Nullable List<List<PurchaseFoodListVosBean>> data) {
if (data != null) {
selectFoods.clear();
for (List<PurchaseFoodListVosBean> datum : data) {
for (PurchaseFoodListVosBean purchaseFoodListVosBean : datum) {
if (purchaseFoodListVosBean.isChecked()) {
selectFoods.add(purchaseFoodListVosBean);
}
}
}
}
} }
@Override @Override
......
...@@ -12,12 +12,16 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,12 +12,16 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerConfirmOrderComponent; import com.gingersoft.supply_chain.di.component.DaggerConfirmOrderComponent;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract; import com.gingersoft.supply_chain.mvp.contract.ConfirmOrderContract;
import com.gingersoft.supply_chain.mvp.presenter.ConfirmOrderPresenter; import com.gingersoft.supply_chain.mvp.presenter.ConfirmOrderPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.ConfirmOrderAdapter;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
...@@ -68,13 +72,33 @@ public class ConfirmOrderFragment extends BaseSupplyChainFragment<ConfirmOrderPr ...@@ -68,13 +72,33 @@ public class ConfirmOrderFragment extends BaseSupplyChainFragment<ConfirmOrderPr
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "採購單確認"); initTopBar(supplyTopBar, "採購單確認");
// ConfirmOrderAdapter adapter = new ConfirmOrderAdapter(); mPresenter.organizeShopCartData();
// rvConfirmOrder.setAdapter(adapter); }
// adapter.setList();
@OnClick({R2.id.btn_confirm_order, R2.id.btn_cancel_order})
public void onClick(View view) {
int viewId = view.getId();
if (viewId == R.id.btn_confirm_order) {
//確認訂單
mPresenter.addPurchaseOrder();
} else if (viewId == R.id.btn_cancel_order) {
killMyself();
}
} }
@OnClick({R2.id.btn_confirm_order,R2.id.btn_cancel_order}) @Override
public void onClick(View view){ public void loadInfo(List<ConfirmOrderBean> confirmOrderBeans) {
ConfirmOrderAdapter adapter = new ConfirmOrderAdapter();
rvConfirmOrder.setAdapter(adapter);
adapter.setList(confirmOrderBeans);
}
@Override
public void addOrderSuccess(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
OrderContentFragment childFragment = findChildFragment(OrderContentFragment.class);
if (childFragment != null) {
childFragment.killMyself();
}
startWithPop(SendMsgFragment.newInstance(purchaseOrders));
} }
} }
...@@ -93,6 +93,7 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr ...@@ -93,6 +93,7 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
} }
} }
} }
shoppingCartAdapter.addChecked(shoppingCartAdapter.getData());
setTotalInfo(totalTypeFood, totalAmount); setTotalInfo(totalTypeFood, totalAmount);
shoppingCartAdapter.notifyDataSetChanged(); shoppingCartAdapter.notifyDataSetChanged();
} }
...@@ -107,9 +108,19 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr ...@@ -107,9 +108,19 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
if (viewId == R.id.tv_order_content_complete) { if (viewId == R.id.tv_order_content_complete) {
//完成 //完成
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans(); List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans();
// mPresenter.addNewPurchaseOrder(purchaseFoodListVosBeans, edOrderContentRemark.getText() + "");
//去到訂單確認頁面 //去到訂單確認頁面
startWithPop(ConfirmOrderFragment.newInstance()); boolean isHasChecked = false;
for (PurchaseFoodListVosBean purchaseFoodListVosBean : purchaseFoodListVosBeans) {
if (purchaseFoodListVosBean.isChecked()) {
isHasChecked = true;
break;
}
}
if (isHasChecked) {
start(ConfirmOrderFragment.newInstance());
} else {
showMessage("請選擇食品");
}
} else if (viewId == R.id.btn_order_content_order_template) { } else if (viewId == R.id.btn_order_content_order_template) {
//訂單模板 //訂單模板
......
...@@ -4,21 +4,39 @@ import android.os.Bundle; ...@@ -4,21 +4,39 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.ui.adapter.RadioListAdapter;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerSendMsgComponent; import com.gingersoft.supply_chain.di.component.DaggerSendMsgComponent;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract; import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter; import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.DeviceUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Efax;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.Email;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.SupplierContacts.SMS;
/** /**
...@@ -26,19 +44,49 @@ import butterknife.BindView; ...@@ -26,19 +44,49 @@ import butterknife.BindView;
*/ */
public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> implements SendMsgContract.View { public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> implements SendMsgContract.View {
private final static String KEY_PURCHASE_ORDER_INFO = "purchaseOrders";
@BindView(R2.id.supply_top_bar) @BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar; QMUITopBar supplyTopBar;
@BindView(R2.id.rv_send_select_supplier)
RecyclerView rvSupplier;
@BindView(R2.id.cb_email)
CheckBox cbEmail;
@BindView(R2.id.cb_sms)
CheckBox cbSms;
@BindView(R2.id.cb_efax)
CheckBox cbEfax;
@BindView(R2.id.rb_whatsapp)
RadioButton rbWhatsapp;
@BindView(R2.id.rb_wechat)
RadioButton rbWechat;
@BindView(R2.id.rb_line)
RadioButton rbLine;
@BindView(R2.id.rb_kakao)
RadioButton rbKakao;
@BindView(R2.id.rg_send_msg_method)
RadioGroup rgSendMsgMethod;
@BindView(R2.id.layout_contact_information) @BindView(R2.id.layout_contact_information)
LinearLayout layoutContactInformation; LinearLayout layoutContactInformation;
@BindView(R2.id.horizontal_dotted) @BindView(R2.id.horizontal_dotted)
View horizontalDotted; View horizontalDotted;
@BindView(R2.id.cb_has_qrcode)
CheckBox cbHasQrCode;
@BindView(R2.id.iv_msg_qr_code)
ImageView ivQrCode;
@BindView(R2.id.btn_supplier_confirm) @BindView(R2.id.btn_supplier_confirm)
QMUIAlphaButton btnSupplierConfirm; QMUIAlphaButton btnSupplierConfirm;
@BindView(R2.id.btn_supplier_cancel) @BindView(R2.id.btn_supplier_cancel)
QMUIAlphaButton btnSupplierCancel; QMUIAlphaButton btnSupplierCancel;
private List<ConfirmOrderBean.PurchaseOrder> purchaseOrders;
private RadioListAdapter radioListAdapter;
public static SendMsgFragment newInstance() { public static SendMsgFragment newInstance(List<ConfirmOrderBean.PurchaseOrder> purchaseOrders) {
SendMsgFragment fragment = new SendMsgFragment(); SendMsgFragment fragment = new SendMsgFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(KEY_PURCHASE_ORDER_INFO, (Serializable) purchaseOrders);
fragment.setArguments(bundle);
return fragment; return fragment;
} }
...@@ -60,5 +108,77 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -60,5 +108,77 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "發送"); initTopBar(supplyTopBar, "發送");
Bundle arguments = getArguments();
if (arguments != null) {
purchaseOrders = (List<ConfirmOrderBean.PurchaseOrder>) arguments.getSerializable(KEY_PURCHASE_ORDER_INFO);
}
if (purchaseOrders != null && purchaseOrders.size() > 0) {
List<String> supplierNames = new ArrayList<>();
for (ConfirmOrderBean.PurchaseOrder purchaseOrder : purchaseOrders) {
supplierNames.add(purchaseOrder.getSupplierName());
}
radioListAdapter = new RadioListAdapter(R.layout.item_radio_left, supplierNames);
radioListAdapter.setSelectIndex(0);
mPresenter.getPurchaseOrderQrCode(purchaseOrders.get(radioListAdapter.getSelectIndex()).getId() + "");
rvSupplier.setLayoutManager(new GridLayoutManager(mContext, 2));
rvSupplier.setAdapter(radioListAdapter);
radioListAdapter.setOnItemClickListener((adapter, view, position) -> {
//切換供應商
//選擇默認的聯繫方式
//獲取信息鏈接
mPresenter.getPurchaseOrderQrCode(purchaseOrders.get(position).getId() + "");
radioListAdapter.setSelectIndex(position);
});
} else {
killMyself();
}
}
@OnClick({R2.id.btn_supplier_confirm, R2.id.btn_supplier_cancel})
public void onClick(View view) {
int viewId = view.getId();
if (viewId == R.id.btn_supplier_confirm) {
//發送
if (rgSendMsgMethod.getCheckedRadioButtonId() == R.id.rb_whatsapp) {
//分享到WhatsApp
DeviceUtils.shareWhatsApp(mContext, url);
} else if (rgSendMsgMethod.getCheckedRadioButtonId() == R.id.rb_wechat) {
//分享到微信
DeviceUtils.shareWeChatFriend(mContext, url);
} else if (rgSendMsgMethod.getCheckedRadioButtonId() == R.id.rb_line) {
//分享到Line
DeviceUtils.shareLine(mContext, "", url);
} else if (rgSendMsgMethod.getCheckedRadioButtonId() == R.id.rb_kakao) {
//跳轉Kakao
}
if (cbEmail.isChecked()) {
//發送email
sendMsg(Email);
}
if (cbSms.isChecked()) {
//發送SMS
sendMsg(SMS);
}
if (cbEfax.isChecked()) {
//發送Efax
sendMsg(Efax);
}
} else if (viewId == R.id.btn_supplier_cancel) {
popTo(PurchaseListFragment.class, true);
}
}
private void sendMsg(int email) {
mPresenter.sendMsg(purchaseOrders.get(radioListAdapter.getSelectIndex()).getId(), email);
}
private String url;
@Override
public void loadQrCode(String url) {
this.url = url;
com.gingersoft.gsa.cloud.base.utils.glide.GlideUtils.display(mContext, ivQrCode, url);
} }
} }
...@@ -3,6 +3,4 @@ ...@@ -3,6 +3,4 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical"/>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_f0"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" /> <include layout="@layout/supply_chain_top_bar" />
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"> android:orientation="vertical">
...@@ -32,8 +33,8 @@ ...@@ -32,8 +33,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="送貨地址:" android:text="送貨地址:"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
...@@ -49,6 +50,8 @@ ...@@ -49,6 +50,8 @@
tools:text="供應商地址" /> tools:text="供應商地址" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -60,8 +63,8 @@ ...@@ -60,8 +63,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="發送時間:" android:text="發送時間:"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
...@@ -70,13 +73,16 @@ ...@@ -70,13 +73,16 @@
android:id="@+id/tv_confirm_order_item_send_time" android:id="@+id/tv_confirm_order_item_send_time"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical" android:layout_weight="1"
android:gravity="right|center_vertical"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" android:textSize="@dimen/dp_15"
tools:text="默認為第二天的時間" /> tools:text="默認為第二天的時間" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -88,8 +94,8 @@ ...@@ -88,8 +94,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="訂單合計($):" android:text="訂單合計($):"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
...@@ -98,13 +104,15 @@ ...@@ -98,13 +104,15 @@
android:id="@+id/tv_confirm_order_item_total_amount" android:id="@+id/tv_confirm_order_item_total_amount"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical" android:layout_weight="1"
android:gravity="right|center_vertical"
android:text="900" android:text="900"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -116,8 +124,8 @@ ...@@ -116,8 +124,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="運費($):" android:text="運費($):"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
...@@ -126,13 +134,15 @@ ...@@ -126,13 +134,15 @@
android:id="@+id/tv_confirm_order_item_freight" android:id="@+id/tv_confirm_order_item_freight"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:gravity="right|center_vertical" android:layout_weight="1"
android:gravity="right|center_vertical"
android:text="100" android:text="100"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -144,8 +154,8 @@ ...@@ -144,8 +154,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="實際應付($):" android:text="實際應付($):"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
...@@ -161,6 +171,8 @@ ...@@ -161,6 +171,8 @@
tools:text="1000" /> tools:text="1000" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_ef_one_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -172,8 +184,8 @@ ...@@ -172,8 +184,8 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/purchase_order_confirm_item_marginTop"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/purchase_order_confirm_item_marginTop"
android:text="備註:" android:text="備註:"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" /> android:textSize="@dimen/dp_15" />
......
...@@ -5,4 +5,5 @@ ...@@ -5,4 +5,5 @@
<dimen name="new_supplier_info_item_marginTop">@dimen/dp_10</dimen> <dimen name="new_supplier_info_item_marginTop">@dimen/dp_10</dimen>
<dimen name="new_supplier_info_item_marginBottom">@dimen/dp_10</dimen> <dimen name="new_supplier_info_item_marginBottom">@dimen/dp_10</dimen>
<dimen name="new_category_dialog_marginLeft">@dimen/dp_10</dimen> <dimen name="new_category_dialog_marginLeft">@dimen/dp_10</dimen>
<dimen name="purchase_order_confirm_item_marginTop">@dimen/dp_10</dimen>
</resources> </resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment