Commit e3e7e244 by Wyh

9.02 1、冷鏈接單 2、lalmove追加服務費 3、顯示餘額

Signed-off-by: Wyh <1239658231>
parent a3e7affc
ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错 ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle") apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao' apply plugin: 'org.greenrobot.greendao'
apply plugin: 'kotlin-kapt'
android { android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"] compileSdkVersion rootProject.ext.android["compileSdkVersion"]
...@@ -56,6 +57,17 @@ android { ...@@ -56,6 +57,17 @@ android {
generateTests false //设置为true以自动生成单元测试。 generateTests false //设置为true以自动生成单元测试。
} }
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', 'src/main/aidl']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/aidl']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['src/main/assets']
}
}
} }
dependencies { dependencies {
...@@ -79,7 +91,8 @@ dependencies { ...@@ -79,7 +91,8 @@ dependencies {
debugImplementation rootProject.ext.dependencies["canary-debug"] debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"] releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"] testImplementation rootProject.ext.dependencies["canary-release"]
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] kapt rootProject.ext.dependencies["dagger2-compiler"]
kapt rootProject.ext.dependencies["butterknife-compiler"]
api rootProject.ext.dependencies["BaseRecyclerViewAdapter"] api rootProject.ext.dependencies["BaseRecyclerViewAdapter"]
implementation rootProject.ext.dependencies["fastjson"] implementation rootProject.ext.dependencies["fastjson"]
// api rootProject.ext.dependencies["zxing"] // api rootProject.ext.dependencies["zxing"]
...@@ -117,6 +130,7 @@ dependencies { ...@@ -117,6 +130,7 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.8' annotationProcessor 'org.projectlombok:lombok:1.18.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.github.huangyanbin:SmartTable:2.2.0' api 'com.github.huangyanbin:SmartTable:2.2.0'
api rootProject.ext.dependencies["permissionx"]
} }
repositories { repositories {
mavenCentral() mavenCentral()
......
<manifest package="com.gingersoft.gsa.cloud.base" <manifest package="com.gingersoft.gsa.cloud.base"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.VIBRATE" />
<application <application
...@@ -22,6 +21,9 @@ ...@@ -22,6 +21,9 @@
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640"/> android:value="640"/>
<service
android:name="com.gingersoft.gsa.cloud.service.GetInfoUpdateService"
android:enabled="true" />
</application> </application>
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
......
...@@ -25,8 +25,8 @@ import com.gingersoft.gsa.cloud.base.BuildConfig; ...@@ -25,8 +25,8 @@ import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.base.R; import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.common.bean.RestaurantExpandInfo; import com.gingersoft.gsa.cloud.base.common.bean.RestaurantExpandInfo;
import com.gingersoft.gsa.cloud.base.utils.AidlUtil; import com.gingersoft.gsa.cloud.base.utils.AidlUtil;
import com.gingersoft.gsa.cloud.base.utils.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.crash.AppCrashHandler; import com.gingersoft.gsa.cloud.base.utils.crash.AppCrashHandler;
import com.gingersoft.gsa.cloud.base.utils.file.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil; import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.xlog.MyBackupStrategy; import com.gingersoft.gsa.cloud.base.utils.xlog.MyBackupStrategy;
...@@ -189,6 +189,18 @@ public class GsaCloudApplication extends BaseApplication { ...@@ -189,6 +189,18 @@ public class GsaCloudApplication extends BaseApplication {
//後台遷移新地址 //後台遷移新地址
RetrofitUrlManager.getInstance().putDomain("new_base_url", HttpsConstans.ROOT_URL+"/ricepon-member/api/"); RetrofitUrlManager.getInstance().putDomain("new_base_url", HttpsConstans.ROOT_URL+"/ricepon-member/api/");
//ricepon_wechat請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_wechat", HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_WECHAT);
//ricepon_order請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_order", HttpsConstans.ROOT_URL + HttpsConstans.URL_RICEPON_ORDER);
//member_web_ricepon_gsa請求地址
RetrofitUrlManager.getInstance().putDomain("member_web_ricepon_gsa", HttpsConstans.ROOT_URL + HttpsConstans.URL_MEMBER_WEB_RICEPON_GSA);
//member-web api 請求地址
RetrofitUrlManager.getInstance().putDomain("member-web", HttpsConstans.ROOT_URL + HttpsConstans.WECHAR_REPORT_PATH);
//ricepon_gsa請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_gsa", HttpsConstans.ROOT_URL + HttpsConstans.URK_RICEPON_GSA);
//ricepon_activities請求地址
RetrofitUrlManager.getInstance().putDomain("ricepon_activities", HttpsConstans.ROOT_URL + HttpsConstans.URK_RICEPON_ACTIVITIES);
} }
private void initPrint() { private void initPrint() {
......
package com.gingersoft.gsa.cloud.base.utils
import android.content.Context
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.SoundPool
import android.os.Build
object SoundPoolUtils {
private var soundPool: SoundPool? = null
fun initSoundPool(context: Context, resId: Int) {
//实例化SoundPool
//sdk版本21是SoundPool 的一个分水岭
if (soundPool == null) {
if (Build.VERSION.SDK_INT >= 21) {
val builder = SoundPool.Builder()
//传入最多播放音频数量,
builder.setMaxStreams(1)
//AudioAttributes是一个封装音频各种属性的方法
val attrBuilder = AudioAttributes.Builder()
//设置音频流的合适的属性
attrBuilder.setLegacyStreamType(AudioManager.STREAM_MUSIC)
//加载一个AudioAttributes
builder.setAudioAttributes(attrBuilder.build())
soundPool = builder.build()
} else {
/**
* 第一个参数:int maxStreams:SoundPool对象的最大并发流数
* 第二个参数:int streamType:AudioManager中描述的音频流类型
*第三个参数:int srcQuality:采样率转换器的质量。 目前没有效果。 使用0作为默认值。
*/
soundPool = SoundPool(1, AudioManager.STREAM_MUSIC, 0)
}
}
//可以通过四种途径来记载一个音频资源:
//1.通过一个AssetFileDescriptor对象
//int load(AssetFileDescriptor afd, int priority)
//2.通过一个资源ID
//int load(Context context, int resId, int priority)
//3.通过指定的路径加载
//int load(String path, int priority)
//4.通过FileDescriptor加载
//int load(FileDescriptor fd, long offset, long length, int priority)
//声音ID 加载音频资源,这里用的是第二种,第三个参数为priority,声音的优先级*API中指出,priority参数目前没有效果,建议设置为1。
loadSound(context, resId)
}
private fun loadSound(context: Context, resId: Int) {
val voiceId = soundPool!!.load(context, resId, 1)
//异步需要等待加载完成,音频才能播放成功
soundPool!!.setOnLoadCompleteListener { soundPool, sampleId, status ->
if (status == 0) {
//第一个参数soundID
//第二个参数leftVolume为左侧音量值(范围= 0.0到1.0)
//第三个参数rightVolume为右的音量值(范围= 0.0到1.0)
//第四个参数priority 为流的优先级,值越大优先级高,影响当同时播放数量超出了最大支持数时SoundPool对该流的处理
//第五个参数loop 为音频重复播放次数,0为值播放一次,-1为无限循环,其他值为播放loop+1次
//第六个参数 rate为播放的速率,范围0.5-2.0(0.5为一半速率,1.0为正常速率,2.0为两倍速率)
soundPool.play(voiceId, 1f, 1f, 1, 0, 1f)
}
}
}
}
\ No newline at end of file
...@@ -35,4 +35,8 @@ public class VibratorUtils { ...@@ -35,4 +35,8 @@ public class VibratorUtils {
} catch (Exception e) { } catch (Exception e) {
} }
} }
public void setJumpActivity(Class clazz){
}
} }
...@@ -13,17 +13,16 @@ import com.elvishew.xlog.XLog; ...@@ -13,17 +13,16 @@ import com.elvishew.xlog.XLog;
import com.gingersoft.gsa.cloud.base.Api; import com.gingersoft.gsa.cloud.base.Api;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.utils.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.JsonUtils; import com.gingersoft.gsa.cloud.base.utils.JsonUtils;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
import com.gingersoft.gsa.cloud.base.utils.file.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil; import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils; import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils;
import com.gingersoft.gsa.cloud.constans.HttpsConstans;
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;
import com.jess.arms.utils.DeviceUtils; import com.jess.arms.utils.DeviceUtils;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
......
package com.gingersoft.gsa.cloud.base.utils.file;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import com.elvishew.xlog.XLog;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2018/11/16
* 修订历史:2018/11/16
* 描述:7.0 兼容
* <files-path name="name" path="path" /> 对应getFilesDir()。
* <cache-path name="name" path="path" /> 对应getCacheDir()。
* <external-path name="name" path="path" /> 对应Environment.getExternalStorageDirectory()。
* <external-files-path name="name" path="path" /> 对应getExternalFilesDir()。
* <external-cache-path name="name" path="path" /> 对应getExternalCacheDir()。
*/
public class FileUtils {
public static String FirstFolder = "GsaCloud";//一级目录
public static String file = "file";//文件文件夹
public static String Image = "image";//图片文件夹
public static String Log = "xLog";//日志存储
public static String ActionLog = "actionLog";//操作日志
public static String ErrorLog = "errorLog";//错误日志存储
public static String APK = "Download";//安装包目录放在系统目录
/*ALBUM_PATH取得机器的SD卡位置,File.separator为分隔符“/”*/
public final static String ALBUM_PATH = Environment.getExternalStorageDirectory() + File.separator + FirstFolder + File.separator;
public final static String IMAGE_PATH = ALBUM_PATH + Image + File.separator;
public final static String File_PATH = ALBUM_PATH + file + File.separator;
public final static String LOG_PATH = ALBUM_PATH + Log + File.separator;
public final static String ACTIONLOG_PATH = LOG_PATH + ActionLog + File.separator;
public final static String ERRORLOG_PATH = LOG_PATH + ErrorLog + File.separator;
public final static String APK_PATH = Environment.getExternalStorageDirectory() + File.separator + APK + File.separator;
public final static String FILE_EXTENSION_SEPARATOR = ".";
//操作日志單最大文件大小
public final static int ACTION_MAX_SIZE = 1024 * 1024 * 5;
//操作日志文件按照時間刪除
public final static int ACTION_MAX_FILE_TIME = 1000 * 60 * 60 * 12;
private FileUtils() {
throw new AssertionError();
}
public static StringBuilder readFile(String filePath, String charsetName) {
File file = new File(filePath);
StringBuilder fileContent = new StringBuilder("");
if (file == null || !file.isFile()) {
return null;
}
BufferedReader reader = null;
try {
InputStreamReader is = new InputStreamReader(new FileInputStream(
file), charsetName);
reader = new BufferedReader(is);
String line = null;
while ((line = reader.readLine()) != null) {
if (!fileContent.toString().equals("")) {
fileContent.append("\r\n");
}
fileContent.append(line);
}
reader.close();
return fileContent;
} catch (IOException e) {
throw new RuntimeException("IOException occurred. ", e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
throw new RuntimeException("IOException occurred. ", e);
}
}
}
}
/**
* 写文件
*
* @param
* @return boolean 返回类型
*/
public static boolean writeFile(String filePath, String content,
boolean append) {
if (TextUtils.isEmpty(content)) {
return false;
}
FileWriter fileWriter = null;
try {
makeDirs(filePath);
fileWriter = new FileWriter(filePath, append);
fileWriter.write(content);
fileWriter.close();
return true;
} catch (IOException e) {
throw new RuntimeException("IOException occurred. ", e);
} finally {
if (fileWriter != null) {
try {
fileWriter.close();
} catch (IOException e) {
throw new RuntimeException("IOException occurred. ", e);
}
}
}
}
/**
* 创建文件的路径
*
* @param
* @return boolean 返回类型
*/
public static boolean makeDirs(String filePath) {
String folderName = getFolderName(filePath);
if (TextUtils.isEmpty(folderName)) {
return false;
}
File folder = new File(folderName);
return (folder.exists() && folder.isDirectory()) ? true : folder.mkdirs();
}
public static String getFolderName(String filePath) {
if (TextUtils.isEmpty(filePath)) {
return filePath;
}
int filePosi = filePath.lastIndexOf(File.separator);
return (filePosi == -1) ? "" : filePath.substring(0, filePosi);
}
/**
* 写文本文件 在Android系统中,文件保存在 /data/data/PACKAGE_NAME/files 目录下
*
* @param context
*/
public static void write(Context context, String fileName, String content) {
if (content == null)
content = "";
try {
FileOutputStream fos = context.openFileOutput(fileName,
Context.MODE_PRIVATE);
fos.write(content.getBytes());
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 读取文本文件 文件保存在 /data/data/PACKAGE_NAME/files
*
* @param context
* @param fileName
* @return
*/
public static String read(Context context, String fileName) {
try {
FileInputStream in = context.openFileInput(fileName);
return readInStream(in);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
public static String readInStream(FileInputStream inStream) {
try {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[512];
int length = -1;
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);
}
outStream.close();
inStream.close();
return outStream.toString();
} catch (IOException e) {
XLog.tag("FileTest").d(e.getMessage());
}
return null;
}
/**
* 创建文件
*
* @param folderPath
* @param fileName
* @return
*/
public static File createFile(String folderPath, String fileName) {
File destDir = new File(folderPath);
if (!destDir.exists()) {
destDir.mkdirs();
}
return new File(folderPath, fileName + fileName);
}
/*
* 在SD卡上创建目录
*/
public static File creatSDDir(String dirName) {
File dir = new File(dirName);
if (!dir.exists()) {
dir.mkdirs();
}
return dir;
}
/**
* 获取文件大小
*
* @param filePath
* @return
*/
public static long getFileSize(String filePath) {
long size = 0;
File file = new File(filePath);
if (file != null && file.exists()) {
size = file.length();
}
return size;
}
/*
* Java文件操作 获取文件扩展名
* */
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
/*
* Java文件操作 获取不带扩展名的文件名
* */
public static String getFileNameNoEx(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot > -1) && (dot < (filename.length()))) {
return filename.substring(0, dot);
}
}
return filename;
}
}
...@@ -7,6 +7,7 @@ public class ExpandConstant { ...@@ -7,6 +7,7 @@ public class ExpandConstant {
public final static String TableModePrintCount = "TableModePrintCount";//餐檯印單打印次數 public final static String TableModePrintCount = "TableModePrintCount";//餐檯印單打印次數
public final static String TableModeClosingPC = "TableModeClosingPC";//餐檯模式結賬單打印次數 public final static String TableModeClosingPC = "TableModeClosingPC";//餐檯模式結賬單打印次數
public final static String OrderReceivingTimeout = "OrderReceivingTimeout";//外送接單超時時間
public final static String Rounding = "Rounding"; public final static String Rounding = "Rounding";
public final static String RoundingDecimal = "RoundingDecimal"; public final static String RoundingDecimal = "RoundingDecimal";
......
package com.gingersoft.gsa.cloud.constans;
import com.gingersoft.gsa.cloud.function.FModule;
public class FunctionManagerConstans {
public static class takeaway{
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 CANCEL_ORDER_BTN_KEY = "takeaway/orderDetails/btn/cancelOrder";
public static final String PRINT_ORDER_BTN_KEY = "takeaway/orderDetails/btn/printOrder";
public static final String LOGISTICS_BTN_KEY = "takeaway/orderDetails/btn/logistics";
public static final String ASSIGNDELIVERY_BTN_KEY = "takeaway/orderDetails/btn/assignDelivery";
public static final String CLOSING_BTN_KEY = "takeaway/orderDetails/btn/closing";
public static final String TRANSPORTATION_BTN_KEY = "takeaway/orderDetails/btn/transportation";
/** 外送/自取- 訂單詳情管理 */
public static final FModule[] orderDetails = {
new FModule(CONFIRM_BTN_KEY, 0, 0),
new FModule(PRODUCTION_COMPLETED_BTN_KEY, 0, 0),
new FModule(CANCEL_ORDER_BTN_KEY, 0, 0),
new FModule(PRINT_ORDER_BTN_KEY, 0, 0),
new FModule(LOGISTICS_BTN_KEY, 0, 0),
new FModule(ASSIGNDELIVERY_BTN_KEY, 0, 0),
new FModule(CLOSING_BTN_KEY, 0, 0),
new FModule(TRANSPORTATION_BTN_KEY, 0, 0),
};
}
}
...@@ -45,24 +45,33 @@ public class HttpsConstans { ...@@ -45,24 +45,33 @@ public class HttpsConstans {
public static String ROOT_SERVER_SHI_SHU_HK = "http://192.168.1.154:9012/api/"; //石书本地 public static String ROOT_SERVER_SHI_SHU_HK = "http://192.168.1.154:9012/api/"; //石书本地
//------------------------------------------外賣接單--------------------------------------------------------------------------- //------------------------------------------外賣接單---------------------------------------------------------------------------
public static final String URL_RICEPON_WECHAT = "/ricepon-wechat/api/";
public static final String URL_RICEPON_ORDER = "/ricepon-order/api/";
public static final String URK_RICEPON_GSA = "/ricepon-gsa/api/";
public static final String URK_RICEPON_ACTIVITIES = "/ricepon-activities/api/";
public static final String URL_MEMBER_WEB_RICEPON_GSA = "/member-web" + URK_RICEPON_GSA;
public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地 public static final String ROOT_SZ_URL = "http://192.168.1.74:6060";//友常本地
public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試 public static final String ROOT_HK_TEST_URL = "https://hktest.ricepon.com:64377";//香港測試
public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式 public static final String ROOT_FORMAL_URL = "https://m.ricepon.com";//正式
//-------------------------------------------報表------------------------------------------------------------------------------- //-------------------------------------------報表-------------------------------------------------------------------------------
private static String REPORT_TEST_ADDRESS = "http://a.ricepon.com:58201";//報表測試地址 public static String REPORT_TEST_ADDRESS = "http://a.ricepon.com:58201";//報表測試地址
private static String REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//報表正式地址 public static String REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//報表正式地址
//報表路徑 //報表路徑
private static String REPORT_PATH = "/ricepon-report/api/"; public static String REPORT_PATH = "/ricepon-report/api/";
//----------------------------------微信公眾號報表地址------------------------------------------------------------------------------------------ //----------------------------------微信公眾號報表地址------------------------------------------------------------------------------------------
private static String WECHAR_REPORT_TEST_ADDRESS = "http://a.ricepon.com:61177";//微信公眾號報表測試地址 public static String WECHAR_REPORT_TEST_ADDRESS = "http://a.ricepon.com:61177";//微信公眾號報表測試地址
private static String WECHAR_REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//微信公眾號報表正式地址 public static String WECHAR_REPORT_FORMAL_ADDRESS = HTTP_ADDRESS_URL_FORMAL;//微信公眾號報表正式地址
private static String WECHAR_REPORT_PATH = "/member-web/api/";//微信公眾號報表路徑 public static String WECHAR_REPORT_PATH = "/member-web/api/";//微信公眾號報表路徑
//---------------------------------------System請求地址---------------------------------------------------------------------------------- //---------------------------------------System請求地址----------------------------------------------------------------------------------
private static String SYSTEM_PATH = "/ricepon-system/api/"; public static String SYSTEM_PATH = "/ricepon-system/api/";
//--------------------------------------配置----------------------------------------------------------------------------------- //--------------------------------------配置-----------------------------------------------------------------------------------
...@@ -87,6 +96,8 @@ public class HttpsConstans { ...@@ -87,6 +96,8 @@ public class HttpsConstans {
//默認url,配置這個值修改環境 //默認url,配置這個值修改環境
public static String ROOT_SERVER_ADDRESS_FORMAL = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH; public static String ROOT_SERVER_ADDRESS_FORMAL = (isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
public static String ROOT_SERVER = isFormal == 1 ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK;
//修改這個值,配置外賣接單環境 //修改這個值,配置外賣接單環境
public static String ROOT_URL;// = isFormal ? ROOT_FORMAL_URL : ROOT_HK_TEST_URL;//正式:ROOT_FORMAL_URL 測試:ROOT_HK_TEST_URL public static String ROOT_URL;// = isFormal ? ROOT_FORMAL_URL : ROOT_HK_TEST_URL;//正式:ROOT_FORMAL_URL 測試:ROOT_HK_TEST_URL
......
...@@ -10,6 +10,8 @@ class OrderDetails { ...@@ -10,6 +10,8 @@ class OrderDetails {
* data : [{"Order_ID":50349,"NUMBER":1,"MEMBER_NAME":"忆逝1","PRICE":88,"discount_amount":0,"PHONE":"15728241877","ORDER_NO":"26202811401145744","Lunchbox":0,"remark":"","pid":0,"PRODUCT_NAME":[{"odsId":"1650249","PRICE":"88.0","num":"1","pid":"0","PRODUCT_NAME":"脆炸粟米蟹肉餅"}],"odsId":1650249,"addressDetail":"香港長沙灣青山道479 - 479A號麗昌工廠大廈 704 室及 802 室(接待處於 704 室蘋果迷你倉 - 荔枝角 (麗昌分店)分店","DELIVERY_CHARGE":0,"order_from":7,"sender":"","SEND_TIME":"盡快送達 18:27","PAY_AMOUNT":88,"ID":50349,"CREATE_TIME":"2020-04-02 17:57:29.0","takeFoodCode":"0","RECEIVER":"張學友 先生","TOTAL_AMOUNT":"88.0"}] * data : [{"Order_ID":50349,"NUMBER":1,"MEMBER_NAME":"忆逝1","PRICE":88,"discount_amount":0,"PHONE":"15728241877","ORDER_NO":"26202811401145744","Lunchbox":0,"remark":"","pid":0,"PRODUCT_NAME":[{"odsId":"1650249","PRICE":"88.0","num":"1","pid":"0","PRODUCT_NAME":"脆炸粟米蟹肉餅"}],"odsId":1650249,"addressDetail":"香港長沙灣青山道479 - 479A號麗昌工廠大廈 704 室及 802 室(接待處於 704 室蘋果迷你倉 - 荔枝角 (麗昌分店)分店","DELIVERY_CHARGE":0,"order_from":7,"sender":"","SEND_TIME":"盡快送達 18:27","PAY_AMOUNT":88,"ID":50349,"CREATE_TIME":"2020-04-02 17:57:29.0","takeFoodCode":"0","RECEIVER":"張學友 先生","TOTAL_AMOUNT":"88.0"}]
*/ */
var code: String? = null
var errorMsg: String? = null
var success: Boolean = false var success: Boolean = false
var sysTime: Long = 0 var sysTime: Long = 0
var data: List<DataBean>? = null var data: List<DataBean>? = null
...@@ -106,7 +108,8 @@ class OrderDetails { ...@@ -106,7 +108,8 @@ class OrderDetails {
// * * Order Cancelled After Collection - 訂單已取消 - 取餐后 9 // * * Order Cancelled After Collection - 訂單已取消 - 取餐后 9
// * * Order Assigned To Another Delivery Man - 已指派另一位配送員 10 // * * Order Assigned To Another Delivery Man - 已指派另一位配送員 10
var payMultiple: List<PayMultiple>? = null var payMultiple: List<PayMultiple>? = null
var companyType:Int = -1 //物流公司類型 0 本店配送 1:zeek;2:lalamove var companyType: Int = -1 //物流公司類型 0 本店配送 1:zeek;2:lalamove
var labUrl: String? = null //打印文檔鏈接
class PRODUCTNAMEBean : Serializable { class PRODUCTNAMEBean : Serializable {
/** /**
......
package com.gingersoft.gsa.cloud.service
import android.annotation.SuppressLint
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.BitmapFactory
import android.os.Binder
import android.os.Build
import android.os.IBinder
import android.os.PowerManager
import android.util.Log
import android.widget.RemoteViews
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.SoundPoolUtils
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil
import com.gingersoft.gsa.cloud.constans.AppConstans
import com.gingersoft.gsa.cloud.constans.HttpsConstans
import com.google.gson.Gson
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import okhttp3.*
import okio.ByteString
import org.json.JSONObject
import java.util.*
import java.util.concurrent.TimeUnit
class GetInfoUpdateService : Service() {
private val TAG = "eee"
/**
* 心跳检测时间
*/
private val HEART_BEAT_RATE = (30 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测
private val WEBSOCKET_HOST_AND_PORT = "${HttpsConstans.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
private var mWebSocket: WebSocket? = null
var client: OkHttpClient? = null
var postCallBack: PostCallBack? = null
private lateinit var mReceiver: ClearHeartBroadcastReceiver
private var newWakeLock: PowerManager.WakeLock? = null
private var myBind: MyBind? = null
private val CHANNEL_ID = "cloud_gsa"
companion object {
@kotlin.jvm.JvmField
var loginfo = StringBuffer()
}
val restaurantId by lazy {
GsaCloudApplication.getRestaurantId(this)
}
override fun onBind(intent: Intent?): IBinder? {
myBind = MyBind()
return myBind
}
override fun onCreate() {
super.onCreate()
val mFilter = IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
mReceiver = ClearHeartBroadcastReceiver()
registerReceiver(mReceiver, mFilter)
InitSocketThread().start()
isDestroy = false
//讓設備在休眠狀態下保持運行
val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
newWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.javaClass.name)
//Value CPU Screen KeyBoard
//PARTIAL_WAKE_LOCK On Off Off
//SCREEN_DIM_WAKE_LOCK On Dim Off
//SCREEN_BRIGHT_WAKE_LOCK On Bright Off
//FULL_WAKE_LOCK On Bright Bright
newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/)
putTimeLog("創建服務onCreate")
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d(TAG, "onStartCommand()")
// 在API11之后构建Notification的方式
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel()
} else {
startNotification()
}
putTimeLog("啟動服務onStartCommand")
return super.onStartCommand(intent, flags, startId)
}
/**
* 创建通知渠道
*/
@RequiresApi(Build.VERSION_CODES.O)
fun createNotificationChannel() {
//设定的通知渠道名称
val channelName = "New Order Notification"
//设置通知的重要程度
val importance = NotificationManager.IMPORTANCE_LOW
//构建通知渠道
val channel = NotificationChannel(CHANNEL_ID, channelName, importance)
channel.description = "New Order Notification"
//向系统注册通知渠道,注册后不能改变重要性以及其他通知行为
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
startNotification()
}
@SuppressLint("InflateParams")
private fun startNotification() {
val broadcastReceiver = Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
val broadcastIntent = PendingIntent.getBroadcast(this, 10, broadcastReceiver, 0)
val remoteViews = RemoteViews(packageName, R.layout.layout_order_receiving)
remoteViews.setOnClickPendingIntent(R.id.btn_stop_service, broadcastIntent)
var intent: Intent? = null
myBind?.jumpActivity?.let {
intent = Intent(this, it)
}
if (intent == null) {
intent = Intent("action.gingersoft.DELIVERY_ORDER")
}
val pendingIntent = PendingIntent.getActivity(this, 0, intent, 0)
//在创建的通知渠道上发送通知
val builder = NotificationCompat.Builder(this, CHANNEL_ID)
builder.setSmallIcon(R.mipmap.ic_launcher) //设置通知图标
.setContentTitle("Ricepon Pos")//设置通知标题
.setContentText("外賣接單服務")//设置通知内容Takeaway order service
.setContent(remoteViews)
.setContentIntent(pendingIntent)
.setAutoCancel(false) //用户触摸时,自动关闭
.setOngoing(true)//设置处于运行状态
.setLargeIcon(BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher))
//将服务置于启动状态 NOTIFICATION_ID指的是创建的通知的ID
startForeground(123, builder.build())
}
inner class MyBind : Binder() {
lateinit var block: (isShow: Boolean) -> Unit
var jumpActivity: Class<*>? = null
set(value) {
field = value
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel()
} else {
startNotification()
}
}
fun setOnPostCallBack(postCallBack: PostCallBack?) {
this@GetInfoUpdateService.postCallBack = postCallBack
}
fun execute(block: (isShow: Boolean) -> Unit) {
this.block = block
}
}
internal inner class InitSocketThread : Thread() {
override fun run() {
super.run()
initSocket()
}
}
// 初始化socket
private fun initSocket() {
putTimeLog("取消心跳")
cancelInterval()
interval({
newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/)
putTimeLog("開啟心跳")
client?.let { it ->
mWebSocket?.let {
it.cancel()
it.send("-1")
it.close(1000, null)
}
it.dispatcher().cancelAll()
}
client = OkHttpClient.Builder().readTimeout(9 * 10, TimeUnit.SECONDS).build()
client?.let {
val request = Request.Builder()
.url(WEBSOCKET_HOST_AND_PORT)
.build()
it.newWebSocket(request, object : WebSocketListener() {
override fun onOpen(webSocket: WebSocket, response: Response) {//开启长连接成功的回调
super.onOpen(webSocket, response)
if (!this@GetInfoUpdateService.isDestroy) {
mWebSocket = webSocket
val token = "weixin_" + restaurantId + "_" + getRandomString(24)
Log.e(TAG, "token:$token")
webSocket.send(Gson().toJson(MsgBean(1, token)))
putTimeLog("連接成功")
cancelTimerDisposable()
myBind?.block?.invoke(false)
}
}
override fun onMessage(webSocket: WebSocket, text: String) {//接收消息的回调
super.onMessage(webSocket, text)
val json = JSONObject(text)
val type = json.optInt("type")
if (postCallBack != null) {
postCallBack!!.callBack(type)
}
//-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知"
if (type == 3 || type == 4 || type == 5
|| type == 7) {
//播放提示音
initSoundPool(R.raw.newordervocal)
} else if (type == 8) {
initSoundPool(R.raw.raw_logistics_cancel)
}
//收到服务器端传过来的消息text
Log.e(TAG, "onMessage:$text")
putTimeLog("收到回調:$text")
}
override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
super.onMessage(webSocket, bytes)
val json = JSONObject(bytes.toString())
if (postCallBack != null) {
postCallBack!!.callBack(json.optInt("type"))
}
Log.e(TAG, "onMessage222:$bytes")
putTimeLog("onMessage222:$bytes")
}
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
super.onClosing(webSocket, code, reason)
//連接斷開,
Log.e(TAG, "onClosing")
putTimeLog("onClosing關閉連接")
}
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
super.onClosed(webSocket, code, reason)
Log.e(TAG, "onClosed")
putTimeLog("onClosed斷開連接")
webSocket.cancel()
}
override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {//长连接连接失败的回调
super.onFailure(webSocket, t, response)
Log.e(TAG, "onFailure " + t.message)
if (!this@GetInfoUpdateService.isDestroy) {
//連接斷開,定時五秒,如果未重連,播放提示音
delayFun({
initSoundPool(R.raw.raw_disconnect)
myBind?.block?.invoke(true)
//推送給相關人員
OkHttp3Utils.noticePersonnel(AppConstans.RP_HEART_ERROR, "心跳斷開十秒以上未連接成功:" + t.message)
}, 10)
putTimeLog("onFailure連接失敗,等待一分鐘後重新連接")
} else {
webSocket.cancel()
it.dispatcher().cancelAll()
}
}
})
it.dispatcher().executorService().shutdown()
}
}, HEART_BEAT_RATE)
}
private var lastSoundTime: Long = 0L
fun initSoundPool(resId: Int) {
val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
if (nowTime - lastSoundTime > 5000) {
Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
putTimeLog("新訂單播放:$nowTime")
lastSoundTime = nowTime
SoundPoolUtils.initSoundPool(this, resId)
}
}
/*获取一条随机字符串*/
fun getRandomString(length: Int): String { //length表示生成字符串的长度
val base = "abcdefghijklmnopqrstuvwxyz0123456789"
val random = Random()
val sb = StringBuffer()
for (i in 0 until length) {
val number = random.nextInt(base.length)
sb.append(base[number])
}
return sb.toString()
}
private var isDestroy = false
override fun onDestroy() {
super.onDestroy()
putTimeLog("服務銷毀onDestroy")
//清除心跳
clearHeart()
isDestroy = true
//取消廣播
unregisterReceiver(mReceiver)
//斷開長鏈接
client?.let {
mWebSocket?.cancel()
it.dispatcher().cancelAll()
}
if (mWebSocket != null) {
mWebSocket!!.send("-1")
mWebSocket!!.close(1000, null)
}
//停止定時心跳
cancelInterval()
//停止延遲執行任務
cancelTimerDisposable()
//停止前台服務
stopForeground(true)
//清除保持喚醒
newWakeLock?.release()
newWakeLock = null
}
private fun clearHeart() {
val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId.toString())
.build()
OkHttp3Utils.post(HttpsConstans.ROOT_URL + "/member-web/api/restaurant/clearHeartbeat", requestBody)
.subscribeOn(Schedulers.io()).subscribe()
}
inner class ClearHeartBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
//關閉service,會調用service的onDestroy
stopSelf()
}
}
/**
* 向日誌添加數據
*/
private fun putTimeLog(content: String) {
loginfo.append(TimeUtil.getCurrentDate(TimeUtil.dateFormatYMDHMS))
loginfo.append(":")
loginfo.append(content)
loginfo.append("\n")
}
var mIntervalDisposable: Disposable? = null
var timerDisposable: Disposable? = null
/**
* 执行定时任务
*/
fun interval(block: () -> Unit, milliseconds: Long) {
Observable.interval(0, milliseconds, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(object : Observer<Long> {
override fun onError(e: Throwable) {}
override fun onComplete() {}
override fun onNext(t: Long) {
block()
}
override fun onSubscribe(d: Disposable) {
mIntervalDisposable = d
}
})
}
/**
* 取消定时器
*/
fun cancelInterval() {
if (mIntervalDisposable != null && !mIntervalDisposable!!.isDisposed) {
mIntervalDisposable!!.dispose()
}
}
fun cancelTimerDisposable() {
if (timerDisposable != null && !timerDisposable!!.isDisposed) {
timerDisposable!!.dispose()
}
}
fun delayFun(block: () -> Unit, milliseconds: Long) {
Observable.timer(milliseconds, TimeUnit.SECONDS)
.subscribe(object : Observer<Long> {
override fun onSubscribe(d: Disposable) {
timerDisposable = d
}
override fun onNext(t: Long) {
block()
}
override fun onError(e: Throwable) {
}
override fun onComplete() {
}
})
}
class MsgBean(var type: Int, var token: String)
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.service
interface PostCallBack {
fun callBack(type: Int)
}
\ No newline at end of file
...@@ -4,17 +4,17 @@ import android.view.View; ...@@ -4,17 +4,17 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.base.R; import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.R2; import com.gingersoft.gsa.cloud.base.R2;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader; import com.gingersoft.gsa.cloud.ui.bean.view.SectionHeader;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionRestaurantItem; import com.gingersoft.gsa.cloud.ui.bean.view.SectionRestaurantItem;
import com.gingersoft.gsa.cloud.ui.view.section.BaseTextSection;
import com.gingersoft.gsa.cloud.ui.view.section.QDSectionHeaderView; import com.gingersoft.gsa.cloud.ui.view.section.QDSectionHeaderView;
import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIDefaultStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUISection; import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter; import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import androidx.annotation.NonNull;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
......
package com.gingersoft.gsa.cloud.ui.utils
import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.constans.FunctionManagerConstans
import com.gingersoft.gsa.cloud.database.bean.Function
class BtnBuilder(var functions: List<Function>) {
companion object {
const val SureBtn = 0
const val CancelBtn = 1
const val PrintBtn = 2
const val LogisticsBtn = 3
const val AssignDeliveryBtn = 4
const val ClosingBtn = 5
const val ProductionCompletedBtn = 6
const val TransportationBtn = 7//選擇運輸工具
const val AdditionalServiceChargeBtn = 8//追加服務費
@Volatile
private var instance: BtnBuilder? = null
@JvmStatic
fun getInstance(functions: List<Function>) = instance
?: synchronized(this) {
instance
?: BtnBuilder(functions).also { instance = it }
}
}
class BtnBean(val type: Int, val btnContent: String, val btnColor: Int, val btnImg: Int)
fun getSureBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.CONFIRM_BTN_KEY, SureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getProductionCompletedBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.PRODUCTION_COMPLETED_BTN_KEY, ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getCancelBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.CANCEL_ORDER_BTN_KEY, CancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
}
fun getPrintBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.PRINT_ORDER_BTN_KEY, PrintBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
}
fun getLogisticsBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.LOGISTICS_BTN_KEY, LogisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAssignDeliveryBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.ASSIGNDELIVERY_BTN_KEY, AssignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
}
fun getClosingBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.CLOSING_BTN_KEY, ClosingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
}
fun getTransportationBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAdditionalServiceChargeBtn(): BtnBean? {
return getBtn(FunctionManagerConstans.takeaway.TRANSPORTATION_BTN_KEY, AdditionalServiceChargeBtn, "追加服務費", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
private fun getBtn(key: String, btnCode: Int, btnContent: String, btnColor: Int, btnImg: Int): BtnBean? {
for (value in functions) {
if (value.resUrl == key) {
return when {
value.status == 3 -> BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg)
// value.status == 1 -> BtnBean(btnCode, btnContent, btnColor, btnImg)
else -> BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
}
return null
// return BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
package com.gingersoft.gsa.cloud.ui.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.jess.arms.utils.DeviceUtils;
public class AddKeyBoard extends FrameLayout {
private String[] keyString = new String[]{"+10", "+20", "+50", "+100", "7", "8", "9", "X", "4", "5", "6", "1", "2", "3", "確定", "0", "00", "000"};
private float screenWidth;
private String amount = "";
private String decimal = "";
private onKeyResultListener onKeyResultListener;
public AddKeyBoard(@NonNull Context context) {
this(context, null);
}
public AddKeyBoard(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public AddKeyBoard(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
screenWidth = DeviceUtils.getScreenWidth(getContext());
RecyclerView recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL));
recyclerView.setAdapter(new KeyBoardAdapter());
addView(recyclerView);
}
public void setOnKeyResultListener(AddKeyBoard.onKeyResultListener onKeyResultListener) {
this.onKeyResultListener = onKeyResultListener;
}
private class KeyBoardAdapter extends RecyclerView.Adapter<KeyBoardAdapter.ViewHolder> {
@NonNull
@Override
public KeyBoardAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(View.inflate(parent.getContext(), R.layout.item_num_keyboard, null));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
ViewGroup.LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
holder.itemView.setOnClickListener(v -> {
if (keyString[position].contains("+")) {
long oldAmount;
if (amount.contains(".")) {
oldAmount = Long.parseLong(amount.substring(0, amount.length() - 1));
amount = (oldAmount + Integer.valueOf(keyString[position].substring(1))) + ".";
} else {
if (amount.length() <= 0) {
amount = keyString[position].substring(1);
} else {
oldAmount = Long.parseLong(amount);
amount = (oldAmount + Integer.valueOf(keyString[position].substring(1))) + "";
}
}
} else if (keyString[position].equals("X")) {
if (decimal.length() > 0) {
decimal = decimal.substring(0, decimal.length() - 1);
} else if (amount.length() > 0) {
amount = amount.substring(0, amount.length() - 1);
}
} else if (!keyString[position].equals("確定")) {
if (keyString[position].equals(".")) {
//如果是小數點
if (!amount.contains(".")) {
if (amount.length() > 0) {
amount += ".";
}
}
} else {
//不是小數點
if (amount.contains(".")) {
if (decimal.length() >= 2) {
ToastUtils.show(getContext(), "最多輸入兩位小數");
} else {
decimal += keyString[position];
}
} else {
amount += keyString[position];
}
}
}
if (keyString[position].equals("確定")) {
if (onKeyResultListener != null) {
onKeyResultListener.onResult(true, amount + decimal);
}
} else {
if (onKeyResultListener != null) {
onKeyResultListener.onResult(false, amount + decimal);
}
}
});
lp.width = (int) (screenWidth / 4);
lp.height = lp.width / 2;
if (keyString[position].equals("X") || keyString[position].equals("確定")) {
lp.height = lp.height * 2;
}
holder.layout.setLayoutParams(lp);
holder.tvKey.setText(keyString[position]);
}
@Override
public int getItemCount() {
return keyString.length;
}
private class ViewHolder extends RecyclerView.ViewHolder {
TextView tvKey;
LinearLayout layout;
public ViewHolder(@NonNull View itemView) {
super(itemView);
tvKey = itemView.findViewById(R.id.tv_keyboard);
layout = itemView.findViewById(R.id.layout);
}
}
}
public interface onKeyResultListener {
void onResult(boolean isComplete, String value);
}
}
...@@ -86,7 +86,7 @@ public class LoadingDialog { ...@@ -86,7 +86,7 @@ public class LoadingDialog {
if (mLoadingDialog == null) { if (mLoadingDialog == null) {
mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog); mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
} else if(mLoadingDialog.isShowing()){ } else if (mLoadingDialog.isShowing()) {
mLoadingDialog.dismiss(); mLoadingDialog.dismiss();
mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog); mLoadingDialog = new Dialog(context, R.style.ui_loading_dialog);
} }
...@@ -111,14 +111,18 @@ public class LoadingDialog { ...@@ -111,14 +111,18 @@ public class LoadingDialog {
* 关闭加载对话框 * 关闭加载对话框
*/ */
public static void cancelDialogForLoading() { public static void cancelDialogForLoading() {
if (animationDrawable != null) { try {
animationDrawable.stop(); if (animationDrawable != null) {
animationDrawable = null; animationDrawable.stop();
} animationDrawable = null;
if (mLoadingDialog != null) { }
mLoadingDialog.dismiss(); if (mLoadingDialog != null) {
mLoadingDialog = null; mLoadingDialog.dismiss();
mLoadingDialog = null;
}
loadingText = null;
} catch (IllegalArgumentException e) {
e.printStackTrace();
} }
loadingText = null;
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_8" />
<solid android:color="@color/close_btn_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/online_payments_bg"/>
<corners android:radius="@dimen/dp_8"/>
</shape>
\ No newline at end of file
<?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="match_parent"
android:id="@+id/layout"
android:orientation="vertical">
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_keyboard"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="+10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<include layout="@layout/include_vertical_color_ccc_dividing_line" />
</com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout>
</com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout>
\ No newline at end of file
<?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"
android:id="@+id/layout_nodata" android:id="@+id/layout_nodata"
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="@dimen/dp_10">
<ImageView
android:id="@+id/iv_launch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_toEndOf="@id/iv_launch"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ricepon pos"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:text="外賣接單服務"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<Button
android:id="@+id/btn_stop_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:background="@drawable/shape_cloas_btn"
android:text="停止接單"
android:textColor="@color/white"
android:textSize="@dimen/dp_14" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_list_popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
</LinearLayout>
\ No newline at end of file
...@@ -152,4 +152,58 @@ ...@@ -152,4 +152,58 @@
<string name="edit_digits_number_words">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</string> <string name="edit_digits_number_words">0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</string>
<string name="print_split_line">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </string> <string name="print_split_line">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </string>
<!--外送/自取 凍鏈-->
<string name="history_order">歷史訂單</string>
<string name="tab_text_1">全部</string>
<string name="tab_text_2">待確認</string>
<string name="tab_text_3">製作中</string>
<string name="tab_text_4">送貨中</string>
<string name="tab_text_5">待取餐</string>
<string name="order_receiving_timeout">接單超時</string>
<string name="logistics_informed">已通知物流</string>
<string name="slash">/</string>
<string name="minus_amount_unit">-$</string>
<string name="count">x</string>
<string name="normal">正常</string>
<string name="rest">休息</string>
<string name="open">營業中</string>
<string name="resting">休息中</string>
<string name="order_no">訂單編號:</string>
<string name="deliveryman">送貨員:</string>
<string name="deliveryman_phone">送貨員手機號:</string>
<string name="logistics_number">物流號:</string>
<string name="take_food_code_omit">----</string>
<string name="receiving_telephone">收貨電話:</string>
<string name="reserved_telephone">預留電話:</string>
<string name="receiving_time">收貨時間:</string>
<string name="self_taking_time">自取時間:</string>
<string name="receiving_address">收貨地址:</string>
<string name="meal_code">取餐碼:</string>
<string name="address">地\u3000址:</string>
<string name="table_number">檯號:</string>
<string name="self">自取</string>
<string name="takeaway">外送</string>
<string name="order_number">單號:</string>
<string name="create_order_time">下單時間:</string>
<string name="remark">備註:</string>
<string name="h5_order">H5訂單</string>
<string name="ricepon_order">ricepon訂單</string>
<string name="left_parenthesis"></string>
<string name="right_parenthesis"></string>
<string name="delivery_type">配送類型:</string>
<string name="delivery_expenses">配送費範圍:</string>
<string name="delivery_fee">最低消費:</string>
<string name="delivery_method">配送方式:</string>
<string name="delivery_difference">補差價:</string>
</resources> </resources>
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
<item name="android:backgroundDimEnabled">true</item><!--背景遮罩效果--> <item name="android:backgroundDimEnabled">true</item><!--背景遮罩效果-->
</style> </style>
<!-- <style name="AppTheme" parent="PublicTheme">--> <!-- <style name="AppTheme" parent="PublicTheme">-->
<!-- <item name="QMUITopBarStyle">@style/QDTopBar</item>--> <!-- <item name="QMUITopBarStyle">@style/QDTopBar</item>-->
<!-- <item name="QMUITabSegmentStyle">@style/QMUITabSegmentStyle</item>--> <!-- <item name="QMUITabSegmentStyle">@style/QMUITabSegmentStyle</item>-->
<!-- </style>--> <!-- </style>-->
<style name="PublicTheme" parent="QMUI.Compat.NoActionBar"> <style name="PublicTheme" parent="QMUI.Compat.NoActionBar">
<!-- 必須配置app自己的theme --> <!-- 必須配置app自己的theme -->
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
<!--固体蓝RoundButton --> <!--固体蓝RoundButton -->
<style name="RoundButton.One"> <style name="RoundButton.One">
<item name="android:layout_height">30dp</item> <item name="android:layout_height">@dimen/dp_30</item>
<item name="android:textColor">@color/theme_white_color</item> <item name="android:textColor">@color/theme_white_color</item>
<item name="btnSolidColor">@color/theme_color</item> <item name="btnSolidColor">@color/theme_color</item>
<item name="btnCornerRadius">@dimen/normal_space5</item> <item name="btnCornerRadius">@dimen/normal_space5</item>
...@@ -303,34 +303,110 @@ ...@@ -303,34 +303,110 @@
<item name="android:textColor">@color/theme_hint_color</item> <item name="android:textColor">@color/theme_hint_color</item>
</style> </style>
<!-- <style name="MySwitcher">--> <!-- <style name="MySwitcher">-->
<!-- <item name="switcherBtn_width">@dimen/dp_46</item>--> <!-- <item name="switcherBtn_width">@dimen/dp_46</item>-->
<!-- <item name="switcherBtn_height">@dimen/dp_26</item>--> <!-- <item name="switcherBtn_height">@dimen/dp_26</item>-->
<!-- <item name="switcherBtn_on_color">@color/switcher_on_color</item>--> <!-- <item name="switcherBtn_on_color">@color/switcher_on_color</item>-->
<!-- <item name="switcherBtn_off_color">@color/switcher_off_color</item>--> <!-- <item name="switcherBtn_off_color">@color/switcher_off_color</item>-->
<!-- <item name="switcherBtn_icon_color">@color/switcher_icon_color</item>--> <!-- <item name="switcherBtn_icon_color">@color/switcher_icon_color</item>-->
<!-- <item name="elevation">@dimen/switcher_elevation</item>--> <!-- <item name="elevation">@dimen/switcher_elevation</item>-->
<!-- </style>--> <!-- </style>-->
<style name="font_style_twelve"> <style name="font_style_twelve">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_12</item> <item name="android:textSize">@dimen/dp_12</item>
</style> </style>
<style name="font_style_fourteen"> <style name="font_style_fourteen">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_14</item> <item name="android:textSize">@dimen/dp_14</item>
</style> </style>
<style name="font_style_sixteen"> <style name="font_style_sixteen">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_16</item> <item name="android:textSize">@dimen/dp_16</item>
</style> </style>
<style name="font_style_eighteen"> <style name="font_style_eighteen">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_18</item> <item name="android:textSize">@dimen/dp_18</item>
</style> </style>
<style name="font_style_twenty"> <style name="font_style_twenty">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_20</item> <item name="android:textSize">@dimen/dp_20</item>
</style> </style>
<style name="app_btn_style">
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/white</item>
<item name="android:layout_height">@dimen/button_height</item>
<item name="android:background">@drawable/shape_app_btn</item>
</style>
<!--————————————————————外送/自取模塊 凍鏈模塊共用樣式————————————————————-->
<!-- 彈窗_收貨標題字體樣式-->
<style name="otherOrderReceiving_title_textStyle">
<item name="android:textColor">@color/color_50</item>
<item name="android:textSize">@dimen/dp_16</item>
</style>
<!-- 彈窗_收貨標題信息字體樣式-->
<style name="otherOrderReceiving_information_textStyle">
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textStyle">bold</item>
</style>
<!-- 彈窗_金額標題字體樣式-->
<style name="otherOrder_bill_textStyle">
<item name="android:textColor">@color/color_3c</item>
<item name="android:textSize">@dimen/dp_16</item>
</style>
<style name="otherOrder_bill_info_textStyle">
<item name="android:textColor">@color/color_3c</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textStyle">bold</item>
</style>
<!-- 訂單列表item的訂單信息名稱字體樣式-->
<style name="otherOrder_item_info_title_textStyle">
<item name="android:textColor">@color/theme_text_color</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的訂單信息字體樣式-->
<style name="otherOrder_item_info_textStyle">
<item name="android:textColor">@color/color_86</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的下單時間字體樣式-->
<style name="otherOrder_item_create_time_textStyle">
<item name="android:textColor">@color/color_66</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 餐廳營業狀態按鈕樣式-->
<style name="otherOrder_restaurant_state_style">
<item name="android:layout_width">@dimen/dp_80</item>
<item name="android:layout_height">@dimen/dp_28</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingLeft">@dimen/dp_8</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_14</item>
</style>
<style name="otherOrder_delivery_setting_layout_style">
<item name="android:paddingRight">@dimen/dp_20</item>
</style>
<style name="otherOrder_details_sixteen_text_Style">
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="otherOrder_details_twelve_text_Style">
<item name="android:textSize">@dimen/dp_12</item>
<item name="android:textColor">@color/color_3c</item>
</style>
</resources> </resources>
...@@ -37,6 +37,7 @@ dependencies { ...@@ -37,6 +37,7 @@ dependencies {
annotationProcessor rootProject.ext.dependencies["butterknife-compiler"] annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
// annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]//依赖插件 // annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]//依赖插件
implementation rootProject.ext.dependencies["multidex"] implementation rootProject.ext.dependencies["multidex"]
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["constraintlayout"] implementation rootProject.ext.dependencies["constraintlayout"]
implementation 'org.jetbrains:annotations:15.0' implementation 'org.jetbrains:annotations:15.0'
//日誌管理 //日誌管理
......
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// 避免 lint 检测出错时停止构建
lintOptions {
abortOnError false
}
defaultConfig {
if (project.ext.runAsApp) {
applicationId "com.gingersoft.coldchain_module"
}
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dataBinding {
enabled = true
}
resourcePrefix "coldChain"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
kapt rootProject.ext.dependencies["dagger2-compiler"]
kapt rootProject.ext.dependencies["butterknife-compiler"]
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapter"]
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.coldchain_module">
<application>
<activity android:name=".mvp.ui.activity.OrderDetailsActivity"/>
<activity android:name=".mvp.ui.activity.SupplementOrderActivity" />
<activity android:name=".mvp.ui.activity.ColdChainMainActivity"/>
<activity android:name=".mvp.ui.activity.HistoryActivity"/>
<!-- arms配置 -->
<meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value="ConfigModule" />
</application>
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.coldchain_module">
<!-- 8.0必要权限 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- 8.0必要权限 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<application
android:name="com.gingersoft.gsa.cloud.base.application.GsaCloudApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_android">
<activity android:name=".mvp.ui.activity.HistoryActivity"/>
<activity android:name=".mvp.ui.activity.OrderDetailsActivity" />
<activity android:name=".mvp.ui.activity.SupplementOrderActivity" />
<activity android:name=".mvp.ui.activity.ColdChainMainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
package com.gingersoft.coldchain_module;
import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication;
/**
* Created by Wyh on 2020/1/7.
*/
public class MyApp extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
<resources>
<string name="app_name">凍鏈</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="user_register_AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimary</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
\ No newline at end of file
package com.gingersoft.coldchain_module;
import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.coldchain_module.mvp.ui.activity.ColdChainMainActivity;
public class ComponentColdChain implements IComponent {
@Override
public String getName() {
//组件的名称,调用此组件的方式:
// CC.obtainBuilder("ComponentA")...build().callAsync()
return "Component.ColdChain";
}
/**
* 组件被调用时的入口
* 要确保每个逻辑分支都会调用到CC.sendCCResult,
* 包括try-catch,if-else,switch-case-default,startActivity
*
* @param cc 组件调用对象,可从此对象中获取相关信息
* @return true:将异步调用CC.sendCCResult(...),用于异步实现相关功能,例如:文件加载、网络请求等
* false:会同步调用CC.sendCCResult(...),即在onCall方法return之前调用,否则将被视为不合法的实现
*/
@Override
public boolean onCall(CC cc) {
String actionName = cc.getActionName();
switch (actionName) {
case "Component.ColdChain":
openActivity(cc);
break;
default:
//这个逻辑分支上没有调用CC.sendCCResult(...),是一种错误的示例
//并且方法的返回值为false,代表不会异步调用CC.sendCCResult(...)
//在LocalCCInterceptor中将会返回错误码为-10的CCResult
break;
}
return false;
}
private void getInfo(CC cc) {
String userName = "billy";
CC.sendCCResult(cc.getCallId(), CCResult.success("userName", userName));
}
private void openActivity(CC cc) {
CCUtil.navigateTo(cc, ColdChainMainActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success());
}
}
package com.gingersoft.coldchain_module.di.component;
import com.gingersoft.coldchain_module.di.module.ColdChainMainModule;
import com.gingersoft.coldchain_module.mvp.ui.activity.ColdChainMainActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Component;
@ActivityScope
@Component(modules = ColdChainMainModule.class, dependencies = AppComponent.class)
public interface ColdChainMainComponent {
void inject(ColdChainMainActivity activity);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.component;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.coldchain_module.di.module.HistoryModule;
import com.jess.arms.di.scope.ActivityScope;
import com.gingersoft.coldchain_module.mvp.ui.activity.HistoryActivity;
@ActivityScope
@Component(modules = HistoryModule.class, dependencies = AppComponent.class)
public interface HistoryComponent {
void inject(HistoryActivity activity);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.component;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.coldchain_module.di.module.HistoryOrderModule;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.coldchain_module.mvp.ui.fragment.HistoryOrderFragment;
@FragmentScope
@Component(modules = HistoryOrderModule.class, dependencies = AppComponent.class)
public interface HistoryOrderComponent {
void inject(HistoryOrderFragment fragment);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.component;
import com.gingersoft.coldchain_module.di.module.OrderDetailsModule;
import com.gingersoft.coldchain_module.mvp.ui.activity.OrderDetailsActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Component;
@ActivityScope
@Component(modules = OrderDetailsModule.class, dependencies = AppComponent.class)
public interface OrderDetailsComponent {
void inject(OrderDetailsActivity activity);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.component;
import com.gingersoft.coldchain_module.di.module.OrderListModule;
import com.gingersoft.coldchain_module.mvp.ui.fragment.OrderListFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Component;
@FragmentScope
@Component(modules = OrderListModule.class, dependencies = AppComponent.class)
public interface OrderListComponent {
void inject(OrderListFragment fragment);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.component;
import com.gingersoft.coldchain_module.di.module.SupplementOrderModule;
import com.gingersoft.coldchain_module.mvp.ui.activity.SupplementOrderActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Component;
@ActivityScope
@Component(modules = SupplementOrderModule.class, dependencies = AppComponent.class)
public interface SupplementOrderComponent {
void inject(SupplementOrderActivity activity);
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract;
import com.gingersoft.coldchain_module.mvp.model.ColdChainMainModel;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
@Module
public class ColdChainMainModule {
private ColdChainMainContract.View view;
/**
* 构建MainModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public ColdChainMainModule(ColdChainMainContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
ColdChainMainContract.View provideMainView() {
return this.view;
}
@ActivityScope
@Provides
ColdChainMainContract.Model provideMainModel(ColdChainMainModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.gingersoft.coldchain_module.mvp.contract.HistoryContract;
import com.gingersoft.coldchain_module.mvp.model.HistoryModel;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
@Module
public class HistoryModule {
private HistoryContract.View view;
/**
* 构建HistoryModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public HistoryModule(HistoryContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
HistoryContract.View provideHistoryView() {
return this.view;
}
@ActivityScope
@Provides
HistoryContract.Model provideHistoryModel(HistoryModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.coldchain_module.mvp.contract.HistoryOrderContract;
import com.gingersoft.coldchain_module.mvp.model.HistoryOrderModel;
@Module
public class HistoryOrderModule {
private HistoryOrderContract.View view;
/**
* 构建HistoryOrderModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public HistoryOrderModule(HistoryOrderContract.View view) {
this.view = view;
}
@FragmentScope
@Provides
HistoryOrderContract.View provideHistoryOrderView() {
return this.view;
}
@FragmentScope
@Provides
HistoryOrderContract.Model provideHistoryOrderModel(HistoryOrderModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract;
import com.gingersoft.coldchain_module.mvp.model.OrderDetailsModel;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
@Module
public class OrderDetailsModule {
private OrderDetailsContract.View view;
/**
* 构建OrderDetailsModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public OrderDetailsModule(OrderDetailsContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
OrderDetailsContract.View provideOrderDetailsView() {
return this.view;
}
@ActivityScope
@Provides
OrderDetailsContract.Model provideOrderDetailsModel(OrderDetailsModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
import com.gingersoft.coldchain_module.mvp.model.OrderListModel;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Module;
import dagger.Provides;
@Module
public class OrderListModule {
private OrderListContract.View view;
/**
* 构建OrderListModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public OrderListModule(OrderListContract.View view) {
this.view = view;
}
@FragmentScope
@Provides
OrderListContract.View provideOrderListView() {
return this.view;
}
@FragmentScope
@Provides
OrderListContract.Model provideOrderListModel(OrderListModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.di.module;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.SupplementOrderModel;
import com.jess.arms.di.scope.ActivityScope;
import dagger.Module;
import dagger.Provides;
@Module
public class SupplementOrderModule {
private SupplementOrderContract.View view;
/**
* 构建SupplementOrderModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
*
* @param view
*/
public SupplementOrderModule(SupplementOrderContract.View view) {
this.view = view;
}
@ActivityScope
@Provides
SupplementOrderContract.View provideSupplementOrderView() {
return this.view;
}
@ActivityScope
@Provides
SupplementOrderContract.Model provideSupplementOrderModel(SupplementOrderModel model) {
return model;
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.constans;
public class ColdChainConstans {
public static final int orderType = 8;
//訂單狀態:已確認
public static final int ORDER_CONFIRMED = 2;
//本地定義常量
//物流已取消
public static final int LOGISTICS_CANCELLED = -2;
//訂單已取消
public static final int ORDER_CANCELLED = -3;
//訂單已讀
public static final int ORDER_READ = -4;
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.bean.PickUpBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface ColdChainMainContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadNumber(SupplementInfoBean bean);
void loadBalance(double price, double bond,boolean isBlink);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存getOrderList(@Body RequestBody requestBody);
interface Model extends IModel {
Observable<OrderList> getOrderList(RequestBody requestBody);
Observable<SupplementInfoBean> getNumByOrderType(RequestBody requestBody);
Observable<PickUpBean> pickUp(RequestBody requestBody);
Observable<BalanceBean> getBalance(String brandId);
}
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface HistoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadData();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<String> getHistoryOrderList(RequestBody requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface HistoryOrderContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<String> getHistoryOrderList(RequestBody requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ReadBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.io.File;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface OrderDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadOrderDetails(OrderDetails.DataBean bean);
void printLogisticsList(File file);
void updateOrderState(int state);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<OrderDetails> findOrderDetails(RequestBody requestBody);
Observable<ShipAnyOrdersNewBean> thirdDelivery(RequestBody requestBody);
Observable<UpdateOrderStatusBean> updateOrderStatus(RequestBody requestBody);
Observable<CancelLogisticsBean> cancelLogistics(RequestBody requestBody);
Observable<ReadBean> setIsRead(RequestBody requestBody);
Observable<String> addPrj(RequestBody requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface OrderListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadOrderList(List<OrderList.DataBeanX.DataBean> data);
void notifyByPosition(int position, OrderList.DataBeanX.DataBean dataBean);
void removeItem(int position);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<OrderList> getOrderList(RequestBody requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.contract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementResultBean;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface SupplementOrderContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadNumber(SupplementInfoBean bean);
void submissionComplete();
void submissionFail();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<SupplementInfoBean> getNumByOrderType(RequestBody requestBody);
Observable<SupplementResultBean> submitOrder(RequestBody requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract;
import com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.bean.PickUpBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.service.ColdChainService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope
public class ColdChainMainModel extends BaseModel implements ColdChainMainContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public ColdChainMainModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<OrderList> getOrderList(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getOrderList(requestBody);
}
@Override
public Observable<SupplementInfoBean> getNumByOrderType(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getNumByOrderType(requestBody);
}
@Override
public Observable<PickUpBean> pickUp(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).pickUp(requestBody);
}
@Override
public Observable<BalanceBean> getBalance(String brandId) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getBalance(brandId);
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.HistoryContract;
import com.gingersoft.coldchain_module.mvp.model.service.ColdChainService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope
public class HistoryModel extends BaseModel implements HistoryContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public HistoryModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<String> getHistoryOrderList(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getHistoryOrderList(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.HistoryOrderContract;
import com.gingersoft.coldchain_module.mvp.model.service.ColdChainService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@FragmentScope
public class HistoryOrderModel extends BaseModel implements HistoryOrderContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public HistoryOrderModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<String> getHistoryOrderList(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getHistoryOrderList(requestBody);
}
}
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract;
import com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ReadBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.coldchain_module.mvp.model.service.OrderDetailService;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope
public class OrderDetailsModel extends BaseModel implements OrderDetailsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public OrderDetailsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<OrderDetails> findOrderDetails(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).findOrderDetails(requestBody);
}
@Override
public Observable<ShipAnyOrdersNewBean> thirdDelivery(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).thirdDelivery(requestBody);
}
@Override
public Observable<UpdateOrderStatusBean> updateOrderStatus(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).gsUpdateOrderStatus(requestBody);
}
@Override
public Observable<CancelLogisticsBean> cancelLogistics(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).cancelLogistics(requestBody);
}
@Override
public Observable<ReadBean> setIsRead(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).setIsRead(requestBody);
}
@Override
public Observable<String> addPrj(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(OrderDetailService.class).addPrj(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.service.ColdChainService;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@FragmentScope
public class OrderListModel extends BaseModel implements OrderListContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public OrderListModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<OrderList> getOrderList(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getOrderList(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementResultBean;
import com.gingersoft.coldchain_module.mvp.model.service.ColdChainService;
import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@ActivityScope
public class SupplementOrderModel extends BaseModel implements SupplementOrderContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SupplementOrderModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<SupplementInfoBean> getNumByOrderType(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).getNumByOrderType(requestBody);
}
@Override
public Observable<SupplementResultBean> submitOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(ColdChainService.class).submitOrder(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model.bean;
public class BalanceBean {
/**
* id : 72
* brandId : 171
* balance : 818.0
* bond : 500.0
* threshold : 0.0
* telephone :
* updateTime : 1598426640164
* createTime : 1598426640164
* updateUid : 341
* createUid : 341
* deletes : 0
*/
private int id;
private int brandId;
private double balance;
private double bond;
private double threshold;
private String telephone;
private long updateTime;
private long createTime;
private int updateUid;
private int createUid;
private int deletes;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getBrandId() {
return brandId;
}
public void setBrandId(int brandId) {
this.brandId = brandId;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public double getBond() {
return bond;
}
public void setBond(double bond) {
this.bond = bond;
}
public double getThreshold() {
return threshold;
}
public void setThreshold(double threshold) {
this.threshold = threshold;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public int getUpdateUid() {
return updateUid;
}
public void setUpdateUid(int updateUid) {
this.updateUid = updateUid;
}
public int getCreateUid() {
return createUid;
}
public void setCreateUid(int createUid) {
this.createUid = createUid;
}
public int getDeletes() {
return deletes;
}
public void setDeletes(int deletes) {
this.deletes = deletes;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
public class CancelLogisticsBean {
private boolean success;
private String errCode;
private String errMsg;
private long sysTime;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
public class FoodDetailsTranBean {
private String odsId;
private String PRICE;
private String num;
private String pid;
private String PRODUCT_NAME;
public FoodDetailsTranBean(String odsId, String PRICE, String num, String pid, String PRODUCT_NAME) {
this.odsId = odsId;
this.PRICE = PRICE;
this.num = num;
this.pid = pid;
this.PRODUCT_NAME = PRODUCT_NAME;
}
public static FoodDetailsTranBean getByPRODUCTNAMEBean(OrderDetails.DataBean.PRODUCTNAMEBean bean) {
return new FoodDetailsTranBean(bean.getOdsId(), bean.getPRICE(), bean.getNum(), bean.getPid(), bean.getPRODUCT_NAME());
}
public static FoodDetailsTranBean getByChildBeanX(OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX bean) {
return new FoodDetailsTranBean(bean.getOdsId(), bean.getPRICE(), bean.getNum(), bean.getPid(), bean.getPRODUCT_NAME());
}
public static FoodDetailsTranBean getByChildBean(OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX.ChildBean bean) {
return new FoodDetailsTranBean(bean.getOdsId(), bean.getPRICE(), bean.getNum(), bean.getPid(), bean.getPRODUCT_NAME());
}
public String getOdsId() {
return odsId;
}
public void setOdsId(String odsId) {
this.odsId = odsId;
}
public String getPRICE() {
return PRICE;
}
public void setPRICE(String PRICE) {
this.PRICE = PRICE;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getPRODUCT_NAME() {
return PRODUCT_NAME;
}
public void setPRODUCT_NAME(String PRODUCT_NAME) {
this.PRODUCT_NAME = PRODUCT_NAME;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
import java.util.List;
public class OrderList {
/**
* success : true
* sysTime : 1598351454426
* data : {"data":[{"MEMBER_NAME":"逗我","ADDRESS_DETAIL":"香港香港仔青年家园","PHONE":"13026680931","isRead":1,"orderPayType":1,"ORDER_NO":"26203823432222770","sendTime":"盡快送達 預計 19:32-19:57","STATUS":2,"PAY_AMOUNT":30,"trkNo":"FD2020081856252620","Id":11121377,"CREATE_TIME":"Aug 18, 2020 6:59:36 PM","takeFoodCode":"0737","order_type":2,"RECEIVER":"敏 先生","waimaiSendTime":"盡快送達 預計 19:32-19:57"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26205743356443954","sendTime":"盡快送達 預計 19:57-20:22","STATUS":3,"PAY_AMOUNT":32.9,"trkNo":"FD2020081352696912","Id":11119841,"CREATE_TIME":"Aug 13, 2020 6:57:56 PM","takeFoodCode":"0721","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:57-20:22"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26203713370942952","sendTime":"盡快送達 預計 19:35-20:00","STATUS":3,"PAY_AMOUNT":32.9,"trkNo":"FD2020081352740270","Id":11119811,"CREATE_TIME":"Aug 13, 2020 6:35:59 PM","takeFoodCode":"0720","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:35-20:00"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26200283308946163","sendTime":"盡快送達 預計 19:26-19:51","STATUS":2,"PAY_AMOUNT":32.9,"trkNo":"FD2020081321241332","Id":11119795,"CREATE_TIME":"Aug 13, 2020 6:26:06 PM","takeFoodCode":"0719","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:26-19:51"},{"MEMBER_NAME":"逗我","ADDRESS_DETAIL":"香港香港仔青年家园","PHONE":"13026680931","isRead":1,"orderPayType":1,"ORDER_NO":"26201693329940218","sendTime":"盡快送達 預計 12:57-13:22","STATUS":3,"PAY_AMOUNT":20,"Id":11119288,"CREATE_TIME":"Aug 13, 2020 11:57:27 AM","takeFoodCode":"0718","order_type":2,"RECEIVER":"敏 先生","waimaiSendTime":"盡快送達 預計 12:57-13:22"},{"ADDRESS_DETAIL":"","takeTime":"08-07 (週五)立即","PHONE":"18576673683","isRead":1,"orderPayType":1,"ORDER_NO":"26200843215151083","sendTime":"","STATUS":3,"PAY_AMOUNT":54.3,"Id":11117364,"CREATE_TIME":"Aug 7, 2020 3:17:33 PM","takeFoodCode":"T107","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 7, 2020 3:17:32 PM"},{"MEMBER_NAME":"梁任东","ADDRESS_DETAIL":"","takeTime":"08-07 (週五)立即","PHONE":"18665823617","isRead":1,"orderPayType":1,"ORDER_NO":"26200653245950329","sendTime":"","STATUS":3,"PAY_AMOUNT":30,"Id":11117343,"CREATE_TIME":"Aug 7, 2020 11:17:35 AM","takeFoodCode":"ML18","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 7, 2020 11:17:35 AM"},{"ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"15073379600","isRead":1,"orderPayType":1,"ORDER_NO":"26200353220341585","sendTime":"","STATUS":3,"PAY_AMOUNT":11.4,"Id":11117332,"CREATE_TIME":"Aug 6, 2020 8:08:22 PM","takeFoodCode":"V925","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 8:08:21 PM"},{"MEMBER_NAME":"stefan","ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"18520231413","isRead":1,"orderPayType":1,"ORDER_NO":"26200003200944097","sendTime":"","STATUS":3,"PAY_AMOUNT":0.1,"Id":11117330,"CREATE_TIME":"Aug 6, 2020 8:00:20 PM","takeFoodCode":"WA31","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 8:00:19 PM"},{"MEMBER_NAME":"stefan","ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"18520231413","isRead":1,"orderPayType":1,"ORDER_NO":"26201743242349492","sendTime":"","STATUS":3,"PAY_AMOUNT":0.1,"Id":11117329,"CREATE_TIME":"Aug 6, 2020 7:34:27 PM","takeFoodCode":"LPY4","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 7:34:27 PM"},{"MaxOrder":4225,"numHistory":224,"maxOrderSelf":2599,"num":1,"orderType_7":{"typeTotalAmount":"986.9","typeDayOrderNum":25},"sumSelfNum":2680,"selflNum":21,"orderType_2":{"typeTotalAmount":"21433.2","typeDayOrderNum":7},"totalAmount":"22420.1","selflNumHistory":81,"dayOrderNum":32,"sumNum":4449,"Open_Status":"1"}],"count":0,"page":{"pageIndex":1,"pageSize":10,"pageCount":0,"totalCount":49}}
*/
private boolean success;
private long sysTime;
private DataBeanX 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 DataBeanX getData() {
return data;
}
public void setData(DataBeanX data) {
this.data = data;
}
public static class DataBeanX {
/**
* data : [{"MEMBER_NAME":"逗我","ADDRESS_DETAIL":"香港香港仔青年家园","PHONE":"13026680931","isRead":1,"orderPayType":1,"ORDER_NO":"26203823432222770","sendTime":"盡快送達 預計 19:32-19:57","STATUS":2,"PAY_AMOUNT":30,"trkNo":"FD2020081856252620","Id":11121377,"CREATE_TIME":"Aug 18, 2020 6:59:36 PM","takeFoodCode":"0737","order_type":2,"RECEIVER":"敏 先生","waimaiSendTime":"盡快送達 預計 19:32-19:57"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26205743356443954","sendTime":"盡快送達 預計 19:57-20:22","STATUS":3,"PAY_AMOUNT":32.9,"trkNo":"FD2020081352696912","Id":11119841,"CREATE_TIME":"Aug 13, 2020 6:57:56 PM","takeFoodCode":"0721","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:57-20:22"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26203713370942952","sendTime":"盡快送達 預計 19:35-20:00","STATUS":3,"PAY_AMOUNT":32.9,"trkNo":"FD2020081352740270","Id":11119811,"CREATE_TIME":"Aug 13, 2020 6:35:59 PM","takeFoodCode":"0720","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:35-20:00"},{"MEMBER_NAME":"宇航","ADDRESS_DETAIL":"香港長沙灣青山道479A號暂时难以","PHONE":"18384840551","isRead":1,"orderPayType":1,"ORDER_NO":"26200283308946163","sendTime":"盡快送達 預計 19:26-19:51","STATUS":2,"PAY_AMOUNT":32.9,"trkNo":"FD2020081321241332","Id":11119795,"CREATE_TIME":"Aug 13, 2020 6:26:06 PM","takeFoodCode":"0719","order_type":2,"RECEIVER":"KN95 先生","waimaiSendTime":"盡快送達 預計 19:26-19:51"},{"MEMBER_NAME":"逗我","ADDRESS_DETAIL":"香港香港仔青年家园","PHONE":"13026680931","isRead":1,"orderPayType":1,"ORDER_NO":"26201693329940218","sendTime":"盡快送達 預計 12:57-13:22","STATUS":3,"PAY_AMOUNT":20,"Id":11119288,"CREATE_TIME":"Aug 13, 2020 11:57:27 AM","takeFoodCode":"0718","order_type":2,"RECEIVER":"敏 先生","waimaiSendTime":"盡快送達 預計 12:57-13:22"},{"ADDRESS_DETAIL":"","takeTime":"08-07 (週五)立即","PHONE":"18576673683","isRead":1,"orderPayType":1,"ORDER_NO":"26200843215151083","sendTime":"","STATUS":3,"PAY_AMOUNT":54.3,"Id":11117364,"CREATE_TIME":"Aug 7, 2020 3:17:33 PM","takeFoodCode":"T107","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 7, 2020 3:17:32 PM"},{"MEMBER_NAME":"梁任东","ADDRESS_DETAIL":"","takeTime":"08-07 (週五)立即","PHONE":"18665823617","isRead":1,"orderPayType":1,"ORDER_NO":"26200653245950329","sendTime":"","STATUS":3,"PAY_AMOUNT":30,"Id":11117343,"CREATE_TIME":"Aug 7, 2020 11:17:35 AM","takeFoodCode":"ML18","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 7, 2020 11:17:35 AM"},{"ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"15073379600","isRead":1,"orderPayType":1,"ORDER_NO":"26200353220341585","sendTime":"","STATUS":3,"PAY_AMOUNT":11.4,"Id":11117332,"CREATE_TIME":"Aug 6, 2020 8:08:22 PM","takeFoodCode":"V925","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 8:08:21 PM"},{"MEMBER_NAME":"stefan","ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"18520231413","isRead":1,"orderPayType":1,"ORDER_NO":"26200003200944097","sendTime":"","STATUS":3,"PAY_AMOUNT":0.1,"Id":11117330,"CREATE_TIME":"Aug 6, 2020 8:00:20 PM","takeFoodCode":"WA31","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 8:00:19 PM"},{"MEMBER_NAME":"stefan","ADDRESS_DETAIL":"","takeTime":"08-06 (週四)立即","PHONE":"18520231413","isRead":1,"orderPayType":1,"ORDER_NO":"26201743242349492","sendTime":"","STATUS":3,"PAY_AMOUNT":0.1,"Id":11117329,"CREATE_TIME":"Aug 6, 2020 7:34:27 PM","takeFoodCode":"LPY4","order_type":7,"RECEIVER":"","waimaiSendTime":"Aug 6, 2020 7:34:27 PM"},{"MaxOrder":4225,"numHistory":224,"maxOrderSelf":2599,"num":1,"orderType_7":{"typeTotalAmount":"986.9","typeDayOrderNum":25},"sumSelfNum":2680,"selflNum":21,"orderType_2":{"typeTotalAmount":"21433.2","typeDayOrderNum":7},"totalAmount":"22420.1","selflNumHistory":81,"dayOrderNum":32,"sumNum":4449,"Open_Status":"1"}]
* count : 0
* page : {"pageIndex":1,"pageSize":10,"pageCount":0,"totalCount":49}
*/
private int count;
private PageBean page;
private List<DataBean> data;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public PageBean getPage() {
return page;
}
public void setPage(PageBean page) {
this.page = page;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class PageBean {
/**
* pageIndex : 1
* pageSize : 10
* pageCount : 0
* totalCount : 49
*/
private int pageIndex;
private int pageSize;
private int pageCount;
private int totalCount;
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
}
public static class DataBean {
/**
* MEMBER_NAME : 逗我
* ADDRESS_DETAIL : 香港香港仔青年家园
* PHONE : 13026680931
* isRead : 1
* orderPayType : 1
* ORDER_NO : 26203823432222770
* sendTime : 盡快送達 預計 19:32-19:57
* STATUS : 2
* PAY_AMOUNT : 30.0
* trkNo : FD2020081856252620
* Id : 11121377
* CREATE_TIME : Aug 18, 2020 6:59:36 PM
* takeFoodCode : 0737
* order_type : 2
* RECEIVER : 敏 先生
* waimaiSendTime : 盡快送達 預計 19:32-19:57
* takeTime : 08-07 (週五)立即
* MaxOrder : 4225
* numHistory : 224
* maxOrderSelf : 2599
* num : 1
* orderType_7 : {"typeTotalAmount":"986.9","typeDayOrderNum":25}
* sumSelfNum : 2680
* selflNum : 21
* orderType_2 : {"typeTotalAmount":"21433.2","typeDayOrderNum":7}
* totalAmount : 22420.1
* selflNumHistory : 81
* dayOrderNum : 32.0
* sumNum : 4449
* Open_Status : 1
*/
private String MEMBER_NAME;
private String ADDRESS_DETAIL;
private String PHONE;
private int isRead = -1;
private int orderPayType;
private String ORDER_NO;
private String sendTime;
private int STATUS;
private double PAY_AMOUNT;
private String trkNo;
private int Id;
private String CREATE_TIME;
private String takeFoodCode;
private int order_type;
private String RECEIVER;
private String waimaiSendTime;
private String takeTime;
private int MaxOrder;
private int numHistory;
private int maxOrderSelf;
private int num;
private int curStat;
private OrderType7Bean orderType_7;
private int sumSelfNum;
private int selflNum;
private OrderType2Bean orderType_2;
private String totalAmount;
private int selflNumHistory;
private double dayOrderNum;
private int sumNum;
private String Open_Status;
public int getCurStat() {
return curStat;
}
public void setCurStat(int curStat) {
this.curStat = curStat;
}
public String getMEMBER_NAME() {
return MEMBER_NAME;
}
public void setMEMBER_NAME(String MEMBER_NAME) {
this.MEMBER_NAME = MEMBER_NAME;
}
public String getADDRESS_DETAIL() {
return ADDRESS_DETAIL;
}
public void setADDRESS_DETAIL(String ADDRESS_DETAIL) {
this.ADDRESS_DETAIL = ADDRESS_DETAIL;
}
public String getPHONE() {
return PHONE;
}
public void setPHONE(String PHONE) {
this.PHONE = PHONE;
}
public int getIsRead() {
return isRead;
}
public void setIsRead(int isRead) {
this.isRead = isRead;
}
public int getOrderPayType() {
return orderPayType;
}
public void setOrderPayType(int orderPayType) {
this.orderPayType = orderPayType;
}
public String getORDER_NO() {
return ORDER_NO;
}
public void setORDER_NO(String ORDER_NO) {
this.ORDER_NO = ORDER_NO;
}
public String getSendTime() {
return sendTime;
}
public void setSendTime(String sendTime) {
this.sendTime = sendTime;
}
public int getSTATUS() {
return STATUS;
}
public void setSTATUS(int STATUS) {
this.STATUS = STATUS;
}
public double getPAY_AMOUNT() {
return PAY_AMOUNT;
}
public void setPAY_AMOUNT(double PAY_AMOUNT) {
this.PAY_AMOUNT = PAY_AMOUNT;
}
public String getTrkNo() {
return trkNo;
}
public void setTrkNo(String trkNo) {
this.trkNo = trkNo;
}
public int getId() {
return Id;
}
public void setId(int Id) {
this.Id = Id;
}
public String getCREATE_TIME() {
return CREATE_TIME;
}
public void setCREATE_TIME(String CREATE_TIME) {
this.CREATE_TIME = CREATE_TIME;
}
public String getTakeFoodCode() {
return takeFoodCode;
}
public void setTakeFoodCode(String takeFoodCode) {
this.takeFoodCode = takeFoodCode;
}
public int getOrder_type() {
return order_type;
}
public void setOrder_type(int order_type) {
this.order_type = order_type;
}
public String getRECEIVER() {
return RECEIVER;
}
public void setRECEIVER(String RECEIVER) {
this.RECEIVER = RECEIVER;
}
public String getWaimaiSendTime() {
return waimaiSendTime;
}
public void setWaimaiSendTime(String waimaiSendTime) {
this.waimaiSendTime = waimaiSendTime;
}
public String getTakeTime() {
return takeTime;
}
public void setTakeTime(String takeTime) {
this.takeTime = takeTime;
}
public int getMaxOrder() {
return MaxOrder;
}
public void setMaxOrder(int MaxOrder) {
this.MaxOrder = MaxOrder;
}
public int getNumHistory() {
return numHistory;
}
public void setNumHistory(int numHistory) {
this.numHistory = numHistory;
}
public int getMaxOrderSelf() {
return maxOrderSelf;
}
public void setMaxOrderSelf(int maxOrderSelf) {
this.maxOrderSelf = maxOrderSelf;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public OrderType7Bean getOrderType_7() {
return orderType_7;
}
public void setOrderType_7(OrderType7Bean orderType_7) {
this.orderType_7 = orderType_7;
}
public int getSumSelfNum() {
return sumSelfNum;
}
public void setSumSelfNum(int sumSelfNum) {
this.sumSelfNum = sumSelfNum;
}
public int getSelflNum() {
return selflNum;
}
public void setSelflNum(int selflNum) {
this.selflNum = selflNum;
}
public OrderType2Bean getOrderType_2() {
return orderType_2;
}
public void setOrderType_2(OrderType2Bean orderType_2) {
this.orderType_2 = orderType_2;
}
public String getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(String totalAmount) {
this.totalAmount = totalAmount;
}
public int getSelflNumHistory() {
return selflNumHistory;
}
public void setSelflNumHistory(int selflNumHistory) {
this.selflNumHistory = selflNumHistory;
}
public double getDayOrderNum() {
return dayOrderNum;
}
public void setDayOrderNum(double dayOrderNum) {
this.dayOrderNum = dayOrderNum;
}
public int getSumNum() {
return sumNum;
}
public void setSumNum(int sumNum) {
this.sumNum = sumNum;
}
public String getOpen_Status() {
return Open_Status;
}
public void setOpen_Status(String Open_Status) {
this.Open_Status = Open_Status;
}
public static class OrderType7Bean {
/**
* typeTotalAmount : 986.9
* typeDayOrderNum : 25
*/
private String typeTotalAmount;
private int typeDayOrderNum;
public String getTypeTotalAmount() {
return typeTotalAmount;
}
public void setTypeTotalAmount(String typeTotalAmount) {
this.typeTotalAmount = typeTotalAmount;
}
public int getTypeDayOrderNum() {
return typeDayOrderNum;
}
public void setTypeDayOrderNum(int typeDayOrderNum) {
this.typeDayOrderNum = typeDayOrderNum;
}
}
public static class OrderType2Bean {
/**
* typeTotalAmount : 21433.2
* typeDayOrderNum : 7
*/
private String typeTotalAmount;
private int typeDayOrderNum;
public String getTypeTotalAmount() {
return typeTotalAmount;
}
public void setTypeTotalAmount(String typeTotalAmount) {
this.typeTotalAmount = typeTotalAmount;
}
public int getTypeDayOrderNum() {
return typeDayOrderNum;
}
public void setTypeDayOrderNum(int typeDayOrderNum) {
this.typeDayOrderNum = typeDayOrderNum;
}
}
}
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
public class PickUpBean {
private boolean success;
private String errCode;
private String errorMsg;
private long sysTime;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
public class ReadBean {
private boolean success;
private long sysTime;
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;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
public class ShipAnyOrdersNewBean {
/**
* success : true
* sysTime : 1598498310257
* data : {"uid":"db0a39a9-9a0b-4c60-8a0c-6135b0a46aa7","ctime":1598469507642,"lUpd":1598469507642,"mchUid":"325764d7-b2e2-4d8b-9a68-7f4473719f9c","mchShipanyCommn":0,"curStat":"Pickup Request Sent","createTime":1598498310200,"restaurantId":153,"orderId":11121726,"isDelete":0,"updateTime":1598498310200,"delivery_man_name":"","delivery_man_phone_num":"","takeFoodCode":"0964","lab_url":""}
*/
private boolean success;
private long sysTime;
private DataBean data;
/**
* errCode : -1
* errMsg : 賬戶餘額不足
*/
private String errCode;
private String errMsg;
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 DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public static class DataBean {
/**
* uid : db0a39a9-9a0b-4c60-8a0c-6135b0a46aa7
* ctime : 1598469507642
* lUpd : 1598469507642
* mchUid : 325764d7-b2e2-4d8b-9a68-7f4473719f9c
* mchShipanyCommn : 0.0
* curStat : Pickup Request Sent
* createTime : 1598498310200
* restaurantId : 153
* orderId : 11121726
* isDelete : 0
* updateTime : 1598498310200
* delivery_man_name :
* delivery_man_phone_num :
* takeFoodCode : 0964
* lab_url :
*/
private String uid;
private long ctime;
private long lUpd;
private String mchUid;
private double mchShipanyCommn;
private String curStat;
private long createTime;
private int restaurantId;
private int orderId;
private int isDelete;
private long updateTime;
private String delivery_man_name;
private String delivery_man_phone_num;
private String takeFoodCode;
private String lab_url;//打印文檔下載鏈接
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public long getCtime() {
return ctime;
}
public void setCtime(long ctime) {
this.ctime = ctime;
}
public long getLUpd() {
return lUpd;
}
public void setLUpd(long lUpd) {
this.lUpd = lUpd;
}
public String getMchUid() {
return mchUid;
}
public void setMchUid(String mchUid) {
this.mchUid = mchUid;
}
public double getMchShipanyCommn() {
return mchShipanyCommn;
}
public void setMchShipanyCommn(double mchShipanyCommn) {
this.mchShipanyCommn = mchShipanyCommn;
}
public String getCurStat() {
return curStat;
}
public void setCurStat(String curStat) {
this.curStat = curStat;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public int getRestaurantId() {
return restaurantId;
}
public void setRestaurantId(int restaurantId) {
this.restaurantId = restaurantId;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public String getDelivery_man_name() {
return delivery_man_name;
}
public void setDelivery_man_name(String delivery_man_name) {
this.delivery_man_name = delivery_man_name;
}
public String getDelivery_man_phone_num() {
return delivery_man_phone_num;
}
public void setDelivery_man_phone_num(String delivery_man_phone_num) {
this.delivery_man_phone_num = delivery_man_phone_num;
}
public String getTakeFoodCode() {
return takeFoodCode;
}
public void setTakeFoodCode(String takeFoodCode) {
this.takeFoodCode = takeFoodCode;
}
public String getLab_url() {
return lab_url;
}
public void setLab_url(String lab_url) {
this.lab_url = lab_url;
}
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
/**
* Created by Administrator on 2019/3/26 0026.
*/
public class SumbitTakeawayResult {
/**
* orderNo : 2192531346128147
* code : 1
* orderId : 9512
* errorMsg : 成功
*/
private String orderNo;
private String code;
private int orderId;
private String errorMsg;
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
import java.util.List;
public class SupplementInfoBean {
/**
* success : true
* sysTime : 1598436389621
* data : {"replenishmentPhone":"13825748822","replenishmentPerson":"德華","pickUpPrompt":"補單提示","replenishmentAddress":"222222","orderVOS":[{"orderType":7,"orderNum":35}],"coldChainPickUpNum":15}
*/
private boolean success;
private long sysTime;
private 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 DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* replenishmentPhone : 13825748822
* replenishmentPerson : 德華
* pickUpPrompt : 補單提示
* replenishmentAddress : 222222
* orderVOS : [{"orderType":7,"orderNum":35}]
* coldChainPickUpNum : 15
*/
private String replenishmentPhone;
private String replenishmentPerson;
private String pickUpPrompt;
private String replenishmentAddress;
private int coldChainPickUpNum;
private List<OrderVOSBean> orderVOS;
public String getReplenishmentPhone() {
return replenishmentPhone;
}
public void setReplenishmentPhone(String replenishmentPhone) {
this.replenishmentPhone = replenishmentPhone;
}
public String getReplenishmentPerson() {
return replenishmentPerson;
}
public void setReplenishmentPerson(String replenishmentPerson) {
this.replenishmentPerson = replenishmentPerson;
}
public String getPickUpPrompt() {
return pickUpPrompt;
}
public void setPickUpPrompt(String pickUpPrompt) {
this.pickUpPrompt = pickUpPrompt;
}
public String getReplenishmentAddress() {
return replenishmentAddress;
}
public void setReplenishmentAddress(String replenishmentAddress) {
this.replenishmentAddress = replenishmentAddress;
}
public int getColdChainPickUpNum() {
return coldChainPickUpNum;
}
public void setColdChainPickUpNum(int coldChainPickUpNum) {
this.coldChainPickUpNum = coldChainPickUpNum;
}
public List<OrderVOSBean> getOrderVOS() {
return orderVOS;
}
public void setOrderVOS(List<OrderVOSBean> orderVOS) {
this.orderVOS = orderVOS;
}
public static class OrderVOSBean {
/**
* orderType : 7
* orderNum : 35
*/
private int orderType;
private int orderNum;
public int getOrderType() {
return orderType;
}
public void setOrderType(int orderType) {
this.orderType = orderType;
}
public int getOrderNum() {
return orderNum;
}
public void setOrderNum(int orderNum) {
this.orderNum = orderNum;
}
}
}
}
package com.gingersoft.coldchain_module.mvp.model.bean;
/**
* 補單結果
*/
public class SupplementResultBean {
private String code;
private String errorMsg;
private String orderNo;
private long orderId;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public long getOrderId() {
return orderId;
}
public void setOrderId(long orderId) {
this.orderId = orderId;
}
}
package com.gingersoft.coldchain_module.mvp.model.bean
class ThirdItem : ArrayList<ThirdItem.ThirdItemItem>() {
data class ThirdItemItem(val descr: String = "",
val dim: Dim = Dim(),
val name: String,
val ori: String = "",
val qty: Int,
val sku: String = "",
val stg: String = "Normal",
val typ: String = "",
val unt_price: UntPrice,
val wt: Wt = Wt()) {
constructor(product_name: String, hkd: UntPrice)
: this("", Dim(), product_name, "", 1, "", "", "", hkd, Wt())
data class Dim(
val hgt: Int = 1,
val len: Int = 1,
val unt: String = "cm", //尺寸單位
val wid: Int = 1
)
data class UntPrice(
val ccy: String = "HKD",//金額單位
val `val`: Double
)
data class Wt(
val unt: String = "kg", //重量單位
val `val`: Int = 1
)
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.model.bean;
public class UpdateOrderStatusBean {
private String code;
private String errorMsg;
private String data;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
package com.gingersoft.coldchain_module.mvp.model.service;
import com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.model.bean.PickUpBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementResultBean;
import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
public interface ColdChainService {
@Headers({"Domain-Name: ricepon_wechat"})
@POST("wechat/findOrderList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<OrderList> getOrderList(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_order"})
@POST("orderStatus/getNumByOrderType" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<SupplementInfoBean> getNumByOrderType(@Body RequestBody requestBody);
@Headers({"Domain-Name: update_version"})
@POST("order/addOrder2" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<SupplementResultBean> submitOrder(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_gsa"})
@POST("coldChain/pickUpShipany" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PickUpBean> pickUp(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_wechat"})
@POST("wechat/findHistoryOrderList" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<String> getHistoryOrderList(@Body RequestBody requestBody);
@Headers({"Domain-Name: ricepon_activities"})
@GET("feign/balance/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BalanceBean> getBalance(@Query("brandId") String brandId);
}
package com.gingersoft.coldchain_module.mvp.model.service;
import com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ReadBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
public interface OrderDetailService {
@Headers({"Domain-Name: ricepon_wechat"})
@POST("wechat/findOrderDetails" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<OrderDetails> findOrderDetails(@Body RequestBody requestBody);
@Headers({"Domain-Name: member-web"})
@POST("order/updateOrderInfoIsRead" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<ReadBean> setIsRead(@Body RequestBody requestBody);
@Headers({"Domain-Name: member_web_ricepon_gsa"})
@POST("gsa/shipAnyOrdersNew" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<ShipAnyOrdersNewBean> thirdDelivery(@Body RequestBody requestBody);
// @Headers({"Domain-Name: member-web"})
// @POST("order/updateOrderStatus" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
// Observable<UpdateOrderStatusBean> cancelOrder(@Body RequestBody requestBody);
@Headers({"Domain-Name: member-web"})
@POST("order/updateOrderStatus" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<UpdateOrderStatusBean> gsUpdateOrderStatus(@Body RequestBody requestBody);
@Headers({"Domain-Name: member_web_ricepon_gsa"})
@POST("gsa/cancelOrder" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<CancelLogisticsBean> cancelLogistics(@Body RequestBody requestBody);
@POST("printerRecording/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<String> addPrj(@Body RequestBody requestBody);
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract;
import com.gingersoft.coldchain_module.mvp.model.bean.BalanceBean;
import com.gingersoft.coldchain_module.mvp.model.bean.PickUpBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
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
public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.Model, ColdChainMainContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public ColdChainMainPresenter(ColdChainMainContract.Model model, ColdChainMainContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getNumByOrderType(int restaurantId, Method method, Object object) {
//startTime endTime
RequestBody requestBody = new FormBody.Builder()
.add("orderTypes", ColdChainConstans.orderType + "")
.add("restaurantId", restaurantId + "")
.build();
mModel.getNumByOrderType(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取餐廳配置信息..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SupplementInfoBean>(mErrorHandler) {
@Override
public void onNext(@NonNull SupplementInfoBean info) {
if (info != null && info.isSuccess()) {
// mRootView.loadNumber(info);
try {
method.setAccessible(true);
method.invoke(object, info);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
}
});
}
public void pickUp(int restaurantId) {
//startTime endTime
RequestBody requestBody = new FormBody.Builder()
.add("orderType", ColdChainConstans.orderType + "")
.add("restaurantId", restaurantId + "")
.build();
mModel.pickUp(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("提交訂單中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<PickUpBean>(mErrorHandler) {
@Override
public void onNext(@NonNull PickUpBean info) {
if (info != null) {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrorMsg())) {
mRootView.showMessage(info.getErrorMsg());
} else {
mRootView.showMessage(info.isSuccess() ? "提交成功" : "提交失敗");
}
}
}
});
}
public void getBalance() {
mModel.getBalance(GsaCloudApplication.getBrandId(GsaCloudApplication.getAppContext()) + "")
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BalanceBean>(mErrorHandler) {
@Override
public void onNext(@NonNull BalanceBean info) {
if (info != null) {
mRootView.loadBalance(info.getBalance(), info.getBond(), info.getBalance() <= info.getThreshold());
}
}
});
}
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.HistoryOrderContract;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
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;
@FragmentScope
public class HistoryOrderPresenter extends BasePresenter<HistoryOrderContract.Model, HistoryOrderContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public HistoryOrderPresenter(HistoryOrderContract.Model model, HistoryOrderContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getHistoryOrderList(int status, int pageIndex, int pageSize, String phone, String startDate, String endDate, String orderNo) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getGsPosShopId(GsaCloudApplication.getAppContext())) //GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) +
.add("status", status + "")
.add("pageIndex", pageIndex + "")
.add("pageSize", pageSize + "")
.add("orderNo", orderNo)
.add("startDate", startDate)
.add("endDate", endDate)
.add("phone", phone)
.build();
mModel.getHistoryOrderList(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取歷史訂單..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<String>(mErrorHandler) {
@Override
public void onNext(@NonNull String info) {
if (info != null) {
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.contract.HistoryContract;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
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
public class HistoryPresenter extends BasePresenter<HistoryContract.Model, HistoryContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public HistoryPresenter(HistoryContract.Model model, HistoryContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getHistoryOrderList(int status, int pageIndex, int pageSize, String phone, String startDate, String endDate, String orderNo) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) + "") //GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) +
.add("status", status + "")
.add("pageIndex", pageIndex + "")
.add("pageSize", pageSize + "")
.add("orderNo", orderNo)
.add("startDate", startDate)
.add("endDate", endDate)
.add("phone", phone)
.build();
mModel.getHistoryOrderList(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取歷史訂單..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<String>(mErrorHandler) {
@Override
public void onNext(@NonNull String info) {
if (info != null) {
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
}
});
}
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract;
import com.gingersoft.coldchain_module.mvp.model.bean.CancelLogisticsBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ReadBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ShipAnyOrdersNewBean;
import com.gingersoft.coldchain_module.mvp.model.bean.ThirdItem;
import com.gingersoft.coldchain_module.mvp.model.bean.UpdateOrderStatusBean;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.FileUtils;
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.base.utils.log.LogUtil;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
@ActivityScope
public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Model, OrderDetailsContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public OrderDetailsPresenter(OrderDetailsContract.Model model, OrderDetailsContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void findOrderDetails(int orderId, int isRead) {
//startTime endTime
RequestBody requestBody = new FormBody.Builder()
.add("orderId", orderId + "")
.build();
mModel.findOrderDetails(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取訂單詳情..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<OrderDetails>(mErrorHandler) {
@Override
public void onNext(@NonNull OrderDetails info) {
if (info != null) {
if (info.getData() != null && info.getData().size() > 0) {
mRootView.loadOrderDetails(info.getData().get(0));
if (isRead == 0) {
setIsRead(info.getData().get(0).getID());
}
} else {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrorMsg())) {
mRootView.showMessage(info.getErrorMsg());
} else {
mRootView.showMessage("獲取訂單詳情失敗");
mRootView.killMyself();
}
}
} else {
mRootView.showMessage("獲取訂單詳情失敗");
mRootView.killMyself();
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage("獲取訂單詳情失敗");
mRootView.killMyself();
}
});
}
public void setIsRead(int orderId) {
RequestBody requestBody = new FormBody.Builder()
.add("id", orderId + "")
.build();
mModel.setIsRead(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<ReadBean>(mErrorHandler) {
@Override
public void onNext(@NonNull ReadBean info) {
mRootView.updateOrderState(ColdChainConstans.ORDER_READ);
}
});
}
public void thirdDelivery(OrderDetails.DataBean dataBean) {
ThirdItem third = new ThirdItem();
if (dataBean.getPRODUCT_NAME() != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) {
ThirdItem.ThirdItemItem.UntPrice hkd = new ThirdItem.ThirdItemItem.UntPrice("HKD", Double.valueOf(productnameBean.getPRICE()));
ThirdItem.ThirdItemItem thirdItemItem;
if (TextUtil.isNotEmptyOrNullOrUndefined(productnameBean.getPRODUCT_NAME())) {
thirdItemItem = new ThirdItem.ThirdItemItem(productnameBean.getPRODUCT_NAME(), hkd);
} else {
thirdItemItem = new ThirdItem.ThirdItemItem("", hkd);
}
third.add(thirdItemItem);
}
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", dataBean.getID() + "")
.add("items", GsonUtils.GsonString(third))
.build();
mModel.thirdDelivery(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("確認訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<ShipAnyOrdersNewBean>(mErrorHandler) {
@Override
public void onNext(@NonNull ShipAnyOrdersNewBean info) {
if (info != null) {
if (info.isSuccess()) {
//修改訂單狀態
updateOrderState(dataBean, ColdChainConstans.ORDER_CONFIRMED, info.getData().getLab_url());
} else {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("確認訂單失敗");
}
mRootView.killMyself();
}
} else {
mRootView.showMessage("服務器錯誤");
mRootView.killMyself();
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage("服務器錯誤");
mRootView.killMyself();
}
});
}
public void updateOrderState(OrderDetails.DataBean dataBean, int status, String labUrl) {
//添加PRJ
addPrj(dataBean);
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId(GsaCloudApplication.getAppContext()) + "")
.add("orderId", dataBean.getID() + "")
.add("status", status + "")
.add("", GsaCloudApplication.getMemberName(GsaCloudApplication.getAppContext()) + "")
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<UpdateOrderStatusBean>(mErrorHandler) {
@Override
public void onNext(@NonNull UpdateOrderStatusBean info) {
if (info != null) {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrorMsg())) {
mRootView.showMessage(info.getErrorMsg());
}
if (status == ColdChainConstans.ORDER_CONFIRMED) {
//模擬獲取到PDF,進行打印
mRootView.updateOrderState(status);
if (TextUtil.isNotEmptyOrNullOrUndefined(labUrl)) {
//下載打印文件
download(labUrl);
} else {
mRootView.showMessage("未獲取到物流單下載鏈接,無法打印");
mRootView.killMyself();
}
} else {
mRootView.killMyself();
}
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage(t.getMessage());
mRootView.killMyself();
}
});
}
public void addPrj(OrderDetails.DataBean dataBean) {
StringBuffer ids = new StringBuffer();
if (dataBean.getPRODUCT_NAME() != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean productnameBean : dataBean.getPRODUCT_NAME()) {
if (productnameBean.getChild() != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX childBeanX : productnameBean.getChild()) {
if (childBeanX != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX.ChildBean childBean : childBeanX.getChild()) {
ids.append(childBean.getOdsId());
ids.append(",");
}
}
ids.append(childBeanX.getOdsId());
ids.append(",");
}
}
ids.append(productnameBean.getOdsId());
ids.append(",");
}
RequestBody requestBody = new FormBody.Builder()
.add("orderId", dataBean.getID() + "")
.add("restaurantId", GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) + "")
.add("orderDetailsIds", ids.toString())
.build();
mModel.addPrj(requestBody);
}
}
public void download(String url) {
try {
Disposable subscribe = Observable.create((ObservableOnSubscribe<File>) emitter -> {
OkHttpClient client = new OkHttpClient.Builder().build();
Request request = new Request.Builder()
.url(url)
.get()
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) {
InputStream is = null;
byte[] buf = new byte[2048];
int len = 0;
FileOutputStream fos = null;
// 储存下载文件的目录
FileUtils.makeDirs(FileUtils.File_PATH);
try {
is = response.body().byteStream();
long total = response.body().contentLength();
File file = new File(FileUtils.File_PATH, url.substring(url.lastIndexOf("/") + 1));
fos = new FileOutputStream(file);
long sum = 0;
while ((len = is.read(buf)) != -1) {
fos.write(buf, 0, len);
sum += len;
int progress = (int) (sum * 1.0f / total * 100);
mRootView.showLoading("下載打印文檔中" + progress + "%");
LogUtil.e(TAG, "download progress : " + progress);
}
emitter.onNext(file);
fos.flush();
LogUtil.e(TAG, "download success");
} catch (Exception e) {
e.printStackTrace();
LogUtil.e(TAG, "download failed : " + e.getMessage());
} finally {
try {
if (is != null)
is.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
if (fos != null)
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
});
}).subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(file -> mRootView.printLogisticsList(file));
} catch (Exception e) {
e.printStackTrace();
}
// mModel.download(url)
// .subscribeOn(Schedulers.io())
// .doOnSubscribe(disposable -> mRootView.showLoading("請稍候..."))
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .doAfterTerminate(() -> mRootView.hideLoading())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<ResponseBody>(mErrorHandler) {
//
// @Override
// public void onNext(@NonNull ResponseBody info) {
//
//
// mRootView.printLogisticsList();
// }
//
// @Override
// public void onError(Throwable t) {
// super.onError(t);
// mRootView.killMyself();
// }
// });
}
public void cancelOrder(int orderId) {
RequestBody requestBody = new FormBody.Builder()
.add("memberId", GsaCloudApplication.getMemberId(GsaCloudApplication.getAppContext()) + "")
.add("orderId", orderId + "")
.add("status", "6")
.add("", GsaCloudApplication.getMemberName(GsaCloudApplication.getAppContext()) + "")
.build();
mModel.updateOrderStatus(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("取消訂單中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<UpdateOrderStatusBean>(mErrorHandler) {
@Override
public void onNext(@NonNull UpdateOrderStatusBean info) {
if (info != null) {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrorMsg())) {
mRootView.showMessage(info.getErrorMsg());
}
mRootView.updateOrderState(ColdChainConstans.ORDER_CANCELLED);
mRootView.killMyself();
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.killMyself();
}
});
}
public void cancelOrderAndLogistics(int orderId) {
cancelLogistics(orderId, true);
}
public void cancelLogistics(int orderId, boolean isCancelOrder) {
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()) +"")
.add("orderId", orderId + "")
.add("reasonId", "")
.add("reasonDesc", "")
.build();
mModel.cancelLogistics(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("取消物流中,請稍候..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<CancelLogisticsBean>(mErrorHandler) {
@Override
public void onNext(@NonNull CancelLogisticsBean info) {
if (info != null) {
if (info.isSuccess()) {
mRootView.updateOrderState(ColdChainConstans.LOGISTICS_CANCELLED);
if (isCancelOrder) {
cancelOrder(orderId);
} else {
mRootView.showMessage("物流已取消");
mRootView.killMyself();
}
} else {
if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("取消物流失敗");
}
}
} else {
mRootView.showMessage("取消物流失敗");
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage("取消物流失敗");
mRootView.killMyself();
}
});
}
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
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;
@FragmentScope
public class OrderListPresenter extends BasePresenter<OrderListContract.Model, OrderListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public OrderListPresenter(OrderListContract.Model model, OrderListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
private List<OrderList.DataBeanX.DataBean> orderList = new ArrayList<>();
public void getOrderList(int restaurantId, int page, String status, String type) {
if (page == 1) {
orderList.clear();
}
RequestBody requestBody = new FormBody.Builder()
.add("restaurantId", restaurantId + "")
.add("page", page + "")
.add("pageSize", "")
.add("status", status)
.add("type", type)
.build();
mModel.getOrderList(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<OrderList>(mErrorHandler) {
@Override
public void onNext(@NonNull OrderList info) {
if (info != null && info.isSuccess() && info.getData() != null) {
if (info.getData().getData() != null && info.getData().getData().size() > 0) {
List<OrderList.DataBeanX.DataBean> dataBeans = info.getData().getData();
dataBeans.remove(dataBeans.size() - 1);
orderList.addAll(dataBeans);
}
mRootView.loadOrderList(orderList);
} else {
mRootView.loadOrderList(null);
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.loadOrderList(null);
}
});
}
public void notifyDataByPosition(int position, int state) {
if (orderList.size() > position) {
OrderList.DataBeanX.DataBean dataBean = orderList.get(position);
if (state == ColdChainConstans.ORDER_READ) {
//已讀
dataBean.setIsRead(ColdChainConstans.ORDER_READ);
mRootView.notifyByPosition(position, dataBean);
} else if (state == ColdChainConstans.LOGISTICS_CANCELLED) {
//物流已取消
dataBean.setCurStat(9);
//物流已取消,狀態只能是待pick up,因為待確認、派送中的訂單是不能取消物流的
dataBean.setSTATUS(2);
mRootView.notifyByPosition(position, dataBean);
} else if (state == ColdChainConstans.ORDER_CANCELLED) {
//訂單已取消
mRootView.removeItem(position);
} else if (state > 0 && state <= 3) {
dataBean.setIsRead(ColdChainConstans.ORDER_READ);
dataBean.setSTATUS(state);
if(state == ColdChainConstans.ORDER_CONFIRMED){
//訂單如已確認,那麼物流狀態也是已通知物流
dataBean.setCurStat(1);
}
mRootView.notifyByPosition(position, dataBean);
}
}
}
}
package com.gingersoft.coldchain_module.mvp.presenter;
import android.app.Application;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementResultBean;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
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
public class SupplementOrderPresenter extends BasePresenter<SupplementOrderContract.Model, SupplementOrderContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public SupplementOrderPresenter(SupplementOrderContract.Model model, SupplementOrderContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getNumByOrderType(int restaurantId) {
//startTime endTime
RequestBody requestBody = new FormBody.Builder()
.add("orderTypes", ColdChainConstans.orderType + "")
.add("restaurantId", restaurantId + "")
.build();
mModel.getNumByOrderType(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SupplementInfoBean>(mErrorHandler) {
@Override
public void onNext(@NonNull SupplementInfoBean info) {
if (info != null && info.isSuccess()) {
mRootView.loadNumber(info);
}
}
});
}
public void submitOrder(int nowIndex, int allNum, String name, String phone, String address) {
RequestBody requestBody = new FormBody.Builder()
.add("order", getOrderJson(name, phone, address))
.add("apiversion", "1")
.build();
mModel.submitOrder(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("剩餘" + nowIndex + "/" + allNum + "條訂單,,,"))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<SupplementResultBean>(mErrorHandler) {
@Override
public void onNext(@NonNull SupplementResultBean info) {
if (info != null) {
if(TextUtil.isNotEmptyOrNullOrUndefined(info.getErrorMsg())){
mRootView.showMessage(info.getErrorMsg());
}
mRootView.submissionComplete();
} else {
mRootView.submissionFail();
}
}
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.submissionFail();
}
});
}
/**
* 订单提交
*/
private String getOrderJson(String name, String phone, String address) {
JSONObject json;
json = new JSONObject();
try {
json.put("shopId", GsaCloudApplication.getRestaurantId(GsaCloudApplication.getAppContext()));
json.put("phone", phone);
json.put("replenishmentType", "1");
json.put("transportationType", "3");
json.put("memberId", GsaCloudApplication.getMemberId(GsaCloudApplication.getAppContext()));
// json.put("addressId", );
json.put("addressDetail", address);
// json.put("sendTime", );
json.put("orderRemark", "");
json.put("payType", 1);
json.put("originalAmount", 0);//原价
json.put("orderType", 8);
json.put("totalPrice", 0);//实际总价
// json.put("waimaiSendTime", waimaiSendTime);//送单时间
JSONArray array = new JSONArray();
JSONObject object = new JSONObject();
object.put("posFid", -222);
object.put("productId", -223);
object.put("productName", "補單食品");
object.put("number", 0);
object.put("price", 0);
object.put("lunchboxPrice", 0);
array.put(object);
json.put("foods", array);
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
}
package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerColdChainMainComponent;
import com.gingersoft.coldchain_module.di.module.ColdChainMainModule;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.ColdChainMainContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.presenter.ColdChainMainPresenter;
import com.gingersoft.coldchain_module.mvp.ui.fragment.OrderListFragment;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.service.GetInfoUpdateService;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.android.material.tabs.TabLayout;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.popup.QMUIPopup;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import static android.animation.ValueAnimator.RESTART;
import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class ColdChainMainActivity extends BaseFragmentActivity<ColdChainMainPresenter> implements ColdChainMainContract.View, View.OnClickListener {
@BindView(R2.id.view_pager)
ViewPager viewPager;
@BindView(R2.id.coldchain_main_top_bar)
QMUITopBar topBar;
@BindView(R2.id.coldchain_main_tabs)
TabLayout tabLayout;
@BindView(R2.id.tv_balance)
TextView tvBalance;
private List<String> status = Arrays.asList("0,1,2,3", "0,1", "2", "3");
private List<OrderListFragment> fragments;
private ClearHeartBroadcastReceiver clearHeartBroadcastReceiver;
private int restaurantId;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerColdChainMainComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.coldChainMainModule(new ColdChainMainModule(this))
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_main; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mPresenter.getBalance();
restaurantId = GsaCloudApplication.getRestaurantId(mContext);
fragments = new ArrayList<>();
List<String> titles = Arrays.asList("全部", "待確認", "待提交", "派送中");
for (int i = 0; i < titles.size(); i++) {
fragments.add(OrderListFragment.newInstance(status.get(i), ColdChainConstans.orderType + ""));
}
getNumByOrderTypeInvoke("loadNumber");
initViewPager(titles);
initService();
initHearBroadcast();
}
public void getNumByOrderTypeInvoke(String functionName) {
Class[] parameterTypes = {SupplementInfoBean.class};
try {
Method method = this.getClass().getDeclaredMethod(functionName, parameterTypes);
mPresenter.getNumByOrderType(restaurantId, method, this);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
private void initViewPager(List<String> titles) {
viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager(), BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
@NonNull
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return titles.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return titles.get(position);
}
});
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
fragments.get(position).setData(status.get(position));
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
tabLayout.setupWithViewPager(viewPager);
}
private void initService() {
//開啟websocket
Intent intent = new Intent(getApplicationContext(), GetInfoUpdateService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent);
} else {
startService(intent);
}
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
}
private void initHearBroadcast() {
clearHeartBroadcastReceiver = new ClearHeartBroadcastReceiver();
IntentFilter intentFilter = new IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART);
registerReceiver(clearHeartBroadcastReceiver, intentFilter);
}
private GetInfoUpdateService.MyBind bind = null;
private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
bind = (GetInfoUpdateService.MyBind) service;
if (bind != null) {
bind.setOnPostCallBack(type -> {
// -1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知"
if (type == 3 || type == 5
|| type == 6 || type == 7) {//ColdChainConstans.orderType
fragments.get(viewPager.getCurrentItem()).onRefreshData();
mPresenter.getBalance();
}
if (type == 3 || type == 6 || type == 7) {
getNumByOrderTypeInvoke("loadNumber");
}
});
bind.execute(aBoolean -> null);
bind.setJumpActivity(ColdChainMainActivity.class);
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
}
};
private int confirmedOrderNum;
@Override
public void loadNumber(SupplementInfoBean bean) {
if (bean != null && bean.getData() != null && bean.getData().getOrderVOS() != null) {
for (SupplementInfoBean.DataBean.OrderVOSBean orderVOSBean : bean.getData().getOrderVOS()) {
if (orderVOSBean.getOrderType() == ColdChainConstans.orderType) {
confirmedOrderNum = orderVOSBean.getOrderNum();
topBar.setTitle("冷鏈接單" + "(" + confirmedOrderNum + "/" + bean.getData().getColdChainPickUpNum() + ")");
}
}
}
}
private ValueAnimator colorAnimation;
@Override
public void loadBalance(double price, double bond, boolean isBlink) {
tvBalance.setText("餘額:" + price + "(保證金" + bond + ")");
if (isBlink) {
//提示餘額不足
int colorFrom = ContextCompat.getColor(mContext, R.color.red);
int colorTo = ContextCompat.getColor(mContext, R.color.blue);
colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.addUpdateListener(animation -> tvBalance.setTextColor((Integer) animation.getAnimatedValue()));
colorAnimation.setDuration(200);
colorAnimation.setRepeatMode(RESTART);
colorAnimation.setRepeatCount(-1);
colorAnimation.start();
}
}
@Override
protected void onResume() {
super.onResume();
if(colorAnimation != null){
colorAnimation.resume();
}
}
@Override
protected void onPause() {
super.onPause();
if(colorAnimation != null){
colorAnimation.pause();
}
}
private class ClearHeartBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//收到關閉心跳的廣播後,同時關閉接單頁面
killMyself();
}
}
@Override
public void initIntent() {
}
private QMUIPopup pop;
@Override
public void initTopBar() {
topBar.setTitle("冷鏈接單");
topBar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself());
// topBar.addRightImageButton(R.drawable.icon_topbar_overflow, R.id.topbar_right_change_button).setOnClickListener(v -> {
// if (pop == null) {
// View view = LayoutInflater.from(this).inflate(R.layout.cold_chain_main_popup, null);
// pop = QMUIPopups.popup(this)
// .preferredDirection(QMUIPopup.DIRECTION_BOTTOM)
// .view(view)
// .radius(QMUIDisplayHelper.dp2px(this, 5))
// .arrow(true)
// .shadow(true)
// .dimAmount(0.6f)
// .offsetYIfTop(0)
// .animStyle(QMUIPopup.ANIM_AUTO)
// .show(v);
// view.findViewById(R.id.layout_history_order).setOnClickListener(v1 -> launchActivity(new Intent(mContext, HistoryActivity.class)));
// } else {
// pop.show(v);
// }
// });
topBar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null)
LoadingDialog.showDialogForLoading(this, message, true);
else
LoadingDialog.showDialogForLoading(this);
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (bind != null) {
bind.setOnPostCallBack(null);
}
unregisterReceiver(clearHeartBroadcastReceiver);
unbindService(serviceConnection);
}
@OnClick({R2.id.btn_supplement_order, R2.id.btn_pick_up})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.btn_supplement_order) {
if (confirmedOrderNum > 15) {
showMessage("訂單數量足夠,不需要補單");
} else {
//補單
getNumByOrderTypeInvoke("jumpSupplementOrder");
}
} else if (viewId == R.id.btn_pick_up) {
getNumByOrderTypeInvoke("pickUp");
}
}
public void pickUp(SupplementInfoBean bean) {
if (orderNumIsSatisfyPickUp(bean)) {
mPresenter.pickUp(restaurantId);
} else {
//提示補單
new AppDialog().showWaringDialog(this, "不滿足送貨條件,是否需要補單?", (view, dialog) -> {
dialog.dismiss();
jumpSupplementOrder(bean);
});
}
}
public void jumpSupplementOrder(SupplementInfoBean bean) {
if (orderNumIsSatisfyPickUp(bean)) {
//現有訂單數 < 小於配置的最低訂單數 才允許補單
showMessage("訂單數已達到最低配送要求,不需要補單");
} else {
Intent intent = new Intent(mContext, SupplementOrderActivity.class);
launchActivity(intent);
}
}
private boolean orderNumIsSatisfyPickUp(SupplementInfoBean bean) {
if (bean != null && bean.getData() != null && bean.getData().getOrderVOS() != null) {
int orderNum = 0;
for (SupplementInfoBean.DataBean.OrderVOSBean orderVOSBean : bean.getData().getOrderVOS()) {
if (orderVOSBean.getOrderType() == ColdChainConstans.orderType) {
orderNum = orderVOSBean.getOrderNum();
}
}
return orderNum >= bean.getData().getColdChainPickUpNum();
}
return false;
}
}
package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerHistoryComponent;
import com.gingersoft.coldchain_module.di.module.HistoryModule;
import com.gingersoft.coldchain_module.mvp.contract.HistoryContract;
import com.gingersoft.coldchain_module.mvp.presenter.HistoryPresenter;
import com.gingersoft.coldchain_module.mvp.ui.fragment.HistoryOrderFragment;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.google.android.material.tabs.TabLayout;
import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class HistoryActivity extends BaseFragmentActivity<HistoryPresenter> implements HistoryContract.View {
@BindView(R2.id.tv_start_time)
TextView mTvStartTime;
@BindView(R2.id.tv_end_time)
TextView mTvEndTime;
// @BindView(R2.id.cold_chain_history_order_top_bar)
// QMUITopBar topBar;
@BindView(R2.id.history_tabs)
TabLayout tabLayout;
// @BindView(R2.id.cold_chain_history_refresh_layout)
// SmartRefreshLayout mRefreshLayout;
private HistoryOrderFragment historyFragment;
private int pageIndex;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerHistoryComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.historyModule(new HistoryModule(this))
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_history_order; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mTvStartTime.setText(TimeUtils.getOldDate(0));
mTvEndTime.setText(TimeUtils.getOldDate(0));
historyFragment = HistoryOrderFragment.newInstance();
// mRefreshLayout.setOnRefreshListener(refreshLayout -> {
// pageIndex = 0;
// getHistoryOrderList();
// });
// mRefreshLayout.setOnLoadMoreListener(refreshLayout -> {
// pageIndex++;
// getHistoryOrderList();
// });
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
pageIndex = 0;
getHistoryOrderList();
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
getSupportFragmentManager().beginTransaction().add(R.id.content_layout, historyFragment).commit();
}
public void getHistoryOrderList() {
mPresenter.getHistoryOrderList(tabLayout.getSelectedTabPosition() == 0 ? 4 : 6, pageIndex, 10, "", "", "", "");
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
// topBar.setTitle(R.string.history_order);
// topBar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself());
// topBar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null)
LoadingDialog.showDialogForLoading(this, message, true);
else
LoadingDialog.showDialogForLoading(this);
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
public void loadData() {
// historyFragment.
}
}
package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.print.PrintManager;
import android.view.KeyEvent;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerOrderDetailsComponent;
import com.gingersoft.coldchain_module.di.module.OrderDetailsModule;
import com.gingersoft.coldchain_module.mvp.contract.OrderDetailsContract;
import com.gingersoft.coldchain_module.mvp.presenter.OrderDetailsPresenter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.MyPrintDocumentAdapter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderDetailsBtnAdapter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderDetailsFoodAdapter;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.constans.FunctionManagerConstans;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.FunctionManager;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.permissionx.guolindev.PermissionX;
import com.permissionx.guolindev.callback.RequestCallback;
import com.qmuiteam.qmui.widget.QMUITopBar;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class OrderDetailsActivity extends BaseActivity<OrderDetailsPresenter> implements OrderDetailsContract.View {
@BindView(R2.id.cold_chain_order_detail_top_bar)
QMUITopBar topBar;
@BindView(R2.id.tv_order_from)
TextView mTvOrderFrom;
@BindView(R2.id.tv_order_state)
TextView mTvOrderStatus;
@BindView(R2.id.tv_order_no)
TextView mTvOrderNo;
@BindView(R2.id.tv_create_time)
TextView mTvCreateTime;
@BindView(R2.id.tv_receiver)
TextView mTvReceiver;
@BindView(R2.id.tv_bill_num)
TextView mTvOrderNum;
@BindView(R2.id.tv_receive_phone)
TextView mTvReceiverPhone;
@BindView(R2.id.tv_receive_time)
TextView mTvReceiverTime;
@BindView(R2.id.tv_receive_address)
TextView mTvReceiverAddress;
@BindView(R2.id.tv_remark)
TextView mTvRemark;
// @BindView(R2.id.tv_delivery_man_name)
// TextView mTvDeliveryManName;
// @BindView(R2.id.tv_delivery_man_phone)
// TextView mTvDeliveryManPhone;
// @BindView(R2.id.tv_delivery_num)
// TextView mTvDeliveryNumber;
@BindView(R2.id.rv_food)
RecyclerView mRvFood;
OrderDetailsFoodAdapter mFoodAdapter;
@BindView(R2.id.rv_order_details_btn)
RecyclerView mRvBtn;
@BindView(R2.id.tv_total)
TextView mTvTotalAmount;
@BindView(R2.id.tv_lunchbox_cost)
TextView mTvLunchboxCost;
@BindView(R2.id.tv_delivery_fee)
TextView mTvDeliveryFee;
@BindView(R2.id.tv_discount)
TextView mTvDiscount;
@BindView(R2.id.tv_total_amount2)
TextView mTvTotalAmount2;
@BindView(R2.id.tv_pay_amount)
TextView mTvPayAmount;
@BindView(R2.id.tv_pay_method)
TextView mTvPayMethod;
private int orderId;
private int isRead = -1;
private BtnBuilder btnBuilder;
private String labUrl;
private int position;
private int orderStatus;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerOrderDetailsComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.orderDetailsModule(new OrderDetailsModule(this))
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.cold_chain_order_details; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
requestPermissions(null);
mPresenter.findOrderDetails(orderId, isRead);
// mPresenter.download("https://labels.shipany.io/sbx2/325764d7-b2e2-4d8b-9a68-7f4473719f9c/2020-08-27/20200827171831451_SF5805023992121_144ac51b-5370-46db-9e8d-50904e33b1b7.pdf");
List<Function> functionByResModule = FunctionManager.getDefault().getFunctionByResModule(this, FunctionManagerConstans.takeaway.class, FunctionManagerConstans.takeaway.orderDetails, "orderDetails/btn");
btnBuilder = BtnBuilder.getInstance(functionByResModule);
}
@Override
public void initIntent() {
orderId = getIntent().getIntExtra("orderId", 0);
isRead = getIntent().getIntExtra("isRead", -1);//是否已讀訂單
position = getIntent().getIntExtra("position", 0);//是否已讀訂單
}
@Override
public void initTopBar() {
topBar.setTitle("訂單詳情");
topBar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself());
topBar.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color));
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
runOnUiThread(() -> {
if (message != null)
LoadingDialog.showDialogForLoading(mContext, message, true);
else
LoadingDialog.showDialogForLoading(mContext);
});
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
Intent intent = new Intent();
intent.putExtra("position", position);
intent.putExtra("orderStatus", orderStatus);
setResult(1001, intent);
finish();
}
@Override
public void loadOrderDetails(OrderDetails.DataBean bean) {
labUrl = bean.getLabUrl();
mTvOrderFrom.setText(getResources().getString(bean.getOrder_from() == 7 ? R.string.h5_order : R.string.ricepon_order));
if (bean.getOrderStatus() == 2) {
mTvOrderStatus.setText("已確認訂單");
mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state1_color));
} else if (bean.getOrderStatus() == 3) {
mTvOrderStatus.setText("訂單派送中");
mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state2_color));
} else if (bean.getOrderStatus() == 0 || bean.getOrderStatus() == 1) {
mTvOrderStatus.setText("待確認訂單");
mTvOrderStatus.setTextColor(ContextCompat.getColor(mContext, R.color.order_state0_color));
}
mTvOrderNo.setText(getResources().getString(R.string.order_no) + bean.getORDER_NO());
mTvCreateTime.setText(getResources().getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(bean.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
mTvReceiver.setText(bean.getRECEIVER());
mTvOrderNum.setText(bean.getBillNo());
mTvReceiverPhone.setText(bean.getPHONE());
mTvReceiverTime.setText(TextUtil.isNotEmptyOrNullOrUndefined(bean.getTakeTime()) ? bean.getTakeTime() : bean.getSEND_TIME());
mTvReceiverAddress.setText(bean.getAddressDetail());
mTvRemark.setText(bean.getRemark());
if (mFoodAdapter == null) {
mFoodAdapter = new OrderDetailsFoodAdapter(bean.getPRODUCT_NAME());
mRvFood.setAdapter(mFoodAdapter);
mRvFood.setLayoutManager(new LinearLayoutManager(mContext));
} else {
mFoodAdapter.setNewInstance(bean.getPRODUCT_NAME());
}
String amountUnit = getResources().getString(R.string.amount_unit);
mTvTotalAmount.setText(amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getLunchbox()), bean.getDELIVERY_CHARGE()));
mTvLunchboxCost.setText(amountUnit + bean.getLunchbox());
mTvDeliveryFee.setText(amountUnit + bean.getDELIVERY_CHARGE());
mTvDiscount.setText(amountUnit + bean.getDiscount_amount());
mTvTotalAmount2.setText(amountUnit + MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getDiscount_amount()));
mTvPayAmount.setText(amountUnit + MoneyUtil.sub(Double.parseDouble(bean.getTOTAL_AMOUNT()), bean.getDiscount_amount()));
if (bean.getOrderPayType() == 2 && bean.getPayMultiple() != null) {
StringBuilder sb = new StringBuilder();
for (OrderDetails.DataBean.PayMultiple payMultiple : bean.getPayMultiple()) {
sb.append(payMultiple.getPayName());
sb.append(",");
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
mTvPayMethod.setText(sb.toString());
}
ArrayList<BtnBuilder.BtnBean> btnBeans = new ArrayList<>();
if (bean.getOrderStatus() == 0 || bean.getOrderStatus() == 1) {
//待確認
btnBeans.add(btnBuilder.getSureBtn());
btnBeans.add(btnBuilder.getCancelBtn());
} else if (bean.getOrderStatus() == 2) {
//待提交
btnBeans.add(btnBuilder.getPrintBtn());
if (bean.isDelete() == 0) {
btnBeans.add(btnBuilder.getLogisticsBtn());
}
btnBeans.add(btnBuilder.getCancelBtn());
} else {
btnBeans.add(btnBuilder.getPrintBtn());
}
if (btnBeans.size() > 1 && btnBeans.size() < 4) {
mRvBtn.setLayoutManager(new GridLayoutManager(mContext, btnBeans.size()));
} else {
mRvBtn.setLayoutManager(new GridLayoutManager(mContext, 3));
}
OrderDetailsBtnAdapter orderDetailsBtnAdapter = new OrderDetailsBtnAdapter(btnBeans);
orderDetailsBtnAdapter.setOnItemClickListener((adapter, view, position) -> {
if (btnBeans.get(position).getType() == BtnBuilder.SureBtn) {
requestPermissions((allGranted, grantedList, deniedList) -> {
//確認訂單
if (allGranted) {
mPresenter.thirdDelivery(bean);
}
});
} else if (btnBeans.get(position).getType() == BtnBuilder.CancelBtn) {
//取消訂單
new AppDialog().showWaringDialog(this, "確認取消訂單?", (v, dialog) -> {
dialog.dismiss();
if (bean.isDelete() == 0) {
mPresenter.cancelOrderAndLogistics(orderId);
} else {
mPresenter.cancelOrder(bean.getID());
}
});
} else if (btnBeans.get(position).getType() == BtnBuilder.LogisticsBtn) {
//取消物流
new AppDialog().showWaringDialog(this, "確認取消物流?", (v, dialog) -> {
dialog.dismiss();
mPresenter.cancelLogistics(bean.getID(), false);
});
} else if (btnBeans.get(position).getType() == BtnBuilder.PrintBtn) {
//打印
requestPermissions((allGranted, grantedList, deniedList) -> {
if (allGranted) {
if (TextUtil.isNotEmptyOrNullOrUndefined(labUrl)) {
mPresenter.download(labUrl);
} else {
showMessage("獲取打印鏈接失敗");
}
}
});
}
});
mRvBtn.setAdapter(orderDetailsBtnAdapter);
}
@Override
public void printLogisticsList(File file) {
doPrint(file);
}
@Override
public void updateOrderState(int state) {
//當訂單狀態修改後,會調用此方法,返回列表頁面時,刷新對應的item
orderStatus = state;
}
/**
* 自定义打印
*/
private void doPrint(File file) {
// Get a PrintManager instance 获取打印驱动对象
PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
// Set job name, which will be displayed in the print queue 设置作业名称,该名称将显示在打印队列中
String jobName = getString(R.string.app_name) + "Document";
// Start a print job, passing in a PrintDocumentAdapter implementation 启动打印作业,传入printdocumentadapter实现
// to handle the generation of a print document处理打印文档的生成
printManager.print(jobName, new MyPrintDocumentAdapter(mContext, file, (code, msg) -> {
if (code != 0) {
showMessage(msg);
}
killMyself();
}), null);
}
private void requestPermissions(RequestCallback requestCallback) {
PermissionX.init(this)
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "打印物流單需要您同意文件讀取權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟文件讀取權限", "確定", "取消"))
.request(requestCallback);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
killMyself();
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerSupplementOrderComponent;
import com.gingersoft.coldchain_module.di.module.SupplementOrderModule;
import com.gingersoft.coldchain_module.mvp.constans.ColdChainConstans;
import com.gingersoft.coldchain_module.mvp.contract.SupplementOrderContract;
import com.gingersoft.coldchain_module.mvp.model.bean.SupplementInfoBean;
import com.gingersoft.coldchain_module.mvp.presenter.SupplementOrderPresenter;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.qmuiteam.qmui.widget.QMUITopBar;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
/**
* 補單
*/
public class SupplementOrderActivity extends BaseActivity<SupplementOrderPresenter> implements SupplementOrderContract.View {
@BindView(R2.id.cold_chain_supplement_order_top_bar)
QMUITopBar topBar;
@BindView(R2.id.tv_supplement_order_name)
TextView mTvName;
@BindView(R2.id.tv_supplement_order_address)
TextView mTvAddress;
@BindView(R2.id.tv_supplement_order_phone)
TextView mTvPhone;
@BindView(R2.id.ed_supplement_order_number)
EditText mEdSupplementNum;
@BindView(R2.id.tv_supplement_tip)
TextView mTvTip;
private int restaurantId;
private int supplementNum;
private int allSupplementNum;
private int pickUpNum;
private String name;
private String phone;
private String address;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerSupplementOrderComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.supplementOrderModule(new SupplementOrderModule(this))
.build()
.inject(this);
}
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.activity_supplement_order; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
restaurantId = GsaCloudApplication.getRestaurantId(mContext);
mPresenter.getNumByOrderType(restaurantId);
findViewById(R.id.btn_confirm_supplement_order).setOnClickListener(v -> {
supplementNum = 0;
//補單
if (mEdSupplementNum != null && TextUtil.isNotEmptyOrNullOrUndefined(mEdSupplementNum.getText().toString())
&& Integer.parseInt(mEdSupplementNum.getText().toString()) > 0) {
supplementNum = Integer.parseInt(mEdSupplementNum.getText().toString());
allSupplementNum = supplementNum;
if (supplementNum > pickUpNum) {
showMessage("補單數量不能超過" + pickUpNum + "單");
return;
}
if (TextUtil.isEmptyOrNullOrUndefined(name)) {
showMessage("未獲取到收貨人姓名");
return;
}
if (TextUtil.isEmptyOrNullOrUndefined(phone)) {
showMessage("未獲取到收貨人手機號");
return;
}
if (TextUtil.isEmptyOrNullOrUndefined(address)) {
showMessage("未獲取到收貨地址");
return;
}
mPresenter.submitOrder(supplementNum, allSupplementNum, name, phone, address);
} else {
showMessage("補單數量必須大於0");
}
});
}
@Override
public void initIntent() {
}
@Override
public void initTopBar() {
topBar.setTitle("補單");
topBar.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener(v -> killMyself());
topBar.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_color));
}
@Override
public void initLanguage() {
}
@Override
public void initLayoutParams() {
}
@Override
public void initLayoutVisible() {
}
@Override
public void showLoading(String message) {
if (message != null)
LoadingDialog.showDialogForLoading(this, message, true);
else
LoadingDialog.showDialogForLoading(this);
}
@Override
public void hideLoading() {
LoadingDialog.cancelDialogForLoading();
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(this, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
finish();
}
@Override
public void loadNumber(SupplementInfoBean bean) {
if (bean != null && bean.getData() != null) {
SupplementInfoBean.DataBean dataBean = bean.getData();
mTvAddress.setText(dataBean.getReplenishmentAddress());
mTvTip.setText(dataBean.getPickUpPrompt());
mTvName.setText(dataBean.getReplenishmentPerson());
mTvPhone.setText(dataBean.getReplenishmentPhone());
name = dataBean.getReplenishmentPerson();
phone = dataBean.getReplenishmentPhone();
address = dataBean.getReplenishmentAddress();
if (dataBean.getOrderVOS() != null) {
int orderNum = 0;
for (SupplementInfoBean.DataBean.OrderVOSBean orderVOSBean : dataBean.getOrderVOS()) {
if (orderVOSBean.getOrderType() == ColdChainConstans.orderType) {
orderNum = orderVOSBean.getOrderNum();
}
}
pickUpNum = dataBean.getColdChainPickUpNum() - orderNum;
if (orderNum > dataBean.getColdChainPickUpNum()) {
showMessage("訂單數已滿足,不需要補單");
killMyself();
} else {
if (pickUpNum > 0) {
mEdSupplementNum.setText(pickUpNum + "");
} else {
showMessage("訂單數已滿足,不需要補單");
killMyself();
}
}
}
}
}
@Override
public void submissionComplete() {
supplementNum--;
if (supplementNum > 0) {
mPresenter.submitOrder(supplementNum, allSupplementNum, name, phone, address);
} else {
// showMessage("補單完成");
killMyself();
}
}
@Override
public void submissionFail() {
showMessage("補單失敗");
killMyself();
}
}
package com.gingersoft.coldchain_module.mvp.ui.adapter;
import android.content.Context;
import android.graphics.pdf.PdfDocument;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintDocumentInfo;
import android.print.pdf.PrintedPdfDocument;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* 创建打印适配器
*/
public class MyPrintDocumentAdapter extends PrintDocumentAdapter {
private Context mContext;
private String mFilePath;
private PrintedPdfDocument mPdfDocument;
public PdfDocument myPdfDocument;
private InputStream input;
private onPrintStatusChangeListener onPrintStatusChangeListener;
public MyPrintDocumentAdapter(Context context, File file, onPrintStatusChangeListener onPrintStatusChangeListener) {
this.mContext = context;
this.mFilePath = file.getPath();
this.onPrintStatusChangeListener = onPrintStatusChangeListener;
}
//当打印进程开始,该方法就将被调用,
@Override
public void onStart() {
super.onStart();
}
//当用户改变了打印输出时,比方说页面尺寸,或者页面的方向时,
// 该函数将被调用。以此会给我们的应用重新计划打印页面的布局,
// 另外该方法必须返回打印文档包含多少页面。
@Override
public void onLayout(PrintAttributes printAttributes,
PrintAttributes printAttributes1,
CancellationSignal cancellationSignal,
LayoutResultCallback layoutResultCallback,
Bundle bundle) {
// //使用请求的页属性创建新的pdfdocument
// mPdfDocument=new PrintedPdfDocument(mContext,printAttributes1);
// 响应取消请求
if (cancellationSignal.isCanceled()) {
layoutResultCallback.onLayoutCancelled();
return;
}
// 将打印信息返回到打印框架
PrintDocumentInfo info = new PrintDocumentInfo
.Builder("name")
.setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT)
.build();
layoutResultCallback.onLayoutFinished(info, true);
}
//此函数被调用后,会将打印页面渲染成一个待打印的文件,该函数
// 可以在onLayout被调用后调用一次或多次
@Override
public void onWrite(PageRange[] pageRanges,
ParcelFileDescriptor parcelFileDescriptor,
CancellationSignal cancellationSignal,
WriteResultCallback writeResultCallback) {
InputStream input = null;
OutputStream output = null;
try {
input = new FileInputStream(mFilePath);
output = new FileOutputStream(parcelFileDescriptor.getFileDescriptor());
byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = input.read(buf)) > 0) {
output.write(buf, 0, bytesRead);
}
writeResultCallback.onWriteFinished(new PageRange[]{PageRange.ALL_PAGES});
} catch (FileNotFoundException e) {
if (onPrintStatusChangeListener != null) {
onPrintStatusChangeListener.onStatusChange(-1, "未找到待打印文件");
}
// Toast.makeText(mContext, "未找到待打印文件", Toast.LENGTH_SHORT).show();
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
// Toast.makeText(mContext, "待打印状态", Toast.LENGTH_SHORT).show();
}
//一旦打印进程结束后,该函数将会被调用。如果我们的应用有任何
// 一次性销毁任务要执行,让这些任务在该方法内执行。这个回调方法不是必须实现的。
@Override
public void onFinish() {
// Toast.makeText(mContext, "已发送打印", Toast.LENGTH_SHORT).show();
if (onPrintStatusChangeListener != null) {
onPrintStatusChangeListener.onStatusChange(0, "打印文件已發送");
}
super.onFinish();
}
public interface onPrintStatusChangeListener {
void onStatusChange(int code, String msg);
}
}
package com.gingersoft.coldchain_module.mvp.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.coldchain_module.R
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
class OrderDetailsBtnAdapter(list: MutableList<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) {
override fun convert(holder: BaseViewHolder, item: BtnBuilder.BtnBean) {
holder.setText(R.id.tv_btn_content, item.btnContent)
holder.setBackgroundResource(R.id.layout_btn_item, item.btnColor)
holder.setImageResource(R.id.iv_btn_mark, item.btnImg)
}
}
\ No newline at end of file
package com.gingersoft.coldchain_module.mvp.ui.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.mvp.model.bean.FoodDetailsTranBean;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import static com.bin.david.form.utils.DensityUtils.dp2px;
public class OrderDetailsFoodAdapter extends BaseQuickAdapter<OrderDetails.DataBean.PRODUCTNAMEBean, BaseViewHolder> {
public OrderDetailsFoodAdapter(@Nullable List<OrderDetails.DataBean.PRODUCTNAMEBean> data) {
super(R.layout.cold_chain_food_item, data);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, OrderDetails.DataBean.PRODUCTNAMEBean bean) {
baseViewHolder.setText(R.id.tv_food_name, bean.getPRODUCT_NAME());
baseViewHolder.setText(R.id.tv_food_number, getContext().getString(R.string.count) + bean.getNum());
baseViewHolder.setText(R.id.tv_food_price, getContext().getString(R.string.amount_unit) + bean.getPRICE());
List<OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX> childBeanXList = bean.getChild();
if (childBeanXList != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX childBeanX : childBeanXList) {
View foodChild = getChild(FoodDetailsTranBean.getByChildBeanX(childBeanX), 10);
LinearLayout content = foodChild.findViewById(R.id.layout_food_content);
List<OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX.ChildBean> childBeans = childBeanX.getChild();
if (childBeans != null) {
for (OrderDetails.DataBean.PRODUCTNAMEBean.ChildBeanX.ChildBean childBean : childBeanX.getChild()) {
content.addView(getChild(FoodDetailsTranBean.getByChildBean(childBean), 20));
}
}
((LinearLayout)baseViewHolder.getView(R.id.layout_food_content)).addView(foodChild);
}
}
}
private View getChild(FoodDetailsTranBean child, int leftMargin) {
View foodChildChild = LayoutInflater.from(getContext()).inflate(R.layout.cold_chain_food_item, null, false);
((TextView)foodChildChild.findViewById(R.id.tv_food_name)).setText(child.getPRODUCT_NAME());
((TextView)foodChildChild.findViewById(R.id.tv_food_number)).setText(getContext().getString(R.string.count) + child.getNum());
((TextView)foodChildChild.findViewById(R.id.tv_food_price)).setText(getContext().getString(R.string.amount_unit) + child.getPRICE());
ImageView childNext = foodChildChild.findViewById(R.id.iv_food_item_next);
childNext.setVisibility(View.VISIBLE);
childNext.setPadding(dp2px(getContext(), leftMargin), 0, 0, 0);
return foodChildChild;
}
}
package com.gingersoft.coldchain_module.mvp.ui.adapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.graphics.drawable.GradientDrawable;
import android.view.View;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import static com.bin.david.form.utils.DensityUtils.dp2px;
public class OrderListAdapter extends BaseQuickAdapter<OrderList.DataBeanX.DataBean, BaseViewHolder> {
public OrderListAdapter(@Nullable List<OrderList.DataBeanX.DataBean> data) {
super(R.layout.cold_chain_order_item2, data);
}
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, OrderList.DataBeanX.DataBean dataBean) {
baseViewHolder.setText(R.id.tv_pay_method, dataBean.getOrderPayType() == 1 ? "貨到付款" : "在線支付");
baseViewHolder.setText(R.id.tv_order_time, TimeUtils.parseTimeRepeat(dataBean.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
baseViewHolder.setText(R.id.tv_order_user_name, dataBean.getRECEIVER() + "(" + dataBean.getPHONE() + ")");
baseViewHolder.setText(R.id.tv_address, "地址:" + dataBean.getADDRESS_DETAIL());
baseViewHolder.setText(R.id.tv_delivery_state, getStatus(dataBean.getCurStat()));
baseViewHolder.setText(R.id.tv_order_amount, "$" + dataBean.getPAY_AMOUNT());
if (dataBean.getIsRead() == 0) {
baseViewHolder.setVisible(R.id.fl_border, true);
alphaAnimator(baseViewHolder.getView(R.id.fl_border));
} else {
baseViewHolder.setGone(R.id.fl_border, true);
baseViewHolder.getView(R.id.fl_border).clearAnimation();
}
String orderStatus = "";
GradientDrawable statusBg = new GradientDrawable();
statusBg.setCornerRadius(dp2px(getContext(), 5f));
if (dataBean.getSTATUS() == 0 || dataBean.getSTATUS() == 1) {
orderStatus = "待確認";
statusBg.setColor(ContextCompat.getColor(getContext(), R.color.order_state0_color));
} else if (dataBean.getSTATUS() == 2) {
orderStatus = "待提交";
statusBg.setColor(ContextCompat.getColor(getContext(), R.color.order_state1_color));
} else if (dataBean.getSTATUS() == 3) {
orderStatus = "派送中";
statusBg.setColor(ContextCompat.getColor(getContext(), R.color.order_state2_color));
}
baseViewHolder.setText(R.id.tv_order_state, orderStatus);
baseViewHolder.getView(R.id.tv_order_state).setBackground(statusBg);
}
private String getStatus(int curStat) {
switch (curStat) {
case 1:
return "已通知物流";
case 2:
return "配送員已接單";
case 3:
return "配送員到店附近";
case 4:
return "配送員已到店";
case 5:
return "配送中";
case 6:
return "到達目的地附近";
case 7:
return "訂單已完成";
case 8:
case 9:
return "物流已取消";
case 10:
return "已指派另一位配送員";
default:
return "";
}
}
private void alphaAnimator(View view) {
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
ofFloat.setDuration(200);
ofFloat.setRepeatCount(-1);
ofFloat.setRepeatMode(ValueAnimator.REVERSE);
ObjectAnimator ofFloat1 = ObjectAnimator.ofFloat(view, "alpha", 1f, 0f);
ofFloat1.setDuration(200);
ofFloat1.setRepeatCount(-1);
ofFloat1.setRepeatMode(ValueAnimator.REVERSE);
animatorSet.play(ofFloat).with(ofFloat1);
animatorSet.setDuration(400);
animatorSet.start();
}
}
package com.gingersoft.coldchain_module.mvp.ui.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerHistoryOrderComponent;
import com.gingersoft.coldchain_module.di.module.HistoryOrderModule;
import com.gingersoft.coldchain_module.mvp.contract.HistoryOrderContract;
import com.gingersoft.coldchain_module.mvp.presenter.HistoryOrderPresenter;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderListAdapter;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class HistoryOrderFragment extends BaseFragment<HistoryOrderPresenter> implements HistoryOrderContract.View {
@BindView(R2.id.cold_chain_order_list)
RecyclerView mRvOrderList;
OrderListAdapter adapter;
public static HistoryOrderFragment newInstance() {
HistoryOrderFragment fragment = new HistoryOrderFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerHistoryOrderComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.historyOrderModule(new HistoryOrderModule(this))
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
* 方法中就可以 {@code switch} 做不同的操作, 这样就可以用统一的入口方法做多个不同的操作, 可以起到分发的作用
* <p>
* 调用此方法时请注意调用时 Fragment 的生命周期, 如果调用 {@link #setData(Object)} 方法时 {@link Fragment#onCreate(Bundle)} 还没执行
* 但在 {@link #setData(Object)} 里却调用了 Presenter 的方法, 是会报空的, 因为 Dagger 注入是在 {@link Fragment#onCreate(Bundle)} 方法中执行的
* 然后才创建的 Presenter, 如果要做一些初始化操作,可以不必让外部调用 {@link #setData(Object)}, 在 {@link #initData(Bundle)} 中初始化就可以了
* <p>
* Example usage:
* <pre>
* public void setData(@Nullable Object data) {
* if (data != null && data instanceof Message) {
* switch (((Message) data).what) {
* case 0:
* loadData(((Message) data).arg1);
* break;
* case 1:
* refreshUI();
* break;
* default:
* //do something
* break;
* }
* }
* }
*
* // call setData(Object):
* Message data = new Message();
* data.what = 0;
* data.arg1 = 1;
* fragment.setData(data);
* </pre>
*
* @param data 当不需要参数时 {@code data} 可以为 {@code null}
*/
@Override
public void setData(@Nullable Object data) {
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
checkNotNull(message);
ArmsUtils.snackbarText(message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
public void loadData(){
}
@Override
public void killMyself() {
}
}
package com.gingersoft.coldchain_module.mvp.ui.fragment;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.coldchain_module.R;
import com.gingersoft.coldchain_module.R2;
import com.gingersoft.coldchain_module.di.component.DaggerOrderListComponent;
import com.gingersoft.coldchain_module.di.module.OrderListModule;
import com.gingersoft.coldchain_module.mvp.contract.OrderListContract;
import com.gingersoft.coldchain_module.mvp.model.bean.OrderList;
import com.gingersoft.coldchain_module.mvp.presenter.OrderListPresenter;
import com.gingersoft.coldchain_module.mvp.ui.activity.ColdChainMainActivity;
import com.gingersoft.coldchain_module.mvp.ui.activity.OrderDetailsActivity;
import com.gingersoft.coldchain_module.mvp.ui.adapter.OrderListAdapter;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.List;
import butterknife.BindView;
import static com.jess.arms.utils.Preconditions.checkNotNull;
public class OrderListFragment extends BaseFragment<OrderListPresenter> implements OrderListContract.View {
@BindView(R2.id.cold_chain_order_list)
RecyclerView mRvOrderList;
@BindView(R2.id.layout_nodata)
LinearLayout layoutNoData;
OrderListAdapter adapter;
@BindView(R2.id.cold_chain_refresh_layout)
SmartRefreshLayout mRefreshLayout;
private int restaurantId;
private String status;
private String type;
private int page = 1;
public static OrderListFragment newInstance(String status, String type) {
OrderListFragment fragment = new OrderListFragment();
Bundle arguments = new Bundle();
arguments.putString("status", status);
arguments.putString("type", type);
fragment.setArguments(arguments);
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerOrderListComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.orderListModule(new OrderListModule(this))
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
mRefreshLayout.setPrimaryColorsId(android.R.color.transparent, android.R.color.black);
restaurantId = GsaCloudApplication.getRestaurantId(mContext);
Bundle arguments = getArguments();
if (arguments != null) {
status = getArguments().getString("status");
type = getArguments().getString("type");
}
onRefreshData();
mRefreshLayout.setOnRefreshListener(refreshLayout -> onRefreshData());
mRefreshLayout.setOnLoadMoreListener(refreshLayout -> {
page++;
getOrderList();
});
}
public void onRefreshData() {
page = 1;
mRefreshLayout.setEnableLoadMore(true);
getOrderList();
}
private void getOrderList() {
mPresenter.getOrderList(restaurantId, page, status, type);
}
// @Override
// public void onResume() {
// super.onResume();
// onRefreshData();
// }
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
* 方法中就可以 {@code switch} 做不同的操作, 这样就可以用统一的入口方法做多个不同的操作, 可以起到分发的作用
* <p>
* 调用此方法时请注意调用时 Fragment 的生命周期, 如果调用 {@link #setData(Object)} 方法时 {@link Fragment#onCreate(Bundle)} 还没执行
* 但在 {@link #setData(Object)} 里却调用了 Presenter 的方法, 是会报空的, 因为 Dagger 注入是在 {@link Fragment#onCreate(Bundle)} 方法中执行的
* 然后才创建的 Presenter, 如果要做一些初始化操作,可以不必让外部调用 {@link #setData(Object)}, 在 {@link #initData(Bundle)} 中初始化就可以了
* <p>
* Example usage:
* <pre>
* public void setData(@Nullable Object data) {
* if (data != null && data instanceof Message) {
* switch (((Message) data).what) {
* case 0:
* loadData(((Message) data).arg1);
* break;
* case 1:
* refreshUI();
* break;
* default:
* //do something
* break;
* }
* }
* }
*
* // call setData(Object):
* Message data = new Message();
* data.what = 0;
* data.arg1 = 1;
* fragment.setData(data);
* </pre>
*
* @param data 当不需要参数时 {@code data} 可以为 {@code null}
*/
@Override
public void setData(@Nullable Object data) {
// if (data instanceof Message) {
// mPresenter.getOrderList(restaurantId, 0, status, type);
// }
}
@Override
public void showLoading(String message) {
}
@Override
public void hideLoading() {
}
@Override
public void showMessage(@NonNull String message) {
ArmsUtils.makeText(mContext, message);
}
@Override
public void launchActivity(@NonNull Intent intent) {
checkNotNull(intent);
ArmsUtils.startActivity(intent);
}
@Override
public void killMyself() {
}
@Override
public void loadOrderList(List<OrderList.DataBeanX.DataBean> data) {
// if (data.size() <= 0) {
// page--;
// mRefreshLayout.setEnableLoadMore(false);
// }
mRefreshLayout.finishRefresh();
mRefreshLayout.finishLoadMore();
if (data != null) {
layoutNoData.setVisibility(data.size() <= 0 ? View.VISIBLE : View.GONE);
mRvOrderList.setVisibility(data.size() <= 0 ? View.GONE : View.VISIBLE);
if (adapter == null) {
adapter = new OrderListAdapter(data);
mRvOrderList.setLayoutManager(new LinearLayoutManager(mContext));
adapter.setOnItemClickListener((adapter1, view, position) -> {
Intent intent = new Intent(mContext, OrderDetailsActivity.class);
intent.putExtra("orderId", data.get(position).getId());
intent.putExtra("isRead", data.get(position).getIsRead());
intent.putExtra("position", position);
startActivityForResult(intent, 1001);
});
mRvOrderList.setAdapter(adapter);
} else {
adapter.setList(data);
}
} else {
layoutNoData.setVisibility(View.VISIBLE);
mRvOrderList.setVisibility(View.GONE);
}
}
@Override
public void notifyByPosition(int position, OrderList.DataBeanX.DataBean dataBean) {
if(adapter != null){
adapter.setData(position, dataBean);
notifyActivityOrderNum();
}
}
@Override
public void removeItem(int position) {
if(adapter != null){
adapter.removeAt(position);
notifyActivityOrderNum();
}
}
private void notifyActivityOrderNum(){
if(getActivity() instanceof ColdChainMainActivity){
((ColdChainMainActivity) getActivity()).getNumByOrderTypeInvoke("loadNumber");
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == 1001 && data != null && mPresenter != null) {
int position = data.getIntExtra("position", -1);
int orderStatus = data.getIntExtra("orderStatus", 0);
mPresenter.notifyDataByPosition(position, orderStatus);
}
}
}
<?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="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f0"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f0"
android:orientation="vertical"
app:elevation="@dimen/dp_0">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/cold_chain_history_order_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:padding="@dimen/dp_10"
android:visibility="gone">
<EditText
android:id="@+id/ed_order_num_search"
android:layout_width="0dp"
android:layout_height="@dimen/dp_38"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_search_bg"
android:hint="請輸入手機號或訂單號"
android:inputType="number"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_50"
android:textColor="@color/theme_333_color"
android:textColorHint="@color/color_ccc"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_search_order"
android:layout_width="@dimen/dp_50"
android:layout_height="0dp"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
app:layout_constraintRight_toRightOf="@id/ed_order_num_search"
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
<TextView
android:id="@+id/tv_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/ed_order_num_search"
app:layout_constraintTop_toBottomOf="@id/ed_order_num_search" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_start_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
app:layout_constraintBottom_toBottomOf="@id/tv_start_time"
app:layout_constraintLeft_toRightOf="@id/tv_start_time"
app:layout_constraintTop_toTopOf="@id/tv_start_time"
app:trv_direction="bottom" />
<TextView
android:id="@+id/tv_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:text="至"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/iv_start_time_triangle"
app:layout_constraintLeft_toRightOf="@id/iv_start_time_triangle"
app:layout_constraintTop_toTopOf="@id/iv_start_time_triangle" />
<TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_to"
app:layout_constraintLeft_toRightOf="@id/tv_to"
app:layout_constraintTop_toTopOf="@id/tv_to" />
<com.gingersoft.gsa.cloud.ui.view.TriangleView
android:id="@+id/iv_end_time_triangle"
android:layout_width="@dimen/dp_8"
android:layout_height="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_2"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_end_time"
app:layout_constraintLeft_toRightOf="@id/tv_end_time"
app:layout_constraintTop_toTopOf="@id/tv_end_time"
app:trv_direction="bottom" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.tabs.TabLayout
android:id="@+id/history_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:tabPaddingEnd="-1dp"
app:tabPaddingStart="-1dp"
app:tabSelectedTextColor="@color/theme_color"
app:tabTextColor="@color/color_ccc">
<com.google.android.material.tabs.TabItem
android:id="@+id/tabItem_completed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已完成" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tabItem_cancelled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已取消" />
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/cold_chain_history_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f0"
tools:context=".ui.activity.DeliveryOrderMainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:elevation="@dimen/dp_0">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/coldchain_main_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/coldchain_main_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:tabBackground="@color/white"
app:tabIndicatorColor="@color/theme_color"
app:tabPaddingEnd="-1dp"
app:tabPaddingStart="-1dp" />
<TextView
android:id="@+id/tv_balance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_10"
android:text="餘額:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="@+id/cold_chain_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent">
<Button
android:id="@+id/btn_supplement_order"
android:layout_width="0dp"
style="@style/app_btn_style"
android:background="@color/theme_color"
android:layout_weight="1"
android:text="補單" />
<Button
android:id="@+id/btn_pick_up"
android:layout_width="0dp"
style="@style/app_btn_style"
android:layout_marginLeft="@dimen/dp_5"
android:background="@color/theme_color"
android:layout_weight="1"
android:text="PICK UP" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/cold_chain_supplement_order_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<TextView
android:id="@+id/tv_supplement_tip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/black"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_8"
android:paddingRight="@dimen/dp_15"
android:paddingBottom="@dimen/dp_8"
android:text="補單的運費由餐廳承擔,以每單計算"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f0"
android:orientation="vertical"
android:padding="@dimen/dp_10">
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_8"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="聯繫人:"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_supplement_order_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:text="張先生"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="聯繫人電話:"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_supplement_order_address"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="張先生"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="地址:"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_supplement_order_phone"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="香港"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@color/white"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_8"
android:orientation="vertical">
<TextView
style="@style/order_details_title_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_8"
android:text="商品詳情" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
android:text="食品"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
android:gravity="center"
android:text="X1"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="$0.0"
android:textColor="@color/black"
android:textSize="@dimen/dp_16" />
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@color/white"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dp_8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="需要補單數量" />
<EditText
android:id="@+id/ed_supplement_order_number"
android:layout_width="@dimen/dp_50"
android:gravity="center"
android:maxLines="1"
android:maxLength="3"
android:layout_height="wrap_content"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="單" />
</LinearLayout>
</com.lihang.ShadowLayout>
<View
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/btn_confirm_supplement_order"
android:layout_width="match_parent"
style="@style/app_btn_style"
android:text="確定" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingTop="@dimen/dp_12">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_food_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintHorizontal_weight="0.5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_food_number"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_food_item_next"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:src="@drawable/item_next"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_food_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_food_name" />
<TextView
android:id="@+id/tv_food_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
tools:text="食品名"
app:layout_constraintLeft_toRightOf="@id/iv_food_item_next"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_food_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/color_3c"
tools:text="食品數量"
android:textSize="@dimen/dp_15"
app:layout_constraintHorizontal_weight="0.2"
app:layout_constraintLeft_toRightOf="@id/layout_food_name"
app:layout_constraintRight_toLeftOf="@id/tv_food_price"
app:layout_constraintTop_toTopOf="@id/layout_food_name" />
<TextView
android:id="@+id/tv_food_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
tools:text="食品價格"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintLeft_toRightOf="@id/tv_food_number"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/layout_food_name" />
<LinearLayout
android:id="@+id/layout_food_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/layout_food_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_history_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_20"
android:background="@color/white"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_10">
<ImageView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:visibility="gone"
android:src="@drawable/ic_history_order" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_list_popup"
android:layout_width="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_height="wrap_content"
android:text="歷史訂單"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/rootview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f0">
<com.qmuiteam.qmui.widget.QMUITopBar
android:id="@+id/cold_chain_order_detail_top_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:fitsSystemWindows="true"
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" />
<!-- 按鈕佈局-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_details_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_order_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/rv_order_details_btn"
android:layout_below="@id/cold_chain_order_detail_top_bar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_order_from"
style="@style/order_details_title_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:textSize="@dimen/dp_16"
android:textStyle="normal"
tools:text="訂單來源" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/other_order_info_dialog_content_marginRight"
android:textColor="#009788"
android:textSize="@dimen/dp_15"
tools:text="訂單狀態" />
</RelativeLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<!-- 訂單編號-->
<TextView
android:id="@+id/tv_order_no"
style="@style/otherOrder_details_twelve_text_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginTop="@dimen/dp_10"
tools:text="訂單編號:" />
<TextView
android:id="@+id/tv_create_time"
style="@style/otherOrder_details_twelve_text_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight="@dimen/dp_10"
tools:text="開單時間:" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10">
<TextView
style="@style/order_details_title_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/other_order_info_dialog_content_marginLeft"
android:text="訂單詳情" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_receiver_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收貨人:" />
<TextView
android:id="@+id/tv_receiver"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receiver_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_bill_num_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單號:" />
<TextView
android:id="@+id/tv_bill_num"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_bill_num_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_receive_phone_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:text="收貨電話:"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_receive_phone"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receive_phone_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_receive_time_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:text="收貨時間:"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_receive_time"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receive_time_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_receive_address_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收貨地址:" />
<TextView
android:id="@+id/tv_receive_address"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_receive_address_text"
android:gravity="right"
tools:text="地址" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_14"
android:paddingLeft="@dimen/dp_7"
android:paddingRight="@dimen/dp_14">
<TextView
android:id="@+id/tv_remark_text"
style="@style/otherOrderReceiving_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="備註:" />
<TextView
android:id="@+id/tv_remark"
style="@style/otherOrderReceiving_information_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_remark_text"
android:gravity="right" />
</RelativeLayout>
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_14"-->
<!-- android:paddingLeft="@dimen/dp_7"-->
<!-- android:paddingRight="@dimen/dp_14">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_man_name_text"-->
<!-- style="@style/otherOrderReceiving_title_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- tools:text="派送員名稱:"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_man_name"-->
<!-- style="@style/otherOrderReceiving_information_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_toRightOf="@id/tv_delivery_man_name_text"-->
<!-- android:gravity="right" />-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_14"-->
<!-- android:paddingLeft="@dimen/dp_7"-->
<!-- android:paddingRight="@dimen/dp_14">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_man_phone_text"-->
<!-- style="@style/otherOrderReceiving_title_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- tools:text="派送員電話:"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_man_phone"-->
<!-- style="@style/otherOrderReceiving_information_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_toRightOf="@id/tv_delivery_man_phone_text"-->
<!-- android:gravity="right" />-->
<!-- </RelativeLayout>-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_14"-->
<!-- android:paddingLeft="@dimen/dp_7"-->
<!-- android:paddingRight="@dimen/dp_14">-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_num_text"-->
<!-- style="@style/otherOrderReceiving_title_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- tools:text="物流號:"-->
<!-- android:layout_height="wrap_content" />-->
<!-- <TextView-->
<!-- android:id="@+id/tv_delivery_num"-->
<!-- style="@style/otherOrderReceiving_information_textStyle"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:layout_toRightOf="@id/tv_delivery_num_text"-->
<!-- android:gravity="right" />-->
<!-- </RelativeLayout>-->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10">
<TextView
android:id="@+id/tv_food_details_text"
style="@style/order_details_title_Style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="商品詳情" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:layout_marginRight="@dimen/other_order_info_dialog_content_marginRight"
android:layout_marginBottom="@dimen/dp_10" />
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_total_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="合計:" />
<TextView
android:id="@+id/tv_total"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_total_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_lunchbox_cost_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="餐盒費:" />
<TextView
android:id="@+id/tv_lunchbox_cost"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_lunchbox_cost_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_delivery_fee_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="送貨費:" />
<TextView
android:id="@+id/tv_delivery_fee"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_delivery_fee_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_discount_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="折扣:" />
<TextView
android:id="@+id/tv_discount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_discount_text"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_total_amount_text2"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="總金額:" />
<TextView
android:id="@+id/tv_total_amount2"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_total_amount_text2"
android:gravity="right" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_pay_amount_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="支付金額:" />
<TextView
android:id="@+id/tv_pay_amount"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_pay_amount_text"
android:gravity="right"
android:textColor="#FF0000" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingLeft="@dimen/other_order_info_dialog_content_marginLeft"
android:paddingRight="@dimen/other_order_info_dialog_content_marginLeft">
<TextView
android:id="@+id/tv_pay_method_text"
style="@style/otherOrder_bill_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="支付方式:" />
<TextView
android:id="@+id/tv_pay_method"
style="@style/otherOrder_bill_info_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/tv_pay_method_text"
android:gravity="right" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_3">
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_4"
android:paddingBottom="@dimen/dp_6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_pay_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="@drawable/shape_payments_btn"
android:gravity="left"
android:paddingLeft="@dimen/dp_8"
android:paddingTop="@dimen/dp_6"
android:paddingRight="@dimen/dp_8"
android:paddingBottom="@dimen/dp_6"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
android:textStyle="bold"/>
<TextView
android:id="@+id/tv_order_time"
style="@style/order_item_twelve_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:textSize="@dimen/dp_10"
tools:text="下單時間"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/dp_14"
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_10"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
tools:text="用戶名+手機號(1234567862)"
tools:textColor="@color/theme_333_color" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5">
<TextView
android:id="@+id/tv_address_text"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6"
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="地址:"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@id/tv_address_text"
app:layout_constraintTop_toTopOf="@id/tv_address_text"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical">
<ImageView
android:id="@+id/ic_vehicle"
android:layout_width="@dimen/dp_26"
android:layout_height="@dimen/dp_26"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:layout_weight="0.35"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/tv_delivery_state"
style="@style/order_item_info_title_textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:textColor="@color/color_3c"
tools:text="已通知物流"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_11"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_4"
android:paddingRight="@dimen/dp_13"
android:paddingBottom="@dimen/dp_4"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:gravity="center_horizontal"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/tv_address"
app:layout_constraintRight_toRightOf="parent"
tools:text="$14141"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id="@+id/fl_border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_3">
<com.lihang.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hl_cornerRadius="@dimen/dp_8"
app:hl_shadowLimit="@dimen/dp_3">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dp_10"
android:paddingLeft="@dimen/dp_14"
android:paddingRight="@dimen/dp_14"
android:paddingBottom="@dimen/dp_6">
<TextView
android:id="@+id/tv_pay_method"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="@drawable/shape_payments_btn"
android:gravity="left"
android:paddingLeft="@dimen/dp_8"
android:paddingTop="@dimen/dp_6"
android:paddingRight="@dimen/dp_8"
android:paddingBottom="@dimen/dp_6"
android:textColor="@color/white"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="支付方式" />
<TextView
android:id="@+id/tv_order_time"
style="@style/order_item_twelve_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:gravity="right"
android:text="@string/Key_add_10"
android:textSize="@dimen/dp_10"
app:layout_constraintLeft_toRightOf="@id/tv_pay_method"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="2019-07-06 15:30:00"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_user_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_14"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/tv_order_state"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_state"
app:layout_constraintTop_toBottomOf="@id/tv_pay_method"
app:layout_constraintTop_toTopOf="@id/tv_order_state"
tools:text="用戶名+手機號(1234567862)"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_address"
style="@style/order_item_info_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/tv_order_amount"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name"
app:layout_constraintVertical_bias="1"
android:textColor="@color/color_3c"
tools:text="用戶收貨地址"
tools:textColor="#868686" />
<TextView
android:id="@+id/tv_delivery_state"
style="@style/order_item_info_title_textStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9"
android:gravity="right"
android:textColor="@color/color_3c"
app:layout_constraintLeft_toRightOf="@id/tv_pay_method"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_time"
tools:text="已通知物流"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_3"
android:gravity="center"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_8"
android:paddingRight="@dimen/dp_20"
android:paddingBottom="@dimen/dp_8"
android:textColor="@color/white"
android:textSize="@dimen/dp_12"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_state"
tools:text="訂單狀態"
tools:textColor="@color/theme_333_color" />
<TextView
android:id="@+id/tv_order_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_7"
android:gravity="center_horizontal"
android:maxWidth="@dimen/dp_100"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_16"
app:layout_constraintLeft_toRightOf="@id/tv_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_order_state"
tools:text="$14141144"
tools:textColor="@color/theme_333_color" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.lihang.ShadowLayout>
<FrameLayout
android:id="@+id/fl_border"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_order_border"
android:visibility="gone" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cold_chain_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/cold_chain_order_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="@+id/layout_nodata"
layout="@layout/layout_no_data" />
</FrameLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/layout_btn_item"
android:layout_height="@dimen/dp_40"
android:gravity="center"
android:layout_marginStart="@dimen/dp_1"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_btn_mark"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_18"/>
<TextView
android:id="@+id/tv_btn_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_4"
android:textColor="@color/white"
android:textSize="@dimen/dp_14" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="other_order_info_dialog_content_marginLeft">@dimen/dp_10</dimen>
<dimen name="other_order_info_dialog_content_marginRight">@dimen/dp_10</dimen>
</resources>
\ No newline at end of file
<resources>
<string name="cold_chain_name">凍鏈</string>
</resources>
<resources>
<!-- 訂單列表item的下單時間字體樣式-->
<style name="order_item_twelve_textStyle">
<item name="android:textColor">@color/color_66</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的訂單信息名稱字體樣式-->
<style name="order_item_info_textStyle">
<item name="android:textColor">@color/theme_text_color</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的訂單信息名稱字體樣式-->
<style name="order_item_info_title_textStyle">
<item name="android:textColor">@color/theme_text_color</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單詳情小標題文字大小-->
<style name="order_details_title_Style">
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="otherOrder_details_twelve_text_Style">
<item name="android:textSize">@dimen/dp_12</item>
<item name="android:textColor">@color/color_3c</item>
</style>
</resources>
package com.gingersoft.coldchain_module;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
...@@ -123,7 +123,9 @@ ext { ...@@ -123,7 +123,9 @@ ext {
// 狀態欄基础依赖包,必须要依赖 // 狀態欄基础依赖包,必须要依赖
"immersionbar" : "com.gyf.immersionbar:immersionbar:3.0.0", "immersionbar" : "com.gyf.immersionbar:immersionbar:3.0.0",
// fragment快速实现(可选) // fragment快速实现(可选)
"immersionbar-components" : "com.gyf.immersionbar:immersionbar-components:3.0.0" "immersionbar-components" : "com.gyf.immersionbar:immersionbar-components:3.0.0",
"permissionx" : 'com.permissionx.guolindev:permissionx:1.3.1'
] ]
} }
apply from: rootProject.file('cc-settings.gradle') apply from: rootProject.file('cc-settings.gradle')
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
android { android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"] compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
...@@ -3,17 +3,20 @@ ...@@ -3,17 +3,20 @@
package="com.gingersoft.gsa.other_order_mode"> package="com.gingersoft.gsa.other_order_mode">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK" />
<application> <application>
<activity <activity
android:name=".ui.activity.OtherOrderActivity" android:name=".ui.activity.DeliveryOrderMainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" /> android:launchMode="singleTop">
<service <intent-filter>
android:name=".service.GetInfoUpdateService" <action android:name="action.gingersoft.DELIVERY_ORDER" />
android:enabled="true" <category android:name="android.intent.category.DEFAULT"/>
/> </intent-filter>
</activity>
<activity android:name=".ui.activity.HistoryOrderActivity" /> <activity android:name=".ui.activity.HistoryOrderActivity" />
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
...@@ -22,7 +25,7 @@ ...@@ -22,7 +25,7 @@
<activity android:name=".ui.activity.DeliverySettingActivity" /> <activity android:name=".ui.activity.DeliverySettingActivity" />
<activity android:name=".ui.activity.OrderDetailsActivity" /> <activity android:name=".ui.activity.OrderDetailsActivity" />
<activity android:name=".ui.activity.PayActivity" /> <activity android:name=".ui.activity.PayActivity" />
<activity android:name=".ui.activity.LogActivity"/> <activity android:name=".ui.activity.LogActivity" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<activity android:name=".ui.activity.LogActivity"/> <activity android:name=".ui.activity.LogActivity"/>
<activity android:name=".ui.activity.OrderDetailsActivity" /> <activity android:name=".ui.activity.OrderDetailsActivity" />
<activity <activity
android:name=".ui.activity.OtherOrderActivity" android:name=".ui.activity.DeliveryOrderMainActivity"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<service android:name=".service.GetInfoUpdateService" /> <service android:name="com.gingersoft.gsa.cloud.service.GetInfoUpdateService" />
<meta-data <meta-data
android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration" android:name="com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
......
...@@ -7,38 +7,12 @@ import com.billy.cc.core.component.CC; ...@@ -7,38 +7,12 @@ 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.function.FModule; import com.gingersoft.gsa.cloud.service.GetInfoUpdateService;
import com.gingersoft.gsa.other_order_mode.service.GetInfoUpdateService; import com.gingersoft.gsa.other_order_mode.ui.activity.DeliveryOrderMainActivity;
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 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 CANCEL_ORDER_BTN_KEY = "takeaway/orderDetails/btn/cancelOrder";
public static final String PRINT_ORDER_BTN_KEY = "takeaway/orderDetails/btn/printOrder";
public static final String LOGISTICS_BTN_KEY = "takeaway/orderDetails/btn/logistics";
public static final String ASSIGNDELIVERY_BTN_KEY = "takeaway/orderDetails/btn/assignDelivery";
public static final String CLOSING_BTN_KEY = "takeaway/orderDetails/btn/closing";
public static final String TRANSPORTATION_BTN_KEY = "takeaway/orderDetails/btn/transportation";
/** 外送/自取- 訂單詳情管理 */
public static final FModule[] orderDetails = {
new FModule(CONFIRM_BTN_KEY, 0, 0),
new FModule(PRODUCTION_COMPLETED_BTN_KEY, 0, 0),
new FModule(CANCEL_ORDER_BTN_KEY, 0, 0),
new FModule(PRINT_ORDER_BTN_KEY, 0, 0),
new FModule(LOGISTICS_BTN_KEY, 0, 0),
new FModule(ASSIGNDELIVERY_BTN_KEY, 0, 0),
new FModule(CLOSING_BTN_KEY, 0, 0),
new FModule(TRANSPORTATION_BTN_KEY, 0, 0),
};
}
@Override @Override
public String getName() { public String getName() {
//组件的名称,调用此组件的方式: //组件的名称,调用此组件的方式:
...@@ -70,7 +44,7 @@ public class OtherOrderComponent implements IComponent { ...@@ -70,7 +44,7 @@ public class OtherOrderComponent implements IComponent {
lifecycleFragmentDoubleText(cc); lifecycleFragmentDoubleText(cc);
break; break;
case "orderActivity": case "orderActivity":
CCUtil.navigateTo(cc, OtherOrderActivity.class); CCUtil.navigateTo(cc, DeliveryOrderMainActivity.class);
CC.sendCCResult(cc.getCallId(), CCResult.success()); CC.sendCCResult(cc.getCallId(), CCResult.success());
break; break;
case "closeHeart": case "closeHeart":
......
package com.gingersoft.gsa.other_order_mode.data package com.gingersoft.gsa.other_order_mode.data
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.print.bean.OrderDetails import com.gingersoft.gsa.cloud.print.bean.OrderDetails
...@@ -8,7 +7,6 @@ import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem ...@@ -8,7 +7,6 @@ import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem
import com.gingersoft.gsa.other_order_mode.data.model.bean.UpdateOrderStatusBean import com.gingersoft.gsa.other_order_mode.data.model.bean.UpdateOrderStatusBean
import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork
import com.google.gson.Gson import com.google.gson.Gson
import com.jess.arms.utils.DeviceUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import okhttp3.FormBody import okhttp3.FormBody
...@@ -138,6 +136,19 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -138,6 +136,19 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.getTransportationConfig(restaurantId) network.getTransportationConfig(restaurantId)
} }
suspend fun additionalServiceCharge(uid: String, orderId: String, paymentValue: Int) = withContext(Dispatchers.IO) {
network.additionalServiceCharge(getBody("uid" to uid, "orderId" to orderId, "paymentValue" to paymentValue.toString()))
}
suspend fun getBanlance(brandId: String) = withContext(Dispatchers.IO) {
network.getBanlance(brandId)
}
suspend fun getActualAmount(orderId: String, uid: String, restaurantId: String) = withContext(Dispatchers.IO) {
network.getActualAmount(orderId, uid, restaurantId)
}
suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO) { suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("restId", restId) .add("restId", restId)
...@@ -182,17 +193,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -182,17 +193,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.addPrj(getBody("orderId" to orderId, "restaurantId" to restaurantId, "orderDetailsIds" to orderDetailsIds)) network.addPrj(getBody("orderId" to orderId, "restaurantId" to restaurantId, "orderDetailsIds" to orderDetailsIds))
} }
suspend fun noticePersonnel(pushContent: String?, code: String) { suspend fun getAdditionalByOrderId(orderId: String, deletes: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() network.getAdditionalByOrderId(orderId, deletes)
.add("code", code)//錯誤碼AppConstans.RP_HEART_ERROR
.add("shopId", GsaCloudApplication.getGsPosShopId(GsaCloudApplication.getAppContext()))
.add("source", GsaCloudApplication.getAppName())//錯誤來源
.add("pushContent", pushContent + "")//推送內容
.add("version", DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()))//系統版本
.build()
network.noticePersonnel(requestBody)
// OkHttp3Utils.post(HttpsConstans.ROOT_URL + "/member-web/api/monitor/pushAlarm", requestBody)
// .subscribeOn(Schedulers.io()).subscribe()
} }
fun getBody(vararg pair: Pair1<String, String>): RequestBody { fun getBody(vararg pair: Pair1<String, String>): RequestBody {
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class AddServiceChargeBean(
val errCode: String,
val errMsg: String,
val success: Boolean,
val sysTime: Long
)
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class BalanceBean(
val balance: Double,
val bond: Double,
val brandId: Int,
val createTime: Long,
val createUid: Int,
val deletes: Int,
val id: Int,
val telephone: String,
val threshold: Double,
val updateTime: Long,
val updateUid: Int
)
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
import com.gingersoft.gsa.cloud.database.bean.Function
import com.gingersoft.gsa.other_order_mode.OtherOrderComponent
import com.gingersoft.gsa.other_order_mode.R
class BtnBuilder(var functions: List<Function>) {
companion object {
val SureBtn = 0
val CancelBtn = 1
val PrintBtn = 2
val LogisticsBtn = 3
val AssignDeliveryBtn = 4
val ClosingBtn = 5
val ProductionCompletedBtn = 6
val TransportationBtn = 7//選擇運輸工具
@Volatile
private var instance: BtnBuilder? = null
fun getInstance(functions: List<Function>) = instance ?: synchronized(this) {
instance ?: BtnBuilder(functions).also { instance = it }
}
}
class BtnBean(val type: Int, val btnContent: String, val btnColor: Int, val btnImg: Int)
fun getSureBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.CONFIRM_BTN_KEY, SureBtn, "確認訂單", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getProductionCompletedBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.PRODUCTION_COMPLETED_BTN_KEY, ProductionCompletedBtn, "製作完成", R.color.other_order_details_sure_btn_color, R.drawable.ic_sure)
}
fun getCancelBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.CANCEL_ORDER_BTN_KEY, CancelBtn, "取消訂單", R.color.other_order_details_cancel_btn_color, R.drawable.ic_cancel)
}
fun getPrintBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.PRINT_ORDER_BTN_KEY, PrintBtn, "打印訂單", R.color.other_order_details_print_btn_color, R.drawable.ic_print)
}
fun getLogisticsBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.LOGISTICS_BTN_KEY, LogisticsBtn, "取消物流", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
fun getAssignDeliveryBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.ASSIGNDELIVERY_BTN_KEY, AssignDeliveryBtn, "指派送貨", R.color.other_order_details_sure_btn_color, R.drawable.ic_deliveryman)
}
fun getClosingBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.CLOSING_BTN_KEY, ClosingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
}
fun getTransportationBtn(): BtnBean? {
return getBtn(OtherOrderComponent.takeaway.TRANSPORTATION_BTN_KEY, TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
private fun getBtn(key:String, btnCode:Int, btnContent: String, btnColor: Int, btnImg: Int): BtnBean? {
for (value in functions) {
if (value.resUrl == key) {
return when {
value.status == 3 -> BtnBean(btnCode, btnContent, R.color.color_ccc, btnImg)
// value.status == 1 -> BtnBean(btnCode, btnContent, btnColor, btnImg)
else -> BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
}
return null
// return BtnBean(btnCode, btnContent, btnColor, btnImg)
}
}
...@@ -6,7 +6,8 @@ class OrderList { ...@@ -6,7 +6,8 @@ class OrderList {
private var sysTime: Long = 0 private var sysTime: Long = 0
private var data: DataBeanX? = null private var data: DataBeanX? = null
var errCode: String? = null var errCode: String? = null
var errMsg:String? = null var errMsg: String? = null
class DataBeanX { class DataBeanX {
...@@ -89,7 +90,10 @@ class OrderList { ...@@ -89,7 +90,10 @@ 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卡車 var transportationType: Int = 0//交通工具 1摩托車 2麵包車 3卡車
var timeSecond: Long = 0//秒,如果這個時間小於餐廳配置的時間,顯示接單超時
var paymentValue: Int = 0//服務費
class OrderType { class OrderType {
var typeTotalAmount: Double = 0.toDouble() var typeTotalAmount: Double = 0.toDouble()
var typeDayOrderNum: Int = 0 var typeDayOrderNum: Int = 0
......
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class ServiceChargeRecordBean(
val `data`: MutableList<DataX>,
val success: Boolean,
val sysTime: Long
) {
data class DataX(
val createTime: Long,
val createUid: Int,
val deletes: Int,
val id: Int,
val logisticsOrderId: Int,
val orderId: Int,
val paymentValue: Double,
val restaurantId: Int,
val status: Int,
val type: Int,
val updateTime: Long,
val updateUid: Int,
val createName: String,
val updateName: String
)
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.data.model.bean
data class TransportAmountBean(
val `data`: List<DataX>,
val success: Boolean,
val sysTime: Long
) {
data class DataX(
val amountOn: Int,
val amountUnder: Int,
val createName: String,
val createTime: Long,
val createUid: Int,
val deliveryAmount: Double,
val id: Int,
val restaurantId: Int,
val status: Int,
val type: Int,
val updateName: String,
val updateTime: Long,
val updateUid: Int
)
}
\ No newline at end of file
...@@ -12,7 +12,7 @@ import kotlin.coroutines.suspendCoroutine ...@@ -12,7 +12,7 @@ import kotlin.coroutines.suspendCoroutine
class CoolWeatherNetwork { class CoolWeatherNetwork {
private val orderService = ServiceCreator.create(WeatherService::class.java) private val ricepon_WechatService = ServiceCreator.create(WeatherService::class.java)
private val service = ServiceCreator.create2(WeatherService::class.java) private val service = ServiceCreator.create2(WeatherService::class.java)
...@@ -24,24 +24,31 @@ class CoolWeatherNetwork { ...@@ -24,24 +24,31 @@ class CoolWeatherNetwork {
private val orderPayService = ServiceCreator.create5(WeatherService::class.java) private val orderPayService = ServiceCreator.create5(WeatherService::class.java)
private val systemService= ServiceCreator.createSystem(WeatherService::class.java) private val systemService = ServiceCreator.createSystem(WeatherService::class.java)
private val activitiesService = ServiceCreator.createActivities(WeatherService::class.java)
private val gsaService = ServiceCreator.createGSA(WeatherService::class.java)
private val rootGsaService = ServiceCreator.createRootGSA(WeatherService::class.java)
//獲取訂單列表 //獲取訂單列表
suspend fun fetchOrderList(requestBody: RequestBody) = orderService.getOrderList(requestBody).await() suspend fun fetchOrderList(requestBody: RequestBody) = ricepon_WechatService.getOrderList(requestBody).await()
//修改餐廳營業狀態 //修改餐廳營業狀態
suspend fun updateRestOpenStatus(requestBody: RequestBody) = service.updateRestOpenStatus(requestBody).await() suspend fun updateRestOpenStatus(requestBody: RequestBody) = service.updateRestOpenStatus(requestBody).await()
//獲取訂單分組數量,例:待確認訂單數量,製作中訂單數量。。。 //獲取訂單分組數量,例:待確認訂單數量,製作中訂單數量。。。
suspend fun getOrderGroupNum(requestBody: RequestBody) = orderService.getOrderGroupNum(requestBody).await() suspend fun getOrderGroupNum(requestBody: RequestBody) = ricepon_WechatService.getOrderGroupNum(requestBody).await()
//獲取訂單信息 //獲取訂單信息
suspend fun getOrderInfo(requestBody: RequestBody) = orderService.getOrderDesc(requestBody).await() suspend fun getOrderInfo(requestBody: RequestBody) = ricepon_WechatService.getOrderDesc(requestBody).await()
//獲取第三方物流信息 //獲取第三方物流信息
suspend fun getShipanyOrderTime(requestBody: RequestBody) = gsposService.getShipanyOrderTime(requestBody).await() suspend fun getShipanyOrderTime(requestBody: RequestBody) = gsposService.getShipanyOrderTime(requestBody).await()
//修改訂單狀態 //修改訂單狀態
suspend fun updateOrderStatus(requestBody: RequestBody) = orderService.updateOrderStatus(requestBody).await() suspend fun updateOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateOrderStatus(requestBody).await()
//gspost修改訂單狀態 //gspost修改訂單狀態
suspend fun gsUpdateOrderStatus(requestBody: RequestBody) = service.gsUpdateOrderStatus(requestBody).await() suspend fun gsUpdateOrderStatus(requestBody: RequestBody) = service.gsUpdateOrderStatus(requestBody).await()
...@@ -55,16 +62,16 @@ class CoolWeatherNetwork { ...@@ -55,16 +62,16 @@ class CoolWeatherNetwork {
suspend fun updateIsRead(requestBody: RequestBody) = service.updateIsRead(requestBody).await() suspend fun updateIsRead(requestBody: RequestBody) = service.updateIsRead(requestBody).await()
//修改自取訂單狀態 //修改自取訂單狀態
suspend fun updateSelfOrderStatus(requestBody: RequestBody) = orderService.updateSelfOrderStatus(requestBody).await() suspend fun updateSelfOrderStatus(requestBody: RequestBody) = ricepon_WechatService.updateSelfOrderStatus(requestBody).await()
// 獲取餐廳配送人員信息 // 獲取餐廳配送人員信息
suspend fun getDeliveryInfo(requestBody: RequestBody) = orderService.getDeliveryInfo(requestBody).await() suspend fun getDeliveryInfo(requestBody: RequestBody) = ricepon_WechatService.getDeliveryInfo(requestBody).await()
//獲取物流配置 //獲取物流配置
suspend fun getDeliveryConfigDTO(requestBody: RequestBody) = gsposService.getDeliveryConfigDTO(requestBody).await() suspend fun getDeliveryConfigDTO(requestBody: RequestBody) = gsposService.getDeliveryConfigDTO(requestBody).await()
//獲取歷史訂單 //獲取歷史訂單
suspend fun getHistoryOrderList(requestBody: RequestBody) = orderService.getHistoryOrderList(requestBody).await() suspend fun getHistoryOrderList(requestBody: RequestBody) = ricepon_WechatService.getHistoryOrderList(requestBody).await()
//取消物流 //取消物流
suspend fun cancelLogistics(requestBody: RequestBody) = gsposService.cancelLogistics(requestBody).await() suspend fun cancelLogistics(requestBody: RequestBody) = gsposService.cancelLogistics(requestBody).await()
...@@ -84,6 +91,14 @@ class CoolWeatherNetwork { ...@@ -84,6 +91,14 @@ class CoolWeatherNetwork {
suspend fun getTransportationConfig(restaurantId: String) = systemService.getTransportationConfig(restaurantId).await() suspend fun getTransportationConfig(restaurantId: String) = systemService.getTransportationConfig(restaurantId).await()
suspend fun additionalServiceCharge(requestBody: RequestBody) = rootGsaService.additionalServiceCharge(requestBody).await()
suspend fun getBanlance(brandId: String) = activitiesService.getBanlance(brandId).await()
suspend fun getActualAmount(orderId: String, uid: String, restaurantId: String) = gsaService.getShipanyTransportAmount(orderId, uid, restaurantId).await()
suspend fun getAdditionalByOrderId(orderId: String, deletes: String) = rootGsaService.getAdditionalByOrderId(orderId, deletes).await()
private suspend fun <T> Call<T>.await(): T { private suspend fun <T> Call<T>.await(): T {
return suspendCoroutine { continuation -> return suspendCoroutine { continuation ->
enqueue(object : Callback<T> { enqueue(object : Callback<T> {
......
...@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication ...@@ -4,6 +4,8 @@ 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.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.constans.HttpsConstans.ROOT_SERVER
import com.gingersoft.gsa.cloud.constans.HttpsConstans.URK_RICEPON_GSA
import com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor import com.gingersoft.gsa.cloud.globalconfig.applyOptions.intercept.LoggingInterceptor
import com.jess.arms.utils.DeviceUtils import com.jess.arms.utils.DeviceUtils
import okhttp3.Headers import okhttp3.Headers
...@@ -13,8 +15,6 @@ import okhttp3.Response ...@@ -13,8 +15,6 @@ import okhttp3.Response
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.converter.scalars.ScalarsConverterFactory import retrofit2.converter.scalars.ScalarsConverterFactory
import java.io.IOException
import java.net.UnknownHostException
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
object ServiceCreator { object ServiceCreator {
...@@ -35,6 +35,7 @@ object ServiceCreator { ...@@ -35,6 +35,7 @@ object ServiceCreator {
private var BASE_URL3 = "$ROOT_URL/member-web/ricepon-gsa/api/" private var BASE_URL3 = "$ROOT_URL/member-web/ricepon-gsa/api/"
private var BASE_URL4 = "$ROOT_URL/ricepon-order/api/" private var BASE_URL4 = "$ROOT_URL/ricepon-order/api/"
private var BASE_SYSTEM = "$ROOT_URL/ricepon-system/api/" private var BASE_SYSTEM = "$ROOT_URL/ricepon-system/api/"
private var URL_ACTIVITIES = "$ROOT_URL/ricepon-activities/api/"
private val builder = Retrofit.Builder() private val builder = Retrofit.Builder()
.baseUrl(BASE_URL) .baseUrl(BASE_URL)
...@@ -66,6 +67,7 @@ object ServiceCreator { ...@@ -66,6 +67,7 @@ object ServiceCreator {
.addConverterFactory(ScalarsConverterFactory.create()) .addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
private val builderSystem = Retrofit.Builder() private val builderSystem = Retrofit.Builder()
.baseUrl(BASE_SYSTEM) .baseUrl(BASE_SYSTEM)
.client(httpClient.build()) .client(httpClient.build())
...@@ -83,6 +85,19 @@ object ServiceCreator { ...@@ -83,6 +85,19 @@ object ServiceCreator {
fun <T> create5(serviceClass: Class<T>): T = builder5.build().create(serviceClass) fun <T> create5(serviceClass: Class<T>): T = builder5.build().create(serviceClass)
fun <T> createSystem(serviceClass: Class<T>): T = builderSystem.build().create(serviceClass) fun <T> createSystem(serviceClass: Class<T>): T = builderSystem.build().create(serviceClass)
fun <T> createActivities(service: Class<T>): T = Retrofit.Builder().baseUrl(URL_ACTIVITIES).client(httpClient.build())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()).build().create(service)
fun <T> createGSA(service: Class<T>): T = Retrofit.Builder().baseUrl(ROOT_SERVER + URK_RICEPON_GSA).client(httpClient.build())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()).build().create(service)
fun <T> createRootGSA(service: Class<T>): T = Retrofit.Builder().baseUrl(ROOT_URL + URK_RICEPON_GSA).client(httpClient.build())
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create()).build().create(service)
/** /**
* 添加请求头 * 添加请求头
*/ */
......
package com.gingersoft.gsa.other_order_mode.data.network.api package com.gingersoft.gsa.other_order_mode.data.network.api
import com.gingersoft.gsa.other_order_mode.data.model.bean.MessageBean
import com.gingersoft.gsa.cloud.print.bean.OrderDetails import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.other_order_mode.data.model.bean.* import com.gingersoft.gsa.other_order_mode.data.model.bean.*
import okhttp3.RequestBody import okhttp3.RequestBody
...@@ -70,5 +69,17 @@ interface WeatherService { ...@@ -70,5 +69,17 @@ interface WeatherService {
fun addPrj(@Body requestBody: RequestBody): Call<String> fun addPrj(@Body requestBody: RequestBody): Call<String>
@GET("restaurantTransportationConfig/list") @GET("restaurantTransportationConfig/list")
fun getTransportationConfig(@Query("restaurantId") restaurantId: String):Call<TransportationBean> fun getTransportationConfig(@Query("restaurantId") restaurantId: String): Call<TransportationBean>
@POST("logisticsExpensesAdditional/payment")
fun additionalServiceCharge(@Body requestBody: RequestBody): Call<AddServiceChargeBean>
@GET("feign/balance/get")
fun getBanlance(@Query("brandId") brandId: String): Call<BalanceBean>
@GET("shipanyTransportAmount/get")
fun getShipanyTransportAmount(@Query("orderId") orderId: String, @Query("uid") uid: String, @Query("restaurantId") restaurantId: String): Call<TransportAmountBean>
@GET("logisticsExpensesAdditional/getAdditionalByOrderId")
fun getAdditionalByOrderId(@Query("orderId") orderId: String, @Query("deletes") deletes: String) : Call<ServiceChargeRecordBean>
} }
\ No newline at end of file
...@@ -22,14 +22,13 @@ import com.gingersoft.gsa.cloud.base.utils.other.TextUtil ...@@ -22,14 +22,13 @@ import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
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.base.widget.DialogUtils
import com.gingersoft.gsa.other_order_mode.data.model.bean.MessageBean
import com.gingersoft.gsa.cloud.constans.AppConstans import com.gingersoft.gsa.cloud.constans.AppConstans
import com.gingersoft.gsa.cloud.constans.PrintConstans import com.gingersoft.gsa.cloud.constans.PrintConstans
import com.gingersoft.gsa.cloud.print.bean.OrderDetails import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.cloud.service.GetInfoUpdateService
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.WeatherRepository import com.gingersoft.gsa.other_order_mode.data.WeatherRepository
import com.gingersoft.gsa.other_order_mode.data.model.bean.* import com.gingersoft.gsa.other_order_mode.data.model.bean.*
import com.gingersoft.gsa.other_order_mode.service.GetInfoUpdateService
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.util.OtherOrderUtils import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.jess.arms.utils.ArmsUtils import com.jess.arms.utils.ArmsUtils
...@@ -61,6 +60,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -61,6 +60,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//其他的所有數據 //其他的所有數據
var otherInfo = MutableLiveData<OrderList.DataBeanX.DataBean>() var otherInfo = MutableLiveData<OrderList.DataBeanX.DataBean>()
var balanceBean = MutableLiveData<BalanceBean>()
//刷新狀態,有數據更新就會更改這個變量,將這個變量修改為allOrderStatus...上面五種狀態,fragment中監聽這個變量,再調用接口獲取最新數據 //刷新狀態,有數據更新就會更改這個變量,將這個變量修改為allOrderStatus...上面五種狀態,fragment中監聽這個變量,再調用接口獲取最新數據
var refreshState = MutableLiveData<Int>() var refreshState = MutableLiveData<Int>()
//訂單號 //訂單號
...@@ -69,7 +70,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -69,7 +70,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
var phone: String = "" var phone: String = ""
//派送員信息 //派送員信息
var deliveryBean: DeliveryBean? = null var deliveryBean: DeliveryBean? = null
//接單超時時間
var timeOut = 0
var addServiceChargeBean = MutableLiveData<AddServiceChargeBean>()
/** /**
* 獲取訂單數量 * 獲取訂單數量
* status * status
...@@ -282,6 +286,17 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -282,6 +286,17 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
var serviceChargeRecordBeans = MutableLiveData<ServiceChargeRecordBean>()
fun getAdditionalByOrderId(orderId: String) {
launch({
serviceChargeRecordBeans.postValue(repository.getAdditionalByOrderId(orderId, "0"))
}, {
serviceChargeRecordBeans.postValue(null)
it.printStackTrace()
})
}
//設置為已讀 //設置為已讀
fun updateIsRead(orderId: String) { fun updateIsRead(orderId: String) {
launch({ launch({
...@@ -318,7 +333,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -318,7 +333,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
/** /**
* 判斷是否需要修改交通工具 * 獲取lalamove交通工具
*/ */
fun getIsUpdateTransportation(restaurantId: Int, listener: (List<TransportationBean.DataX.Transportation>?) -> Unit) { fun getIsUpdateTransportation(restaurantId: Int, listener: (List<TransportationBean.DataX.Transportation>?) -> Unit) {
launch({ launch({
...@@ -335,6 +350,30 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -335,6 +350,30 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
/**
* 獲取交通工具實際金額
*/
fun getActualAmount(orderId: String, uid: Int, restaurantId: Int, block: (TransportAmountBean?) -> Unit) {
launch({
block.invoke(repository.getActualAmount(orderId, uid.toString(), restaurantId.toString()))
}, {
block.invoke(null)
it.printStackTrace()
})
}
/**
* 獲取餘額
*/
fun getBanlance(brandId: Int) {
launch({
balanceBean.postValue(repository.getBanlance(brandId.toString()))
}, {
balanceBean.postValue(null)
it.printStackTrace()
})
}
fun closingBill(orderDetails: OrderDetails.DataBean, payMethods: List<PayMethod>, listener: (Int, Boolean) -> Unit) { fun closingBill(orderDetails: OrderDetails.DataBean, payMethods: List<PayMethod>, listener: (Int, Boolean) -> Unit) {
launch({ launch({
...@@ -360,7 +399,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -360,7 +399,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
Log.e("eee", "gsUpdateOrderStatus報錯:" + it.message) Log.e("eee", "gsUpdateOrderStatus報錯:" + it.message)
// integralBean.postValue(null) // integralBean.postValue(null)
}) })
} }
...@@ -439,7 +477,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -439,7 +477,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
printOrder(DeliveryPrint, it, listener) printOrder(DeliveryPrint, it, listener)
} }
} else { } else {
listener.invoke(getMsgBean(OrderDelivery, errorMsg, false)) if (errorMsg != null) {
listener.invoke(getMsgBean(OrderDelivery, errorMsg!!, false))
} else {
listener.invoke(getMsgBean(OrderDelivery, "", false))
}
} }
} }
} else { } else {
...@@ -456,6 +498,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -456,6 +498,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
/** /**
* 獲取交通工具配置 * 獲取交通工具配置
*/ */
...@@ -465,6 +508,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -465,6 +508,19 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/** /**
* 添加服務費
*/
fun additionalServiceCharge(uid: String, orderId: String, paymentValue: Int) {
launch({
addServiceChargeBean.postValue(repository.additionalServiceCharge(uid, orderId, paymentValue))
}, {
addServiceChargeBean.postValue(null)
it.printStackTrace()
})
}
/**
* 打印訂單 * 打印訂單
*/ */
fun printOrder(code: Int, dataBean: OrderDetails.DataBean, listener: (MessageBean) -> Unit) { fun printOrder(code: Int, dataBean: OrderDetails.DataBean, listener: (MessageBean) -> Unit) {
...@@ -794,13 +850,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -794,13 +850,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
fun noticePersonnel(pushContent: String?, code: String) {
launch({
repository.noticePersonnel(pushContent, code)
}, {
})
}
private fun launch(block: suspend () -> Unit, error: suspend (Throwable) -> Unit) = viewModelScope.launch { private fun launch(block: suspend () -> Unit, error: suspend (Throwable) -> Unit) = viewModelScope.launch {
try { try {
block() block()
......
package com.gingersoft.gsa.other_order_mode.service //package com.gingersoft.gsa.other_order_mode.service
//
import android.annotation.SuppressLint //import android.annotation.SuppressLint
import android.app.NotificationChannel //import android.app.NotificationChannel
import android.app.NotificationManager //import android.app.NotificationManager
import android.app.PendingIntent //import android.app.PendingIntent
import android.app.Service //import android.app.Service
import android.content.* //import android.content.*
import android.graphics.BitmapFactory //import android.graphics.BitmapFactory
import android.media.AudioAttributes //import android.os.Binder
import android.media.AudioManager //import android.os.Build
import android.media.SoundPool //import android.os.IBinder
import android.os.Binder //import android.os.PowerManager
import android.os.Build //import android.util.Log
import android.os.IBinder //import android.widget.RemoteViews
import android.os.PowerManager //import androidx.annotation.RequiresApi
import android.util.Log //import androidx.core.app.NotificationCompat
import android.util.TimeUtils //import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import android.widget.RemoteViews //import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils
import androidx.annotation.RequiresApi //import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil
import androidx.core.app.NotificationCompat //import com.gingersoft.gsa.cloud.constans.AppConstans
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication //import com.gingersoft.gsa.cloud.constans.HttpsConstans
import com.gingersoft.gsa.cloud.base.utils.okhttpUtils.OkHttp3Utils //import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil //import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator
import com.gingersoft.gsa.cloud.constans.AppConstans //import com.gingersoft.gsa.other_order_mode.ui.activity.DeliveryOrderMainActivity
import com.gingersoft.gsa.cloud.constans.HttpsConstans //import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.gingersoft.gsa.other_order_mode.R //import com.gingersoft.gsa.other_order_mode.util.RxTimerUtil
import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator //import com.google.gson.Gson
import com.gingersoft.gsa.other_order_mode.ui.activity.OtherOrderActivity //import io.reactivex.schedulers.Schedulers
import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils //import okhttp3.*
import com.gingersoft.gsa.other_order_mode.util.RxTimerUtil //import okio.ByteString
import com.google.gson.Gson //import org.json.JSONObject
import com.jess.arms.utils.DeviceUtils //import java.util.*
import io.reactivex.schedulers.Schedulers //import java.util.concurrent.TimeUnit
import okhttp3.* //
import okio.ByteString //class GetInfoUpdateService : Service() {
import org.json.JSONObject //
import java.util.* // private val TAG = "eee"
import java.util.concurrent.TimeUnit // /**
// * 心跳检测时间
class GetInfoUpdateService : Service() { // */
// private val HEART_BEAT_RATE = (15 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测
private val TAG = "eee" // private val WEBSOCKET_HOST_AND_PORT = "${ServiceCreator.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号
/** //
* 心跳检测时间 // private var mWebSocket: WebSocket? = null
*/ // var client: OkHttpClient? = null
private val HEART_BEAT_RATE = (15 * 1000).toLong()//每隔15秒进行一次对长连接的心跳检测 //
private val WEBSOCKET_HOST_AND_PORT = "${ServiceCreator.ROOT_URL}/ricepon-websocket/js/webSocketServer"//可替换为自己的主机名和端口号 // var postCallBack: PostCallBack? = null
// private lateinit var mReceiver: ClearHeartBroadcastReceiver
private var mWebSocket: WebSocket? = null //
var client: OkHttpClient? = null // private var newWakeLock: PowerManager.WakeLock? = null
//
var postCallBack: PostCallBack? = null // private var myBind: MyBind? = null
private lateinit var mReceiver: ClearHeartBroadcastReceiver //
// private val CHANNEL_ID = "cloud_gsa"
private var newWakeLock: PowerManager.WakeLock? = null //
// companion object {
private var myBind: MyBind? = null // @kotlin.jvm.JvmField
// var loginfo = StringBuffer()
companion object { // }
@kotlin.jvm.JvmField //
var loginfo = StringBuffer() // val restaurantId by lazy {
} // GsaCloudApplication.getRestaurantId(this)
// }
val restaurantId by lazy { //
GsaCloudApplication.getRestaurantId(this) // override fun onBind(intent: Intent?): IBinder? {
// 26 // myBind = MyBind()
} // return myBind
// }
override fun onBind(intent: Intent?): IBinder? { //
myBind = MyBind() //
return myBind // override fun onCreate() {
} // super.onCreate()
// val mFilter = IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
// mReceiver = ClearHeartBroadcastReceiver()
override fun onCreate() { // registerReceiver(mReceiver, mFilter)
super.onCreate() //
val mFilter = IntentFilter(AppConstans.CLEAR_ORDER_RECEIVING_HEART) // InitSocketThread().start()
mReceiver = ClearHeartBroadcastReceiver() // isDestroy = false
registerReceiver(mReceiver, mFilter) //
// //讓設備在休眠狀態下保持運行
InitSocketThread().start() // val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
isDestroy = false // newWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.javaClass.name)
// //Value CPU Screen KeyBoard
//讓設備在休眠狀態下保持運行 // //PARTIAL_WAKE_LOCK On Off Off
val pm = getSystemService(Context.POWER_SERVICE) as PowerManager // //SCREEN_DIM_WAKE_LOCK On Dim Off
newWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.javaClass.name) // //SCREEN_BRIGHT_WAKE_LOCK On Bright Off
//Value CPU Screen KeyBoard // //FULL_WAKE_LOCK On Bright Bright
//PARTIAL_WAKE_LOCK On Off Off // newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/)
//SCREEN_DIM_WAKE_LOCK On Dim Off // putTimeLog("創建服務onCreate")
//SCREEN_BRIGHT_WAKE_LOCK On Bright Off // }
//FULL_WAKE_LOCK On Bright Bright //
newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/) // override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
putTimeLog("創建服務onCreate") // Log.d(TAG, "onStartCommand()")
} // // 在API11之后构建Notification的方式
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { // createNotificationChannel()
Log.d(TAG, "onStartCommand()") // } else {
// 在API11之后构建Notification的方式 // startNotification()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // }
createNotificationChannel() // putTimeLog("啟動服務onStartCommand")
} else { // return super.onStartCommand(intent, flags, startId)
startNotification() // }
} //
putTimeLog("啟動服務onStartCommand") // /**
return super.onStartCommand(intent, flags, startId) // * 创建通知渠道
} // */
// @RequiresApi(Build.VERSION_CODES.O)
val CHANNEL_ID = "cloud_gsa" // fun createNotificationChannel() {
/** // //设定的通知渠道名称
* 创建通知渠道 // val channelName = "New Order Notification"
*/ // //设置通知的重要程度
@RequiresApi(Build.VERSION_CODES.O) // val importance = NotificationManager.IMPORTANCE_LOW
fun createNotificationChannel() { // //构建通知渠道
//设定的通知渠道名称 // val channel = NotificationChannel(CHANNEL_ID, channelName, importance)
val channelName = "New Order Notification" // channel.description = "New Order Notification"
//设置通知的重要程度 // //向系统注册通知渠道,注册后不能改变重要性以及其他通知行为
val importance = NotificationManager.IMPORTANCE_LOW // val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
//构建通知渠道 // notificationManager.createNotificationChannel(channel)
val channel = NotificationChannel(CHANNEL_ID, channelName, importance) // startNotification()
channel.description = "New Order Notification" // }
//向系统注册通知渠道,注册后不能改变重要性以及其他通知行为 //
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager // @SuppressLint("InflateParams")
notificationManager.createNotificationChannel(channel) // private fun startNotification() {
startNotification() // val broadcastReceiver = Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART)
} // val broadcastIntent = PendingIntent.getBroadcast(this, 10, broadcastReceiver, 0)
// val remoteViews = RemoteViews(packageName, R.layout.layout_order_receiving)
@SuppressLint("InflateParams") // remoteViews.setOnClickPendingIntent(R.id.btn_stop_service, broadcastIntent)
private fun startNotification() { // val intent = Intent(this, DeliveryOrderMainActivity::class.java)
val broadcastReceiver = Intent(AppConstans.CLEAR_ORDER_RECEIVING_HEART) // val pendingIntent = PendingIntent.getActivity(this, 0, intent, 0)
val broadcastIntent = PendingIntent.getBroadcast(this, 10, broadcastReceiver, 0) //
// LocalBroadcastManager.getInstance(context).sendBroadcast(intent); // //在创建的通知渠道上发送通知
val remoteViews = RemoteViews(packageName, R.layout.layout_order_receiving) // val builder = NotificationCompat.Builder(this, CHANNEL_ID)
remoteViews.setOnClickPendingIntent(R.id.btn_stop_service, broadcastIntent) // builder.setSmallIcon(R.mipmap.ic_launcher) //设置通知图标
val intent = Intent(this, OtherOrderActivity::class.java) // .setContentTitle("Ricepon Pos")//设置通知标题
val pendingIntent = PendingIntent.getActivity(this, 0, intent, 0) // .setContentText("外賣接單服務")//设置通知内容Takeaway order service
// .setContentIntent(pendingIntent)
//在创建的通知渠道上发送通知 // .setContent(remoteViews)
val builder = NotificationCompat.Builder(this, CHANNEL_ID) // .setAutoCancel(false) //用户触摸时,自动关闭
builder.setSmallIcon(R.mipmap.ic_launcher) //设置通知图标 // .setOngoing(true)//设置处于运行状态
.setContentTitle("Ricepon Pos")//设置通知标题 // .setLargeIcon(BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher))
.setContentText("外賣接單服務")//设置通知内容Takeaway order service // //将服务置于启动状态 NOTIFICATION_ID指的是创建的通知的ID
.setContentIntent(pendingIntent) // startForeground(123, builder.build())
.setContent(remoteViews) // }
.setAutoCancel(false) //用户触摸时,自动关闭 //
.setOngoing(true)//设置处于运行状态 // inner class MyBind : Binder() {
.setLargeIcon(BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher)) // lateinit var block: (isShow: Boolean) -> Unit
//将服务置于启动状态 NOTIFICATION_ID指的是创建的通知的ID //
startForeground(123, builder.build()) // fun setOnPostCallBack(postCallBack: PostCallBack?) {
} // this@GetInfoUpdateService.postCallBack = postCallBack
// }
inner class MyBind : Binder() { //
lateinit var block: (isShow: Boolean) -> Unit // fun execute(block: (isShow: Boolean) -> Unit) {
// this.block = block
fun setOnPostCallBack(postCallBack: PostCallBack?) { // }
this@GetInfoUpdateService.postCallBack = postCallBack // }
} //
// internal inner class InitSocketThread : Thread() {
fun execute(block: (isShow: Boolean) -> Unit) { // override fun run() {
this.block = block // super.run()
} // initSocket()
} // }
// }
internal inner class InitSocketThread : Thread() { //
override fun run() { // // 初始化socket
super.run() // private fun initSocket() {
initSocket() // putTimeLog("取消心跳")
} // RxTimerUtil.cancelInterval()
} // RxTimerUtil.interval({
// newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/)
// 初始化socket // putTimeLog("開啟心跳")
private fun initSocket() { //
putTimeLog("取消心跳") // client?.let { it ->
RxTimerUtil.cancelInterval() // mWebSocket?.let {
RxTimerUtil.interval({ // it.cancel()
newWakeLock?.acquire(10 * 60 * 1000L /*10 minutes*/) // it.send("-1")
putTimeLog("開啟心跳") // it.close(1000, null)
// }
client?.let { it -> // it.dispatcher().cancelAll()
mWebSocket?.let { // }
it.cancel()
it.send("-1")
it.close(1000, null)
}
it.dispatcher().cancelAll()
}
// if (client == null) { // if (client == null) {
client = OkHttpClient.Builder().readTimeout(9 * 10, TimeUnit.SECONDS).build() // client = OkHttpClient.Builder().readTimeout(9 * 10, TimeUnit.SECONDS).build()
// } // }
client?.let { // client?.let {
val request = Request.Builder() // val request = Request.Builder()
.url(WEBSOCKET_HOST_AND_PORT) // .url(WEBSOCKET_HOST_AND_PORT)
.build() // .build()
it.newWebSocket(request, object : WebSocketListener() { // it.newWebSocket(request, object : WebSocketListener() {
override fun onOpen(webSocket: WebSocket, response: Response) {//开启长连接成功的回调 // override fun onOpen(webSocket: WebSocket, response: Response) {//开启长连接成功的回调
super.onOpen(webSocket, response) // super.onOpen(webSocket, response)
if (!this@GetInfoUpdateService.isDestroy) { // if (!this@GetInfoUpdateService.isDestroy) {
mWebSocket = webSocket // mWebSocket = webSocket
val token = "weixin_" + restaurantId + "_" + getRandomString(24) // val token = "weixin_" + restaurantId + "_" + getRandomString(24)
Log.e(TAG, "token:$token") // Log.e(TAG, "token:$token")
webSocket.send(Gson().toJson(MsgBean(1, token))) // webSocket.send(Gson().toJson(MsgBean(1, token)))
putTimeLog("連接成功") // putTimeLog("連接成功")
RxTimerUtil.cancelTimerDisposable() // RxTimerUtil.cancelTimerDisposable()
myBind?.block?.invoke(false) // myBind?.block?.invoke(false)
} // }
} // }
//
override fun onMessage(webSocket: WebSocket?, text: String?) {//接收消息的回调 // override fun onMessage(webSocket: WebSocket, text: String) {//接收消息的回调
super.onMessage(webSocket, text) // super.onMessage(webSocket, text)
val json = JSONObject(text) // val json = JSONObject(text)
val type = json.optInt("type") // val type = json.optInt("type")
if (postCallBack != null) { // if (postCallBack != null) {
postCallBack!!.callBack(type) // postCallBack!!.callBack(type)
} // }
//-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知" // //-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知"
if (type == 3 || type == 4 || type == 5 // if (type == 3 || type == 4 || type == 5
|| type == 7) { // || type == 7) {
//播放提示音 // //播放提示音
initSoundPool(R.raw.newordervocal) // initSoundPool(R.raw.newordervocal)
} else if (type == 8) { // } else if (type == 8) {
initSoundPool(R.raw.raw_logistics_cancel) // initSoundPool(R.raw.raw_logistics_cancel)
} // }
//收到服务器端传过来的消息text // //收到服务器端传过来的消息text
Log.e(TAG, "onMessage:" + text!!) // Log.e(TAG, "onMessage:$text")
putTimeLog("收到回調:$text") // putTimeLog("收到回調:$text")
} // }
//
override fun onMessage(webSocket: WebSocket?, bytes: ByteString?) { // override fun onMessage(webSocket: WebSocket, bytes: ByteString) {
super.onMessage(webSocket, bytes) // super.onMessage(webSocket, bytes)
val json = JSONObject(bytes.toString()) // val json = JSONObject(bytes.toString())
if (postCallBack != null) { // if (postCallBack != null) {
postCallBack!!.callBack(json.optInt("type")) // postCallBack!!.callBack(json.optInt("type"))
} // }
Log.e(TAG, "onMessage222:" + bytes!!) // Log.e(TAG, "onMessage222:$bytes")
putTimeLog("onMessage222:$bytes") // putTimeLog("onMessage222:$bytes")
} // }
//
override fun onClosing(webSocket: WebSocket?, code: Int, reason: String?) { // override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
super.onClosing(webSocket, code, reason) // super.onClosing(webSocket, code, reason)
//連接斷開, // //連接斷開,
Log.e(TAG, "onClosing") // Log.e(TAG, "onClosing")
// InitSocketThread().start()//创建一个新的连接 // putTimeLog("onClosing關閉連接")
putTimeLog("onClosing關閉連接") // }
} //
// override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
override fun onClosed(webSocket: WebSocket?, code: Int, reason: String?) { // super.onClosed(webSocket, code, reason)
super.onClosed(webSocket, code, reason) // Log.e(TAG, "onClosed")
Log.e(TAG, "onClosed") // putTimeLog("onClosed斷開連接")
putTimeLog("onClosed斷開連接") // webSocket.cancel()
webSocket?.cancel() // }
} //
// override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) {//长连接连接失败的回调
override fun onFailure(webSocket: WebSocket?, t: Throwable?, response: Response?) {//长连接连接失败的回调 // super.onFailure(webSocket, t, response)
super.onFailure(webSocket, t, response) // Log.e(TAG, "onFailure " + t.message)
Log.e(TAG, "onFailure " + t!!.message) // if (!this@GetInfoUpdateService.isDestroy) {
if (!this@GetInfoUpdateService.isDestroy) { // //連接斷開,定時五秒,如果未重連,播放提示音
// Log.e(TAG, "沒銷毀") // RxTimerUtil.delayFun({
// initSocket()//创建一个新的连接Expected HTTP 101 response but was '502 Bad Gateway' // initSoundPool(R.raw.raw_disconnect)
//連接斷開,定時五秒,如果未重連,播放提示音 // myBind?.block?.invoke(true)
RxTimerUtil.delayFun({ // //推送給相關人員
initSoundPool(R.raw.raw_disconnect) // OkHttp3Utils.noticePersonnel(AppConstans.RP_HEART_ERROR, "心跳斷開十秒以上未連接成功:" + t.message)
myBind?.block?.invoke(true) // }, 10)
//推送給相關人員 // putTimeLog("onFailure連接失敗,等待一分鐘後重新連接")
OkHttp3Utils.noticePersonnel(AppConstans.RP_HEART_ERROR, "心跳斷開十秒以上未連接成功:" + t.message) // } else {
}, 10) // webSocket.cancel()
putTimeLog("onFailure連接失敗,等待一分鐘後重新連接") // it.dispatcher().cancelAll()
} else { // }
webSocket?.cancel() // }
it.dispatcher().cancelAll() // })
} // it.dispatcher().executorService().shutdown()
} // }
}) // }, HEART_BEAT_RATE)
it.dispatcher().executorService().shutdown() // }
} //
}, HEART_BEAT_RATE) // private var lastSoundTime: Long = 0L
} // fun initSoundPool(resId: Int) {
// val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
private var lastSoundTime: Long = 0L // if (nowTime - lastSoundTime > 5000) {
fun initSoundPool(resId: Int) { // Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲 // putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
// if (resId == R.raw.newordervocal) { // putTimeLog("新訂單播放:$nowTime")
if (nowTime - lastSoundTime > 5000) {
Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
putTimeLog("新訂單播放:$nowTime")
lastSoundTime = nowTime
OtherOrderUtils.initSoundPool(this, resId)
}
// } else {
// lastSoundTime = nowTime // lastSoundTime = nowTime
// OtherOrderUtils.initSoundPool(this, resId) // OtherOrderUtils.initSoundPool(this, resId)
// } // }
} // }
//
/*获取一条随机字符串*/ // /*获取一条随机字符串*/
fun getRandomString(length: Int): String { //length表示生成字符串的长度 // fun getRandomString(length: Int): String { //length表示生成字符串的长度
val base = "abcdefghijklmnopqrstuvwxyz0123456789" // val base = "abcdefghijklmnopqrstuvwxyz0123456789"
val random = Random() // val random = Random()
val sb = StringBuffer() // val sb = StringBuffer()
for (i in 0 until length) { // for (i in 0 until length) {
val number = random.nextInt(base.length) // val number = random.nextInt(base.length)
sb.append(base[number]) // sb.append(base[number])
} // }
return sb.toString() // return sb.toString()
} // }
//
private var isDestroy = false // private var isDestroy = false
//
override fun onDestroy() { // override fun onDestroy() {
super.onDestroy() // super.onDestroy()
putTimeLog("服務銷毀onDestroy") // putTimeLog("服務銷毀onDestroy")
//
//清除心跳 // //清除心跳
clearHeart() // clearHeart()
isDestroy = true // isDestroy = true
//取消廣播 // //取消廣播
unregisterReceiver(mReceiver) // unregisterReceiver(mReceiver)
//斷開長鏈接 // //斷開長鏈接
client?.let { // client?.let {
mWebSocket?.cancel() // mWebSocket?.cancel()
it.dispatcher().cancelAll() // it.dispatcher().cancelAll()
} // }
if (mWebSocket != null) { // if (mWebSocket != null) {
mWebSocket!!.send("-1") // mWebSocket!!.send("-1")
mWebSocket!!.close(1000, null) // mWebSocket!!.close(1000, null)
} // }
//停止定時心跳 // //停止定時心跳
RxTimerUtil.cancelInterval() // RxTimerUtil.cancelInterval()
//停止延遲執行任務 // //停止延遲執行任務
RxTimerUtil.cancelTimerDisposable() // RxTimerUtil.cancelTimerDisposable()
//停止前台服務 // //停止前台服務
stopForeground(true) // stopForeground(true)
//清除保持喚醒 // //清除保持喚醒
newWakeLock?.release() // newWakeLock?.release()
newWakeLock = null // newWakeLock = null
} // }
//
private fun clearHeart() { // private fun clearHeart() {
val requestBody = FormBody.Builder() // val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId.toString()) // .add("restaurantId", restaurantId.toString())
.build() // .build()
OkHttp3Utils.post(HttpsConstans.ROOT_URL + "/member-web/api/restaurant/clearHeartbeat", requestBody) // OkHttp3Utils.post(HttpsConstans.ROOT_URL + "/member-web/api/restaurant/clearHeartbeat", requestBody)
.subscribeOn(Schedulers.io()).subscribe() // .subscribeOn(Schedulers.io()).subscribe()
} // }
//
inner class ClearHeartBroadcastReceiver : BroadcastReceiver() { // inner class ClearHeartBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) { // override fun onReceive(context: Context?, intent: Intent?) {
//關閉service,會調用service的onDestroy // //關閉service,會調用service的onDestroy
stopSelf() // stopSelf()
} // }
} // }
//
/** // /**
* 向日誌添加數據 // * 向日誌添加數據
*/ // */
private fun putTimeLog(content: String) { // private fun putTimeLog(content: String) {
loginfo.append(TimeUtil.getCurrentDate(TimeUtil.dateFormatYMDHMS)) // loginfo.append(TimeUtil.getCurrentDate(TimeUtil.dateFormatYMDHMS))
loginfo.append(":") // loginfo.append(":")
loginfo.append(content) // loginfo.append(content)
loginfo.append("\n") // loginfo.append("\n")
} // }
//
interface PostCallBack { // interface PostCallBack {
fun callBack(type: Int) // fun callBack(type: Int)
} // }
//
class MsgBean(var type: Int, var token: String) // class MsgBean(var type: Int, var token: String)
//
} //}
\ No newline at end of file \ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.activity package com.gingersoft.gsa.other_order_mode.ui.activity
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
import android.animation.ValueAnimator.RESTART
import android.app.Dialog import android.app.Dialog
import android.content.* import android.content.*
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.SoundPool
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
...@@ -25,12 +22,15 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication ...@@ -25,12 +22,15 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
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.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.constans.AppConstans import com.gingersoft.gsa.cloud.constans.AppConstans
import com.gingersoft.gsa.cloud.constans.ExpandConstant
import com.gingersoft.gsa.cloud.constans.HttpsConstans import com.gingersoft.gsa.cloud.constans.HttpsConstans
import com.gingersoft.gsa.cloud.database.utils.ExpandInfoDaoUtils
import com.gingersoft.gsa.cloud.service.GetInfoUpdateService
import com.gingersoft.gsa.cloud.service.PostCallBack
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator import com.gingersoft.gsa.other_order_mode.data.network.ServiceCreator
import com.gingersoft.gsa.other_order_mode.databinding.ActivityOtherOrderBinding import com.gingersoft.gsa.other_order_mode.databinding.ActivityOtherOrderBinding
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.service.GetInfoUpdateService
import com.gingersoft.gsa.other_order_mode.ui.adapter.SectionsPagerAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.SectionsPagerAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
...@@ -42,7 +42,7 @@ import com.qmuiteam.qmui.widget.popup.QMUIPopups ...@@ -42,7 +42,7 @@ import com.qmuiteam.qmui.widget.popup.QMUIPopups
import kotlinx.android.synthetic.main.activity_other_order.* import kotlinx.android.synthetic.main.activity_other_order.*
class OtherOrderActivity : BaseActivity() { class DeliveryOrderMainActivity : BaseActivity() {
private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] } private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private val instance by lazy { this } private val instance by lazy { this }
...@@ -81,6 +81,7 @@ class OtherOrderActivity : BaseActivity() { ...@@ -81,6 +81,7 @@ class OtherOrderActivity : BaseActivity() {
val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order) val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order)
initOutTime()
initWebsocket() initWebsocket()
initAppTop() initAppTop()
initSwitchRestStatus() initSwitchRestStatus()
...@@ -112,7 +113,59 @@ class OtherOrderActivity : BaseActivity() { ...@@ -112,7 +113,59 @@ class OtherOrderActivity : BaseActivity() {
btn_open_or_close_info.post { btn_open_or_close_info.post {
btnHeight = btn_open_or_close_info.height.toFloat() btnHeight = btn_open_or_close_info.height.toFloat()
} }
pageViewModel.getDeliveryInfo(restaurantId.toString(), memberId.toString()) pageViewModel.apply {
getDeliveryInfo(restaurantId.toString(), memberId.toString())
getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity))
balanceBean.observe(this@DeliveryOrderMainActivity, Observer {
it?.let {
tv_balance.text = "餘額:${it.balance}" + "(保證金: ${it.bond} )"
if (it.balance <= it.threshold) {
//提示餘額不足
val colorFrom = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.red)
val colorTo = ContextCompat.getColor(this@DeliveryOrderMainActivity, R.color.blue)
colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
colorAnimation?.apply {
addUpdateListener { animation ->
tv_balance.setTextColor(animation.animatedValue as Int)
}
duration = 200
repeatMode = RESTART
repeatCount = -1
start()
}
}
}
})
}
}
private var colorAnimation: ValueAnimator? = null
override fun onResume() {
super.onResume()
colorAnimation?.let {
it.resume()
}
}
override fun onPause() {
super.onPause()
colorAnimation?.let {
it.pause()
}
}
private fun initOutTime() {
val expandInfoDaoUtils = ExpandInfoDaoUtils(this)
val expandInfos = expandInfoDaoUtils.queryAllExpandInfo()
if (expandInfos != null) {
for (expandInfo in expandInfos) {
if (expandInfo.settingName == ExpandConstant.OrderReceivingTimeout) {
pageViewModel.timeOut = expandInfo.valueInt
}
}
}
} }
/** /**
...@@ -157,7 +210,7 @@ class OtherOrderActivity : BaseActivity() { ...@@ -157,7 +210,7 @@ class OtherOrderActivity : BaseActivity() {
mTvTitle.setText(ints[i]) mTvTitle.setText(ints[i])
mNumber.text = "0" mNumber.text = "0"
mNumber.setTextColor(this@OtherOrderActivity.resources.getColor(colors[i])) mNumber.setTextColor(this@DeliveryOrderMainActivity.resources.getColor(colors[i]))
while (pageViewModel.mOrderNum.size <= i) { while (pageViewModel.mOrderNum.size <= i) {
pageViewModel.mOrderNum.add(MutableLiveData()) pageViewModel.mOrderNum.add(MutableLiveData())
} }
...@@ -177,9 +230,9 @@ class OtherOrderActivity : BaseActivity() { ...@@ -177,9 +230,9 @@ class OtherOrderActivity : BaseActivity() {
if (ed_order_num_search.text != null && ed_order_num_search.text.isNotEmpty()) { if (ed_order_num_search.text != null && ed_order_num_search.text.isNotEmpty()) {
pageViewModel.phone = ed_order_num_search.text.toString() pageViewModel.phone = ed_order_num_search.text.toString()
pageViewModel.getOrderList(restaurantId.toString(), viewPager.currentItem, "0", false) pageViewModel.getOrderList(restaurantId.toString(), viewPager.currentItem, "0", false)
// ToastUtils.show(this@OtherOrderActivity, "搜索到$it" + "條數據") // ToastUtils.show(this@DeliveryOrderMainActivity, "搜索到$it" + "條數據")
} else { } else {
ToastUtils.show(this@OtherOrderActivity, "請輸入手機號或訂單號") ToastUtils.show(this@DeliveryOrderMainActivity, "請輸入手機號或訂單號")
} }
} }
} }
...@@ -278,7 +331,7 @@ class OtherOrderActivity : BaseActivity() { ...@@ -278,7 +331,7 @@ class OtherOrderActivity : BaseActivity() {
private fun initWebsocket() { private fun initWebsocket() {
//開啟websocket //開啟websocket
val intent = Intent(this, GetInfoUpdateService::class.java) val intent = Intent(applicationContext, GetInfoUpdateService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startForegroundService(intent) startForegroundService(intent)
} else { } else {
...@@ -299,27 +352,33 @@ class OtherOrderActivity : BaseActivity() { ...@@ -299,27 +352,33 @@ class OtherOrderActivity : BaseActivity() {
private var serviceConnection = object : ServiceConnection { private var serviceConnection = object : ServiceConnection {
override fun onServiceConnected(name: ComponentName, service: IBinder) { override fun onServiceConnected(name: ComponentName, service: IBinder) {
bind = service as GetInfoUpdateService.MyBind bind = service as GetInfoUpdateService.MyBind
bind?.setOnPostCallBack(object : GetInfoUpdateService.PostCallBack { bind?.let { it ->
override fun callBack(type: Int) { it.setOnPostCallBack(object : PostCallBack {
//-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知" override fun callBack(type: Int) {
if (type == 3 || type == 4 || type == 5 //-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知"
|| type == 6 || type == 7) { if (type == 3 || type == 4 || type == 5
pageViewModel.refreshState.postValue(selectPosition) || type == 6 || type == 7) {
pageViewModel.refreshState.postValue(selectPosition)
//刷新餘額
pageViewModel.getBanlance(GsaCloudApplication.getBrandId(this@DeliveryOrderMainActivity))
}
}
})
it.execute {
if (it) {
ivDisconnectView.visibility = View.VISIBLE
} else {
ivDisconnectView.visibility = View.INVISIBLE
} }
} }
}) it.jumpActivity = this@DeliveryOrderMainActivity::class.java
bind?.execute {
if (it) {
ivDisconnectView.visibility = View.VISIBLE
} else {
ivDisconnectView.visibility = View.INVISIBLE
}
} }
} }
override fun onServiceDisconnected(name: ComponentName) { override fun onServiceDisconnected(name: ComponentName) {
} }
} }
private var isOpen: Boolean = true private var isOpen: Boolean = true
private val btnOpenBg by lazy { ContextCompat.getDrawable(this, R.drawable.shape_white_bottom_border)!! } private val btnOpenBg by lazy { ContextCompat.getDrawable(this, R.drawable.shape_white_bottom_border)!! }
private val btnCloseBg by lazy { ContextCompat.getDrawable(this, R.drawable.shape_dialog_bg)!! } private val btnCloseBg by lazy { ContextCompat.getDrawable(this, R.drawable.shape_dialog_bg)!! }
...@@ -347,11 +406,13 @@ class OtherOrderActivity : BaseActivity() { ...@@ -347,11 +406,13 @@ class OtherOrderActivity : BaseActivity() {
background = btnOpenBg background = btnOpenBg
layout_search_info.visibility = View.VISIBLE layout_search_info.visibility = View.VISIBLE
layout_today_order_info.visibility = View.VISIBLE layout_today_order_info.visibility = View.VISIBLE
tv_balance.visibility = View.VISIBLE
} else { } else {
text = "查看詳情" text = "查看詳情"
background = btnCloseBg background = btnCloseBg
layout_search_info.visibility = View.GONE layout_search_info.visibility = View.GONE
layout_today_order_info.visibility = View.GONE layout_today_order_info.visibility = View.GONE
tv_balance.visibility = View.GONE
} }
} }
btn_open_or_close_info.isClickable = true btn_open_or_close_info.isClickable = true
......
package com.gingersoft.gsa.other_order_mode.ui.activity package com.gingersoft.gsa.other_order_mode.ui.activity
import android.os.Bundle import android.os.Bundle
import androidx.core.content.ContextCompat
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryConfig import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryConfig
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
...@@ -18,7 +19,7 @@ class DeliverySettingActivity : BaseActivity() { ...@@ -18,7 +19,7 @@ class DeliverySettingActivity : BaseActivity() {
deliverylist_fragment = supportFragmentManager.findFragmentById(R.id.deliverylist_fragment) as DeliveryFragment deliverylist_fragment = supportFragmentManager.findFragmentById(R.id.deliverylist_fragment) as DeliveryFragment
top_bar_delivery.setTitle("配送設置") top_bar_delivery.setTitle("配送設置")
top_bar_delivery.setBackgroundColor(resources.getColor(R.color.theme_color)) top_bar_delivery.setBackgroundColor(ContextCompat.getColor(this, R.color.theme_color))
top_bar_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() } top_bar_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
top_bar_delivery.addRightImageButton(R.drawable.ic_add, R.id.topbar_right_change_button).setOnClickListener { v -> top_bar_delivery.addRightImageButton(R.drawable.ic_add, R.id.topbar_right_change_button).setOnClickListener { v ->
supportFragmentManager.beginTransaction().add(R.id.fl_delivery, UpdateDeliveryFragment.newInstance(null)).addToBackStack(null).commit() supportFragmentManager.beginTransaction().add(R.id.fl_delivery, UpdateDeliveryFragment.newInstance(null)).addToBackStack(null).commit()
......
package com.gingersoft.gsa.other_order_mode.ui.activity; package com.gingersoft.gsa.other_order_mode.ui.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.gingersoft.gsa.cloud.service.GetInfoUpdateService;
import com.gingersoft.gsa.other_order_mode.R; import com.gingersoft.gsa.other_order_mode.R;
import com.gingersoft.gsa.other_order_mode.service.GetInfoUpdateService;
public class LogActivity extends AppCompatActivity { public class LogActivity extends AppCompatActivity {
......
package com.gingersoft.gsa.other_order_mode.ui.activity package com.gingersoft.gsa.other_order_mode.ui.activity
import android.app.Dialog
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Gravity
import android.view.View import android.view.View
import android.view.WindowManager
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
...@@ -16,12 +19,14 @@ import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication ...@@ -16,12 +19,14 @@ 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.base.widget.DialogUtils
import com.gingersoft.gsa.cloud.constans.FunctionManagerConstans
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
import com.gingersoft.gsa.other_order_mode.OtherOrderComponent import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.cloud.ui.view.AddKeyBoard
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.BtnBuilder import com.gingersoft.gsa.other_order_mode.data.model.bean.ServiceChargeRecordBean
import com.gingersoft.gsa.other_order_mode.data.model.bean.TransportationBean import com.gingersoft.gsa.other_order_mode.data.model.bean.TransportationBean
import com.gingersoft.gsa.other_order_mode.databinding.ActivityOrderDetailsBinding import com.gingersoft.gsa.other_order_mode.databinding.ActivityOrderDetailsBinding
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
...@@ -32,6 +37,7 @@ import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Compani ...@@ -32,6 +37,7 @@ import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Compani
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
import com.gingersoft.gsa.other_order_mode.ui.adapter.ThirdExpensesAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.gingersoft.gsa.other_order_mode.util.showSelectDialog import com.gingersoft.gsa.other_order_mode.util.showSelectDialog
...@@ -49,6 +55,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -49,6 +55,7 @@ class OrderDetailsActivity : BaseActivity() {
private var orderPayType: Int = 0 private var orderPayType: Int = 0
private var isRead: Int = -1 private var isRead: Int = -1
private var state: Int = -1 private var state: Int = -1
private var isTimeOut: Boolean = false
lateinit var skeletonScreen: ViewSkeletonScreen lateinit var skeletonScreen: ViewSkeletonScreen
var restaurantId: Int = -1 var restaurantId: Int = -1
...@@ -56,7 +63,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -56,7 +63,7 @@ class OrderDetailsActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_order_details) binding = DataBindingUtil.setContentView(this, R.layout.activity_order_details)
val functionByResModule = FunctionManager.getDefault().getFunctionByResModule(this, OtherOrderComponent.takeaway::class.java, OtherOrderComponent.takeaway.orderDetails, "orderDetails/btn") val functionByResModule = FunctionManager.getDefault().getFunctionByResModule(this, FunctionManagerConstans.takeaway::class.java, FunctionManagerConstans.takeaway.orderDetails, "orderDetails/btn")
btnBuilder = BtnBuilder.getInstance(functionByResModule) btnBuilder = BtnBuilder.getInstance(functionByResModule)
val rootView = findViewById<View>(R.id.scroll_order_info) val rootView = findViewById<View>(R.id.scroll_order_info)
...@@ -74,7 +81,7 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -74,7 +81,7 @@ class OrderDetailsActivity : BaseActivity() {
orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式 orderPayType = intent.getIntExtra("orderPayType", 0)//訂單支付方式
isRead = intent.getIntExtra("isRead", -1)//是否已讀訂單 isRead = intent.getIntExtra("isRead", -1)//是否已讀訂單
state = intent.getIntExtra("orderStatus", -1)//訂單狀態 state = intent.getIntExtra("orderStatus", -1)//訂單狀態
isTimeOut = intent.getBooleanExtra("isTimeOut", false)//接單是否超時
pageViewModel = ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply { pageViewModel = ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply {
if (isRead == 0) { if (isRead == 0) {
//如果是未讀,調用設為已讀接口 //如果是未讀,調用設為已讀接口
...@@ -93,6 +100,9 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -93,6 +100,9 @@ class OrderDetailsActivity : BaseActivity() {
} }
private fun PageViewModel.getOrderDetails(orderId: String, binding: ActivityOrderDetailsBinding) { private fun PageViewModel.getOrderDetails(orderId: String, binding: ActivityOrderDetailsBinding) {
getShipanyAndOrderInfo(restaurantId, orderId)
getAdditionalByOrderId(orderId)
orderDetails.observe(this@OrderDetailsActivity, Observer { it -> orderDetails.observe(this@OrderDetailsActivity, Observer { it ->
skeletonScreen.hide()//隱藏骨架屏 skeletonScreen.hide()//隱藏骨架屏
if (it?.data != null && it.data!!.isNotEmpty()) { if (it?.data != null && it.data!!.isNotEmpty()) {
...@@ -108,7 +118,6 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -108,7 +118,6 @@ class OrderDetailsActivity : BaseActivity() {
val orderStatusText: String val orderStatusText: String
val type = if (orderDetails.order_type == 7) "自取" else "外送" val type = if (orderDetails.order_type == 7) "自取" else "外送"
when (orderDetails.orderStatus) { when (orderDetails.orderStatus) {
2 -> {//製作中 2 -> {//製作中
if (state == 0) { if (state == 0) {
...@@ -122,6 +131,12 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -122,6 +131,12 @@ class OrderDetailsActivity : BaseActivity() {
btnBuilder.getLogisticsBtn()?.let { btnBuilder.getLogisticsBtn()?.let {
btnList.add(it) btnList.add(it)
} }
//已超時,添加追加服務費的按鈕
if (isTimeOut && orderDetails.companyType == 2) {
btnBuilder.getAdditionalServiceChargeBtn()?.let {
btnList.add(it)
}
}
} }
} else { } else {
btnBuilder.getPrintBtn()?.let { btnBuilder.getPrintBtn()?.let {
...@@ -132,13 +147,19 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -132,13 +147,19 @@ class OrderDetailsActivity : BaseActivity() {
btnBuilder.getProductionCompletedBtn()?.let { btnBuilder.getProductionCompletedBtn()?.let {
btnList.add(it) btnList.add(it)
} }
tv_order_state.setTextColor(resources.getColor(R.color.order_state0_color)) tv_order_state.setTextColor(ContextCompat.getColor(this@OrderDetailsActivity, R.color.order_state0_color))
} else { } else {
//製作中的外賣,應該有打印、取消物流、取消訂單 //製作中的外賣,應該有打印、取消物流、取消訂單
if (orderDetails.isDelete == 0) { if (orderDetails.isDelete == 0) {
btnBuilder.getLogisticsBtn()?.let { btnBuilder.getLogisticsBtn()?.let {
btnList.add(it) btnList.add(it)
} }
if (isTimeOut) {
//已超時,添加追加服務費的按鈕
btnBuilder.getAdditionalServiceChargeBtn()?.let {
btnList.add(it)
}
}
} else { } else {
if (orderDetails.companyType == 2) { if (orderDetails.companyType == 2) {
btnBuilder.getTransportationBtn()?.let { btnBuilder.getTransportationBtn()?.let {
...@@ -197,7 +218,6 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -197,7 +218,6 @@ class OrderDetailsActivity : BaseActivity() {
tv_order_state.setTextColor(ContextCompat.getColor(this@OrderDetailsActivity, R.color.order_state0_color)) tv_order_state.setTextColor(ContextCompat.getColor(this@OrderDetailsActivity, R.color.order_state0_color))
} }
} }
if (orderDetails.orderPayType == 2 && orderDetails.payMultiple != null) { if (orderDetails.orderPayType == 2 && orderDetails.payMultiple != null) {
val sb = StringBuilder() val sb = StringBuilder()
for (value in orderDetails.payMultiple!!) { for (value in orderDetails.payMultiple!!) {
...@@ -214,16 +234,42 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -214,16 +234,42 @@ class OrderDetailsActivity : BaseActivity() {
rv_food.layoutManager = LinearLayoutManager(this@OrderDetailsActivity) rv_food.layoutManager = LinearLayoutManager(this@OrderDetailsActivity)
rv_food.adapter = FoodListAdapter(this@OrderDetailsActivity, orderDetails.PRODUCT_NAME!!) rv_food.adapter = FoodListAdapter(this@OrderDetailsActivity, orderDetails.PRODUCT_NAME!!)
val orderBtnAdapter = OrderDetailsAdapter(btnList)
rv_order_details_btn.apply {
adapter = orderBtnAdapter
var spanCount = 3
val gridLayoutManager =
if (btnList.size <= spanCount) {
spanCount = btnList.size
GridLayoutManager(this@OrderDetailsActivity, spanCount)
} else {
GridLayoutManager(this@OrderDetailsActivity, spanCount)
}
if (btnList.size in 1..4) { gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
rv_order_details_btn.layoutManager = GridLayoutManager(this@OrderDetailsActivity, btnList.size) override fun getSpanSize(position: Int): Int {
} else { //5個按鈕,第五個的position=4. 4
rv_order_details_btn.layoutManager = GridLayoutManager(this@OrderDetailsActivity, 3) return if (position < spanCount) {
1
} else {
if (btnList.size > (((position + 1) / spanCount) + 1) * spanCount) {
1
} else {
val size = btnList.size % spanCount
if (size > (spanCount / 2)) {
1
} else {
spanCount / size
}
}
}
}
}
layoutManager = gridLayoutManager
} }
val orderBtnAdapter = OrderDetailsAdapter(btnList)
rv_order_details_btn.adapter = orderBtnAdapter
//亂糟糟的代碼,該優化了 // 亂糟糟的代碼,該優化了
//--------------------------------------------------------------不同按鈕點擊事件---------------------------------------------------------------------------------------- //--------------------------------------------------------------不同按鈕點擊事件----------------------------------------------------------------------------------------
orderBtnAdapter.setOnItemClickListener { adapter, view, position -> orderBtnAdapter.setOnItemClickListener { adapter, view, position ->
when (btnList[position].type) { when (btnList[position].type) {
...@@ -238,8 +284,14 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -238,8 +284,14 @@ class OrderDetailsActivity : BaseActivity() {
cancelOrder(orderDetails) cancelOrder(orderDetails)
BtnBuilder.TransportationBtn -> { BtnBuilder.TransportationBtn -> {
//lalamove重新選擇運輸工具 //lalamove重新選擇運輸工具
selectLalaMove(orderDetails, false) { it, orderDetails -> showLoading()
showSelectTransportation(it, orderDetails, false) getIsUpdateTransportation(restaurantId) {
cancelDialogForLoading()
if (it == null) {
ToastUtils.show(this@OrderDetailsActivity, "未獲取到交通工具")
} else {
showSelectTransportation(it, orderDetails, false)
}
} }
} }
BtnBuilder.ClosingBtn -> { BtnBuilder.ClosingBtn -> {
...@@ -296,6 +348,10 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -296,6 +348,10 @@ class OrderDetailsActivity : BaseActivity() {
}) })
} }
} }
BtnBuilder.AdditionalServiceChargeBtn -> {
//追加服務費
showAddServiceChangeDialog()
}
else -> { else -> {
showLoading() showLoading()
confirmOrder(orderDetails) confirmOrder(orderDetails)
...@@ -307,7 +363,54 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -307,7 +363,54 @@ class OrderDetailsActivity : BaseActivity() {
finish() finish()
} }
}) })
getShipanyAndOrderInfo(restaurantId, orderId)
//添加服務費
addServiceChargeBean.observe(this@OrderDetailsActivity, Observer {
cancelDialogForLoading()
if (it != null) {
finish()
if (TextUtil.isNotEmptyOrNullOrUndefined(it.errMsg)) {
ToastUtils.show(this@OrderDetailsActivity, it.errMsg)
}
}
})
serviceChargeRecordBeans.observe(this@OrderDetailsActivity, Observer {
if (it != null && it.data.isNotEmpty()) {
layout_third_expenses?.visibility = View.VISIBLE
it.data.add(0, ServiceChargeRecordBean.DataX(0, 0, 0, 0, 0, 0, 0.0, 0, 0, 0, 0, 0, "", ""))
rv_third_expenses?.adapter = ThirdExpensesAdapter(it.data)
rv_third_expenses?.layoutManager = LinearLayoutManager(this@OrderDetailsActivity)
}
})
}
private fun showAddServiceChangeDialog() {
object : DialogUtils(this@OrderDetailsActivity, R.layout.layout_add_service_charge) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
hepler.setOnClickListenter(R.id.tv_cancel) { dialog.dismiss() }
hepler.getView<AddKeyBoard>(R.id.keyboard_addservice_charge).setOnKeyResultListener { isComplete, value ->
hepler.setText(R.id.ed_service_charge, value)
if (isComplete && value.isNotEmpty()) {
if (value.toDouble() < 10) {
ToastUtils.show(this@OrderDetailsActivity, "最低金額$10")
} else {
//添加服務費
dialog.dismiss()
additionalServiceCharge(value.toInt())
}
}
}
}
}
.setWidth(WindowManager.LayoutParams.MATCH_PARENT)
.setGravity(Gravity.BOTTOM)
.show()
}
private fun additionalServiceCharge(amount: Int) {
showLoading()
pageViewModel.additionalServiceCharge(GsaCloudApplication.getMemberId(this@OrderDetailsActivity).toString(), orderId, amount)
} }
private fun PageViewModel.selectLalaMove(orderDetails: OrderDetails.DataBean, isPrint: Boolean, 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) {
...@@ -352,26 +455,44 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -352,26 +455,44 @@ class OrderDetailsActivity : BaseActivity() {
}) })
} }
private fun PageViewModel.showSelectTransportation(it: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) { private fun PageViewModel.showSelectTransportation(transportationBeans: List<TransportationBean.DataX.Transportation>, orderDetails: OrderDetails.DataBean, isPrint: Boolean) {
val data = ArrayList<String>() //獲取實際金額
for (value in it) { showLoading()
data.add(when (value.type) { getActualAmount(orderId, GsaCloudApplication.getMemberId(this@OrderDetailsActivity), restaurantId) {
1 -> "摩托車($" + value.amountUnder + "-$" + value.amountOn + ")" cancelDialogForLoading()
2 -> "麵包車($" + value.amountUnder + "-$" + value.amountOn + ")" it?.let { transportAmountBean ->
3 -> "卡車($" + value.amountUnder + "-$" + value.amountOn + ")" transportAmountBean.data.let { transportData ->
else -> "($" + value.amountUnder + "-$" + value.amountOn + ")" val data = ArrayList<String>()
}) for (value in transportData) {
} if (value.deliveryAmount <= 0) {
val adapter = DeliveryAdapter(data) data.add(when (value.type) {
showSelectDialog("選擇運輸工具", 2, adapter as RecyclerView.Adapter<RecyclerView.ViewHolder>, { dialog -> 1 -> "摩托車"
if (adapter.selectIndex == -1) { 2 -> "麵包車"
ToastUtils.show(this@OrderDetailsActivity, "請選擇交通工具") 3 -> "卡車"
} else { else -> ""
confirmOrder(orderDetails, it[adapter.selectIndex].type.toString(), isPrint) })
} else {
data.add(when (value.type) {
1 -> "摩托車($" + value.deliveryAmount + ")"
2 -> "麵包車($" + value.deliveryAmount + ")"
3 -> "卡車($" + value.deliveryAmount + ")"
else -> "($" + value.deliveryAmount + ")"
})
}
}
val adapter = DeliveryAdapter(data)
showSelectDialog("選擇運輸工具", 2, adapter as RecyclerView.Adapter<RecyclerView.ViewHolder>, {
if (adapter.selectIndex == -1) {
ToastUtils.show(this@OrderDetailsActivity, "請選擇交通工具")
} else {
confirmOrder(orderDetails, transportationBeans[adapter.selectIndex].type.toString(), isPrint)
}
}, { dialog ->
dialog.dismiss()
})
}
} }
}, { }
it.dismiss()
})
} }
...@@ -526,5 +647,6 @@ class OrderDetailsActivity : BaseActivity() { ...@@ -526,5 +647,6 @@ class OrderDetailsActivity : BaseActivity() {
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
DialogUtils.staticDismiss() DialogUtils.staticDismiss()
pageViewModel.serviceChargeRecordBeans.removeObservers(this@OrderDetailsActivity)
} }
} }
package com.gingersoft.gsa.other_order_mode.ui.adapter
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.other_order_mode.R
class OrderBtnAdapter(var list: MutableList<BtnBuilder.BtnBean>) : RecyclerView.Adapter<OrderBtnAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val btnBuilder = list[position]
holder.btn.text = btnBuilder.btnContent
holder.btnImg.setBackgroundColor(btnBuilder.btnColor)
holder.btnImg.setImageResource(btnBuilder.btnImg)
}
override fun getItemCount() = list.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(View.inflate(parent.context, R.layout.item_btn, null))
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
var layout: LinearLayout = view.findViewById(R.id.layout_btn_item)
var btnImg: ImageView = view.findViewById(R.id.iv_btn_mark)
var btn: TextView = view.findViewById(R.id.tv_btn_content)
}
}
\ No newline at end of file
...@@ -2,8 +2,8 @@ package com.gingersoft.gsa.other_order_mode.ui.adapter ...@@ -2,8 +2,8 @@ package com.gingersoft.gsa.other_order_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.ui.utils.BtnBuilder
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.BtnBuilder
class OrderDetailsAdapter(list: MutableList<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) { class OrderDetailsAdapter(list: MutableList<BtnBuilder.BtnBean>) : BaseQuickAdapter<BtnBuilder.BtnBean, BaseViewHolder>(R.layout.item_btn, list) {
......
...@@ -16,10 +16,9 @@ import androidx.recyclerview.widget.RecyclerView.Adapter ...@@ -16,10 +16,9 @@ import androidx.recyclerview.widget.RecyclerView.Adapter
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList import com.gingersoft.gsa.other_order_mode.data.model.bean.OrderList
import com.gingersoft.gsa.other_order_mode.databinding.LayoutDeliveryOrderItemBinding import com.gingersoft.gsa.other_order_mode.databinding.LayoutDeliveryOrderItemBinding
import com.gingersoft.gsa.other_order_mode.databinding.LayoutOtherOrderItemBinding
import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px import com.scwang.smartrefresh.layout.util.SmartUtil.dp2px
class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.ViewHolder>() { class OtherOrdersAdapter(var context: Context, var outTime: Int) : Adapter<OtherOrdersAdapter.ViewHolder>() {
private var databeans: List<OrderList.DataBeanX.DataBean>? = null private var databeans: List<OrderList.DataBeanX.DataBean>? = null
...@@ -56,10 +55,18 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -56,10 +55,18 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
10 -> "已指派另一位配送員" 10 -> "已指派另一位配送員"
else -> "" else -> ""
} }
if (data.curStat < 2) {
//是否超時
if (outTime == 0) {
holder.binding.isTimeOut = false
} else {
holder.binding.isTimeOut = data.timeSecond < outTime
}
}
} else { } else {
holder.binding.deliveryState = "" holder.binding.deliveryState = ""
holder.binding.isTimeOut = false
} }
holder.binding.vehicle = when (data.transportationType) { holder.binding.vehicle = when (data.transportationType) {
1 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_motorcycle) 1 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_motorcycle)
2 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_bread_car) 2 -> ContextCompat.getDrawable(holder.itemView.context, R.drawable.ic_bread_car)
......
package com.gingersoft.gsa.other_order_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtil
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.ServiceChargeRecordBean
class ThirdExpensesAdapter(data: MutableList<ServiceChargeRecordBean.DataX>?) : BaseQuickAdapter<ServiceChargeRecordBean.DataX, BaseViewHolder>(R.layout.item_third_expenses, data) {
override fun convert(holder: BaseViewHolder, item: ServiceChargeRecordBean.DataX) {
if (holder.adapterPosition == 0) {
holder.setText(R.id.tv_third_expenses_user, "追加人")
holder.setText(R.id.tv_third_expenses_time, "追加時間")
holder.setText(R.id.tv_third_expenses_amount, "金額")
} else {
holder.setText(R.id.tv_third_expenses_user, "" + item.updateName)
holder.setText(R.id.tv_third_expenses_time, TimeUtil.StampToData(TimeUtil.dateFormatYMDHMS, item.updateTime))
holder.setText(R.id.tv_third_expenses_amount, "+$" + item.paymentValue)
}
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.fragment package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
......
...@@ -2,10 +2,6 @@ package com.gingersoft.gsa.other_order_mode.ui.fragment ...@@ -2,10 +2,6 @@ package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
...@@ -13,19 +9,14 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -13,19 +9,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
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.ui.utils.AppDialog
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel import com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel
import com.gingersoft.gsa.other_order_mode.ui.activity.OrderDetailsActivity import com.gingersoft.gsa.other_order_mode.ui.activity.OrderDetailsActivity
import com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.OtherOrdersAdapter
import com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment import com.gingersoft.gsa.other_order_mode.ui.base.BaseFragment
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.gingersoft.gsa.other_order_mode.util.OtherOrderUtils
import com.gingersoft.gsa.other_order_mode.util.setState import com.gingersoft.gsa.other_order_mode.util.setState
import kotlinx.android.synthetic.main.fragment_other_order.* import kotlinx.android.synthetic.main.fragment_other_order.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlin.String as String1
/** /**
* A placeholder fragment containing a simple view. * A placeholder fragment containing a simple view.
...@@ -52,7 +43,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -52,7 +43,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
// 初始化recyclerview // 初始化recyclerview
rv_other_order.layoutManager = LinearLayoutManager(activity) rv_other_order.layoutManager = LinearLayoutManager(activity)
val adapter = OtherOrdersAdapter(activity!!) val adapter = OtherOrdersAdapter(activity!!, pageViewModel.timeOut * 60 * 1000)
adapter.setOnItemClickListenter { data -> adapter.setOnItemClickListenter { data ->
// 點擊查詢食品詳情 // 點擊查詢食品詳情
...@@ -62,6 +53,15 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) { ...@@ -62,6 +53,15 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
intent.putExtra("orderStatus", data.STATUS) intent.putExtra("orderStatus", data.STATUS)
intent.putExtra("orderPayType", data.orderPayType) intent.putExtra("orderPayType", data.orderPayType)
intent.putExtra("isRead", data.isRead) intent.putExtra("isRead", data.isRead)
//已指派物流 並且 狀態為未接單 才判斷是否超時
if (data.isDelete == 0 && data.curStat < 2) {
if (pageViewModel.timeOut == 0) {
//為0時沒配置,不顯示追加服務費按鈕
intent.putExtra("isTimeOut", false)
} else {
intent.putExtra("isTimeOut", data.timeSecond < pageViewModel.timeOut * 60 * 1000)
}
}
startActivity(intent) startActivity(intent)
} }
rv_other_order.adapter = adapter rv_other_order.adapter = adapter
......
...@@ -4,8 +4,8 @@ import android.app.Activity ...@@ -4,8 +4,8 @@ import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.view.View import android.view.View
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.gingersoft.gsa.cloud.base.R
import com.gingersoft.gsa.cloud.ui.utils.AppDialog import com.gingersoft.gsa.cloud.ui.utils.AppDialog
import com.gingersoft.gsa.other_order_mode.R
fun View.setState(state: Boolean) { fun View.setState(state: Boolean) {
visibility = if (state) { visibility = if (state) {
...@@ -30,7 +30,7 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel: ...@@ -30,7 +30,7 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel:
} }
fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit){ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit){
AppDialog().showSelectDialog(this, title, spanCount, adapter){view, dialog-> AppDialog().showSelectDialog(this, title, spanCount, adapter){ view, dialog->
when (view.id) { when (view.id) {
R.id.tv_delivery_confirm -> { R.id.tv_delivery_confirm -> {
confirm.invoke(dialog) confirm.invoke(dialog)
...@@ -42,3 +42,5 @@ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView ...@@ -42,3 +42,5 @@ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView
} }
} }
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
android:layout_width="@dimen/dp_50" android:layout_width="@dimen/dp_50"
android:layout_height="0dp" android:layout_height="0dp"
android:padding="@dimen/dp_10" android:padding="@dimen/dp_10"
android:src="@mipmap/ic_search" android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search" app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
app:layout_constraintRight_toRightOf="@id/ed_order_num_search" app:layout_constraintRight_toRightOf="@id/ed_order_num_search"
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" /> app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
......
...@@ -636,6 +636,38 @@ ...@@ -636,6 +636,38 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/layout_third_expenses"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_dialog_bg"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:text="第三方費用"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_third_expenses"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</RelativeLayout> </RelativeLayout>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_f0" android:background="@color/color_f0"
tools:context=".ui.activity.OtherOrderActivity"> tools:context=".ui.activity.DeliveryOrderMainActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<!-- app:tabPaddingStart="-1dp"--> <!-- app:tabPaddingStart="-1dp"-->
<!-- app:tabPaddingEnd="-1dp"--> <!-- app:tabPaddingEnd="-1dp"-->
<androidx.constraintlayout.widget.ConstraintLayout <LinearLayout
android:id="@+id/cl_order_info" android:id="@+id/cl_order_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
android:layout_marginRight="@dimen/dp_6" android:layout_marginRight="@dimen/dp_6"
android:background="@drawable/shape_dialog_bg" android:background="@drawable/shape_dialog_bg"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_search_info" android:id="@+id/layout_search_info"
...@@ -169,7 +170,7 @@ ...@@ -169,7 +170,7 @@
android:layout_width="@dimen/dp_50" android:layout_width="@dimen/dp_50"
android:layout_height="0dp" android:layout_height="0dp"
android:padding="@dimen/dp_10" android:padding="@dimen/dp_10"
android:src="@mipmap/ic_search" android:src="@drawable/ic_search"
app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search" app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
app:layout_constraintRight_toRightOf="@id/ed_order_num_search" app:layout_constraintRight_toRightOf="@id/ed_order_num_search"
app:layout_constraintTop_toTopOf="@id/ed_order_num_search" /> app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />
...@@ -214,6 +215,16 @@ ...@@ -214,6 +215,16 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_balance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_10"
android:text="餘額:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layout_today_order_info" android:id="@+id/layout_today_order_info"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -409,7 +420,7 @@ ...@@ -409,7 +420,7 @@
android:textColor="@color/color_a9" android:textColor="@color/color_a9"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" /> app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" />
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
android:id="@+id/layout_btn_item" android:id="@+id/layout_btn_item"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:gravity="center" android:gravity="center"
android:layout_marginTop="@dimen/dp_1"
android:layout_marginStart="@dimen/dp_1" android:layout_marginStart="@dimen/dp_1"
android:orientation="horizontal"> android:orientation="horizontal">
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_third_expenses_user"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
tools:text="追加人" />
<TextView
android:id="@+id/tv_third_expenses_time"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center"
android:text="FENG"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
tools:text="追加時間" />
<TextView
android:id="@+id/tv_third_expenses_amount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
tools:text="+$10" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_white_top_border"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="追加服務費"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="@dimen/button_height"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingRight="@dimen/dp_10"
android:text="取消"
android:textColor="@color/theme_color"
android:textSize="@dimen/dp_14" />
</RelativeLayout>
<include layout="@layout/include_horizontal_color_ccc_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="追加金額數"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
<TextView
android:id="@+id/ed_service_charge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_login_edit_border"
android:hint="最低金額$10"
android:padding="@dimen/dp_10"
android:textColor="@color/theme_333_color" />
</LinearLayout>
<com.gingersoft.gsa.cloud.ui.view.AddKeyBoard
android:id="@+id/keyboard_addservice_charge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
\ No newline at end of file
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
<variable <variable
name="vehicle" name="vehicle"
type="android.graphics.drawable.Drawable" /> type="android.graphics.drawable.Drawable" />
<variable
name="isTimeOut"
type="Boolean" />
</data> </data>
<FrameLayout <FrameLayout
...@@ -258,7 +262,7 @@ ...@@ -258,7 +262,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2" android:layout_marginLeft="@dimen/dp_2"
android:layout_weight="0.35" android:layout_weight="0.4"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
...@@ -269,8 +273,8 @@ ...@@ -269,8 +273,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/dp_15"
android:text="@{delivery_state}" android:text="@{delivery_state}"
android:textColor="@color/color_3c" android:textColor="@{isTimeOut?@color/red_600:@color/color_3c}"
tools:text="已通知物流" tools:text="@{isTimeOut?@string/order_receiving_timeout:delivery_state}"
tools:textColor="@color/theme_333_color" /> tools:textColor="@color/theme_333_color" />
<TextView <TextView
...@@ -304,6 +308,35 @@ ...@@ -304,6 +308,35 @@
app:layout_constraintTop_toBottomOf="@id/barrier_order_item_three" app:layout_constraintTop_toBottomOf="@id/barrier_order_item_three"
tools:text="$14141" tools:text="$14141"
tools:textColor="@color/theme_333_color" /> tools:textColor="@color/theme_333_color" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="@{data.paymentValue!=0?View.VISIBLE:View.GONE}">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="追加服務費:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/sp_10" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:gravity="center_horizontal"
android:text="@{@string/amount_unit + data.paymentValue}"
android:textColor="@color/red_600"
android:textSize="@dimen/sp_10"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/tv_address"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier_order_item_three"
tools:text="$14141"
tools:textColor="@color/theme_333_color" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
<resources> <resources>
<string name="app_name">訂單管理</string> <string name="app_name">訂單管理</string>
<string name="history_order">歷史訂單</string>
<string name="tab_text_1">全部</string>
<string name="tab_text_2">待確認</string>
<string name="tab_text_3">製作中</string>
<string name="tab_text_4">送貨中</string>
<string name="tab_text_5">待取餐</string>
<string name="slash">/</string>
<string name="amount_unit">$</string>
<string name="minus_amount_unit">-$</string>
<string name="count">x</string>
<string name="normal">正常</string>
<string name="rest">休息</string>
<string name="open">營業中</string>
<string name="resting">休息中</string>
<string name="receiving_telephone">收貨電話:</string>
<string name="reserved_telephone">預留電話:</string>
<string name="receiving_time">收貨時間:</string>
<string name="self_taking_time">自取時間:</string>
<string name="receiving_address">收貨地址:</string>
<string name="meal_code">取餐碼:</string>
<string name="address">地\u3000址:</string>
<string name="table_number">檯號:</string>
<string name="self">自取</string>
<string name="takeaway">外送</string>
<string name="order_number">單號:</string>
<string name="create_order_time">下單時間:</string>
<string name="remark">備註:</string>
<string name="h5_order">H5訂單</string>
<string name="ricepon_order">ricepon訂單</string>
<string name="order_no">訂單編號:</string>
<string name="deliveryman">送貨員:</string>
<string name="deliveryman_phone">送貨員手機號:</string>
<string name="logistics_number">物流號:</string>
<string name="take_food_code_omit">----</string>
<string name="left_parenthesis"></string>
<string name="right_parenthesis"></string>
<string name="delivery_type">配送類型:</string>
<string name="delivery_expenses">配送費範圍:</string>
<string name="delivery_fee">最低消費:</string>
<string name="delivery_method">配送方式:</string>
<string name="delivery_difference">補差價:</string>
</resources> </resources>
...@@ -45,64 +45,4 @@ ...@@ -45,64 +45,4 @@
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
</style> </style>
<!-- 彈窗_收貨標題字體樣式-->
<style name="otherOrderReceiving_title_textStyle">
<item name="android:textColor">@color/color_50</item>
<item name="android:textSize">@dimen/dp_16</item>
</style>
<!-- 彈窗_收貨標題信息字體樣式-->
<style name="otherOrderReceiving_information_textStyle">
<item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textStyle">bold</item>
</style>
<!-- 彈窗_金額標題字體樣式-->
<style name="otherOrder_bill_textStyle">
<item name="android:textColor">@color/color_3c</item>
<item name="android:textSize">@dimen/dp_16</item>
</style>
<style name="otherOrder_bill_info_textStyle">
<item name="android:textColor">@color/color_3c</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textStyle">bold</item>
</style>
<!-- 訂單列表item的訂單信息名稱字體樣式-->
<style name="otherOrder_item_info_title_textStyle">
<item name="android:textColor">@color/theme_text_color</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的訂單信息字體樣式-->
<style name="otherOrder_item_info_textStyle">
<item name="android:textColor">@color/color_86</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 訂單列表item的下單時間字體樣式-->
<style name="otherOrder_item_create_time_textStyle">
<item name="android:textColor">@color/color_66</item>
<item name="android:textSize">@dimen/dp_12</item>
</style>
<!-- 餐廳營業狀態按鈕樣式-->
<style name="otherOrder_restaurant_state_style">
<item name="android:layout_width">@dimen/dp_80</item>
<item name="android:layout_height">@dimen/dp_28</item>
<item name="android:gravity">center_vertical</item>
<item name="android:paddingLeft">@dimen/dp_8</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_14</item>
</style>
<style name="otherOrder_delivery_setting_layout_style">
<item name="android:paddingRight">@dimen/dp_20</item>
</style>
<style name="otherOrder_details_sixteen_text_Style">
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textColor">@color/theme_333_color</item>
<item name="android:textStyle">bold</item>
</style>
<style name="otherOrder_details_twelve_text_Style">
<item name="android:textSize">@dimen/dp_12</item>
<item name="android:textColor">@color/color_3c</item>
</style>
</resources> </resources>
...@@ -82,6 +82,7 @@ dependencies { ...@@ -82,6 +82,7 @@ dependencies {
addComponent 'print-module' addComponent 'print-module'
addComponent 'delivery_pick_mode' addComponent 'delivery_pick_mode'
addComponent 'manager-module' addComponent 'manager-module'
addComponent 'coldchain-module'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03' implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
apply from: rootProject.file('cc-settings.gradle') apply from: rootProject.file('cc-settings.gradle')
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
android { android {
......
...@@ -18,6 +18,7 @@ public class ComponentMain implements IComponent { ...@@ -18,6 +18,7 @@ public class ComponentMain implements IComponent {
new FModule("main/order/delivery", R.drawable.ic_delivery_mode,R.drawable.ic_delivery_mode_close) , new FModule("main/order/delivery", R.drawable.ic_delivery_mode,R.drawable.ic_delivery_mode_close) ,
new FModule("main/order/takeaway", R.drawable.ic_outsourcing_model,R.drawable.ic_outsourcing_model_close), new FModule("main/order/takeaway", R.drawable.ic_outsourcing_model,R.drawable.ic_outsourcing_model_close),
new FModule("main/order/preorder", R.drawable.ic_pre_order_mode,R.drawable.ic_pre_order_mode_close), new FModule("main/order/preorder", R.drawable.ic_pre_order_mode,R.drawable.ic_pre_order_mode_close),
new FModule("main/order/coldChain", R.drawable.ic_pre_order_mode,R.drawable.ic_pre_order_mode_close),
}; };
/**首頁- 管理*/ /**首頁- 管理*/
public static final FModule [] manager = { public static final FModule [] manager = {
......
...@@ -177,7 +177,7 @@ public class BusinessReportPresenter extends BasePresenter<BusinessReportContrac ...@@ -177,7 +177,7 @@ 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 { } else {
mRootView.loadOrderAnalysis(null); mRootView.loadOrderAnalysis(new ArrayList<>());
} }
} else { } else {
mRootView.loadOrderAnalysis(null); mRootView.loadOrderAnalysis(null);
......
...@@ -67,10 +67,8 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT ...@@ -67,10 +67,8 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT
// .build(); // .build();
mModel.getRestaurantReport(restaurantId) mModel.getRestaurantReport(restaurantId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<MainBusinessBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<MainBusinessBean>(mErrorHandler) {
...@@ -93,10 +91,8 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT ...@@ -93,10 +91,8 @@ public class MainTopPresenter extends BasePresenter<MainTopContract.Model, MainT
.build(); .build();
mModel.getOrderInfoChart(requestBody) mModel.getOrderInfoChart(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<MainOrderInfoChartBean>(mErrorHandler) { .subscribe(new ErrorHandleSubscriber<MainOrderInfoChartBean>(mErrorHandler) {
@Override @Override
......
...@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.file.FileUtils import com.gingersoft.gsa.cloud.base.utils.FileUtils
import com.gingersoft.gsa.cloud.main.R import com.gingersoft.gsa.cloud.main.R
import kotlinx.android.synthetic.main.activity_look_log.* import kotlinx.android.synthetic.main.activity_look_log.*
import java.io.BufferedReader import java.io.BufferedReader
......
...@@ -29,7 +29,6 @@ import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils; ...@@ -29,7 +29,6 @@ import com.gingersoft.gsa.cloud.base.utils.RestaurantInfoUtils;
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.other.SPUtils; import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils; import com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.constans.ResultConstans; import com.gingersoft.gsa.cloud.constans.ResultConstans;
import com.gingersoft.gsa.cloud.database.bean.Function; import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.function.FunctionManager; import com.gingersoft.gsa.cloud.function.FunctionManager;
...@@ -46,9 +45,7 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainSideMenuAdapter; ...@@ -46,9 +45,7 @@ import com.gingersoft.gsa.cloud.main.mvp.ui.adapter.MainSideMenuAdapter;
import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MainTopFragment; import com.gingersoft.gsa.cloud.main.mvp.ui.fragment.MainTopFragment;
import com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu; import com.gingersoft.gsa.cloud.main.mvp.ui.view.SlidingMenu;
import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean; import com.gingersoft.gsa.cloud.ui.bean.mode.BrandsBean;
import com.gingersoft.gsa.cloud.ui.widget.dialog.ChooseRestaurantDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog; import com.gingersoft.gsa.cloud.ui.widget.dialog.CommonTipDialog;
import com.gingersoft.gsa.cloud.ui.widget.dialog.LoadingDialog;
import com.gyf.immersionbar.ImmersionBar; import com.gyf.immersionbar.ImmersionBar;
import com.jess.arms.base.BaseFragmentActivity; import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
...@@ -65,8 +62,6 @@ import butterknife.BindView; ...@@ -65,8 +62,6 @@ import butterknife.BindView;
import butterknife.BindViews; import butterknife.BindViews;
import butterknife.OnClick; import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_NONACTIVATED;
import static com.gingersoft.gsa.cloud.database.bean.Function.STATUS_TIME_LIMIT;
import static com.jess.arms.utils.Preconditions.checkNotNull; import static com.jess.arms.utils.Preconditions.checkNotNull;
...@@ -260,6 +255,8 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -260,6 +255,8 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
// return; // return;
// } // }
List<Function> functions = new ArrayList<>(); List<Function> functions = new ArrayList<>();
// functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0));
// functions.add(new Function((long) 140, 150, 5, "冷鏈接單", R.drawable.ic_pre_order_mode, 0));
//// if (!BuildConfig.DEBUG) { //// if (!BuildConfig.DEBUG) {
// functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0)); // functions.add(new Function((long) 150, 0, 5, "點餐", 0, 0));
...@@ -394,6 +391,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl ...@@ -394,6 +391,11 @@ public class NewMainActivity extends BaseFragmentActivity<NewMainPresenter> impl
.setActionName("showTableManageActivity") .setActionName("showTableManageActivity")
.build() .build()
.call(); .call();
} else if(name.equals("冷鏈接單")){
CC.obtainBuilder("Component.ColdChain")
.setActionName("Component.ColdChain")
.build()
.call();
} }
} }
......
...@@ -20,6 +20,7 @@ include 'cc-register', ...@@ -20,6 +20,7 @@ include 'cc-register',
'manager-module', 'manager-module',
'manager-module', 'manager-module',
'delivery_pick_mode', 'delivery_pick_mode',
'tracker' 'tracker',
'coldchain-module'
...@@ -2,46 +2,28 @@ package com.gingersoft.gsa.cloud.table.mvp.ui.widget; ...@@ -2,46 +2,28 @@ package com.gingersoft.gsa.cloud.table.mvp.ui.widget;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.net.ParseException;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter; import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.database.bean.Discount; import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.table.R; import com.gingersoft.gsa.cloud.table.R;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.FoodReason;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.FoodReasonAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.DiscountAdapter; import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.DiscountAdapter;
import com.google.gson.JsonIOException;
import com.google.gson.JsonParseException;
import com.jess.arms.base.DefaultAdapter;
import com.qmuiteam.qmui.layout.QMUILinearLayout; import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.layout.QMUIRelativeLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper; import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUIEmptyView;
import com.qmuiteam.qmui.widget.QMUISlider;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
import org.json.JSONException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/** /**
* 作者:ELEGANT_BIN * 作者:ELEGANT_BIN
* 版本:1.6.0 * 版本:1.6.0
...@@ -157,12 +139,9 @@ public class DiscountDialog extends Dialog { ...@@ -157,12 +139,9 @@ public class DiscountDialog extends Dialog {
} }
if (canScan) { if (canScan) {
mTopBar.addRightImageButton(R.mipmap.table_white_scan, R.id.topbar_right_change_button) mTopBar.addRightImageButton(R.mipmap.table_white_scan, R.id.topbar_right_change_button)
.setOnClickListener(new View.OnClickListener() { .setOnClickListener(v -> {
@Override if (onClickListener != null) {
public void onClick(View v) { onClickListener.onScan();
if (onClickListener != null) {
onClickListener.onScan();
}
} }
}); });
} }
...@@ -173,14 +152,11 @@ public class DiscountDialog extends Dialog { ...@@ -173,14 +152,11 @@ public class DiscountDialog extends Dialog {
if (mAdapter == null) { if (mAdapter == null) {
mAdapter = new DiscountAdapter(mContext, mItems); mAdapter = new DiscountAdapter(mContext, mItems);
} }
mAdapter.setOnItemClickListener(new DefaultAdapter.OnRecyclerViewItemClickListener() { mAdapter.setOnItemClickListener((view, viewType, data, position) -> {
@Override if (onClickListener != null) {
public void onItemClick(View view, int viewType, Object data, int position) { onClickListener.onItemClick((Discount) data, position);
if (onClickListener != null) {
onClickListener.onItemClick((Discount) data, position);
}
closeDialog();
} }
closeDialog();
}); });
recycler_discount.setLayoutManager(createLayoutManager()); recycler_discount.setLayoutManager(createLayoutManager());
recycler_discount.setAdapter(mAdapter); recycler_discount.setAdapter(mAdapter);
......
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