Commit eb12ef4f by Wyh

8.20 1、優化報錯推送內容 2、每日營業報表 3、新增重新加載view 4、更改選擇餐廳頁面 5、派送員報表 6、新增選擇時間view 7、外送按鈕權限控制 8、修改外送的提示音

Signed-off-by: Wyh <1239658231>
parent 114cb283
...@@ -4,6 +4,7 @@ import android.util.Log; ...@@ -4,6 +4,7 @@ import android.util.Log;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.encryption.Aes; import com.gingersoft.gsa.cloud.base.utils.encryption.Aes;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil;
import com.gingersoft.gsa.cloud.constans.AppConstans; import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.constans.HttpsConstans; import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor; import com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor;
...@@ -254,18 +255,18 @@ public class OkHttp3Utils { ...@@ -254,18 +255,18 @@ public class OkHttp3Utils {
/** /**
* 心跳接口報錯,推送給相關人員 * 心跳接口報錯,推送給相關人員
* 版本,時間,RP_HD001,Gingersoft,GS1,26ErrorMsg:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*/ */
public static void noticePersonnel(String errCode, String pushContent) { public static void noticePersonnel(String errCode, String pushContent) {
String restaurantInfo = "品牌名:" + String restaurantInfo =
GsaCloudApplication.getBrandName(GsaCloudApplication.getAppContext()) + "版本號:" + DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "|" + DeviceUtils.getVersionCode(GsaCloudApplication.getAppContext()) +
"餐廳名:" + "時間:" + TimeUtil.getCurrentDate(TimeUtil.dateFormatYMDHMS) +
GsaCloudApplication.getRestaurantName(GsaCloudApplication.getAppContext()) + "報錯CODE:" + errCode +
"餐廳ID:" + "品牌名:" + GsaCloudApplication.getBrandName(GsaCloudApplication.getAppContext()) +
GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) + "餐廳名:" + GsaCloudApplication.getRestaurantName(GsaCloudApplication.getAppContext()) +
"報錯CODE:" + "餐廳ID:" + GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) +
errCode + "登陸人員:" + GsaCloudApplication.getMemberName(GsaCloudApplication.getAppContext()) + "|" + GsaCloudApplication.getMemberId(GsaCloudApplication.getAppContext()) +
"報錯原因:" + "報錯原因:" + pushContent;
pushContent;
RequestBody requestBody = new FormBody.Builder() RequestBody requestBody = new FormBody.Builder()
.add("code", errCode)//錯誤碼 .add("code", errCode)//錯誤碼
.add("shopId", GsaCloudApplication.getGsPosShopId(GsaCloudApplication.getAppContext())) .add("shopId", GsaCloudApplication.getGsPosShopId(GsaCloudApplication.getAppContext()))
......
...@@ -532,7 +532,6 @@ public class TimeUtils { ...@@ -532,7 +532,6 @@ public class TimeUtils {
* @return * @return
*/ */
public static String getDatebyDate(String date, int day) { public static String getDatebyDate(String date, int day) {
Log.e("eee", "時間" + date);
if (day == 0) { if (day == 0) {
return ""; return "";
} }
......
package com.gingersoft.gsa.cloud.base.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.ui.view.ReloadView;
public abstract class BaseReloadView extends FrameLayout {
private ReloadView.onReLoadListener onReLoadListener;
private ReloadView reloadView;
private ViewGroup contentView;
private View replaceView;
public void setOnReLoadListener(ReloadView.onReLoadListener onReLoadListener) {
this.onReLoadListener = onReLoadListener;
if(reloadView != null){
reloadView.setOnReLoadListener(onReLoadListener);
}
}
public BaseReloadView(@NonNull Context context) {
this(context, null);
}
public BaseReloadView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public BaseReloadView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public BaseReloadView init() {
if (getDataIsNull()) {
//如果不是打印,並且數據為空
reloadView = new ReloadView(getContext());
reloadView.setOnReLoadListener(onReLoadListener);
getContentView();
if (replaceView != null) {
replaceView.setVisibility(GONE);
((ViewGroup)replaceView.getParent()).addView(reloadView);
}
} else {
getContentView();
}
return this;
}
private ViewGroup getContentView() {
if (contentView == null) {
contentView = getChildView();
addView(contentView);
replaceView = contentView.findViewById(R.id.layout_replace);
}
return contentView;
}
public void notifyData() {
if (getDataIsNull()) {
//如果不是打印,並且數據為空
if (reloadView == null) {
reloadView = new ReloadView(getContext());
reloadView.setOnReLoadListener(onReLoadListener);
if (replaceView != null) {
replaceView.setVisibility(GONE);
((ViewGroup)replaceView.getParent()).addView(reloadView);
}
} else {
if (replaceView != null) {
replaceView.setVisibility(GONE);
}
if (reloadView != null) {
reloadView.setVisibility(VISIBLE);
} else {
reloadView = new ReloadView(getContext());
reloadView.setOnReLoadListener(onReLoadListener);
((ViewGroup)replaceView.getParent()).addView(reloadView);
}
}
} else {
if (reloadView != null) {
reloadView.setVisibility(GONE);
}
if (replaceView != null) {
replaceView.setVisibility(VISIBLE);
}
refreshData();
}
}
public abstract boolean getDataIsNull();
public abstract ViewGroup getChildView();
public abstract void refreshData();
}
...@@ -162,6 +162,12 @@ public abstract class DialogUtils implements LifecycleObserver { ...@@ -162,6 +162,12 @@ public abstract class DialogUtils implements LifecycleObserver {
return this; return this;
} }
public static void staticDismiss() {
if (dialog != null)
dialog.dismiss();
dialog = null;
}
public DialogUtils setGravity(int gravity) { public DialogUtils setGravity(int gravity) {
if (dialog != null && dialog.getWindow() != null) { if (dialog != null && dialog.getWindow() != null) {
dialog.getWindow().setGravity(gravity); dialog.getWindow().setGravity(gravity);
......
...@@ -65,6 +65,7 @@ public class FunctionManager { ...@@ -65,6 +65,7 @@ public class FunctionManager {
function.setIcRes(module.getDisableIconRes()); function.setIcRes(module.getDisableIconRes());
break; break;
} }
break;
} }
} }
functions.add(function); functions.add(function);
......
...@@ -44,12 +44,9 @@ public class BasTextSectiontAdapter extends QMUIDefaultStickySectionAdapter<Sect ...@@ -44,12 +44,9 @@ public class BasTextSectiontAdapter extends QMUIDefaultStickySectionAdapter<Sect
super.onBindSectionHeader(holder, position, section); super.onBindSectionHeader(holder, position, section);
QDSectionHeaderView itemView = (QDSectionHeaderView) holder.itemView; QDSectionHeaderView itemView = (QDSectionHeaderView) holder.itemView;
itemView.render(section.getHeader(), section.isFold()); itemView.render(section.getHeader(), section.isFold());
itemView.getArrowView().setOnClickListener(new View.OnClickListener() { itemView.getArrowView().setOnClickListener(v -> {
@Override int pos = holder.isForStickyHeader ? position : holder.getAdapterPosition();
public void onClick(View v) { toggleFold(pos, false);
int pos = holder.isForStickyHeader ? position : holder.getAdapterPosition();
toggleFold(pos, false);
}
}); });
} }
......
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.R;
public class ReloadView extends FrameLayout {
private onReLoadListener onReLoadListener;
public interface onReLoadListener {
void onReLoad();
}
public ReloadView(@NonNull Context context) {
this(context, null);
}
public ReloadView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public ReloadView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
View view = View.inflate(context, R.layout.layout_reload, null);
view.setOnClickListener(v -> {
if(onReLoadListener != null){
onReLoadListener.onReLoad();
}
});
addView(view);
}
public void setOnReLoadListener(ReloadView.onReLoadListener onReLoadListener) {
this.onReLoadListener = onReLoadListener;
}
}
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="加載失敗,"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重新加載"
android:textColor="@color/theme_color"
android:textSize="@dimen/dp_16" />
</LinearLayout>
</com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout>
\ No newline at end of file
...@@ -25,4 +25,5 @@ ...@@ -25,4 +25,5 @@
<item name="layout_for_test" type="id"/> <item name="layout_for_test" type="id"/>
<item name="topbar_heart_disconnect" type="id"/> <item name="topbar_heart_disconnect" type="id"/>
<item name="layout_replace" type="id"/>
</resources> </resources>
\ No newline at end of file
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" /> <activity android:name=".mvp.ui.activity.mvp.ui.activity.SwitchServerActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity" /> <activity android:name=".mvp.ui.activity.mvp.ui.activity.RecoverPasswordActivity" />
<activity android:name=".mvp.ui.activity.mvp.ui.activity.ChooseRestaurantActivity"/>
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" /> android:value="ConfigModule" />
......
...@@ -4,6 +4,7 @@ import com.billy.cc.core.component.CC; ...@@ -4,6 +4,7 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult; import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil; import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent; import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.ChooseRestaurantActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity; import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity; import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
...@@ -49,6 +50,10 @@ public class ComponentLogin implements IComponent { ...@@ -49,6 +50,10 @@ public class ComponentLogin implements IComponent {
CCUtil.navigateTo(cc, SwitchServerActivity.class); CCUtil.navigateTo(cc, SwitchServerActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success()); CC.sendCCResult(cc.getCallId(), CCResult.success());
break; break;
case "ChooseRestaurant":
CCUtil.navigateTo(cc, ChooseRestaurantActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
break;
default: default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例 //这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...) //并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
......
...@@ -34,8 +34,6 @@ public interface BaseLoginContract { ...@@ -34,8 +34,6 @@ public interface BaseLoginContract {
void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands); void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands);
void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBean, List<BrandsBean.BrandsData> brands);
void jumpMainActivity(); void jumpMainActivity();
void jumpDownloadActivity(); void jumpDownloadActivity();
......
package com.gingersoft.gsa.cloud.login.mvp.contract; package com.gingersoft.gsa.cloud.login.mvp.contract;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils; import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils; import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
...@@ -24,6 +18,7 @@ import com.gingersoft.gsa.cloud.constans.UserConstans; ...@@ -24,6 +18,7 @@ import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.login.R; import com.gingersoft.gsa.cloud.login.R;
import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean; import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean;
import com.gingersoft.gsa.cloud.login.mvp.presenter.BaseLoginPresenter; import com.gingersoft.gsa.cloud.login.mvp.presenter.BaseLoginPresenter;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.ChooseRestaurantActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity; import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity; import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.SwitchServerActivity;
import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.LoginLimitAdapter; import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.LoginLimitAdapter;
...@@ -73,7 +68,8 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -73,7 +68,8 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
} }
jumpDownloadActivity(); jumpDownloadActivity();
} else { } else {
showChooseRestaurantDialog(brandsBeans, brands);
// showChooseRestaurantDialog(brandsBeans, brands);
} }
} }
...@@ -83,14 +79,28 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B ...@@ -83,14 +79,28 @@ public abstract class LoginInterfaceImpl<P extends BaseLoginPresenter> extends B
} }
private void saveLoginInfo(LoginBean loginBean) { private void saveLoginInfo(LoginBean loginBean) {
GsaCloudApplication.setBrandRestaurantInfos(mContext, ""); // GsaCloudApplication.setBrandRestaurantInfos(mContext, "");
if (loginBean.getData() != null) { if (loginBean.getData() != null) {
GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken()); GsaCloudApplication.setLoginToken(mContext, loginBean.getData().getToken());
if (loginBean.getData().getUser() != null) { if (loginBean.getData().getUser() != null) {
GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getId()); GsaCloudApplication.setMemberId(mContext, loginBean.getData().getUser().getId());
GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName()); GsaCloudApplication.setMemberName(mContext, loginBean.getData().getUser().getUserName());
//獲取餐廳 //獲取餐廳
mPresenter.getRestaurantList(); // mPresenter.getRestaurantList();
boolean autoLogin = (boolean) SPUtils.get(mContext, UserConstans.AUTO_LOGIN, false);
if (autoLogin) {
int restaurantId = GsaCloudApplication.getRestaurantId(this);
if (restaurantId != 0) {
//上一次進入app有選擇餐廳,通過餐廳ID獲取允許的最大登陸數
// mPresenter.getLoginLimit(restaurantId, false);
jumpMainActivity();
return;
}
}
Intent intent = new Intent(mContext, ChooseRestaurantActivity.class);
Class clazz = getClass();
intent.putExtra("form", clazz.getName());
launchActivity(intent);
} }
} }
} }
......
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract; package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract;
import com.gingersoft.gsa.cloud.bean.PublicBean;
import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface ChooseRestaurantContract { public interface ChooseRestaurantContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void saveRestaurantListInfo(List<BrandsBean.BrandsData> brands);
void jumpMainActivity();
void jumpDownloadActivity();
void jumpActivity(Class activity);
void showLoginLimit(List<LoginLimitBean> loginLimitBeans);
void kickOut();
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel{ interface Model extends IModel {
Observable<BrandsBean> getRestaurantList();
Observable<PublicBean> getLoginLimit(int restaurantId);
Observable<Object> loginOut(int userId, RequestBody requestBody);
} }
} }
package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.model; package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.bean.PublicBean;
import com.gingersoft.gsa.cloud.login.mvp.server.LoginService;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
...@@ -10,6 +14,9 @@ import javax.inject.Inject; ...@@ -10,6 +14,9 @@ import javax.inject.Inject;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.ChooseRestaurantContract; import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.ChooseRestaurantContract;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope @ActivityScope
public class ChooseRestaurantModel extends BaseModel implements ChooseRestaurantContract.Model{ public class ChooseRestaurantModel extends BaseModel implements ChooseRestaurantContract.Model{
...@@ -29,4 +36,22 @@ public class ChooseRestaurantModel extends BaseModel implements ChooseRestaurant ...@@ -29,4 +36,22 @@ public class ChooseRestaurantModel extends BaseModel implements ChooseRestaurant
this.mGson = null; this.mGson = null;
this.mApplication = null; this.mApplication = null;
} }
@Override
public Observable<BrandsBean> getRestaurantList() {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.getRestaurantList();
}
@Override
public Observable<PublicBean> getLoginLimit(int restaurantId) {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.getLoginLimit(restaurantId);
}
@Override
public Observable<Object> loginOut(int userId, RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(LoginService.class)
.loginOut(userId, requestBody);
}
} }
\ No newline at end of file
...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.presenter; ...@@ -2,15 +2,32 @@ package com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.jess.arms.integration.AppManager; import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.bean.PublicBean;
import com.gingersoft.gsa.cloud.login.mvp.bean.LoginLimitBean;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.ChooseRestaurantContract;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.ui.activity.LoginActivity;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jess.arms.di.scope.ActivityScope; import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import com.jess.arms.integration.AppManager;
import javax.inject.Inject; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import com.gingersoft.gsa.cloud.login.mvp.ui.activity.mvp.contract.ChooseRestaurantContract; import java.util.List;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.RequestBody;
@ActivityScope @ActivityScope
...@@ -37,4 +54,109 @@ public class ChooseRestaurantPresenter extends BasePresenter<ChooseRestaurantCon ...@@ -37,4 +54,109 @@ public class ChooseRestaurantPresenter extends BasePresenter<ChooseRestaurantCon
this.mImageLoader = null; this.mImageLoader = null;
this.mApplication = null; this.mApplication = null;
} }
public void getRestaurantList() {
mModel.getRestaurantList()
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取餐廳信息中..."))
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BrandsBean>(mErrorHandler) {
@Override
public void onNext(@NonNull BrandsBean info) {
if (info != null) {
if(TextUtil.isNotEmptyOrNullOrUndefined(info.getMessage())){
mRootView.showMessage(info.getMessage());
}
mRootView.saveRestaurantListInfo(info.getData());
} else {
mRootView.saveRestaurantListInfo(null);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage("獲取餐廳信息失敗");
mRootView.killMyself();
}
});
}
/**
* @param restaurantId 餐廳ID
* @param isDownload 是否去下載頁面
*/
public void getLoginLimit(int restaurantId, boolean isDownload) {
mModel.getLoginLimit(restaurantId)
.subscribeOn(Schedulers.io())
.subscribeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取登錄人數中..."))
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<PublicBean>(mErrorHandler) {
@Override
public void onNext(PublicBean s) {
if (s != null && s.isSuccess()) {
List<LoginLimitBean> loginLimitBeans = new Gson().fromJson(GsonUtils.GsonString(s.getData()), new TypeToken<List<LoginLimitBean>>() {}.getType());
// List<LoginLimitBean> logins = GsonUtils.GsonToList("", LoginLimitBean.class);
if (loginLimitBeans == null || loginLimitBeans.size() <= 0) {
if (isDownload) {
mRootView.jumpDownloadActivity();
} else {
mRootView.jumpMainActivity();
}
} else {
mRootView.showMessage("登錄人數達到上限");
//已達上限,彈出彈窗
mRootView.showLoginLimit(loginLimitBeans);
}
} else {
mRootView.showMessage("獲取登陸人數失敗");
mRootView.jumpActivity(LoginActivity.class);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showLoginLimit(null);
// mRootView.launchActivity(new Intent(IAcitivity, LoginActivity.class));
// mRootView.jumpDownloadActivity();
}
});
}
/**
* 踢出用戶
*/
public void loginOut(int userId) {
RequestBody requestBody = new FormBody.Builder()
.add("type", "2")
.build();
mModel.loginOut(userId, requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(null))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<Object>(mErrorHandler) {
@Override
public void onNext(@NonNull Object info) {
mRootView.kickOut();
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.kickOut();
}
});
}
} }
...@@ -7,7 +7,6 @@ import android.text.Editable; ...@@ -7,7 +7,6 @@ import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod; import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
...@@ -27,9 +26,7 @@ import com.gingersoft.gsa.cloud.login.di.component.DaggerLoginComponent; ...@@ -27,9 +26,7 @@ import com.gingersoft.gsa.cloud.login.di.component.DaggerLoginComponent;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract; import com.gingersoft.gsa.cloud.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl; import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl;
import com.gingersoft.gsa.cloud.login.mvp.presenter.LoginPresenter; import com.gingersoft.gsa.cloud.login.mvp.presenter.LoginPresenter;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
...@@ -306,21 +303,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements ...@@ -306,21 +303,8 @@ public class LoginActivity extends LoginInterfaceImpl<LoginPresenter> implements
RememberPwd(); RememberPwd();
//自動登陸 //自動登陸
autoLogin(); autoLogin();
//保存登陸信息
// saveLoginInfo(loginBean);
} }
//158 - 189
@Override
public void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBeans, List<BrandsBean.BrandsData> brands) {
new ChooseRestaurantDialog.BottomListSheetBuilder(mContext)
.addBrandItems(brandsBeans)
.setOnItemClickListener((dialog, item, position) -> ChooseRestaurantItemClick(brands, dialog, item.getRestaurantsBean()))
.build()
.show();
}
/** /**
* 記住密碼 * 記住密碼
*/ */
......
...@@ -29,10 +29,8 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl; ...@@ -29,10 +29,8 @@ import com.gingersoft.gsa.cloud.login.mvp.contract.LoginInterfaceImpl;
import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract; import com.gingersoft.gsa.cloud.login.mvp.contract.WelcomeContract;
import com.gingersoft.gsa.cloud.login.mvp.presenter.WelcomePresenter; import com.gingersoft.gsa.cloud.login.mvp.presenter.WelcomePresenter;
import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.GuideAdapter; import com.gingersoft.gsa.cloud.login.mvp.ui.adapter.GuideAdapter;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean; import com.gingersoft.gsa.cloud.ui.bean.mode.LoginBean;
import com.gingersoft.gsa.cloud.ui.widget.Indicator.UIndicator; import com.gingersoft.gsa.cloud.ui.widget.Indicator.UIndicator;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils; import com.jess.arms.utils.ArmsUtils;
...@@ -265,28 +263,7 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem ...@@ -265,28 +263,7 @@ public class WelcomeActivity extends LoginInterfaceImpl<WelcomePresenter> implem
@Override @Override
public void loginSuccess(LoginBean info) { public void loginSuccess(LoginBean info) {
super.loginSuccess(info); super.loginSuccess(info);
// finish(); finish();
}
private boolean isChooseRestaurant = false;
@Override
public void showChooseRestaurantDialog(List<BrandsBean.BrandsData> brandsBeans, List<BrandsBean.BrandsData> brands) {
new ChooseRestaurantDialog.BottomListSheetBuilder(mContext)
.addBrandItems(brandsBeans)
.setOnItemClickListener((dialog, item, position) -> {
isChooseRestaurant = true;
ChooseRestaurantItemClick(brands, dialog, item.getRestaurantsBean());
})
.setOnDismissListener(dialog -> {
if (!isChooseRestaurant) {
//沒有選擇餐廳,就回到登陸頁面
startActivity(new Intent(mContext, LoginActivity.class));
}
killMyself();
})
.build()
.show();
} }
@OnClick({R2.id.iv_guide_close, R2.id.tv_experience}) @OnClick({R2.id.iv_guide_close, R2.id.tv_experience})
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/theme_background_color"
android:orientation="vertical"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_title_color="@color/theme_white_color" />
<com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout
android:id="@+id/section_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.mvp.contract; package com.gingersoft.gsa.cloud.main.mvp.contract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DailyReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryLineChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryPersonnelReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
...@@ -27,6 +30,10 @@ public interface SalesContract { ...@@ -27,6 +30,10 @@ public interface SalesContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadInfo(List<SalesFoodsBean.DataBean.SalesRankingBean> salesRanking); void loadInfo(List<SalesFoodsBean.DataBean.SalesRankingBean> salesRanking);
void loadDeliveryPersonnelReport(List<DailyReportBean> dailyReportBeans);
void loadDeliveryLineChart(List<DeliveryLineChartBean.DataBean> data);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -34,5 +41,10 @@ public interface SalesContract { ...@@ -34,5 +41,10 @@ public interface SalesContract {
Observable<SalesFoodsBean> getSalesReportInfo(Map<String, Object> map); Observable<SalesFoodsBean> getSalesReportInfo(Map<String, Object> map);
Observable<SalesFoodsBean> getSalesReportInfo(RequestBody requestBody); Observable<SalesFoodsBean> getSalesReportInfo(RequestBody requestBody);
Observable<DeliveryLineChartBean> getDeliveryOrderCurveInfo(Map<String, Object> map);
Observable<DeliveryPersonnelReportBean> getDeliveryPersonnelReport(Map<String, Object> map);
} }
} }
...@@ -3,6 +3,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model; ...@@ -3,6 +3,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model;
import android.app.Application; import android.app.Application;
import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract; import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryLineChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryPersonnelReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService; import com.gingersoft.gsa.cloud.main.mvp.model.service.MainReportService;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -60,4 +62,16 @@ public class SalesModel extends BaseModel implements SalesContract.Model { ...@@ -60,4 +62,16 @@ public class SalesModel extends BaseModel implements SalesContract.Model {
return mRepositoryManager.obtainRetrofitService(MainReportService.class) return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getSalesReportInfo(requestBody); .getSalesReportInfo(requestBody);
} }
@Override
public Observable<DeliveryLineChartBean> getDeliveryOrderCurveInfo(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getDeliveryOrderCurveInfo(map);
}
@Override
public Observable<DeliveryPersonnelReportBean> getDeliveryPersonnelReport(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(MainReportService.class)
.getDeliveryPersonnelReport(map);
}
} }
\ No newline at end of file
package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.util.List;
public class DeliveryLineChartBean {
/**
* success : true
* sysTime : 1597738181961
* data : [{"date":"2020-08-10","num":0},{"date":"2020-08-11","num":15},{"date":"2020-08-12","num":6},{"date":"2020-08-13","num":0},{"date":"2020-08-14","num":0},{"date":"2020-08-15","num":1},{"date":"2020-08-16","num":0},{"date":"2020-08-17","num":0},{"date":"2020-08-18","num":0},{"date":"2020-08-19","num":0}]
*/
private boolean success;
private long sysTime;
private List<DataBean> data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* date : 2020-08-10
* num : 0
*/
private String date;
private int num;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
}
package com.gingersoft.gsa.cloud.main.mvp.model.bean;
import java.util.List;
public class DeliveryPersonnelReportBean {
/**
* success : true
* sysTime : 1597733885720
* data : [{"senderName":"john","num":1,"amount":20},{"senderName":"mary","num":1,"amount":25},{"senderName":"theshy","num":1,"amount":334},{"senderName":"tong1","num":1,"amount":89.1},{"senderName":"wudi","num":1,"amount":20},{"senderName":"有個快遞員叫送貨員的人名字是送貨的快遞員的名字叫快遞員的人的名字叫送貨的快車手","num":2,"amount":90.8},{"senderName":"陳大文","num":2,"amount":45},{"senderName":"馬雲","num":13,"amount":2310.7}]
*/
private boolean success;
private long sysTime;
private List<DataBean> data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* senderName : john
* num : 1
* amount : 20.0
*/
private String senderName;
private int num;
private double amount;
public String getSenderName() {
return senderName;
}
public void setSenderName(String senderName) {
this.senderName = senderName;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
}
}
...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model.service; ...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.main.mvp.model.service;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.BusinessDetailsBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.BusinessDetailsBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DaySalesReportBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.DaySalesReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryLineChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryPersonnelReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DiscountDetailsReportBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.DiscountDetailsReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainBusinessBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainBusinessBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.MainOrderInfoChartBean;
...@@ -29,7 +31,7 @@ import retrofit2.http.QueryMap; ...@@ -29,7 +31,7 @@ import retrofit2.http.QueryMap;
public interface MainReportService { public interface MainReportService {
//支付分析報表 //支付分析報表
@Headers({"Domain-Name: wechat_report"}) @Headers({"Domain-Name: gsa_report"})
@POST("wx/findPayMode" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("wx/findPayMode" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PaymentMethodBean> getPaymentInfo(@Body RequestBody requestBody); Observable<PaymentMethodBean> getPaymentInfo(@Body RequestBody requestBody);
...@@ -43,6 +45,16 @@ public interface MainReportService { ...@@ -43,6 +45,16 @@ public interface MainReportService {
@POST("wx/findFoodTop" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("wx/findFoodTop" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<SalesFoodsBean> getSalesReportInfo(@Body RequestBody requestBody); Observable<SalesFoodsBean> getSalesReportInfo(@Body RequestBody requestBody);
//外送訂單折線圖
@Headers({"Domain-Name: gsa_report"})
@GET("report/delivered/getLineChart" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<DeliveryLineChartBean> getDeliveryOrderCurveInfo(@QueryMap Map<String, Object> map);
//外送員分析
@Headers({"Domain-Name: gsa_report"})
@GET("report/delivered/getTakeawayReport" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<DeliveryPersonnelReportBean> getDeliveryPersonnelReport(@QueryMap Map<String, Object> map);
//營業信息 //營業信息
@Headers({"Domain-Name: gsa_report"}) @Headers({"Domain-Name: gsa_report"})
......
...@@ -138,8 +138,16 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -138,8 +138,16 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
public void onNext(@NonNull DaySalesReportBean info) { public void onNext(@NonNull DaySalesReportBean info) {
if (info != null && info.isSuccess()) { if (info != null && info.isSuccess()) {
loadDaySalesReport(info.getData()); loadDaySalesReport(info.getData());
} else {
loadDaySalesReport(null);
} }
} }
@Override
public void onError(Throwable t) {
super.onError(t);
loadDaySalesReport(null);
}
}); });
} }
...@@ -168,9 +176,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -168,9 +176,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
} }
dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", "100", info.getData().getAmountSum() + "")); dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", "100", info.getData().getAmountSum() + ""));
mRootView.loadOrderAnalysis(dailyReportBeans); mRootView.loadOrderAnalysis(dailyReportBeans);
} else {
mRootView.loadOrderAnalysis(null);
} }
} else {
mRootView.loadOrderAnalysis(null);
} }
} }
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loadOrderAnalysis(null);
}
}); });
} }
...@@ -198,9 +216,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -198,9 +216,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
} }
dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", "100", info.getData().getAmountSum() + "")); dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", "100", info.getData().getAmountSum() + ""));
mRootView.loadOrderDetailsReport(dailyReportBeans); mRootView.loadOrderDetailsReport(dailyReportBeans);
} else {
mRootView.loadOrderDetailsReport(null);
} }
} else {
mRootView.loadOrderDetailsReport(null);
} }
} }
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loadOrderDetailsReport(null);
}
}); });
} }
...@@ -228,9 +256,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -228,9 +256,19 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac
} }
dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", info.getData().getAmountSum() + "")); dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", info.getData().getAmountSum() + ""));
mRootView.loadDiscountDetailsReport(dailyReportBeans); mRootView.loadDiscountDetailsReport(dailyReportBeans);
} else {
mRootView.loadDiscountDetailsReport(null);
} }
} else {
mRootView.loadDiscountDetailsReport(null);
} }
} }
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loadDiscountDetailsReport(null);
}
}); });
} }
......
...@@ -4,6 +4,9 @@ import android.app.Application; ...@@ -4,6 +4,9 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract; import com.gingersoft.gsa.cloud.main.mvp.contract.SalesContract;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DailyReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryLineChartBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DeliveryPersonnelReportBean;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.SalesFoodsBean;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -11,7 +14,9 @@ import com.jess.arms.integration.AppManager; ...@@ -11,7 +14,9 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -121,4 +126,63 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont ...@@ -121,4 +126,63 @@ public class SalesPresenter extends BasePresenter<SalesContract.Model, SalesCont
} }
}); });
} }
public void getDeliveryOrderCurveInfo(String restaurantId, String startTime,String endTime){
Map<String, Object> map = new HashMap<>();
map.put("restaurantId", restaurantId);
map.put("startTime", startTime);
map.put("endTime", endTime);
mModel.getDeliveryOrderCurveInfo(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<DeliveryLineChartBean>(mErrorHandler) {
@Override
public void onNext(@NonNull DeliveryLineChartBean info) {
if(info != null && info.isSuccess()){
mRootView.loadDeliveryLineChart(info.getData());
}
}
});
}
public void getDeliveryPersonnelReport(String restaurantId, String startTime,String endTime){
Map<String, Object> map = new HashMap<>();
map.put("restaurantId", restaurantId);
map.put("startTime", startTime);
map.put("endTime", endTime);
mModel.getDeliveryPersonnelReport(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<DeliveryPersonnelReportBean>(mErrorHandler) {
@Override
public void onNext(@NonNull DeliveryPersonnelReportBean info) {
if(info != null && info.isSuccess()){
if (info.getData() != null) {
List<DailyReportBean> dailyReportBeans = new ArrayList<>();
dailyReportBeans.add(new DailyReportBean("姓名", "總單量", "平均每單用時(min)", "金額"));
for (DeliveryPersonnelReportBean.DataBean listBean : info.getData()) {
dailyReportBeans.add(new DailyReportBean(listBean.getSenderName(), listBean.getNum() + "", "用時", listBean.getAmount() + ""));
}
// dailyReportBeans.add(new DailyReportBean("合計", info.getData().getBillNumSum() + "", "100", info.getData().getAmountSum() + ""));
mRootView.loadDeliveryPersonnelReport(dailyReportBeans);
}
} else {
}
}
});
}
} }
...@@ -381,40 +381,45 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -381,40 +381,45 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
if (!TextUtils.isEmpty(brandRestaurantInfos)) { if (!TextUtils.isEmpty(brandRestaurantInfos)) {
List<BrandsBean.BrandsData> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, BrandsBean.BrandsData.class); List<BrandsBean.BrandsData> brandsBeans = JsonUtils.parseArray(brandRestaurantInfos, BrandsBean.BrandsData.class);
if (brandsBeans != null && brandsBeans.size() > 0) { if (brandsBeans != null && brandsBeans.size() > 0) {
new ChooseRestaurantDialog.BottomListSheetBuilder(this) CC.obtainBuilder("User.Component.Login")
.addBrandItems(brandsBeans) .setActionName("ChooseRestaurant")
.setOnItemClickListener((dialog, item, position) -> {
//切換餐廳,發送關閉接單的廣播,並清除心跳
sendBroadcast(new Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART));
//关闭Prj打印服務
CC.obtainBuilder("Component.Print")
.setActionName("stopPrintService")
.build()
.call();
BrandsBean.BrandsData.RestaurantsBean restaurantsBean = item.getRestaurantsBean();
BrandsBean.BrandsData brandsBean = RestaurantInfoUtils.getBrandByRestaurantId(brandsBeans, restaurantsBean.getRestaurantId());
if (brandsBean != null) {
saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean.getRestaurantId(), restaurantsBean.getRestaurantName());
}
GsaCloudApplication.setRestaurantId(NewMainActivity.this, restaurantsBean.getRestaurantId());
GsaCloudApplication.setRestaurantName(NewMainActivity.this, restaurantsBean.getRestaurantName());
updateTitleInfo();
CC.obtainBuilder("Component.Download")
.setActionName("showDownloadActivity")
.addParam("fromPage", 2)
.build()
.call();
dialog.dismiss();
})
.build() .build()
.show(); .call();
// new ChooseRestaurantDialog.BottomListSheetBuilder(this)
// .addBrandItems(brandsBeans)
// .setOnItemClickListener((dialog, item, position) -> {
// //切換餐廳,發送關閉接單的廣播,並清除心跳
// sendBroadcast(new Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART));
//
// //关闭Prj打印服務
// CC.obtainBuilder("Component.Print")
// .setActionName("stopPrintService")
// .build()
// .call();
//
// BrandsBean.BrandsData.RestaurantsBean restaurantsBean = item.getRestaurantsBean();
//
// BrandsBean.BrandsData brandsBean = RestaurantInfoUtils.getBrandByRestaurantId(brandsBeans, restaurantsBean.getRestaurantId());
//
// if (brandsBean != null) {
// saveBrandAndRestaurantInfo(brandsBean.getBrandId(), brandsBean.getBrandName(), restaurantsBean.getRestaurantId(), restaurantsBean.getRestaurantName());
// }
//
// GsaCloudApplication.setRestaurantId(NewMainActivity.this, restaurantsBean.getRestaurantId());
// GsaCloudApplication.setRestaurantName(NewMainActivity.this, restaurantsBean.getRestaurantName());
//
// updateTitleInfo();
//
// CC.obtainBuilder("Component.Download")
// .setActionName("showDownloadActivity")
// .addParam("fromPage", 2)
// .build()
// .call();
// dialog.dismiss();
// })
// .build()
// .show();
} }
} }
} }
...@@ -497,6 +502,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -497,6 +502,12 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
@Override @Override
public void loginOut() { public void loginOut() {
GsaCloudApplication.isLogin = false; GsaCloudApplication.isLogin = false;
//关闭Prj打印服務
CC.obtainBuilder("Component.Print")
.setActionName("stopPrintService")
.build()
.call();
//跳轉登陸頁面
CC.obtainBuilder("User.Component.Login") CC.obtainBuilder("User.Component.Login")
.setActionName("showActivityA") .setActionName("showActivityA")
.build() .build()
......
...@@ -54,7 +54,9 @@ public class DailyBusinessAdapter extends BaseQuickAdapter<DailyReportBean, Base ...@@ -54,7 +54,9 @@ public class DailyBusinessAdapter extends BaseQuickAdapter<DailyReportBean, Base
((TextView) baseViewHolder.getView(R.id.tv_public_three)).setTextSize(24); ((TextView) baseViewHolder.getView(R.id.tv_public_three)).setTextSize(24);
((TextView) baseViewHolder.getView(R.id.tv_public_four)).setTextSize(24); ((TextView) baseViewHolder.getView(R.id.tv_public_four)).setTextSize(24);
baseViewHolder.setBackgroundColor(R.id.horizontal_dividing_line, R.color.black); baseViewHolder.setBackgroundColor(R.id.horizontal_dividing_line, R.color.black);
baseViewHolder.setBackgroundColor(R.id.vertical_dividing_line, R.color.black); baseViewHolder.setBackgroundColor(R.id.public_report_vertical_dividing_line1, R.color.black);
baseViewHolder.setBackgroundColor(R.id.public_report_vertical_dividing_line2, R.color.black);
baseViewHolder.setBackgroundColor(R.id.public_report_vertical_dividing_line3, R.color.black);
} else { } else {
if (baseViewHolder.getAdapterPosition() % 2 == 0) { if (baseViewHolder.getAdapterPosition() % 2 == 0) {
if (baseViewHolder.getAdapterPosition() == getData().size() - 1) { if (baseViewHolder.getAdapterPosition() == getData().size() - 1) {
......
...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view; ...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -11,30 +12,27 @@ import androidx.annotation.Nullable; ...@@ -11,30 +12,27 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil; import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.widget.BaseReloadView;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DaySalesReportBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.DaySalesReportBean;
import com.gingersoft.gsa.cloud.ui.view.ReloadView;
import com.lihang.ShadowLayout;
public class BillingAnalysisReportView extends FrameLayout { public class BillingAnalysisReportView extends BaseReloadView {
private boolean isPrint = false; private boolean isPrint = false;
private Context mContext;
private TextView tvBillNum; private TextView tvBillNum;
private TextView tvBillAverage; private TextView tvBillAverage;
private TextView tvPeople; private TextView tvPeople;
private TextView tvPeopleAvgPrice; private TextView tvPeopleAvgPrice;
private DaySalesReportBean.DataBean dataBean;
public BillingAnalysisReportView(@NonNull Context context) { public BillingAnalysisReportView(@NonNull Context context) {
this(context, null); this(context, null);
} }
public BillingAnalysisReportView(@NonNull Context context, boolean isPrint, DaySalesReportBean.DataBean dataBean) {
super(context, null);
this.isPrint = isPrint;
this.mContext = context;
init(mContext, dataBean);
}
public BillingAnalysisReportView(@NonNull Context context, @Nullable AttributeSet attrs) { public BillingAnalysisReportView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1); this(context, attrs, -1);
} }
...@@ -43,10 +41,24 @@ public class BillingAnalysisReportView extends FrameLayout { ...@@ -43,10 +41,24 @@ public class BillingAnalysisReportView extends FrameLayout {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
private void init(Context mContext,DaySalesReportBean.DataBean dataBean) { public BillingAnalysisReportView setPrint(boolean print) {
this.mContext = mContext; isPrint = print;
View view = View.inflate(mContext, R.layout.layout_report_billing_analysis, null); return this;
}
public BillingAnalysisReportView setDataBean(DaySalesReportBean.DataBean dataBean) {
this.dataBean = dataBean;
return this;
}
@Override
public boolean getDataIsNull() {
return !isPrint && dataBean == null;
}
@Override
public ViewGroup getChildView() {
View view = View.inflate(getContext(), R.layout.layout_report_billing_analysis, null);
TextView tvTitle = view.findViewById(R.id.tv_bill_analysis_title); TextView tvTitle = view.findViewById(R.id.tv_bill_analysis_title);
tvBillNum = view.findViewById(R.id.tv_report_bill_number); tvBillNum = view.findViewById(R.id.tv_report_bill_number);
tvBillAverage = view.findViewById(R.id.tv_report_bill_average_price); tvBillAverage = view.findViewById(R.id.tv_report_bill_average_price);
...@@ -54,12 +66,12 @@ public class BillingAnalysisReportView extends FrameLayout { ...@@ -54,12 +66,12 @@ public class BillingAnalysisReportView extends FrameLayout {
tvPeopleAvgPrice = view.findViewById(R.id.tv_report_people_average_price); tvPeopleAvgPrice = view.findViewById(R.id.tv_report_people_average_price);
View horizontalLine = view.findViewById(R.id.horizontal_dividing_line); View horizontalLine = view.findViewById(R.id.horizontal_dividing_line);
View verticalLine= view.findViewById(R.id.vertical_dividing_line); View verticalLine = view.findViewById(R.id.vertical_dividing_line);
if (isPrint) { if (isPrint) {
tvTitle.setTextSize(30); tvTitle.setTextSize(30);
((TextView)view.findViewById(R.id.tv_bill_number_text)).setTextSize(26); ((TextView) view.findViewById(R.id.tv_bill_number_text)).setTextSize(26);
((TextView)view.findViewById(R.id.tv_people_text)).setTextSize(26); ((TextView) view.findViewById(R.id.tv_people_text)).setTextSize(26);
tvBillNum.setTextSize(28); tvBillNum.setTextSize(28);
tvBillAverage.setTextSize(20); tvBillAverage.setTextSize(20);
...@@ -67,18 +79,27 @@ public class BillingAnalysisReportView extends FrameLayout { ...@@ -67,18 +79,27 @@ public class BillingAnalysisReportView extends FrameLayout {
tvPeople.setTextSize(28); tvPeople.setTextSize(28);
tvPeopleAvgPrice.setTextSize(20); tvPeopleAvgPrice.setTextSize(20);
horizontalLine.setBackgroundColor(ContextCompat.getColor(mContext, R.color.black)); horizontalLine.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black));
verticalLine.setBackgroundColor(ContextCompat.getColor(mContext, R.color.black)); verticalLine.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black));
} }
setData(dataBean); refreshData();
addView(view); return view.findViewById(R.id.layout_business_info);
} }
public void setData(DaySalesReportBean.DataBean dataBean){
tvBillNum.setText(dataBean.getBillNum() + "");
tvBillAverage.setText("單均價:$" + MoneyUtil.divide(dataBean.getFoodAmount(), dataBean.getBillNum())); @Override
tvPeople.setText(dataBean.getBillPerson() + ""); public void refreshData() {
tvPeopleAvgPrice.setText("人均價:$" + MoneyUtil.divide(dataBean.getFoodAmount(), dataBean.getBillPerson())); if (dataBean != null) {
tvBillNum.setText(dataBean.getBillNum() + "");
tvBillAverage.setText("單均價:$" + MoneyUtil.divide(dataBean.getFoodAmount(), dataBean.getBillNum()));
tvPeople.setText(dataBean.getBillPerson() + "");
tvPeopleAvgPrice.setText("人均價:$" + MoneyUtil.divide(dataBean.getFoodAmount(), dataBean.getBillPerson()));
}
}
public void setData(DaySalesReportBean.DataBean dataBean) {
this.dataBean = dataBean;
notifyData();
} }
} }
...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view; ...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -13,34 +14,33 @@ import androidx.recyclerview.widget.GridLayoutManager; ...@@ -13,34 +14,33 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.widget.BaseReloadView;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.BusinessBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.BusinessBean;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.BusinessInfoAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.BusinessInfoAdapter;
import com.gingersoft.gsa.cloud.ui.view.ReloadView;
import java.util.List; import java.util.List;
/** /**
* 每日營業詳情 * 每日營業詳情
*/ */
public class DailyBusinessView extends FrameLayout { public class DailyBusinessView extends BaseReloadView {
private boolean isPrint = false; private boolean isPrint = false;
private BusinessInfoAdapter printBusinessInfoAdapter; private BusinessInfoAdapter printBusinessInfoAdapter;
private List<BusinessBean> businessBeans; private List<BusinessBean> businessBeans;
private RecyclerView mBusinessDetails; private RecyclerView mBusinessDetails;
private Context mContext;
public DailyBusinessView(@NonNull Context context) { public DailyBusinessView(@NonNull Context context) {
this(context, null); this(context, null);
} }
public DailyBusinessView(@NonNull Context context, boolean isPrint, List<BusinessBean> businessBeans) { public DailyBusinessView(@NonNull Context context, boolean isPrint, List<BusinessBean> businessBeans) {
super(context, null); this(context, null);
this.isPrint = isPrint; this.isPrint = isPrint;
this.businessBeans = businessBeans; this.businessBeans = businessBeans;
this.mContext = context;
init(mContext);
} }
...@@ -50,30 +50,39 @@ public class DailyBusinessView extends FrameLayout { ...@@ -50,30 +50,39 @@ public class DailyBusinessView extends FrameLayout {
public DailyBusinessView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public DailyBusinessView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
init(context);
} }
private void init(Context mContext) { @Override
this.mContext = mContext; public boolean getDataIsNull() {
View view = View.inflate(mContext, R.layout.layout_report_daily_business_details, null); return !isPrint && businessBeans == null;
TextView tvTitle = view.findViewById(R.id.tv_daily_business_statement_title); }
TextView tvRestaurantName = view.findViewById(R.id.tv_restaurant_name);
View horizontalLine = view.findViewById(R.id.horizontal_dividing_line);
mBusinessDetails = view.findViewById(R.id.rv_business_details);
tvRestaurantName.setText(GsaCloudApplication.getRestaurantName(mContext)); @Override
public ViewGroup getChildView() {
View contentView = View.inflate(getContext(), R.layout.layout_report_daily_business_details, null);
TextView tvTitle = contentView.findViewById(R.id.tv_daily_business_statement_title);
TextView tvRestaurantName = contentView.findViewById(R.id.tv_restaurant_name);
View horizontalLine = contentView.findViewById(R.id.horizontal_dividing_line);
mBusinessDetails = contentView.findViewById(R.id.rv_business_details);
tvRestaurantName.setText(GsaCloudApplication.getRestaurantName(getContext()));
if (isPrint) { if (isPrint) {
tvRestaurantName.setTextSize(24); tvRestaurantName.setTextSize(24);
tvTitle.setTextSize(30); tvTitle.setTextSize(30);
horizontalLine.setBackgroundColor(ContextCompat.getColor(mContext, R.color.black)); horizontalLine.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black));
} }
notifyData(businessBeans); notifyData();
addView(view); return contentView.findViewById(R.id.layout_business_info);
} }
public void notifyData(List<BusinessBean> businessBeans){ @Override
public void refreshData() {
notifyData();
}
public void notifyData() {
if (printBusinessInfoAdapter == null) { if (printBusinessInfoAdapter == null) {
mBusinessDetails.setLayoutManager(new GridLayoutManager(mContext, 3) { mBusinessDetails.setLayoutManager(new GridLayoutManager(getContext(), 3) {
@Override @Override
public boolean canScrollVertically() { public boolean canScrollVertically() {
return false; return false;
...@@ -86,5 +95,10 @@ public class DailyBusinessView extends FrameLayout { ...@@ -86,5 +95,10 @@ public class DailyBusinessView extends FrameLayout {
} }
} }
public DailyBusinessView setNewData(List<BusinessBean> businessBeans){
this.businessBeans = businessBeans;
notifyData();
return this;
}
} }
...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view; ...@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.TextView; import android.widget.TextView;
...@@ -11,25 +12,32 @@ import androidx.annotation.Nullable; ...@@ -11,25 +12,32 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.base.widget.BaseReloadView;
import com.gingersoft.gsa.cloud.main.R; import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.main.mvp.model.bean.DailyReportBean; import com.gingersoft.gsa.cloud.main.mvp.model.bean.DailyReportBean;
import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.DailyBusinessAdapter; import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.DailyBusinessAdapter;
import com.gingersoft.gsa.cloud.ui.view.ReloadView;
import java.util.List; import java.util.List;
public class OperatingReportView extends FrameLayout { public class OperatingReportView extends BaseReloadView {
private boolean isPrint = false; private boolean isPrint = false;
private DailyBusinessAdapter adapter; private DailyBusinessAdapter adapter;
private List<DailyReportBean> dailyReportBeans;
private int spanCount;
private String title;
public OperatingReportView(@NonNull Context context) { public OperatingReportView(@NonNull Context context) {
this(context, null); this(context, null);
} }
public OperatingReportView(@NonNull Context context, boolean isPrint, String title, List<DailyReportBean> dailyReportBeans, int spanCount) { public OperatingReportView(@NonNull Context context, boolean isPrint, String title, List<DailyReportBean> dailyReportBeans, int spanCount) {
super(context, null); this(context, null);
this.isPrint = isPrint; this.isPrint = isPrint;
init(context, title, dailyReportBeans, spanCount); this.dailyReportBeans = dailyReportBeans;
this.spanCount = spanCount;
this.title = title;
} }
...@@ -41,30 +49,69 @@ public class OperatingReportView extends FrameLayout { ...@@ -41,30 +49,69 @@ public class OperatingReportView extends FrameLayout {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
private void init(Context mContext, String title, List<DailyReportBean> dailyReportBeans, int spanCount) { @Override
View view = View.inflate(mContext, R.layout.layout_report_net_operating_value_details, null); public boolean getDataIsNull() {
return !isPrint && dailyReportBeans == null;
}
@Override
public ViewGroup getChildView() {
View view = View.inflate(getContext(), R.layout.layout_report_net_operating_value_details, null);
TextView tvTitle = view.findViewById(R.id.tv_report_title); TextView tvTitle = view.findViewById(R.id.tv_report_title);
tvTitle.setText(title); tvTitle.setText(title);
RecyclerView rv = view.findViewById(R.id.rv_business_details); RecyclerView rv = view.findViewById(R.id.rv_business_details);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext) { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()) {
@Override @Override
public boolean canScrollVertically() { public boolean canScrollVertically() {
return false; return false;
} }
}; };
rv.setLayoutManager(linearLayoutManager); rv.setLayoutManager(linearLayoutManager);
adapter = new DailyBusinessAdapter(mContext, dailyReportBeans, spanCount, isPrint); adapter = new DailyBusinessAdapter(getContext(), dailyReportBeans, spanCount, isPrint);
rv.setAdapter(adapter); rv.setAdapter(adapter);
if (isPrint) { if (isPrint) {
tvTitle.setTextSize(30); tvTitle.setTextSize(30);
} }
notifyData(dailyReportBeans); notifyData(dailyReportBeans);
addView(view); return view.findViewById(R.id.layout_business_info);
} }
public void notifyData(List<DailyReportBean> dailyReportBeans){ @Override
adapter.setNewInstance(dailyReportBeans); public void refreshData() {
if (adapter != null) {
adapter.setNewInstance(dailyReportBeans);
} else {
}
} }
// private void init(Context mContext, String title, List<DailyReportBean> dailyReportBeans, int spanCount) {
// View view = View.inflate(mContext, R.layout.layout_report_net_operating_value_details, null);
// TextView tvTitle = view.findViewById(R.id.tv_report_title);
// tvTitle.setText(title);
//
// RecyclerView rv = view.findViewById(R.id.rv_business_details);
// LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext) {
// @Override
// public boolean canScrollVertically() {
// return false;
// }
// };
// rv.setLayoutManager(linearLayoutManager);
// adapter = new DailyBusinessAdapter(mContext, dailyReportBeans, spanCount, isPrint);
// rv.setAdapter(adapter);
//
// if (isPrint) {
// tvTitle.setTextSize(30);
// }
// notifyData(dailyReportBeans);
// addView(view);
// }
public void notifyData(List<DailyReportBean> dailyReportBeans) {
this.dailyReportBeans = dailyReportBeans;
}
} }
package com.gingersoft.gsa.cloud.main.mvp.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.base.utils.time.TimePickerUtils;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.main.R;
import com.gingersoft.gsa.cloud.ui.view.TriangleView;
import java.text.ParseException;
import java.util.Calendar;
public class StartEndTimePickerView extends FrameLayout implements View.OnClickListener {
private TextView tvStartTime;
private TriangleView startTriangleView;
private TextView tvEndTime;
private TriangleView endTriangleView;
private onUpdateTimePicker onUpdateTimePicker;
public StartEndTimePickerView(@NonNull Context context) {
this(context, null, -1);
}
public StartEndTimePickerView(@NonNull Context context, onUpdateTimePicker onUpdateTimePicker) {
this(context);
this.onUpdateTimePicker = onUpdateTimePicker;
}
public StartEndTimePickerView(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public StartEndTimePickerView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
public void setOnUpdateTimePicker(StartEndTimePickerView.onUpdateTimePicker onUpdateTimePicker) {
this.onUpdateTimePicker = onUpdateTimePicker;
}
private void init(Context context) {
View view = View.inflate(context, R.layout.layout_start_end_time_picker, null);
tvStartTime = view.findViewById(R.id.tv_start_time);
startTriangleView = view.findViewById(R.id.iv_start_time_triangle);
tvEndTime = view.findViewById(R.id.tv_end_time);
endTriangleView = view.findViewById(R.id.iv_end_time_triangle);
tvStartTime.setText(TimeUtils.getOldDate(-7));
tvEndTime.setText(TimeUtils.getOldDate(0));
tvStartTime.setOnClickListener(this);
startTriangleView.setOnClickListener(this);
tvEndTime.setOnClickListener(this);
endTriangleView.setOnClickListener(this);
updateTime();
this.addView(view);
}
@Override
public void onClick(View v) {
int viewId = v.getId();
try {
String time;
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.DAY_OF_YEAR, startTime.getActualMinimum(Calendar.DAY_OF_YEAR));//今年第一天
Calendar endTime = Calendar.getInstance();
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
startTriangleView.toggle();
time = tvStartTime.getText().toString();
endTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(tvEndTime.getText().toString()));
} else {
endTriangleView.toggle();
time = tvEndTime.getText().toString();
startTime.setTime(TimeUtils.DATE_FORMAT_DATE.parse(tvStartTime.getText().toString()));
}
Calendar cal = Calendar.getInstance();
try {
//設置默認時間為當前的起止時間
cal.setTime(TimeUtils.DATE_FORMAT_DATE.parse(time));
} catch (ParseException e) {
e.printStackTrace();
}
//打開時間選擇器
TimePickerUtils.showReportTimePicker(v.getContext(), startTime, endTime, cal, (date, v1) ->
{
if (viewId == R.id.tv_start_time || viewId == R.id.iv_start_time_triangle) {
tvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
} else {
tvEndTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
}
updateTime();
}).setOnDismissListener(o -> {
if (startTriangleView.isOpen()) {
startTriangleView.toggle();
} else if (endTriangleView.isOpen()) {
endTriangleView.toggle();
}
});
} catch (ParseException e) {
e.printStackTrace();
}
}
private void updateTime() {
if (onUpdateTimePicker != null) {
onUpdateTimePicker.onUpdateTime(tvStartTime.getText().toString(), tvEndTime.getText().toString());
}
}
public interface onUpdateTimePicker {
void onUpdateTime(String startTime, String endTime);
}
public String getStartTime(){
if(tvStartTime != null){
return tvStartTime.getText().toString();
}
return TimeUtils.getOldDate(-7);
}
public String getEndTime(){
if(tvEndTime != null){
return tvEndTime.getText().toString();
}
return TimeUtils.getOldDate(0);
}
}
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:descendantFocusability="afterDescendants" android:descendantFocusability="afterDescendants"
android:orientation="vertical" android:orientation="vertical"
tools:context="com.gingersoft.gsa.cloud.main.mvp.ui.activity.LookLogActivity"> tools:context="com.gingersoft.gsa.cloud.main.mvp.ui.activity.LookLogActivity">
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
android:id="@+id/table_layout" android:id="@+id/table_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/tabIndicator_height" android:layout_height="@dimen/tabIndicator_height"
android:background="@color/white"
app:tabIndicator="@drawable/tablayout_indicator" app:tabIndicator="@drawable/tablayout_indicator"
app:tabIndicatorColor="@color/theme_color" app:tabIndicatorColor="@color/theme_color"
app:tabIndicatorFullWidth="false"/> app:tabIndicatorFullWidth="false"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="match_parent"
android:layout_width="match_parent" android:background="@color/white"
android:layout_height="match_parent"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/topbar" android:id="@+id/topbar"
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
android:id="@+id/tv_settlement_time" android:id="@+id/tv_settlement_time"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/theme_red_color" android:layout_marginTop="@dimen/dp_10"
android:gravity="center" android:gravity="center"
android:textSize="@dimen/sp_14"
android:text="上次清機時間:" android:text="上次清機時間:"
android:layout_marginTop="@dimen/dp_10"/> android:textColor="@color/theme_red_color"
android:textSize="@dimen/sp_14" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton <com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_settlement_report" android:id="@+id/btn_settlement_report"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10" android:layout_margin="@dimen/dp_10"
android:textSize="@dimen/sp_14" android:background="@color/theme_color"
android:textColor="@color/theme_white_color"
android:text="清機報表" android:text="清機報表"
android:background="@color/theme_color"/> android:textColor="@color/theme_white_color"
android:textSize="@dimen/sp_14" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
app:hl_shadowLimit="@dimen/main_shadow_limit"> app:hl_shadowLimit="@dimen/main_shadow_limit">
<LinearLayout <LinearLayout
android:id="@+id/business_curve_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
......
...@@ -8,17 +8,18 @@ ...@@ -8,17 +8,18 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/layout_sales"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<com.lihang.ShadowLayout <com.lihang.ShadowLayout
android:id="@+id/layout_business_chart" android:id="@+id/layout_business_chart"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_15" android:paddingBottom="@dimen/dp_15"
app:hl_cornerRadius="@dimen/dp_4" app:hl_cornerRadius="@dimen/dp_4"
app:hl_dy="@dimen/main_shadow_dy" app:hl_dy="@dimen/main_shadow_dy"
...@@ -93,9 +94,9 @@ ...@@ -93,9 +94,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_215" android:layout_height="@dimen/dp_215"
android:layout_gravity="center" android:layout_gravity="center"
android:focusableInTouchMode="true"
android:focusable="true"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:focusable="true"
android:focusableInTouchMode="true"
android:visibility="visible" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
...@@ -105,9 +106,7 @@ ...@@ -105,9 +106,7 @@
android:id="@+id/layout_business_info" android:id="@+id/layout_business_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_4" android:layout_marginTop="@dimen/dp_4"
android:layout_marginRight="@dimen/dp_10"
app:hl_cornerRadius="@dimen/dp_4" app:hl_cornerRadius="@dimen/dp_4"
app:hl_dy="@dimen/main_shadow_dy" app:hl_dy="@dimen/main_shadow_dy"
app:hl_shadowBackColor="@color/white" app:hl_shadowBackColor="@color/white"
...@@ -153,8 +152,62 @@ ...@@ -153,8 +152,62 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</HorizontalScrollView> </HorizontalScrollView>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_15"
app:hl_cornerRadius="@dimen/dp_4"
app:hl_dy="@dimen/main_shadow_dy"
app:hl_shadowBackColor="@color/white"
app:hl_shadowColor="@color/shadow_color"
app:hl_shadowLimit="@dimen/main_shadow_limit">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="外送訂單"
android:textColor="#181818"
android:textSize="@dimen/sp_17" />
<com.gingersoft.gsa.cloud.main.mvp.ui.view.StartEndTimePickerView
android:id="@+id/time_select_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.gingersoft.gsa.cloud.ui.AAChartCore.AAChartCoreLib.AAChartConfiger.AAChartView
android:id="@+id/pc_report_delivery"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_150"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
</com.lihang.ShadowLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
android:layout_weight="1" android:layout_weight="1"
tools:text="支付統計" /> tools:text="支付統計" />
<include layout="@layout/include_vertical_color_e8_dividing_line" /> <include
android:id="@+id/public_report_vertical_dividing_line1"
layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_public_two" android:id="@+id/tv_public_two"
...@@ -39,11 +41,12 @@ ...@@ -39,11 +41,12 @@
android:layout_weight="1" android:layout_weight="1"
tools:text="賬單數量" /> tools:text="賬單數量" />
<include layout="@layout/include_vertical_color_e8_dividing_line" /> <include
android:id="@+id/public_report_vertical_dividing_line2"
layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_public_three" android:id="@+id/tv_public_three"
style="@style/main_daily_business_statement_item_textStyle" style="@style/main_daily_business_statement_item_textStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -52,7 +55,9 @@ ...@@ -52,7 +55,9 @@
android:layout_weight="1" android:layout_weight="1"
tools:text="佔比(%)" /> tools:text="佔比(%)" />
<include layout="@layout/include_vertical_color_e8_dividing_line" /> <include
android:id="@+id/public_report_vertical_dividing_line3"
layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_public_four" android:id="@+id/tv_public_four"
......
<?xml version="1.0" encoding="utf-8"?>
<com.lihang.ShadowLayout 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:id="@+id/layout_business_chart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:paddingBottom="@dimen/dp_15"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_dy="@dimen/main_shadow_dy"
app:hl_shadowBackColor="@color/white"
app:hl_shadowColor="@color/shadow_color"
app:hl_shadowLimit="@dimen/main_shadow_limit">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="營業金額"
android:textColor="#181818"
android:textSize="@dimen/sp_17" />
<TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="2020-02-13"
android:textColor="#181818"
android:textSize="@dimen/sp_10" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_start_time_triangle"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_5"
android:paddingLeft="@dimen/dp_2"
app:trv_direction="bottom" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:text="到"
android:textColor="#999"
android:textSize="@dimen/sp_10" />
<TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
tools:text="2020-02-14"
android:textColor="#181818"
android:textSize="@dimen/sp_10" />
<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"
app:trv_direction="bottom" />
</LinearLayout>
<com.gingersoft.gsa.cloud.ui.AAChartCore.AAChartCoreLib.AAChartConfiger.AAChartView
android:id="@+id/report_chart"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_150"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
</com.lihang.ShadowLayout>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
layout="@layout/include_horizontal_color_e8_dividing_line"/> layout="@layout/include_horizontal_color_e8_dividing_line"/>
<LinearLayout <LinearLayout
android:id="@+id/layout_replace"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
......
...@@ -34,46 +34,37 @@ ...@@ -34,46 +34,37 @@
android:layout_weight="1" android:layout_weight="1"
android:text="每日營業詳情" /> android:text="每日營業詳情" />
<!-- <TextView-->
<!-- android:id="@+id/tv_end_time"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="2020-02-14"-->
<!-- android:textColor="#181818"-->
<!-- android:textSize="@dimen/sp_10" />-->
<!-- <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"-->
<!-- app:trv_direction="bottom" />-->
</LinearLayout> </LinearLayout>
<TextView <LinearLayout
android:id="@+id/tv_restaurant_name" android:id="@+id/layout_replace"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:orientation="vertical">
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="餐廳名稱"
android:textColor="#3c3c3c"
android:textSize="@dimen/dp_16" />
<include <TextView
layout="@layout/include_horizontal_color_e8_dividing_line" android:id="@+id/tv_restaurant_name"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_0_5" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" /> android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_10"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="餐廳名稱"
android:textColor="#3c3c3c"
android:textSize="@dimen/dp_16" />
<androidx.recyclerview.widget.RecyclerView <include
android:id="@+id/rv_business_details" layout="@layout/include_horizontal_color_e8_dividing_line"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="@dimen/dp_0_5"
</LinearLayout> android:layout_marginTop="@dimen/dp_10" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_business_details"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
\ No newline at end of file
...@@ -25,11 +25,17 @@ ...@@ -25,11 +25,17 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
tools:text="營業金額淨值詳情" /> tools:text="營業金額淨值詳情" />
<androidx.recyclerview.widget.RecyclerView <FrameLayout
android:id="@+id/rv_business_details" android:id="@+id/layout_replace"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content">
android:layout_marginTop="@dimen/dp_15"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_business_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_15" />
</FrameLayout>
</LinearLayout> </LinearLayout>
</com.lihang.ShadowLayout> </com.lihang.ShadowLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#181818"
tools:text="2020-02-14"
android:textSize="@dimen/sp_10" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_start_time_triangle"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_5"
android:paddingLeft="@dimen/dp_2"
app:trv_direction="bottom" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:text="到"
android:textColor="#999"
android:textSize="@dimen/sp_10" />
<TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
tools:text="2020-02-14"
android:textColor="#181818"
android:textSize="@dimen/sp_10" />
<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"
app:trv_direction="bottom" />
</LinearLayout>
\ No newline at end of file
...@@ -15,6 +15,7 @@ import com.gingersoft.gsa.other_order_mode.ui.activity.OtherOrderActivity; ...@@ -15,6 +15,7 @@ import com.gingersoft.gsa.other_order_mode.ui.activity.OtherOrderActivity;
public class OtherOrderComponent implements IComponent { public class OtherOrderComponent implements IComponent {
public static class takeaway{ public static class takeaway{
public static final String CONFIRM_BTN_KEY = "takeaway/orderDetails/btn/confirmOrder"; public static final String CONFIRM_BTN_KEY = "takeaway/orderDetails/btn/confirmOrder";
public static final String PRODUCTION_COMPLETED_BTN_KEY = "takeaway/orderDetails/btn/ProductionCompleted"; public static final String PRODUCTION_COMPLETED_BTN_KEY = "takeaway/orderDetails/btn/ProductionCompleted";
public static final String CANCEL_ORDER_BTN_KEY = "takeaway/orderDetails/btn/cancelOrder"; public static final String CANCEL_ORDER_BTN_KEY = "takeaway/orderDetails/btn/cancelOrder";
......
...@@ -59,13 +59,13 @@ class BtnBuilder(var functions: List<Function>) { ...@@ -59,13 +59,13 @@ class BtnBuilder(var functions: List<Function>) {
return getBtn(OtherOrderComponent.takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics) return getBtn(OtherOrderComponent.takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
} }
fun getBtn(key:String, btnCode:Int, btnContent: String,btnColor: Int, btnImg: Int): BtnBean? { private fun getBtn(key:String, btnCode:Int, btnContent: String, btnColor: Int, btnImg: Int): BtnBean? {
for (value in functions) { for (value in functions) {
if (value.resUrl == key) { if (value.resUrl == key) {
return if (value.status == 3) { return when {
BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg) value.status == 3 -> BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg)
} else { // value.status == 1 -> BtnBean(btnCode, btnContent, btnColor, btnImg)
BtnBean(btnCode, btnContent, btnColor, btnImg) else -> BtnBean(btnCode, btnContent, btnColor, btnImg)
} }
} }
} }
......
...@@ -88,7 +88,7 @@ class OrderList { ...@@ -88,7 +88,7 @@ class OrderList {
var orderType_2: OrderType? = null var orderType_2: OrderType? = null
var orderType_7: OrderType? = null var orderType_7: OrderType? = null
var isRead: Int = 0 //0未讀,1已讀 var isRead: Int = 0 //0未讀,1已讀
var transportationType:Int= 0//交通工具 1摩托車 2麵包車 3卡車
class OrderType { class OrderType {
var typeTotalAmount: Double = 0.toDouble() var typeTotalAmount: Double = 0.toDouble()
var typeDayOrderNum: Int = 0 var typeDayOrderNum: Int = 0
......
...@@ -50,7 +50,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -50,7 +50,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val CancelLogistics = 1006//取消物流 val CancelLogistics = 1006//取消物流
val ProductionComplete = 1007//製作完成 val ProductionComplete = 1007//製作完成
val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調 val DeliveryPrint = 1008//訂單確認成功,是否成功打印回調
val Transportation = 1009//修改運輸工具成功
} }
var mOrderNum = arrayListOf<MutableLiveData<Int>>() var mOrderNum = arrayListOf<MutableLiveData<Int>>()
...@@ -274,6 +274,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -274,6 +274,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
} }
}, { }, {
OkHttp3Utils.noticePersonnel("", "獲取訂單詳情失敗")
orderDetails.postValue(null) orderDetails.postValue(null)
}) })
} }
...@@ -288,7 +289,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -288,7 +289,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
fun confirmOrder(dataBean: OrderDetails.DataBean, trafficType: String = "", restaurantId: Int, listener: (MessageBean) -> Unit) { fun confirmOrder(dataBean: OrderDetails.DataBean, trafficType: String = "", restaurantId: Int, isPrint: Boolean = true, listener: (MessageBean) -> Unit) {
launch({ launch({
when (dataBean.companyType) { when (dataBean.companyType) {
0 -> { 0 -> {
...@@ -297,11 +298,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -297,11 +298,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
1 -> { 1 -> {
//zeek //zeek
thirdSend(restaurantId, dataBean, trafficType, 2, listener) thirdSend(restaurantId, dataBean, trafficType, 2, isPrint, listener)
} }
2 -> { 2 -> {
//lalamove //lalamove
thirdSend(restaurantId, dataBean, trafficType, 2, listener) thirdSend(restaurantId, dataBean, trafficType, 2, isPrint, listener)
} }
} }
}, { }, {
...@@ -316,25 +317,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -316,25 +317,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 判斷是否需要修改交通工具 * 判斷是否需要修改交通工具
*/ */
fun getIsUpdateTransportation(dataBean: OrderDetails.DataBean, restaurantId: Int, listener: (List<TransportationBean.DataX.Transportation>?) -> Unit) { fun getIsUpdateTransportation(restaurantId: Int, listener: (List<TransportationBean.DataX.Transportation>?) -> Unit) {
launch({ launch({
val data = getTransportationConfig(restaurantId) val data = getTransportationConfig(restaurantId)
if (data.success) { if (data.success) {
data.data?.list?.let { data.data?.list?.let {
for (value in it) {
if (value.status == 1) {
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
if (dataBean.PRICE > value.amountUnder && dataBean.PRICE < value.amountOn) {
//價格在範圍內
listener.invoke(listOf(value))
} else {
//價格不在默認交通工具範圍內,回到activity中彈出彈窗,讓用戶選擇交通工具
listener.invoke(it)
}
return@launch
}
}
//如果執行到這一步,可能是沒有默認交通工具
listener.invoke(it) listener.invoke(it)
return@launch return@launch
} }
...@@ -529,7 +516,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -529,7 +516,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 第三方派送 * 第三方派送
*/ */
private fun thirdSend(restaurantId: Int, dataBean: OrderDetails.DataBean, trafficType: String, status: Int, listener: (MessageBean) -> Unit) { private fun thirdSend(restaurantId: Int, dataBean: OrderDetails.DataBean, trafficType: String, status: Int, isPrint: Boolean = true, listener: (MessageBean) -> Unit) {
val third = ThirdItem() val third = ThirdItem()
//將食品數據轉為第三方需要的數據 //將食品數據轉為第三方需要的數據
dataBean.PRODUCT_NAME?.let { dataBean.PRODUCT_NAME?.let {
...@@ -544,14 +531,18 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -544,14 +531,18 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
} }
//調用第三方物流接口 //調用第三方物流接口
callThird(dataBean, trafficType, third, restaurantId, status, listener) callThird(dataBean, trafficType, third, restaurantId, status, isPrint, listener)
} }
private fun callThird(dataBean: OrderDetails.DataBean, trafficType: String, third: ThirdItem, restaurantId: Int, status: Int, listener: (MessageBean) -> Unit) { private fun callThird(dataBean: OrderDetails.DataBean, trafficType: String, third: ThirdItem, restaurantId: Int, status: Int, isPrint: Boolean = true, listener: (MessageBean) -> Unit) {
launch({ launch({
repository.thirdDelivery(dataBean.ID.toString(), trafficType, third).apply { repository.thirdDelivery(dataBean.ID.toString(), trafficType, third).apply {
if (success) { if (success) {
updateOrderAndPrint(restaurantId, dataBean, status, listener) if (isPrint) {
updateOrderAndPrint(restaurantId, dataBean, status, listener)
} else {
listener(getMsgBean(Transportation, errMsg ?: "修改運輸工具成功", success))
}
} else if (!TextUtil.isEmptyOrNullOrUndefined(errMsg)) { } else if (!TextUtil.isEmptyOrNullOrUndefined(errMsg)) {
listener.invoke(getMsgBean(OrderDelivery, errMsg, false)) listener.invoke(getMsgBean(OrderDelivery, errMsg, false))
//第三方物流接口異常 //第三方物流接口異常
...@@ -573,7 +564,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -573,7 +564,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//已經指派第三方物流,就調用修改訂單狀態接口 //已經指派第三方物流,就調用修改訂單狀態接口
updateOrderAndPrint(restaurantId, dataBean, status, listener) updateOrderAndPrint(restaurantId, dataBean, status, listener)
} else { } else {
callThird(dataBean, trafficType, third, restaurantId, status, listener) callThird(dataBean, trafficType, third, restaurantId, status, isPrint, listener)
} }
} }
} else { } else {
......
...@@ -15,6 +15,7 @@ import com.ethanhua.skeleton.ViewSkeletonScreen ...@@ -15,6 +15,7 @@ import com.ethanhua.skeleton.ViewSkeletonScreen
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.function.FunctionManager import com.gingersoft.gsa.cloud.function.FunctionManager
import com.gingersoft.gsa.cloud.print.bean.OrderDetails import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.ui.utils.AppDialog import com.gingersoft.gsa.cloud.ui.utils.AppDialog
...@@ -27,6 +28,7 @@ import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel ...@@ -27,6 +28,7 @@ import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.OrderDelivery import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.OrderDelivery
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.PrintCode import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.PrintCode
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.Transportation
import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryAdapter
import com.gingersoft.gsa.other_order_mode.ui.adapter.FoodListAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.FoodListAdapter
import com.gingersoft.gsa.other_order_mode.ui.adapter.OrderDetailsAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.OrderDetailsAdapter
...@@ -236,8 +238,8 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -236,8 +238,8 @@ class OrderDetailsActivity : BaseActivity() {
cancelOrder(orderDetails) cancelOrder(orderDetails)
BtnBuilder.TransportationBtn -> { BtnBuilder.TransportationBtn -> {
//lalamove重新選擇運輸工具 //lalamove重新選擇運輸工具
selectLalaMove(orderDetails) { it, orderDetails -> selectLalaMove(orderDetails, false) { it, orderDetails ->
showSelectTransportation(it, orderDetails) showSelectTransportation(it, orderDetails, false)
} }
} }
BtnBuilder.ClosingBtn -> { BtnBuilder.ClosingBtn -> {
...@@ -258,6 +260,10 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -258,6 +260,10 @@ class OrderDetailsActivity : BaseActivity() {
} }
BtnBuilder.SureBtn -> { BtnBuilder.SureBtn -> {
//確認訂單,判斷是本店還是zeek或是lalamove //確認訂單,判斷是本店還是zeek或是lalamove
if (orderDetails.order_type == 7) {
//如果是自取單,將物流類型改為本店
orderDetails.companyType = 0
}
when (orderDetails.companyType) { when (orderDetails.companyType) {
0, 1 -> { 0, 1 -> {
//本店配送和zeek //本店配送和zeek
...@@ -265,8 +271,8 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -265,8 +271,8 @@ class OrderDetailsActivity : BaseActivity() {
} }
2 -> { 2 -> {
//lalamove //lalamove
selectLalaMove(orderDetails) { it, orderDetails -> selectLalaMove(orderDetails, true) { it, orderDetails ->
showIsUpdateTransportation(it, orderDetails) showIsUpdateTransportation(it, orderDetails, true)
} }
} }
} }
...@@ -304,35 +310,41 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -304,35 +310,41 @@ class OrderDetailsActivity : BaseActivity() {
getShipanyAndOrderInfo(restaurantId, orderId) getShipanyAndOrderInfo(restaurantId, orderId)
} }
private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, black: (it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) -> Unit) { private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, isPrint: Boolean, black: (it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) -> Unit) {
showLoading() showLoading()
getIsUpdateTransportation(orderDetails, restaurantId) { getIsUpdateTransportation(restaurantId) {
cancelDialogForLoading() cancelDialogForLoading()
when { if (it == null) {
it == null -> { //沒有交通工具 ToastUtils.show(this@OrderDetailsActivity, "未獲取到交通工具")
ToastUtils.show(this@OrderDetailsActivity, "未獲取到交通工具") } else {
} for (value in it) {
it.size == 1 -> { //如果只有一個交通工具,就選這個 if (value.status == 1) {
confirmOrder(orderDetails, it[0].type.toString()) //默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
} if (orderDetails.PAY_AMOUNT > value.amountUnder && orderDetails.PAY_AMOUNT < value.amountOn) {
else -> { //價格在範圍內
//否則彈窗讓用戶手動選擇 confirmOrder(orderDetails, value.type.toString(), isPrint)
black(it, orderDetails) return@getIsUpdateTransportation
} else {
//價格不在默認交通工具範圍內,回到activity中彈出彈窗,讓用戶選擇交通工具
//否則彈窗讓用戶手動選擇
black(it, orderDetails)
}
}
} }
} }
} }
} }
private fun PageViewModel.showIsUpdateTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) { private fun PageViewModel.showIsUpdateTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
showWaringDialog("金額範圍和對應的運輸工具不符,是否修改運輸工具", { dialog -> showWaringDialog("金額範圍和對應的運輸工具不符,是否修改運輸工具", { dialog ->
//要修改運輸工具,彈出彈窗讓用戶選擇 //要修改運輸工具,彈出彈窗讓用戶選擇
showSelectTransportation(it, orderDetails) showSelectTransportation(it, orderDetails, isPrint)
dialog.dismiss() dialog.dismiss()
}, { dialog -> }, { dialog ->
//不修改運輸工具,使用默認的 //不修改運輸工具,使用默認的
for (value in it) { for (value in it) {
if (value.status == 1) { if (value.status == 1) {
confirmOrder(orderDetails, value.type.toString()) confirmOrder(orderDetails, value.type.toString(), isPrint)
break break
} }
} }
...@@ -340,7 +352,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -340,7 +352,7 @@ class OrderDetailsActivity : BaseActivity() {
}) })
} }
private fun PageViewModel.showSelectTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean) { private fun PageViewModel.showSelectTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
val data = ArrayList<String>() val data = ArrayList<String>()
for (value in it) { for (value in it) {
data.add(when (value.type) { data.add(when (value.type) {
...@@ -355,7 +367,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -355,7 +367,7 @@ class OrderDetailsActivity : BaseActivity() {
if (adapter.selectIndex == -1) { if (adapter.selectIndex == -1) {
ToastUtils.show(this@OrderDetailsActivity, "請選擇交通工具") ToastUtils.show(this@OrderDetailsActivity, "請選擇交通工具")
} else { } else {
confirmOrder(orderDetails, it[adapter.selectIndex].type.toString()) confirmOrder(orderDetails, it[adapter.selectIndex].type.toString(), isPrint)
} }
}, { }, {
it.dismiss() it.dismiss()
...@@ -363,11 +375,19 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -363,11 +375,19 @@ class OrderDetailsActivity : BaseActivity() {
} }
private fun PageViewModel.confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "") { private fun PageViewModel.confirmOrder(orderDetails: OrderDetails.DataBean, trafficType: String = "", isPrint: Boolean = true) {
showLoading() showLoading()
confirmOrder(orderDetails, trafficType, restaurantId) { msg -> confirmOrder(orderDetails, trafficType, restaurantId, isPrint) { msg ->
cancelDialogForLoading() cancelDialogForLoading()
when (msg.code) { when (msg.code) {
Transportation.toString() -> {//修改運輸工具
finish()
ToastUtils.show(this@OrderDetailsActivity, if (TextUtil.isNotEmptyOrNullOrUndefined(msg.errorMsg)) {
msg.errorMsg
} else {
"修改成功"
})
}
DeliveryPrint.toString() -> {//訂單已確認,是否打印成功 DeliveryPrint.toString() -> {//訂單已確認,是否打印成功
finish() finish()
ToastUtils.show(this@OrderDetailsActivity, if (msg.success) { ToastUtils.show(this@OrderDetailsActivity, if (msg.success) {
...@@ -502,4 +522,9 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -502,4 +522,9 @@ class OrderDetailsActivity : BaseActivity() {
} }
} }
} }
override fun onDestroy() {
super.onDestroy()
DialogUtils.staticDismiss()
}
} }
...@@ -33,12 +33,10 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -33,12 +33,10 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
notifyDataSetChanged() notifyDataSetChanged()
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_delivery_order_item, parent, false)) return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_delivery_order_item, parent, false))
} }
override fun onBindViewHolder(holder: ViewHolder, position: Int) { override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val data = this.databeans!![position] val data = this.databeans!![position]
holder.binding.data = data holder.binding.data = data
...@@ -61,6 +59,15 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -61,6 +59,15 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
holder.binding.deliveryState = "" holder.binding.deliveryState = ""
} }
holder.binding.vehicle = when (data.transportationType) {
1 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_motorcycle)
2 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_bread_car)
3 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_truck)
else -> null
}
// @drawable/ic_motorcycle
var state: String? = null var state: String? = null
val bg = GradientDrawable() val bg = GradientDrawable()
bg.cornerRadius = dp2px(5f).toFloat() bg.cornerRadius = dp2px(5f).toFloat()
......
...@@ -125,6 +125,8 @@ ...@@ -125,6 +125,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:background="@color/white"
app:tabPaddingEnd="-1dp" app:tabPaddingEnd="-1dp"
app:tabSelectedTextColor="@color/theme_color"
app:tabTextColor="@color/color_ccc"
app:tabPaddingStart="-1dp"> app:tabPaddingStart="-1dp">
<com.google.android.material.tabs.TabItem <com.google.android.material.tabs.TabItem
......
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
<variable <variable
name="isSelf" name="isSelf"
type="Boolean" /> type="Boolean" />
<variable
name="vehicle"
type="android.graphics.drawable.Drawable" />
</data> </data>
<FrameLayout <FrameLayout
...@@ -238,23 +242,23 @@ ...@@ -238,23 +242,23 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical">
android:paddingLeft="@dimen/dp_5"
android:visibility="gone"
android:paddingRight="@dimen/dp_5">
<ImageView <ImageView
android:id="@+id/ic_vehicle" android:id="@+id/ic_vehicle"
android:layout_width="@dimen/dp_26" android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26" android:layout_height="@dimen/dp_26"
android:src="@drawable/ic_motorcycle" /> android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:src="@{vehicle}"
android:visibility="@{vehicle== null?View.GONE:View.VISIBLE}" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="0.35"
android:layout_marginLeft="@dimen/dp_2"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:layout_weight="0.35"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<com.yanzhenjie.recyclerview.SwipeRecyclerView <com.yanzhenjie.recyclerview.SwipeRecyclerView
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<include layout="@layout/include_horizontal_color_ccc_dividing_line" /> <include layout="@layout/include_horizontal_color_ccc_dividing_line" />
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
...@@ -18,6 +17,7 @@ ...@@ -18,6 +17,7 @@
android:id="@+id/print_table_layout" android:id="@+id/print_table_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/tabIndicator_height" android:layout_height="@dimen/tabIndicator_height"
app:tabBackground="@color/white"
app:tabIndicator="@drawable/tablayout_indicator" app:tabIndicator="@drawable/tablayout_indicator"
app:tabIndicatorColor="@color/theme_color" app:tabIndicatorColor="@color/theme_color"
app:tabIndicatorFullWidth="false" /> app:tabIndicatorFullWidth="false" />
......
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