Commit 1c6d730d by Wyh

5.30 提交

parent 04c3d010
......@@ -146,13 +146,15 @@ public class GsaCloudApplication extends BaseApplication {
ClassicsFooter.REFRESH_FOOTER_NOTHING = getString(R.string.srl_footer_nothing);//"全部加载完成";
}
private void initDomainUrl() {
public static void initDomainUrl() {
HttpsConstans.isFormal = (boolean) SPUtils.get(getAppContext(), "isFormal", true);
HttpsConstans.init();
//需要單獨配置域名URL的,在接口上添加@Headers({"Domain-Name: settlement_report_server"}),不添加則是使用默認域名
setGlobalDomain();
//清機報表請求地址
RetrofitUrlManager.getInstance().putDomain("settlement_report_server", HttpsConstans.ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL);
//gsa報表請求地址
RetrofitUrlManager.getInstance().putDomain("gsa_report", HttpsConstans.REPORT_SERVER_ADDRESS);
RetrofitUrlManager.getInstance().putDomain("gsa_report", HttpsConstans.REPORT_SERVER_ADDRESS);//DEFAULT_REPORT_ADDRESS
//微信報表請求地址
RetrofitUrlManager.getInstance().putDomain("wechat_report", HttpsConstans.WECHAR_REPORT_SERVER_ADDRESS);
//沽清控制請求地址
......
......@@ -30,7 +30,7 @@ import com.gingersoft.gsa.cloud.base.R;
*/
public abstract class DialogUtils {
private Context mContext;
private Dialog dialog2 = null;
private static Dialog dialog;
private View view;
private int style = R.style.PhotoDialog;
private int mWidth = WindowManager.LayoutParams.WRAP_CONTENT;
......@@ -43,14 +43,6 @@ public abstract class DialogUtils {
view = LayoutInflater.from(mContext).inflate(xmlLayout, null);
}
private Dialog getInstance() {
synchronized (this) {
if (dialog2 == null) {
dialog2 = new Dialog(mContext, style);
}
return dialog2;
}
}
public DialogUtils(Context mContext, View view) {
this.mContext = mContext;
......@@ -73,18 +65,21 @@ public abstract class DialogUtils {
}
public DialogUtils createDialogView() {
if(dialog != null) {
dialog.dismiss();
}
dialog = new Dialog(mContext);
viewHepler = getViewHepler();
initLayout(viewHepler, getInstance());
getInstance().setContentView(viewHepler.getContentView());
Window dialogWindow = getInstance().getWindow();
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(); // 获取对话框当前的参数值
Window window = getInstance().getWindow();
Window window = dialog.getWindow();
if (window != null) {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
window.getDecorView().setBackgroundResource(android.R.color.transparent);
......@@ -105,32 +100,33 @@ public abstract class DialogUtils {
dialogWindow.setAttributes(p);
// android Activity改成dialog样式后 怎设置点击空白处关闭窗体,点击窗体以外的地方关闭窗体
getInstance().setCanceledOnTouchOutside(true);
getInstance().setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(true);
// dialog.show();
return this;
}
public Dialog getDialog() {
return getInstance();
return dialog;
}
public DialogUtils dismiss() {
getInstance().dismiss();
if (dialog != null)
dialog.dismiss();
return this;
}
public DialogUtils setGravity(int gravity) {
if (getInstance().getWindow() != null) {
getInstance().getWindow().setGravity(gravity);
if (dialog.getWindow() != null) {
dialog.getWindow().setGravity(gravity);
}
return this;
}
public DialogUtils show() {
dismiss();
getInstance().show();
dialog.show();
return this;
}
......@@ -143,11 +139,11 @@ public abstract class DialogUtils {
}
public boolean isShowing() {
return getInstance() != null && getInstance().isShowing();
return dialog != null && dialog.isShowing();
}
public DialogUtils setOnDismissListener(DialogInterface.OnDismissListener dismissListener) {
getInstance().setOnDismissListener(dismissListener);
dialog.setOnDismissListener(dismissListener);
return this;
}
......@@ -159,7 +155,7 @@ public abstract class DialogUtils {
public DialogUtils setCanceledOnTouchOutside(boolean cancel) {
getInstance().setCanceledOnTouchOutside(cancel);
dialog.setCanceledOnTouchOutside(cancel);
return this;
}
......
......@@ -5,26 +5,88 @@ package com.gingersoft.gsa.cloud.constans;
*/
public class HttpsConstans {
public static String ROOT_ADDRESS_FORMAL = "https://m.ricepon.com:8444/ricepon-cloud-gsa/api/";//正式服務器
public static final String ROOT_SERVER_ADDRESS_FORMAL_SZ = "http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/";//深圳服务器
public static final String ROOT_SERVER_ADDRESS_FORMAL_HK = "http://a.ricepon.com:58201/ricepon-cloud-gsa/api/";//香港服务器
// public static String ROOT_ADDRESS_FORMAL = "https://m.ricepon.com:8444/ricepon-cloud-gsa/api/";//正式服務器
// public static final String ROOT_SERVER_ADDRESS_FORMAL_SZ = "http://gingersoft.tpddns.cn:58201/ricepon-cloud-gsa/api/";//深圳服务器
// public static final String ROOT_SERVER_ADDRESS_FORMAL_HK = "http://a.ricepon.com:58201/ricepon-cloud-gsa/api/";//香港服务器
// public static String ROOT_SERVER_YOU_CHANG_HK = "http://192.168.1.142:9012/api/"; //友常本地
// public static String ROOT_SERVER_SHI_WEI_HK = "http://192.168.1.154:9012/api/"; //世維本地
// //默認為正式
// public static String ROOT_SERVER_ADDRESS_FORMAL = ROOT_SERVER_ADDRESS_FORMAL_HK;
//
// //外賣接單
// public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地
// public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試
// public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式
// public static String ROOT_URL = HttpsConstans.ROOT_HK_TEST_URL;
//
// //清機接口地址
// public static String ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = "http://a.ricepon.com:58201/";
// //報表地址
// public static String REPORT_SERVER_ADDRESS = "http://a.ricepon.com:58201/ricepon-report/api/";
// //微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
// public static String WECHAR_REPORT_SERVER_ADDRESS = "http://a.ricepon.com:61177/member-web/api/";
// //報表地址
// public static String _SERVER_ADDRESS = "http://a.ricepon.com:61177/member-web/api/";
//--------------------------------------------其他全局----------------------------------------------------------------------------
private static String HTTP_ADDRESS_URL_FORMAL = "https://m.ricepon.com:8444";//正式服務器
private static String HTTP_ADDRESS_URL_SZ = "http://gingersoft.tpddns.cn:58201";//深圳測試
private static String HTTP_ADDRESS_URL_HK = "http://a.ricepon.com:58201";//香港測試
private static String PATH = "/ricepon-cloud-gsa/api/";//路徑
public static String ROOT_SERVER_YOU_CHANG_HK = "http://192.168.1.142:9012/api/"; //友常本地
public static String ROOT_SERVER_SHI_WEI_HK = "http://192.168.1.154:9012/api/"; //世維本地
//默認為正式
public static String ROOT_SERVER_ADDRESS_FORMAL = ROOT_ADDRESS_FORMAL;
//外賣接單
//------------------------------------------外賣接單---------------------------------------------------------------------------
public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地
public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試
public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式
public static String ROOT_URL = HttpsConstans.ROOT_FORMAL_URL;
//-------------------------------------------報表-------------------------------------------------------------------------------
private static String REPORT_TEST_ADDRESS = "http://a.ricepon.com:58201";//報表測試地址
private static String REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//報表正式地址
//報表路徑
private static String REPORT_PATH = "/ricepon-report/api/";
//----------------------------------微信公眾號報表地址------------------------------------------------------------------------------------------
private static String WECHAR_REPORT_TEST_ADDRESS = "http://a.ricepon.com:61177";//微信公眾號報表測試地址
private static String WECHAR_REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//微信公眾號報表正式地址
private static String WECHAR_REPORT_PATH = "/member-web/api/";//微信公眾號報表路徑
//--------------------------------------配置-----------------------------------------------------------------------------------
/**
* 修改這個值控制是否是正式
*/
public static boolean isFormal = true;
//沽清控制地址
public static String _SERVER_ADDRESS = (isFormal ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/";
//清機接口地址
public static String ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = "http://a.ricepon.com:58201/";
//報表地址
public static String REPORT_SERVER_ADDRESS = "http://a.ricepon.com:58201/ricepon-report/api/";
//微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
public static String WECHAR_REPORT_SERVER_ADDRESS = "http://a.ricepon.com:61177/member-web/api/";
//報表地址
public static String _SERVER_ADDRESS = "http://a.ricepon.com:61177/member-web/api/";
}
public static String ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS;
//默認url,配置這個值修改環境
public static String ROOT_SERVER_ADDRESS_FORMAL = (isFormal ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
//修改這個值,配置外賣接單環境
public static String ROOT_URL = isFormal ? ROOT_FORMAL_URL : ROOT_HK_TEST_URL;//正式:ROOT_FORMAL_URL 測試:ROOT_HK_TEST_URL
//修改這個值,修改報表默認環境
public static String REPORT_SERVER_ADDRESS = (isFormal ? REPORT_FORMAL_ADDRESS : REPORT_TEST_ADDRESS) + REPORT_PATH;//測試:REPORT_FORMAL_ADDRESS 正式:REPORT_TEST_ADDRESS
//修改這個值,修改微信公眾號報表地址:首頁曲線圖數據,支付分析報表數據
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() {
_SERVER_ADDRESS = (isFormal ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = (isFormal ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
ROOT_URL = isFormal ? ROOT_FORMAL_URL : ROOT_HK_TEST_URL;//正式:ROOT_FORMAL_URL 測試:ROOT_HK_TEST_URL
REPORT_SERVER_ADDRESS = (isFormal ? REPORT_FORMAL_ADDRESS : REPORT_TEST_ADDRESS) + REPORT_PATH;//測試:REPORT_FORMAL_ADDRESS 正式:REPORT_TEST_ADDRESS
WECHAR_REPORT_SERVER_ADDRESS = (isFormal ? WECHAR_REPORT_FORMAL_ADDRESS : WECHAR_REPORT_TEST_ADDRESS) + WECHAR_REPORT_PATH;//正式:WECHAR_REPORT_FORMAL_ADDRESS 測試:WECHAR_REPORT_TEST_ADDRESS
}
}
\ No newline at end of file
......@@ -68,9 +68,13 @@ class OrderDetails {
//後台不會返回
var order_type: Int = 0
var orderPayType: Int = 0
var isDelete: Int = 1 //默認為1,為1時是本店配送,為0是第三方物流
var isDelete: Int = 1 //默認為1,為0是第三方物流,其他則是本店配送
var payType: Int = 0//1:积分支付;2:支付宝;3:财付通;4:微信支付;5:货到付款;6:其他支付
var PRODUCT_NAME: List<PRODUCTNAMEBean>? = null
var couponList: List<CouponBean>? = null
var estimatedTime: String? = null
class PRODUCTNAMEBean {
/**
......@@ -123,5 +127,7 @@ class OrderDetails {
}
}
}
data class CouponBean(val couponName: String, val discount_amount: Float)
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<corners android:radius="@dimen/dp_8" />
<stroke
android:width="@dimen/dp_2"
android:width="@dimen/dp_3"
android:color="@color/order_state0_color" />
</shape>
\ No newline at end of file
......@@ -480,4 +480,8 @@
<color name="switcher_on_color">#6EBE8C</color>
<color name="switcher_off_color">#ff4651</color>
<color name="switcher_icon_color">@color/white</color>
<color name="restaurant_color_open">#6FBE8E</color>
<color name="restaurant_color_busy_close">#F56C6C</color>
<color name="restaurant_color_busy_open">#E6A23C</color>
</resources>
......@@ -19,4 +19,8 @@
<item name="qmui_arch_swipe_layout_in_back" type="id"/>
<item name="iv_left_back" type="id"/>
<item name="iv_history" type="id"/>
<item name="topbar_right_change_button" type="id"/>
</resources>
\ No newline at end of file
......@@ -55,7 +55,7 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
}
public void login(String account, String pwd) {
if (account.equals("88888888") && pwd.equals("cc81081168")) {
if (account.equals("888888") && pwd.equals("cc81081168")) {
mRootView.startToSwitchServer();
return;
}
......@@ -80,7 +80,7 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
GsaCloudApplication.userName = info.getData().getUser().getUserName();
mRootView.showMessage("登陸成功");
mRootView.loginSuccess(info);
//開啟打印服務
//開啟Prj打印服務
CC.obtainBuilder("Component.Print")
.setActionName("openPrintService")
.build()
......
......@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.R2;
......@@ -39,12 +40,8 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
*/
public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> implements SwitchServerContract.View {
@BindView(R2.id.rb_server_sz)
RadioButton rbSZ;
@BindView(R2.id.rb_server_hk)
RadioButton rbHK;
@BindView(R2.id.rb_youchang_hk)
RadioButton rb_youchang_hk;
@BindView(R2.id.rb_server_formal)
RadioButton rbFormal;
@BindView(R2.id.btn_switch_server)
......@@ -67,41 +64,28 @@ public class SwitchServerActivity extends BaseActivity<SwitchServerPresenter> im
return R.layout.activity_switch_server; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
///RetrofitUrlManager.getInstance().putDomain("common", HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL);
@Override
public void initData(@Nullable Bundle savedInstanceState) {
String nowServer = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL;
tvNowServer.setText("當前服務器:" + nowServer);
rbHK.setText("香港服務器:" + HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_HK);
rbSZ.setText("深圳服務器:" + HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_SZ);
rb_youchang_hk.setText("世維本地:" + HttpsConstans.ROOT_SERVER_YOU_CHANG_HK);
rbFormal.setText("正式服務器:" + HttpsConstans.ROOT_ADDRESS_FORMAL);
if (nowServer.equals(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_SZ)) {
rbSZ.setChecked(true);
} else if (nowServer.equals(HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_HK)) {
rbHK.setChecked(true);
} else if (nowServer.equals(HttpsConstans.ROOT_ADDRESS_FORMAL)) {
if (HttpsConstans.isFormal) {
rbFormal.setChecked(true);
} else {
rb_youchang_hk.setChecked(true);
rbHK.setChecked(true);
}
rbHK.setText("測試服務器");
rbFormal.setText("正式服務器");
switchServer.setOnClickListener(v -> {
if (rbSZ.isChecked()) {
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_SZ;
HttpsConstans.ROOT_URL = HttpsConstans.ROOT_SZ_URL;
} else if (rbHK.isChecked()) {
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL = HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL_HK;
HttpsConstans.ROOT_URL = HttpsConstans.ROOT_HK_TEST_URL;
} else if (rbFormal.isChecked()) {
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL = HttpsConstans.ROOT_ADDRESS_FORMAL;
HttpsConstans.ROOT_URL = HttpsConstans.ROOT_FORMAL_URL;
if (rbHK.isChecked()) {
SPUtils.put(this, "isFormal", false);
} else {
HttpsConstans.ROOT_SERVER_ADDRESS_FORMAL = HttpsConstans.ROOT_SERVER_SHI_WEI_HK;
HttpsConstans.ROOT_URL = HttpsConstans.ROOT_HK_TEST_URL;
SPUtils.put(this, "isFormal", true);
}
GsaCloudApplication.setGlobalDomain();
GsaCloudApplication.initDomainUrl();
finish();
startActivity(new Intent(mContext, LoginActivity.class));
System.exit(0);
});
}
......
......@@ -272,6 +272,7 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
@Override
public void loginSuccess(LoginBean info) {
super.loginSuccess(info);
finish();
}
private boolean isChooseRestaurant = false;
......
......@@ -10,29 +10,11 @@
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rb_server_sz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="深圳環境"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_16" />
<RadioButton
android:id="@+id/rb_server_hk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="香港環境"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_16" />
<RadioButton
android:id="@+id/rb_youchang_hk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="友常本地"
android:text="測試環境"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_16" />
......
......@@ -58,13 +58,14 @@ public class FoodRankingAdapter extends BaseQuickAdapter<SalesFoodsBean.DataBean
helper.setTextColor(R.id.tv_ranking_food_unit_price, mContext.getResources().getColor(R.color.color_3c));
helper.setTextColor(R.id.tv_ranking_proportion_quantity, mContext.getResources().getColor(R.color.color_3c));
helper.setTextColor(R.id.tv_ranking_ratio_amount, mContext.getResources().getColor(R.color.color_3c));
helper.setText(R.id.tv_ranking_food_unit_price, item.getPrice() + "");
helper.setText(R.id.tv_ranking_foodname, item.getProductName());
helper.setText(R.id.tv_ranking_food_sales_num, item.getNumber() + "");
helper.setText(R.id.tv_ranking_food_sales_amount, item.getAmount() + "");
helper.setText(R.id.tv_ranking_proportion_quantity, (MoneyUtil.priceCalculation(MoneyUtil.divide(item.getNumber(), totalNum, 2, ROUND_HALF_UP), 100)) + "%");
helper.setText(R.id.tv_ranking_ratio_amount, (MoneyUtil.priceCalculation(MoneyUtil.divide(item.getAmount(), totalAmount, 2, ROUND_HALF_UP), 100)) + "%");
if (item != null) {
helper.setText(R.id.tv_ranking_food_unit_price, item.getPrice() + "");
helper.setText(R.id.tv_ranking_foodname, item.getProductName());
helper.setText(R.id.tv_ranking_food_sales_num, item.getNumber() + "");
helper.setText(R.id.tv_ranking_food_sales_amount, item.getAmount() + "");
helper.setText(R.id.tv_ranking_proportion_quantity, (MoneyUtil.priceCalculation(MoneyUtil.divide(item.getNumber(), totalNum, 2, ROUND_HALF_UP), 100)) + "%");
helper.setText(R.id.tv_ranking_ratio_amount, (MoneyUtil.priceCalculation(MoneyUtil.divide(item.getAmount(), totalAmount, 2, ROUND_HALF_UP), 100)) + "%");
}
}
}
}
......@@ -302,7 +302,7 @@ public class BusinessReportFragment extends BaseFragment<BusinessReportPresenter
TimePickerUtils.showReportTimePicker(mContext, cal, (date, v1) ->
{
mTvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int month = calendar.get(Calendar.MONTH);
......
......@@ -188,11 +188,13 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
public void loadInfo(List<SalesFoodsBean.DataBean.SalesRankingBean> salesRanking) {
totalAmount = 0;
totalNum = 0;
for (SalesFoodsBean.DataBean.SalesRankingBean salesRankingBean : salesRanking) {
totalAmount = MoneyUtil.sum(totalAmount, salesRankingBean.getAmount());
totalNum = totalNum + salesRankingBean.getNumber();
if (salesRankingBean != null) {
totalAmount = MoneyUtil.sum(totalAmount, salesRankingBean.getAmount());
totalNum = totalNum + salesRankingBean.getNumber();
}
}
List<SalesFoodsBean.DataBean.SalesRankingBean> rankings = new ArrayList<>(salesRanking);
rankings.add(0, new SalesFoodsBean.DataBean.SalesRankingBean());
if (mSortNumberingAdapter == null) {
......
......@@ -71,6 +71,7 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
......
......@@ -7,12 +7,14 @@
<application>
<activity
android:name=".ui.activity.OtherOrderActivity"
android:launchMode="singleTop"
android:label="@string/app_name" />
<service android:name=".service.GetInfoUpdateService" />
<activity android:name=".ui.activity.HistoryOrderActivity" />
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
<activity android:name=".ui.activity.DeliverySettingActivity"/>
</application>
</manifest>
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data
import com.gingersoft.gsa.other_order_mode.data.network.DeliveryNetwork
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.FormBody
class DeliveryRepository private constructor(private val network: DeliveryNetwork) {
suspend fun queryDeliveryList(restaurantId: String) = withContext(Dispatchers.IO){
val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId)
.build()
network.queryDeliveryList(requestBody)
}
companion object {
private lateinit var instance: DeliveryRepository
fun getInstance(network: DeliveryNetwork): DeliveryRepository {
if (!Companion::instance.isInitialized) {
synchronized(DeliveryRepository::class.java) {
if (!Companion::instance.isInitialized) {
instance = DeliveryRepository(network)
}
}
}
return instance
}
}
}
\ No newline at end of file
......@@ -7,13 +7,15 @@ import okhttp3.FormBody
class HistoryOrderRepository private constructor(private val network: CoolWeatherNetwork) {
suspend fun getHistoryOrderList(restaurantId: String, status: String, pageIndex: String, pageSize: String, orderNo: String = "", phone: String = "") = withContext(Dispatchers.IO) {
suspend fun getHistoryOrderList(restaurantId: String, status: String, startDate: String, endDate: String, pageIndex: String, pageSize: String, orderNo: String = "", phone: String = "") = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId)
.add("status", status)
.add("pageIndex", pageIndex)
.add("pageSize", pageSize)
.add("orderNo", orderNo)
.add("startDate", startDate)
.add("endDate", endDate)
.add("phone", phone)
.build()
val heWeather = network.getHistoryOrderList(requestBody)
......
......@@ -32,10 +32,10 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.getOrderGroupNum(requestBody)
}
suspend fun updateRestOpenStatus(state: Boolean, restaurantId: String) = withContext(Dispatchers.IO) {
suspend fun updateRestOpenStatus(state: Int, restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restId", restaurantId)
.add("openStatus", if (state) "1" else "2")
.add("openStatus", state.toString())
.build()
val data = network.updateRestOpenStatus(requestBody)
data
......@@ -49,6 +49,16 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
data
}
suspend fun getShipanyOrderTime(restaurantId: String, orderId: String, type: Int) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)
.add("restaurantId", restaurantId)
.add("type", type.toString())//1、预计整张订单完成时间2、預計配送員接單時間3、預計配送員到店時間4、配送員預計送達時間
.build()
network.getShipanyOrderTime(requestBody)
}
suspend fun updateOrderStatus(orderId: String, selfOrderId: String?, status: Int, mobile: String?, sender: String?, isPush: Int, orderType: Int) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("orderId", orderId)
......@@ -99,7 +109,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
}
suspend fun cancelLogistics(shopId: String, orderId: String) = withContext(Dispatchers.IO) {
network.cancelLogistics(getBody("shopId" to shopId, "orderId" to orderId))
network.cancelLogistics(getBody("restaurantId" to shopId, "orderId" to orderId))
}
suspend fun updateOrderStates(memberId: String, orderId: String, status: String, updateBy: String) = withContext(Dispatchers.IO) {
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
class CancelLogisticsBean(val success: Boolean, val errCode: String, val errMsg: String, val sysTime: Long) {
class CancelLogisticsBean(val code: String, val success: Boolean, val errCode: String, val errMsg: String, val sysTime: Long, val data: Data) {
data class Data(val result: Result) {
data class Result(val code: Int, val descr: String)
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class Data(
val estimated_time: Int
)
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class EstimatedBean(
val `data`: Data,
val success: Boolean,
val sysTime: Long
)
\ No newline at end of file
......@@ -5,12 +5,16 @@ data class OrderGoupNumBean(
val success: Boolean,
val sysTime: Long) {
data class Data(
val self: List<SelfTakeaway>,
val self: List<Self>,
val selfTakeaway: List<SelfTakeaway>,
val takeaway: List<SelfTakeaway>) {
data class SelfTakeaway(
val STATUS: Int,
val SumNum: Int
)
data class Self(val STATUS: Int,
val selfSumNum: Int)
}
}
\ No newline at end of file
......@@ -71,6 +71,8 @@ class OrderList {
var PHONE: String? = null
var orderPayType: Int = 0
var ORDER_NO: String? = null
var sendTime: String? = null
var waimaiSendTime:String? = null
var Id: Int = 0
var CREATE_TIME: String? = null
var takeFoodCode: String? = null
......@@ -82,7 +84,7 @@ class OrderList {
var maxOrderSelf: Int = 0
var num: Int = 0
var dayOrderNum: Int = 0
var Open_Status: String? = null//1為營業中 2為休息中
var Open_Status: String? = null//0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單
var orderType_2: OrderType? = null
var orderType_7: OrderType? = null
......
......@@ -28,6 +28,9 @@ class CoolWeatherNetwork {
//獲取訂單信息
suspend fun getOrderInfo(requestBody: RequestBody) = orderService.getOrderDesc(requestBody).await()
//獲取第三方物流信息
suspend fun getShipanyOrderTime(requestBody: RequestBody) = gsposService.getShipanyOrderTime(requestBody).await()
//修改訂單狀態
suspend fun updateOrderStatus(requestBody: RequestBody) = orderService.updateOrderStatus(requestBody).await()
......
package com.gingersoft.gsa.other_order_mode.data.network
import com.gingersoft.gsa.other_order_mode.data.network.api.DeliveryService
import com.gingersoft.gsa.other_order_mode.data.network.api.WeatherService
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
class DeliveryNetwork {
private val orderService = ServiceCreator.create(DeliveryService::class.java)
private val service = ServiceCreator.create2(DeliveryService::class.java)
private val gsposService = ServiceCreator.create3(DeliveryService::class.java)
//獲取物流配置
suspend fun queryDeliveryList(requestBody: RequestBody) = gsposService.queryDeliveryList(requestBody).await()
private suspend fun <T> Call<T>.await(): T {
return suspendCoroutine { continuation ->
enqueue(object : Callback<T> {
override fun onFailure(call: Call<T>, t: Throwable) {
t.printStackTrace()
continuation.resumeWithException(t)
}
override fun onResponse(call: Call<T>, response: Response<T>) {
val body = response.body()
if (body != null) {
continuation.resume(body)
} else continuation.resumeWithException(RuntimeException("response body is null") as Throwable)
}
})
}
}
companion object {
private var network: DeliveryNetwork? = null
fun getInstance(): DeliveryNetwork {
if (network == null) {
synchronized(DeliveryNetwork::class.java) {
if (network == null) {
network = DeliveryNetwork()
}
}
}
return network!!
}
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.network.api
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryConfig
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.POST
interface DeliveryService {
@POST("gsa/getDeliveryConfigDTO")
fun queryDeliveryList(@Body requestBody: RequestBody): Call<DeliveryConfig>
}
\ No newline at end of file
......@@ -21,6 +21,9 @@ interface WeatherService {
@POST("wechat/findOrderDetails")
fun getOrderDesc(@Body requestBody: RequestBody): Call<OrderDetails>
@POST("gsa/calculateEstimatedTime")
fun getShipanyOrderTime(@Body requestBody: RequestBody): Call<EstimatedBean>
@POST("wechat/updateOrderStatus")
fun updateOrderStatus(@Body requestBody: RequestBody): Call<UpdateOrderBean>
......@@ -43,5 +46,5 @@ interface WeatherService {
fun cancelLogistics(@Body requestBody: RequestBody): Call<CancelLogisticsBean>
@POST("order/updateOrderStatus")
fun cancelOrder(@Body requestBody: RequestBody): Call<String>
fun cancelOrder(@Body requestBody: RequestBody): Call<CancelLogisticsBean>
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.model.factory
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.gingersoft.gsa.other_order_mode.data.DeliveryRepository
import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel
class DeliveryFactory(private val repository: DeliveryRepository) : ViewModelProvider.NewInstanceFactory() {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
return DeliveryViewModel(repository) as T
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.model.viewModel
import android.content.Context
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog
import kotlinx.coroutines.launch
open class BaseViewModel : ViewModel() {
protected fun showLoading(context: Context, message: String? = null) {
if (message != null)
LoadingDialog.showDialogForLoading(context, message, true)
else
LoadingDialog.showDialogForLoading(context)
}
protected fun cancelDialogForLoading() {
LoadingDialog.cancelDialogForLoading()
}
protected fun launch(block: suspend () -> Unit, error: suspend (Throwable) -> Unit) = viewModelScope.launch {
try {
block()
} catch (e: Throwable) {
error(e)
}
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.model.viewModel
import com.gingersoft.gsa.other_order_mode.data.DeliveryRepository
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryConfig
class DeliveryViewModel(private val repository: DeliveryRepository) : BaseViewModel() {
fun queryDeliveryList(restaurantId: String, listenter: (DeliveryConfig?) -> Unit) {
launch({
repository.queryDeliveryList(restaurantId).apply {
listenter.invoke(this)
}
}, {
listenter.invoke(null)
})
}
}
......@@ -13,7 +13,7 @@ import kotlinx.coroutines.launch
class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepository) : ViewModel() {
var data = MutableLiveData<HistoryOrderBean>()
fun getHistoryOrderList(context: Context, pageIndex: String, orderNum: String = "", listener: (HistoryOrderBean?) -> Unit) {
fun getHistoryOrderList(context: Context, pageIndex: String, orderNum: String = "", startDate: String, endDate: String, listener: (HistoryOrderBean?) -> Unit) {
launch({
var phone = ""
var orderNumber = ""
......@@ -23,7 +23,7 @@ class HistoryOrderViewModel(private val historyOrderRepository: HistoryOrderRepo
orderNumber = orderNum
}
historyOrderRepository.getHistoryOrderList(GsaCloudApplication.getRestaurantId(context).toString(), "4", pageIndex, "10", orderNumber, phone).apply {
historyOrderRepository.getHistoryOrderList(GsaCloudApplication.getRestaurantId(context).toString(), "4", startDate, endDate, pageIndex, "10", orderNumber, phone).apply {
this.getData()?.let {
if (it.size > 0) {
it.removeAt(it.size - 1)//移除最後一個,最後一個是顯示總條數的
......
......@@ -24,7 +24,9 @@ import com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import com.gingersoft.gsa.other_order_mode.data.model.bean.*
import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryAdapter
import com.jess.arms.utils.ArmsUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
......@@ -66,8 +68,14 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 獲取訂單數量
* status 0,1待確認
* 2 已確認,外賣是指派送單,自取是製作完成
* status
* 0:未支付;
* 1:待確認(已支付, 待餐廳確認);
* 2:制作中(餐厅确认);
* 3:外賣是派送中,自取是待取餐
* 4:确认收货(完成);
* 5:是否评论;6:取消;
* 已確認,外賣是指派送單,自取是製作完成
*/
fun getOrderGroupNum(restaurantId: String) {
launch({
......@@ -79,9 +87,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//遍歷獲得外賣自取的 待確認和製作中的總單數
for (i in data.selfTakeaway) {
when {
i.STATUS == 0 -> //貨到付款的待確認
i.STATUS == 0 -> //未支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 1 -> //在線支付的待確認
i.STATUS == 1 -> //支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 2 -> //製作中
mOrderNum[2].value = i.SumNum
......@@ -95,7 +103,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
for (i in data.self) {
if (i.STATUS == 3) {
mOrderNum[4].value = i.SumNum
mOrderNum[4].value = i.selfSumNum
}
}
......@@ -116,7 +124,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 獲取訂單
* 獲取訂單列表
*/
fun getOrderList(context: Context, position: Int, page: String, isLoadMore: Boolean, listener: (Int) -> Unit) {
launch({
......@@ -138,15 +146,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//取得最後一個對象,裡面有營業狀態和外賣訂單數,自取訂單數
val dataBean: OrderList.DataBeanX.DataBean = myData[myData.size - 1]
if (dataBean.Open_Status != null) {
restaurantState.value = dataBean.Open_Status!! == "1"
restaurantState.value = dataBean.Open_Status!!.toInt()
}
if (myData.size == 1) {
otherInfo.value = myData[0]
listener.invoke(0)
} else {
if (position == 0) {//查詢全部訂單時才加載這些數據
otherInfo.value = myData[myData.size - 1]
listener.invoke(myData.size - 1)
}
listener.invoke(myData.size - 1)
//移除掉最後一個對象
myData.removeAt(myData.size - 1)
//如果是加載更多
......@@ -169,14 +174,15 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//餐廳營業狀態,控制按鈕
var restaurantState = MutableLiveData<Boolean>()
var restaurantState = MutableLiveData<Int>()
/**
* 修改餐廳營業狀態
* 0=休息中, 1=營業中,2=繁忙中不可接單,3繁忙可接單
*/
fun setRestaurantState(context: Context, state: Boolean) {
fun setRestaurantState(context: Context, state: Int) {
launch({
if (state) {
if (state != 0 && state != 2) {
updateRestOpenStatus(state, context)
} else {
//暫停接單,彈窗向用戶確認是否關閉
......@@ -206,7 +212,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 修改餐廳營業狀態
*/
suspend fun updateRestOpenStatus(state: Boolean, context: Context) {
suspend fun updateRestOpenStatus(state: Int, context: Context) {
repository.updateRestOpenStatus(state, GsaCloudApplication.getRestaurantId(context).toString()).apply {
if (isSuccess()) {
restaurantState.value = state
......@@ -228,6 +234,71 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
/**
* 根據餐廳ID和訂單ID獲取物流信息
*/
// fun getShipanyOrderTime(restaurantId: String, orderId: String) {
// launch({
// repository.getShipanyOrderTime(restaurantId, orderId).apply {
// }
// }, {
// //出錯
// it.printStackTrace()
// })
// }
fun getShipanyAndOrderInfo(curStat: Int, restaurantId: String, orderId: String, listener: (OrderDetails?) -> Unit) {
launch({
withContext(Dispatchers.IO) {
val orderDetail = withContext(Dispatchers.Default) { repository.getOrderInfo(orderId) }
if (orderDetail.data != null && orderDetail.data!!.isNotEmpty()) {
if(curStat != 0) {
val data = orderDetail.data!![0]
val type: Int
val estimatedTime: String
when (curStat) {
1 -> {
type = 2
estimatedTime = "預計配送員接單時間:"
}
2, 3 -> {
type = 3
estimatedTime = "預計配送員到店時間:"
}
4, 5, 6 -> {
type = 4
estimatedTime = "配送員預計送達時間:"
}
else -> {
type = 1
estimatedTime = "预计整张订单完成时间:"
}
}
val estimatedBean = withContext(Dispatchers.Default) { repository.getShipanyOrderTime(restaurantId, orderId, type) }//1、预计整张订单完成时间2、預計配送員接單時間3、預計配送員到店時間4、配送員預計送達時間
if (estimatedBean.data.estimated_time > 0) {
data.estimatedTime = estimatedTime + ("${estimatedBean.data.estimated_time}分鐘後")
} else {
data.estimatedTime = ""
}
}
withContext(Dispatchers.Main) {
listener.invoke(orderDetail)
}
} else {
withContext(Dispatchers.Main) {
listener.invoke(null)
}
}
}
}, {
withContext(Dispatchers.Main) {
listener.invoke(null)
}
})
}
/**
* 待確認 --- 確認之後狀態變為 製作中,按鈕顯示:自取:製作完成,外賣:指派送貨----自取的狀態為待取餐,按鈕為結賬,外賣的狀態為派送中,按鈕顯示結賬
* 更新訂單信息,自取或是外賣
......@@ -252,7 +323,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
if (data.order_type == 2) {
// 是外賣
if (status == 3) {
if (orderDetails.data!![0].isDelete == 1) {
if (orderDetails.data!![0].isDelete != 0) {
if (deliveryBean != null && deliveryBean!!.data.isNotEmpty()) {
selectorDelivery(listener, context, data, status, isPush)
} else {
......@@ -481,11 +552,14 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 取消物流
*/
fun cancelLogistics(shopId: String, orderId: String,listener: (String) -> Unit) {
fun cancelLogistics(shopId: String, orderId: String, listener: (String) -> Unit) {
launch({
repository.cancelLogistics(shopId, orderId).apply {
Log.e("eee", "請求結果$errMsg")
listener.invoke(errMsg)
if (success) {
listener.invoke("已取消物流")
} else {
listener.invoke(this.errMsg)
}
}
}, {
listener.invoke("取消物流失敗")
......@@ -495,14 +569,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
* 取消訂單,如果有物流需要先提示取消物流
*/
fun cancelOrder(context: Context, orderId: String,listener: (String) -> Unit) {
fun cancelOrder(context: Context, orderId: String, listener: (Boolean) -> Unit) {
launch({
repository.updateOrderStates(GsaCloudApplication.getMemberId(context).toString(), orderId, "6", GsaCloudApplication.getMemberName(context)).apply {
Log.e("eee", "取消訂單請求結果$this")
listener.invoke(this)
listener.invoke(code == "1")
}
}, {
listener.invoke("取消訂單失敗")
listener.invoke(false)
})
}
......@@ -512,6 +585,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
block()
} catch (e: Throwable) {
error(e)
e.printStackTrace()
}
}
......
package com.gingersoft.gsa.other_order_mode.ui.activity
import android.os.Bundle
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.ui.fragment.UpdateDeliveryFragment
import kotlinx.android.synthetic.main.activity_delivery.*
class DeliverySettingActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_delivery)
top_bar_delivery.setTitle("備送設置")
top_bar_delivery.setBackgroundColor(resources.getColor(R.color.theme_color))
top_bar_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
top_bar_delivery.addRightImageButton(R.drawable.ic_add, R.id.topbar_right_change_button).setOnClickListener { v ->
supportFragmentManager.beginTransaction().replace(R.id.fl_delivery, UpdateDeliveryFragment.newInstance()).addToBackStack(null).commit()
}
}
}
\ No newline at end of file
......@@ -6,6 +6,8 @@ import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import com.gingersoft.gsa.cloud.base.utils.time.TimePickerUtils
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.R2
......@@ -17,6 +19,8 @@ import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.gingersoft.gsa.other_order_mode.util.setState
import com.scwang.smartrefresh.layout.SmartRefreshLayout
import kotlinx.android.synthetic.main.activity_history_order.*
import java.text.ParseException
import java.util.*
class HistoryOrderActivity : BaseActivity() {
......@@ -35,17 +39,21 @@ class HistoryOrderActivity : BaseActivity() {
rvOrderList = findViewById(R.id.rv_other_order)
layoutNoData = findViewById(R.id.layout_nodata)
tv_start_time.text = TimeUtils.getOldDate(0)
tv_end_time.text = TimeUtils.getOldDate(0)
initAppTop()
rvOrderList.layoutManager = LinearLayoutManager(this)
initViewModel()
getHistoryInfo()
getHistoryInfo(time = tv_start_time.text.toString())
initSearch()
initRefresh()
}
private fun getHistoryInfo(page: Int = pageIndex, orderNum: String = "") {
private fun getHistoryInfo(page: Int = pageIndex, orderNum: String = "", time: String) {
showLoading()
mViewModel.getHistoryOrderList(this, page.toString(), orderNum) {
mViewModel.getHistoryOrderList(this, page.toString(), orderNum, time, time) {
cancelDialogForLoading()
it?.let {
refreshLayout.setEnableLoadMore(it.getData() != null)
......@@ -85,7 +93,7 @@ class HistoryOrderActivity : BaseActivity() {
iv_search_order.setOnClickListener {
//搜索
if (ed_order_num_search.text != null && ed_order_num_search.text.isNotEmpty()) {
getHistoryInfo(1, ed_order_num_search.text.toString())
getHistoryInfo(1, ed_order_num_search.text.toString(), "")
} else {
ToastUtils.show(this@HistoryOrderActivity, "請輸入手機號或訂單號")
}
......@@ -98,11 +106,11 @@ class HistoryOrderActivity : BaseActivity() {
//下拉刷新,加載更多
refreshLayout.setOnRefreshListener {
pageIndex = 1
getHistoryInfo()
getHistoryInfo(time = tv_start_time.text.toString())
}
refreshLayout.setOnLoadMoreListener {
pageIndex++
getHistoryInfo()
getHistoryInfo(time = tv_start_time.text.toString())
}
}
......@@ -111,4 +119,43 @@ class HistoryOrderActivity : BaseActivity() {
qm_other_order_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
qm_other_order_bar.setBackgroundColor(resources.getColor(R.color.theme_color))
}
fun onClickListener(v: View?) {
when (v!!.id) {
R.id.iv_start_time_triangle, R.id.tv_start_time -> {
iv_start_time_triangle.toggle()
val cal = Calendar.getInstance()
try {
//設置默認時間為當前的起止時間
cal.time = TimeUtils.DATE_FORMAT_DATE.parse(tv_start_time.text.toString())
} catch (e: ParseException) {
e.printStackTrace()
}
TimePickerUtils.showReportTimePicker(this@HistoryOrderActivity, cal) { date, v ->
tv_start_time.text = TimeUtils.DATE_FORMAT_DATE.format(date)
}.setOnDismissListener {
iv_start_time_triangle.toggle()
pageIndex = 1
getHistoryInfo(time = tv_start_time.text.toString())
}
}
// R.id.tv_end_time, R.id.iv_end_time_triangle -> {
// iv_end_time_triangle.toggle()
// val cal = Calendar.getInstance()
// try {
// //設置默認時間為當前的起止時間
// cal.time = TimeUtils.DATE_FORMAT_DATE.parse(tv_end_time.text.toString())
// } catch (e: ParseException) {
// e.printStackTrace()
// }
// TimePickerUtils.showReportTimePicker(this@HistoryOrderActivity, cal) { date, v ->
// tv_end_time.text = TimeUtils.DATE_FORMAT_DATE.format(date)
// }.setOnDismissListener {
// iv_end_time_triangle.toggle()
// pageIndex = 1
// getHistoryInfo()
// }
// }
}
}
}
\ No newline at end of file
......@@ -6,12 +6,14 @@ import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.SoundPool
import android.os.Build
import android.os.Bundle
import android.os.IBinder
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.databinding.DataBindingUtil
......@@ -19,8 +21,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.viewpager.widget.ViewPager
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.ui.view.SwitchButton
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.databinding.ActivityOtherOrderBinding
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
......@@ -28,6 +30,10 @@ import com.gingersoft.gsa.other_order_mode.service.GetInfoUpdateService
import com.gingersoft.gsa.other_order_mode.ui.adapter.SectionsPagerAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.qmuiteam.qmui.widget.popup.QMUIPopup
import com.qmuiteam.qmui.widget.popup.QMUIPopups
import kotlinx.android.synthetic.main.activity_other_order.*
......@@ -56,7 +62,6 @@ class OtherOrderActivity : BaseActivity() {
private var layoutHeight: Float = 0F
private var btnHeight: Float = 0F
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order)
......@@ -155,26 +160,85 @@ class OtherOrderActivity : BaseActivity() {
}
}
private var restaurantPopup: QMUIPopup? = null
private var stateBg = GradientDrawable()
/**
* 切換餐廳狀態按鈕
*/
private fun initSwitchRestStatus() {
stateBg.cornerRadius = QMUIDisplayHelper.dp2px(this, 4).toFloat()
btnOpenBg = resources.getDrawable(R.drawable.shape_white_bottom_border)
btnCloseBg = resources.getDrawable(R.drawable.shape_dialog_bg)
btn_switch_restaurant_state.setOnClickListener {
pageViewModel.setRestaurantState(this, !(it as SwitchButton).statusBasedOnPos)
//切換營業狀態
tv_restaurant_state.setOnClickListener {
if (restaurantPopup == null) {
val view: View = LayoutInflater.from(this).inflate(R.layout.popup_layout_restaurant_state, null)
restaurantPopup = QMUIPopups.popup(this)
.preferredDirection(QMUIPopup.DIRECTION_BOTTOM)
.view(view)
.radius(QMUIDisplayHelper.dp2px(this, 5))
.arrow(false)
.shadow(false)
.offsetYIfTop(0)
.animStyle(QMUIPopup.ANIM_AUTO)
.show(it)
view.apply {
//營業中
findViewById<TextView>(R.id.tv_restaurant_open).setOnClickListener {
updateRestaurantState(1)
}
//休息中
findViewById<TextView>(R.id.tv_restaurant_close).setOnClickListener {
updateRestaurantState(0)
}
//繁忙不接單
findViewById<TextView>(R.id.tv_restaurant_busy_close).setOnClickListener {
updateRestaurantState(2)
}
//繁忙可接單
findViewById<TextView>(R.id.tv_restaurant_busy_open).setOnClickListener {
updateRestaurantState(3)
}
}
} else {
restaurantPopup?.show(it)
}
}
//綁定營業按鈕狀態
pageViewModel.restaurantState.observe(this, Observer {
btn_switch_restaurant_state.isChecked = it
when (it) {
0 -> {
tv_restaurant_state.text = "休息中"
stateBg.setColor(resources.getColor(R.color.color_c8))
}
1 -> {
tv_restaurant_state.text = "營業中"
stateBg.setColor(resources.getColor(R.color.restaurant_color_open))
}
2 -> {
tv_restaurant_state.text = "繁忙不接"
stateBg.setColor(resources.getColor(R.color.restaurant_color_busy_close))
}
3 -> {
tv_restaurant_state.text = "繁忙可接"
stateBg.setColor(resources.getColor(R.color.restaurant_color_busy_open))
}
}
tv_restaurant_state.background = stateBg
})
btn_open_or_close_info.setOnClickListener {
setOrderInfoOpenOrClose()
}
}
private fun updateRestaurantState(state: Int) {
pageViewModel.setRestaurantState(this@OtherOrderActivity, state)
restaurantPopup?.dismiss()
}
private fun initWebsocket() {
//開啟websocket
val intent = Intent(this, GetInfoUpdateService::class.java)
......@@ -195,7 +259,7 @@ class OtherOrderActivity : BaseActivity() {
if (type == 3 || type == 4 || type == 5
|| type == 6 || type == 7) {
//播放提示音
if (type == 5) {
if (type == 5 || type == 4) {
pageViewModel.refreshState.postValue(1)
} else {
pageViewModel.refreshState.postValue(type)
......@@ -308,16 +372,47 @@ class OtherOrderActivity : BaseActivity() {
view.requestLayout()
}
private var pop: QMUIPopup? = null
/**
* 初始化標題欄
*/
private fun initAppTop() {
qm_other_order_bar.setTitle(R.string.app_name)
qm_other_order_bar.setTitle(GsaCloudApplication.getRestaurantName(this))
qm_other_order_bar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
qm_other_order_bar.addRightImageButton(R.drawable.ic_history_order, R.id.iv_history).setOnClickListener {
//歷史訂單
startActivity(Intent(this, HistoryOrderActivity::class.java))
qm_other_order_bar.addRightImageButton(R.drawable.icon_topbar_overflow, R.id.topbar_right_change_button).setOnClickListener {
//彈出彈窗
if (pop == null) {
val view = LayoutInflater.from(this).inflate(R.layout.layout_more_popup, null)
pop = QMUIPopups.popup(this)
.preferredDirection(QMUIPopup.DIRECTION_BOTTOM)
.view(view)
.radius(QMUIDisplayHelper.dp2px(this, 5))
.arrow(true)
.shadow(true)
.dimAmount(0.6f)
.offsetYIfTop(0)
.animStyle(QMUIPopup.ANIM_AUTO)
.show(it)
view.findViewById<QMUIAlphaTextView>(R.id.tv_delivery_setting).setOnClickListener {
//備送設置
startActivity(Intent(this, DeliverySettingActivity::class.java))
pop!!.dismiss()
}
view.findViewById<QMUIAlphaTextView>(R.id.tv_history_order).setOnClickListener {
//歷史訂單
startActivity(Intent(this, HistoryOrderActivity::class.java))
pop!!.dismiss()
}
} else {
pop!!.show(it)
}
}
// qm_other_order_bar.addRightImageButton(R.drawable.ic_history_order, R.id.iv_history).setOnClickListener {
// //歷史訂單
// startActivity(Intent(this, HistoryOrderActivity::class.java))
// }
qm_other_order_bar.setBackgroundColor(resources.getColor(R.color.theme_color))
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
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.DeliveryConfig
import com.gingersoft.gsa.other_order_mode.databinding.ItemDeliveryLayoutBinding
class DeliveryListAdapter(val context: Context, data: List<DeliveryConfig.Data.DeliveryInfo>) : BaseQuickAdapter<DeliveryConfig.Data.DeliveryInfo, DeliveryListAdapter.ViewHolder>(data) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_delivery_layout, null)
return ViewHolder(view)
}
override fun convert(helper: ViewHolder?, item: DeliveryConfig.Data.DeliveryInfo?) {
helper?.let { helper ->
helper.binding.apply {
// deliveryType = when(item!!.distributionType){
// "SHORT_RANGE"->
// "STANDARD"->
// "LONG_DISTANCE"->
// else ->""
// }
item?.let { it ->
deliveryType = it.distributionType
deliveryExpenses = "${it.distributionFeeMin}-${it.distributionFeeMax}"
deliveryFee = it.distributionFee.toString()
deliveryMethod = if (it.type == 1) "物流備送" else "本店備送"
deliveryDifference = it.deliveryCost.toString()
}
}
}
}
class ViewHolder(itemView: View) : BaseViewHolder(itemView) {
var binding: ItemDeliveryLayoutBinding = DataBindingUtil.bind(itemView)!!
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.adapter
import android.animation.Animator
import android.animation.AnimatorSet
import android.animation.ObjectAnimator.ofFloat
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.drawable.GradientDrawable
import android.support.v4.media.session.PlaybackStateCompat
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -45,22 +43,18 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
holder.binding.data = data
holder.binding.isSelf = data.order_type == 7
data.trkNo?.apply {
if (length > 0) {
holder.binding.deliveryState = when (data.curStat) {
1 -> "訂單已創建"
2 -> "配送員已接單"
3 -> "配送員到店附近"
4 -> "配送員已到店"
5 -> "配送中"
6 -> "到達目的地附近"
7 -> "訂單已完成"
8 -> "物流已取消"//取餐前
9 -> "物流已取消"//取餐後
10 -> "已指派另一位配送員"
else -> ""
}
}
holder.binding.deliveryState = when (data.curStat) {
1 -> "已通知物流"
2 -> "配送員已接單"
3 -> "配送員到店附近"
4 -> "配送員已到店"
5 -> "配送中"
6 -> "到達目的地附近"
7 -> "訂單已完成"
8 -> "物流已取消"//取餐前
9 -> "物流已取消"//取餐後
10 -> "已指派另一位配送員"
else -> ""
}
var state: String? = null
......@@ -100,20 +94,22 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
//堂食外賣背景
val orderingMethodBg = GradientDrawable()
orderingMethodBg.shape = GradientDrawable.OVAL
orderingMethodBg.shape = GradientDrawable.RECTANGLE
orderingMethodBg.cornerRadii = floatArrayOf(dp2px(8f).toFloat(), dp2px(8f).toFloat(), 0f, 0f, 0f, 0f, dp2px(8f).toFloat(), dp2px(8f).toFloat())
holder.binding.orderingMethod =
when {
data.order_type == 2 -> {
orderingMethodBg.setColor(getColor(R.color.order_state2_color))
"外"
"外"
}
data.order_type == 7 -> {
orderingMethodBg.setColor(getColor(R.color.order_state3_color))
"自"
"自"
}
else -> {
orderingMethodBg.setColor(getColor(R.color.order_state1_color))
"堂"
"堂"
}
}
holder.binding.orderingMethodBg = orderingMethodBg
......
package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel
import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryListAdapter
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import kotlinx.android.synthetic.main.fragment_delivery_list.*
class DeliveryFragment : Fragment() {
companion object {
fun newInstance() = DeliveryFragment()
}
private lateinit var viewModel: DeliveryViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_delivery_list, container, false)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java]
viewModel.queryDeliveryList(GsaCloudApplication.getRestaurantId(activity!!).toString()) {
if (it?.data?.list != null && it.data.list.isNotEmpty()) {
val deliveryListAdapter = DeliveryListAdapter(context!!, it.data.list)
rv_delivery.adapter = deliveryListAdapter
rv_delivery.layoutManager = LinearLayoutManager(context!!)
rv_delivery.visibility = View.VISIBLE
} else {
rv_delivery.visibility = View.GONE
}
}
// rv_delivery
}
}
......@@ -11,6 +11,7 @@ import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
......@@ -19,6 +20,8 @@ import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.gingersoft.gsa.other_order_mode.util.setState
import kotlinx.android.synthetic.main.fragment_other_order.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlin.String as String1
/**
......@@ -53,7 +56,9 @@ class PlaceholderFragment : BaseFragment() {
adapter.setOnItemClickListenter { data ->
// 點擊查詢食品詳情
pageViewModel.getOrderInfo(data.Id.toString()) { it1 ->
showLoading()
pageViewModel.getShipanyAndOrderInfo(data.curStat, GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) { it1 ->
cancelDialogForLoading()
//顯示彈窗
if (this@PlaceholderFragment.context != null && it1 != null) {
OtherOrderUtils.showOrderDetailsDialog(this@PlaceholderFragment.context!!, it1, data.STATUS, data.order_type) { view, _, dialog ->
......@@ -71,31 +76,52 @@ class PlaceholderFragment : BaseFragment() {
R.id.btn_cancel_order -> {
//取消訂單,先判斷有沒有物流
showLoading()
if (it1.data!![0].isDelete == 1) {
//本店配送的單,應該先需要召回
pageViewModel.cancelOrder(context!!, data.Id.toString()){
ToastUtils.show(context, it)
cancelDialogForLoading()
if (it1.data!![0].isDelete == 0) {
//第三方物流單
//彈出彈窗詢問是否確認取消
AppDialog.showWaringDialog(context, "是否確認取消第三方派送?") { v, dialog ->
when (v.id) {
R.id.tv_dialog_confirm -> {
//取消物流
pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) {
ToastUtils.show(context, it)
cancelDialogForLoading()
refresh()//刷新當前頁面
}
dialog.dismiss()
}
R.id.tv_dialog_cancel -> dialog.dismiss()
}
}
} else {
//第三方物流單,得先取消物流
pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) {
ToastUtils.show(context, it)
//本店配送的單
pageViewModel.cancelOrder(context!!, data.Id.toString()) {
ToastUtils.show(context, if (it) {
"取消訂單成功"
} else {
"取消訂單失敗"
})
cancelDialogForLoading()
refresh()//刷新當前頁面
}
}
dialog.dismiss()
}
}
}
} else {
ToastUtils.show(context, "獲取訂單詳情失敗")
}
}
}
rv_other_order.adapter = adapter
//有多少個Fragment就添加多少個監聽
while (pageViewModel.mOrderList.size <= arguments?.getInt(INDEX)!!) {
pageViewModel.mOrderList.add(MutableLiveData())
}
// 綁定當前fragment的數據項
// 綁定監聽當前fragment的數據項
pageViewModel.mOrderList[arguments?.getInt(INDEX)!!].observe(viewLifecycleOwner, Observer {
it.let { adapter.setData(it) }
})
......@@ -105,8 +131,10 @@ class PlaceholderFragment : BaseFragment() {
// 下拉刷新,加載更多
refresh_layout.setOnRefreshListener {
refresh()
//重新拉取一遍送貨員和第三方派送信息
pageViewModel.getDeliveryInfo(context!!)
pageViewModel.getDeliveryConfigDTO(context!!)
}
refresh_layout.setOnLoadMoreListener {
page++
getOrderList(pageViewModel, true)
......
package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import kotlinx.android.synthetic.main.update_delivery_fragment.*
class UpdateDeliveryFragment : Fragment() {
companion object {
fun newInstance() = UpdateDeliveryFragment()
}
private lateinit var viewModel: DeliveryViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.update_delivery_fragment, container, false)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java]
top_bar_update_delivery.setTitle("備送設置")
top_bar_update_delivery.setBackgroundColor(resources.getColor(R.color.theme_color))
top_bar_update_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { activity?.let { it.onBackPressed() } }
}
}
package com.gingersoft.gsa.other_order_mode.util
import com.gingersoft.gsa.other_order_mode.data.DeliveryRepository
import com.gingersoft.gsa.other_order_mode.data.HistoryOrderRepository
import com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork
import com.gingersoft.gsa.other_order_mode.data.network.DeliveryNetwork
import com.gingersoft.gsa.other_order_mode.model.factory.DeliveryFactory
import com.gingersoft.gsa.other_order_mode.model.factory.HistoryOrderModelFactory
import com.gingersoft.gsa.other_order_mode.model.factory.WeatherModelFactory
......@@ -19,5 +22,6 @@ object InjectorUtil {
private fun getHistoryRepository() = HistoryOrderRepository.getInstance(CoolWeatherNetwork.getInstance())
fun getDeliveryFactory() = DeliveryFactory(DeliveryRepository.getInstance(DeliveryNetwork.getInstance()))
}
\ No newline at end of file
......@@ -41,13 +41,14 @@ object OtherOrderUtils {
//自取
btnContent = "製作完成"
tvStatus.setTextColor(context.resources.getColor(R.color.order_state0_color))
cancelBtnContent = "取消訂單"
} else {
if (orderData.isDelete == 1) {
btnContent = "指派送貨"
cancelBtnContent = "取消訂單"
} else {
if (orderData.isDelete == 0) {
btnContent = "重印"
cancelBtnContent = "取消物流"
} else {
btnContent = "指派送貨"
cancelBtnContent = "取消訂單"
}
tvStatus.setTextColor(context.resources.getColor(R.color.order_state1_color))
}
......@@ -71,9 +72,23 @@ object OtherOrderUtils {
cancelBtnContent = "取消訂單"
}
}
layoutOrderInfoDialogBinding.patMethod = when (orderData.payType) {
1 -> "积分支付"
2 -> "支付宝"
3 -> "财付通"
4 -> "微信支付"
5 -> "货到付款"
6 -> "其他支付"
else -> ""
}
if (!showBtn) {
cancelBtnContent = ""
}
layoutOrderInfoDialogBinding.orderStatus = type + orderStatus
layoutOrderInfoDialogBinding.btnContent = btnContent
layoutOrderInfoDialogBinding.cancelBtnContent = cancelBtnContent
layoutOrderInfoDialogBinding.estimatedTime = orderData.estimatedTime
}
val rvFood: RecyclerView = hepler.getView(R.id.rv_food)
......
package com.gingersoft.gsa.other_order_mode.util
import android.content.Context
import android.graphics.drawable.Drawable
import android.view.View
fun View.setState(state: Boolean) {
......@@ -8,4 +10,9 @@ fun View.setState(state: Boolean) {
} else {
View.GONE
}
}
fun Context.getDrawable(drawable: Int): Drawable {
return this.resources.getDrawable(drawable)
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_4"/>
<solid android:color="@color/restaurant_color_open"/>
</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:id="@+id/fl_delivery"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/top_bar_delivery"
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" />
<fragment
android:name="com.gingersoft.gsa.other_order_mode.ui.fragment.DeliveryFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/top_bar_delivery" />
</RelativeLayout>
......@@ -6,7 +6,7 @@
android:layout_height="match_parent"
android:background="@color/color_f0"
android:orientation="vertical"
tools:context=".ui.activity.OtherOrderActivity">
tools:context=".ui.activity.HistoryOrderActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
......@@ -26,6 +26,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:padding="@dimen/dp_10">
<EditText
......@@ -35,11 +37,11 @@
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_search_bg"
android:hint="請輸入手機號或訂單號"
android:inputType="number"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_50"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/color_ccc"
android:inputType="number"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
......@@ -54,9 +56,70 @@
app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
app:layout_constraintRight_toRightOf="@id/ed_order_num_search"
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
<TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:onClick="onClickListener"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/ed_order_num_search"
app:layout_constraintTop_toBottomOf="@id/ed_order_num_search" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_start_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
android:onClick="onClickListener"
app:layout_constraintBottom_toBottomOf="@id/tv_start_time"
app:layout_constraintLeft_toRightOf="@id/tv_start_time"
app:layout_constraintTop_toTopOf="@id/tv_start_time"
app:trv_direction="bottom" />
<TextView
android:id="@+id/tv_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:text="至"
android:visibility="gone"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="@id/iv_start_time_triangle"
app:layout_constraintLeft_toRightOf="@id/iv_start_time_triangle"
app:layout_constraintTop_toTopOf="@id/iv_start_time_triangle" />
<TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:onClick="onClickListener"
android:textColor="@color/theme_333_color"
android:visibility="gone"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="@id/tv_to"
app:layout_constraintLeft_toRightOf="@id/tv_to"
app:layout_constraintTop_toTopOf="@id/tv_to" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_end_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
android:onClick="onClickListener"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_end_time"
app:layout_constraintLeft_toRightOf="@id/tv_end_time"
app:layout_constraintTop_toTopOf="@id/tv_end_time"
app:trv_direction="bottom" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/fragment_other_order"/>
<include layout="@layout/fragment_other_order" />
</LinearLayout>
\ No newline at end of file
......@@ -47,9 +47,9 @@
android:id="@+id/cl_order_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_6"
android:background="@drawable/shape_dialog_bg"
android:focusable="true"
android:focusableInTouchMode="true">
......@@ -154,14 +154,14 @@
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_search_bg"
android:hint="請輸入手機號或訂單號"
android:inputType="number"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_50"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/color_ccc"
android:textSize="@dimen/dp_14"
android:inputType="number"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/btn_switch_restaurant_state"
app:layout_constraintRight_toLeftOf="@id/tv_restaurant_state"
app:layout_constraintTop_toBottomOf="@id/tv_month_takeaway_num_text" />
<ImageView
......@@ -175,22 +175,43 @@
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
<com.gingersoft.gsa.cloud.ui.view.SwitchButton
android:id="@+id/btn_switch_restaurant_state"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_40"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
app:kswBackColor="@color/selector_switch_button"
app:kswBackRadius="@dimen/dp_20"
app:kswTextOff="@string/resting"
app:kswTextOn="@string/open"
app:kswThumbColor="@color/white"
app:kswThumbMarginBottom="@dimen/dp_4"
app:kswThumbMarginTop="@dimen/dp_4"
<TextView
android:id="@+id/tv_restaurant_state"
style="@style/otherOrder_restaurant_state_style"
android:background="@drawable/shape_restaurant_state_bg"
android:text="營業中 "
app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
<ImageView
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_5"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_4"
android:src="@drawable/qmui_popup_arrow_down"
app:layout_constraintBottom_toBottomOf="@id/tv_restaurant_state"
app:layout_constraintRight_toRightOf="@id/tv_restaurant_state"
app:layout_constraintTop_toTopOf="@id/tv_restaurant_state" />
<!-- -->
<!-- <com.gingersoft.gsa.cloud.ui.view.SwitchButton-->
<!-- android:id="@+id/btn_switch_restaurant_state"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="@dimen/dp_40"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="@dimen/dp_12"-->
<!-- app:kswBackColor="@color/selector_switch_button"-->
<!-- app:kswBackRadius="@dimen/dp_20"-->
<!-- app:kswTextOff="@string/resting"-->
<!-- app:kswTextOn="@string/open"-->
<!-- app:kswThumbColor="@color/white"-->
<!-- app:kswThumbMarginBottom="@dimen/dp_4"-->
<!-- app:kswThumbMarginTop="@dimen/dp_4"-->
<!-- app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />-->
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_delivery"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.qmuiteam.qmui.layout.QMUIButton
android:id="@+id/tv_add_delivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_border_bg"
android:text="添加備送方式"
android:padding="@dimen/dp_10"
android:textColor="@color/theme_color" />
</LinearLayout>
\ No newline at end of file
<?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">
<data>
<variable
name="delivery_type"
type="String" />
<variable
name="delivery_expenses"
type="String" />
<variable
name="delivery_fee"
type="String" />
<variable
name="delivery_method"
type="String" />
<variable
name="delivery_difference"
type="String" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_delivery_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:text="@{@string/delivery_type+ delivery_type}"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_delivery_expenses"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_expenses + delivery_expenses}"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_type" />
<TextView
android:id="@+id/tv_delivery_fee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_fee + delivery_fee}"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_expenses" />
<TextView
android:id="@+id/tv_delivery_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_method + delivery_method}"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_fee" />
<TextView
android:id="@+id/tv_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_difference + delivery_difference}"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_method" />
<TextView
android:id="@+id/iv_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="編輯"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/iv_delete"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/iv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="刪除"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_12"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/horizontal_dividing_line"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/color_ccc"
app:layout_constraintTop_toBottomOf="@id/tv_difference" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -75,7 +75,7 @@
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{data.rECEIVER}"
......@@ -83,6 +83,7 @@
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_time"
app:layout_constraintTop_toBottomOf="@id/tv_ordering_method" />
<TextView
......@@ -92,7 +93,6 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintBottom_toBottomOf="@id/tv_order_user_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_order_user_name" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_delivery_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10"
android:text="備送設置"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_history_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10"
android:text="歷史訂單"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
......@@ -38,6 +38,14 @@
<variable
name="showBtn"
type="Boolean" />
<variable
name="patMethod"
type="String" />
<variable
name="estimatedTime"
type="String" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -119,18 +127,42 @@
app:layout_constraintTop_toBottomOf="@id/tv_total_amount_text" />
<TextView
android:id="@+id/tv_order_no"
android:id="@+id/tv_take_food_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_15"
android:text="@{@string/order_no + data.oRDER_NO}"
android:text="取餐碼:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_total_amount" />
<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:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_take_food_code"
app:layout_constraintLeft_toRightOf="@id/tv_take_food_code"
app:layout_constraintTop_toTopOf="@id/tv_take_food_code" />
<TextView
android:id="@+id/tv_order_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:text="@{@string/order_no + data.oRDER_NO}"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_num" />
<TextView
android:id="@+id/tv_create_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -142,13 +174,26 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_no" />
<TextView
android:id="@+id/tv_estimated_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
android:text="@{estimatedTime}"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
android:visibility="@{estimatedTime.length()>0?View.VISIBLE:View.GONE}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_create_time" />
<View
android:id="@+id/line_info_top"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/color_ccc"
app:layout_constraintTop_toBottomOf="@id/tv_create_time" />
app:layout_constraintTop_toBottomOf="@id/tv_estimated_time" />
<TextView
android:id="@+id/tv_receiver_text"
......@@ -536,6 +581,29 @@
android:textColor="#FF0000"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_pay_amount_text" />
<TextView
android:id="@+id/tv_pay_method_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="支付方式:"
android:visibility="@{patMethod.length()==0?View.GONE:View.VISIBLE}"
app:layout_constraintRight_toRightOf="@id/tv_total_text"
app:layout_constraintTop_toBottomOf="@id/tv_pay_amount_text" />
<TextView
android:id="@+id/tv_pay_method"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:text="@{patMethod}"
android:visibility="@{patMethod.length()==0?View.GONE:View.VISIBLE}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_pay_method_text" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
......
......@@ -6,6 +6,8 @@
<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" />
......@@ -44,180 +46,201 @@
type="Boolean" />
</data>
<com.lihang.ShadowLayout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
android:layout_marginRight="@dimen/dp_3">
<androidx.constraintlayout.widget.ConstraintLayout
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<TextView
android:id="@+id/tv_payment_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@{payMethodBg}"
android:paddingLeft="@dimen/dp_6"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_6"
android:paddingBottom="@dimen/dp_2"
android:text="@{payMethod}"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_ordering_method"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_8"
android:background="@{orderingMethodBg}"
android:gravity="center"
android:text="@{orderingMethod}"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"
app:layout_constraintLeft_toRightOf="@id/tv_payment_method"
app:layout_constraintTop_toTopOf="parent" />
<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:text="@{delivery_state}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="@{data.rECEIVER}"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintRight_toLeftOf="@id/tv_order_time"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_ordering_method" />
<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:layout_marginLeft="@dimen/dp_5"
android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_order_user_name" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_order_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:barrierDirection="right"
app:constraint_referenced_ids="tv_address_text,tv_cellphone_num_text,tv_order_num_text" />
<TextView
android:id="@+id/tv_cellphone_num_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="手機號:"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" />
<TextView
android:id="@+id/tv_cellphone_num"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:text="@{data.pHONE}"
app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
app:layout_constraintTop_toTopOf="@id/tv_cellphone_num_text" />
<TextView
android:id="@+id/tv_order_num_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_5"
android:text="取餐碼:"
app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num_text"
app:layout_constraintTop_toBottomOf="@id/tv_cellphone_num_text" />
<TextView
android:id="@+id/tv_order_num"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="wrap_content"
android:textStyle="bold"
android:layout_height="wrap_content"
android:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num"
app:layout_constraintTop_toTopOf="@id/tv_order_num_text" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@{stateBg}"
android:padding="@dimen/dp_5"
android:text="@{state}"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
app:layout_constraintBottom_toBottomOf="@id/tv_order_num_text"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_cellphone_num_text" />
<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:layout_marginLeft="@dimen/dp_2"
android:layout_marginTop="@dimen/dp_5"
android:text="@{isSelf?@string/meal_code:@string/address}"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_num_text" />
<TextView
android:id="@+id/tv_address"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:text="@{isSelf?data.takeFoodCode:data.aDDRESS_DETAIL}"
app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num"
app:layout_constraintRight_toLeftOf="@id/tv_order_amount"
app:layout_constraintTop_toTopOf="@id/tv_address_text" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{@string/amount_unit + data.pAY_AMOUNT}"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_14"
app:layout_constraintBottom_toBottomOf="@id/tv_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_address" />
</androidx.constraintlayout.widget.ConstraintLayout>
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" />
<TextView
android:id="@+id/tv_payment_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@{payMethodBg}"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_2"
android:text="@{payMethod}"
android:textColor="@color/white"
android:textSize="@dimen/sp_10"
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_order_time"
style="@style/otherOrder_item_create_time_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="right"
android:textSize="@dimen/dp_10"
android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
app:layout_constraintLeft_toRightOf="@id/tv_payment_method"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="@id/tv_payment_method"
app:layout_constraintTop_toTopOf="@id/tv_payment_method" />
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:text="@{data.rECEIVER + @string/left_parenthesis+data.pHONE + @string/right_parenthesis}"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/tv_delivery_method"
app:layout_constraintRight_toLeftOf="@id/barrier_order_right_line"
app:layout_constraintTop_toBottomOf="@id/tv_payment_method" />
<TextView
android:id="@+id/tv_delivery_state"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_18"
android:gravity="right"
android:text="@{delivery_state}"
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" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_order_right_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:barrierDirection="left"
app:constraint_referenced_ids="tv_order_amount,tv_delivery_state,tv_order_state" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_order_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:barrierDirection="right"
app:constraint_referenced_ids="tv_address_text,tv_order_num_text" />
<TextView
android:id="@+id/tv_delivery_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9"
android:text="@{data.waimaiSendTime}"
android:textColor="#EC2D2D"
android:textSize="@dimen/dp_12"
android:visibility="visible"
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" />
<TextView
android:id="@+id/tv_order_num_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:text="取餐碼:"
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_time" />
<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:text='@{data.takeFoodCode.equals("0")? @string/take_food_code_omit:data.takeFoodCode}'
android:textSize="@dimen/dp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_order_num_text"
app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
app:layout_constraintTop_toTopOf="@id/tv_order_num_text" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:background="@{stateBg}"
android:padding="@dimen/dp_5"
android:text="@{state}"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
app:layout_constraintRight_toRightOf="@id/tv_order_time"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_state" />
<TextView
android:id="@+id/tv_address_text"
style="@style/otherOrder_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_9"
android:text="@{@string/address}"
android:visibility="@{isSelf?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="@id/tv_address"
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_order_num_text" />
<TextView
android:id="@+id/tv_address"
style="@style/otherOrder_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_10"
android:text="@{data.aDDRESS_DETAIL}"
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" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_10"
android:text="@{@string/amount_unit + data.pAY_AMOUNT}"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
app:layout_constraintRight_toRightOf="@id/tv_order_time"
app:layout_constraintTop_toTopOf="@id/tv_address_text"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id="@+id/fl_border"
......@@ -225,5 +248,5 @@
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
</com.lihang.ShadowLayout>
</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:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_restaurant_open"
style="@style/otherOrder_restaurant_state_style"
android:background="@color/restaurant_color_open"
android:text="營業中" />
<TextView
android:id="@+id/tv_restaurant_close"
style="@style/otherOrder_restaurant_state_style"
android:background="@color/color_c8"
android:text="休息中" />
<TextView
android:id="@+id/tv_restaurant_busy_close"
style="@style/otherOrder_restaurant_state_style"
android:background="@color/restaurant_color_busy_close"
android:text="繁忙不接" />
<TextView
android:id="@+id/tv_restaurant_busy_open"
style="@style/otherOrder_restaurant_state_style"
android:background="@color/restaurant_color_busy_open"
android:text="繁忙可接" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:background="@color/white"
tools:context=".ui.fragment.UpdateDeliveryFragment">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/top_bar_update_delivery"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:layout_constraintTop_toTopOf="parent"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -41,4 +41,14 @@
<string name="deliveryman_phone">送貨員手機號:</string>
<string name="logistics_number">物流號:</string>
<string name="take_food_code_omit">----</string>
<string name="left_parenthesis"></string>
<string name="right_parenthesis"></string>
<string name="delivery_type">配送類型:</string>
<string name="delivery_expenses">配送費範圍:</string>
<string name="delivery_fee">起送費:</string>
<string name="delivery_method">配送方式:</string>
<string name="delivery_difference">補差價:</string>
</resources>
......@@ -82,6 +82,14 @@
<item name="android:textColor">@color/color_66</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 餐廳營業狀態按鈕樣式-->
<style name="otherOrder_restaurant_state_style">
<item name="android:layout_width">@dimen/dp_80</item>
<item name="android:layout_height">@dimen/dp_28</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingLeft">@dimen/dp_8</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_14</item>
</style>
</resources>
......@@ -203,7 +203,7 @@ public class PrintOtherOrder extends PrinterRoot {
//配送費
setAmount(data.getDELIVERY_CHARGE(), view.findViewById(R.id.tv_delivery_fee_text), view.findViewById(R.id.tv_delivery_fee), amountUnit);
//折扣
setAmount(data.getDiscount_amount(), view.findViewById(R.id.tv_discount_text), view.findViewById(R.id.tv_discount), amountUnit);
setAmount(data.getDiscount_amount(), view.findViewById(R.id.tv_discount_text), view.findViewById(R.id.tv_discount), "-" + amountUnit);
//總金額
setText(view, R.id.tv_total_amount, amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
//支付金額
......
......@@ -363,6 +363,7 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
hepler.setViewClick(R.id.internet_print, v -> {
//修改默認打印方式為IP打印
SPUtils.put(mContext, PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.IP_PRINT);
dialog.dismiss();
//彈出彈窗,讓用戶選擇ip打印機
showIpPrintDeviceList(printerDeviceBeans, bitmaps);
});
......
......@@ -185,7 +185,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="配送費:"
android:text="送貨費:"
android:textStyle="normal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_lunchbox_cost" />
......
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