Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
ea7060d3
Commit
ea7060d3
authored
Aug 13, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8.13 1、物流取消提示 2、lalamove選擇運輸工具 3、lalamove取消物流後可再次選擇運輸工具
Signed-off-by: Wyh <1239658231>
parent
275bd337
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
267 additions
and
182 deletions
+267
-182
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/utils/AppDialog.java
+2
-2
base-module/src/main/res/layout/dialog_select_layout.xml
+5
-5
config.gradle
+2
-2
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
+12
-10
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/BtnBuilder.kt
+5
-0
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+77
-59
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
+9
-11
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OrderDetailsActivity.kt
+132
-69
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
+0
-1
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/DeliveryAdapter.kt
+14
-7
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/OtherOrdersAdapter.kt
+7
-14
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/ViewUtil.kt
+2
-2
other_order_mode/src/main/res/raw/raw_logistics_cancel.mp3
+0
-0
No files found.
base-module/src/main/java/com/gingersoft/gsa/cloud/ui/utils/AppDialog.java
View file @
ea7060d3
...
@@ -40,12 +40,12 @@ public class AppDialog {
...
@@ -40,12 +40,12 @@ public class AppDialog {
}.
show
();
}.
show
();
}
}
public
void
showSelectDialog
(
Context
context
,
String
title
,
RecyclerView
.
Adapter
adapter
,
DialogOnClickListenter
sureOnclickListenter
)
{
public
void
showSelectDialog
(
Context
context
,
String
title
,
int
spanCount
,
RecyclerView
.
Adapter
adapter
,
DialogOnClickListenter
sureOnclickListenter
)
{
new
DialogUtils
(
context
,
R
.
layout
.
dialog_select_layout
)
{
new
DialogUtils
(
context
,
R
.
layout
.
dialog_select_layout
)
{
@Override
@Override
public
void
initLayout
(
ViewHepler
hepler
,
Dialog
dialog
)
{
public
void
initLayout
(
ViewHepler
hepler
,
Dialog
dialog
)
{
hepler
.
setText
(
R
.
id
.
tv_title
,
title
);
hepler
.
setText
(
R
.
id
.
tv_title
,
title
);
hepler
.
setAdapter
(
R
.
id
.
rv_delivery
,
new
GridLayoutManager
(
context
,
4
),
adapter
);
hepler
.
setAdapter
(
R
.
id
.
rv_delivery
,
new
GridLayoutManager
(
context
,
spanCount
),
adapter
);
hepler
.
setOnClickListenter
(
R
.
id
.
tv_delivery_confirm
,
v
->
sureOnclickListenter
.
onclick
(
v
,
dialog
));
hepler
.
setOnClickListenter
(
R
.
id
.
tv_delivery_confirm
,
v
->
sureOnclickListenter
.
onclick
(
v
,
dialog
));
hepler
.
setOnClickListenter
(
R
.
id
.
tv_delivery_cancel
,
v
->
sureOnclickListenter
.
onclick
(
v
,
dialog
));
hepler
.
setOnClickListenter
(
R
.
id
.
tv_delivery_cancel
,
v
->
sureOnclickListenter
.
onclick
(
v
,
dialog
));
}
}
...
...
base-module/src/main/res/layout/dialog_select_layout.xml
View file @
ea7060d3
...
@@ -2,15 +2,15 @@
...
@@ -2,15 +2,15 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:orientation=
"vertical"
>
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:paddingBottom=
"@dimen/dp_20"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_white_eight_corners_bg"
android:background=
"@drawable/shape_white_eight_corners_bg"
android:paddingLeft=
"@dimen/dp_10"
android:paddingRight=
"@dimen/dp_10"
android:paddingBottom=
"@dimen/dp_20"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<FrameLayout
<FrameLayout
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
android:layout_marginLeft=
"@dimen/dp_16"
android:layout_marginLeft=
"@dimen/dp_16"
android:layout_marginRight=
"@dimen/dp_16"
android:layout_marginRight=
"@dimen/dp_16"
android:layout_marginBottom=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:background=
"@drawable/shape_
fifty_tran_
green_btn"
android:background=
"@drawable/shape_green_btn"
android:gravity=
"center"
android:gravity=
"center"
android:paddingTop=
"@dimen/dp_12"
android:paddingTop=
"@dimen/dp_12"
android:paddingBottom=
"@dimen/dp_12"
android:paddingBottom=
"@dimen/dp_12"
...
...
config.gradle
View file @
ea7060d3
...
@@ -7,8 +7,8 @@ ext {
...
@@ -7,8 +7,8 @@ ext {
targetSdkVersion
:
28
,
targetSdkVersion
:
28
,
//正式版: 1.0.3 3
//正式版: 1.0.3 3
//內部測試版:1.2.0 20
//內部測試版:1.2.0 20
versionCode
:
5
,
versionCode
:
6
,
versionName
:
"1.0.
5
"
versionName
:
"1.0.
6
"
]
]
version
=
[
version
=
[
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/WeatherRepository.kt
View file @
ea7060d3
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.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.utils.JsonUtils
import
com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils
import
com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils
import
com.gingersoft.gsa.cloud.
constans.AppConstans
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
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem
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
...
@@ -15,7 +13,6 @@ import kotlinx.coroutines.Dispatchers
...
@@ -15,7 +13,6 @@ import kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.withContext
import
kotlinx.coroutines.withContext
import
okhttp3.FormBody
import
okhttp3.FormBody
import
okhttp3.MediaType
import
okhttp3.MediaType
import
okhttp3.MultipartBody
import
okhttp3.RequestBody
import
okhttp3.RequestBody
import
kotlin.Pair
as
Pair1
import
kotlin.Pair
as
Pair1
...
@@ -117,12 +114,14 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -117,12 +114,14 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
}
}
suspend
fun
thirdDelivery
(
orderId
:
String
,
thirdItem
:
ThirdItem
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
thirdDelivery
(
orderId
:
String
,
t
rafficType
:
String
=
""
,
t
hirdItem
:
ThirdItem
)
=
withContext
(
Dispatchers
.
IO
)
{
val
requestBody
=
FormBody
.
Builder
()
val
requestBody
=
FormBody
.
Builder
()
.
add
(
"orderId"
,
orderId
)
.
add
(
"orderId"
,
orderId
)
.
add
(
"items"
,
Gson
().
toJson
(
thirdItem
))
.
add
(
"items"
,
Gson
().
toJson
(
thirdItem
))
.
build
()
if
(
TextUtil
.
isNotEmptyOrNullOrUndefined
(
trafficType
))
{
network
.
thirdDelivery
(
requestBody
)
requestBody
.
add
(
"trafficType"
,
trafficType
)
//運輸類型 1摩托車 2麵包車 3卡車
}
network
.
thirdDelivery
(
requestBody
.
build
())
}
}
suspend
fun
updateSelfOrderStatus
(
ids
:
String
,
status
:
String
,
restaurantId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
updateSelfOrderStatus
(
ids
:
String
,
status
:
String
,
restaurantId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
...
@@ -135,6 +134,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -135,6 +134,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
data
data
}
}
suspend
fun
getTransportationConfig
(
restaurantId
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
network
.
getTransportationConfig
(
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
()
...
@@ -152,8 +154,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -152,8 +154,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network
.
getDeliveryConfigDTO
(
requestBody
)
network
.
getDeliveryConfigDTO
(
requestBody
)
}
}
suspend
fun
cancelLogistics
(
shop
Id
:
String
,
orderId
:
String
,
reasonId
:
String
,
reasonDesc
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
cancelLogistics
(
restaurant
Id
:
String
,
orderId
:
String
,
reasonId
:
String
,
reasonDesc
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
network
.
cancelLogistics
(
getBody
(
"restaurantId"
to
shop
Id
,
"orderId"
to
orderId
,
"reasonId"
to
reasonId
,
"reasonDesc"
to
reasonDesc
))
network
.
cancelLogistics
(
getBody
(
"restaurantId"
to
restaurant
Id
,
"orderId"
to
orderId
,
"reasonId"
to
reasonId
,
"reasonDesc"
to
reasonDesc
))
}
}
suspend
fun
updateOrderStates
(
memberId
:
String
,
orderId
:
String
,
status
:
String
,
updateBy
:
String
,
reasonId
:
String
,
reasonDesc
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
updateOrderStates
(
memberId
:
String
,
orderId
:
String
,
status
:
String
,
updateBy
:
String
,
reasonId
:
String
,
reasonDesc
:
String
)
=
withContext
(
Dispatchers
.
IO
)
{
...
@@ -161,7 +163,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
...
@@ -161,7 +163,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
}
}
suspend
fun
getCancelReason
(
brandId
:
Int
,
restaurantId
:
Int
,
type
:
Int
)
=
withContext
(
Dispatchers
.
IO
)
{
suspend
fun
getCancelReason
(
brandId
:
Int
,
restaurantId
:
Int
,
type
:
Int
)
=
withContext
(
Dispatchers
.
IO
)
{
// val requestBody = FormBody.Builder()
// val requestBody = FormBody.Builder()
// .add("brandId", brandId)
// .add("brandId", brandId)
// .add("restaurantId", restaurantId)
// .add("restaurantId", restaurantId)
// .add("type", type)//取消原因類型,1食品取消,2,物流取消,3,訂單取消
// .add("type", type)//取消原因類型,1食品取消,2,物流取消,3,訂單取消
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/data/model/bean/BtnBuilder.kt
View file @
ea7060d3
...
@@ -12,6 +12,7 @@ class BtnBuilder {
...
@@ -12,6 +12,7 @@ class BtnBuilder {
val
assignDeliveryBtn
=
4
val
assignDeliveryBtn
=
4
val
closingBtn
=
5
val
closingBtn
=
5
val
ProductionCompletedBtn
=
6
val
ProductionCompletedBtn
=
6
val
TransportationBtn
=
7
//選擇運輸工具
}
}
class
BtnBean
(
val
type
:
Int
,
val
btnContent
:
String
,
val
btnColor
:
Int
,
val
btnImg
:
Int
)
class
BtnBean
(
val
type
:
Int
,
val
btnContent
:
String
,
val
btnColor
:
Int
,
val
btnImg
:
Int
)
...
@@ -44,5 +45,9 @@ class BtnBuilder {
...
@@ -44,5 +45,9 @@ class BtnBuilder {
return
BtnBean
(
closingBtn
,
"結賬"
,
R
.
color
.
other_order_details_cancel_btn_color
,
R
.
drawable
.
ic_closing
)
return
BtnBean
(
closingBtn
,
"結賬"
,
R
.
color
.
other_order_details_cancel_btn_color
,
R
.
drawable
.
ic_closing
)
}
}
fun
getTransportationBtn
():
BtnBean
{
return
BtnBean
(
TransportationBtn
,
"運輸工具"
,
R
.
color
.
other_order_details_cancel_logistics_btn_color
,
R
.
drawable
.
ic_logistics
)
}
}
}
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
ea7060d3
...
@@ -36,8 +36,6 @@ import com.jess.arms.utils.ArmsUtils
...
@@ -36,8 +36,6 @@ import com.jess.arms.utils.ArmsUtils
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
kotlinx.coroutines.withContext
import
org.json.JSONArray
import
org.json.JSONObject
class
PageViewModel
(
private
val
repository
:
WeatherRepository
)
:
ViewModel
()
{
class
PageViewModel
(
private
val
repository
:
WeatherRepository
)
:
ViewModel
()
{
...
@@ -232,7 +230,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -232,7 +230,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
var
orderDetails
=
MutableLiveData
<
OrderDetails
>()
var
orderDetails
=
MutableLiveData
<
OrderDetails
>()
//獲取訂單詳情和物流送達時間
//獲取訂單詳情和物流送達時間
fun
getShipanyAndOrderInfo
(
restaurantId
:
String
,
orderId
:
String
)
{
fun
getShipanyAndOrderInfo
(
restaurantId
:
Int
,
orderId
:
String
)
{
launch
({
launch
({
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
val
orderDetail
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getOrderInfo
(
orderId
)
}
val
orderDetail
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getOrderInfo
(
orderId
)
}
...
@@ -262,7 +260,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -262,7 +260,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
estimatedTime
=
"預計整張訂單完成時間:"
estimatedTime
=
"預計整張訂單完成時間:"
}
}
}
}
val
estimatedBean
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getShipanyOrderTime
(
restaurantId
,
orderId
,
type
)
}
//1、预计整张订单完成时间2、預計配送員接單時間3、預計配送員到店時間4、配送員預計送達時間
val
estimatedBean
=
withContext
(
Dispatchers
.
Default
)
{
repository
.
getShipanyOrderTime
(
restaurantId
.
toString
()
,
orderId
,
type
)
}
//1、预计整张订单完成时间2、預計配送員接單時間3、預計配送員到店時間4、配送員預計送達時間
// if (estimatedBean.data.estimated_time > 0) {
// if (estimatedBean.data.estimated_time > 0) {
if
(
estimatedBean
.
data
!=
null
)
{
if
(
estimatedBean
.
data
!=
null
)
{
data
.
estimatedTime
=
estimatedTime
+
(
"${estimatedBean.data.estimated_time}分鐘後"
)
data
.
estimatedTime
=
estimatedTime
+
(
"${estimatedBean.data.estimated_time}分鐘後"
)
...
@@ -290,39 +288,20 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -290,39 +288,20 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
fun
updateOrderStatusByBtn
(
btnId
:
Int
,
dataBean
:
OrderDetails
.
DataBean
,
restaurantId
:
String
,
listener
:
(
MessageBean
)
->
Unit
)
{
fun
confirmOrder
(
dataBean
:
OrderDetails
.
DataBean
,
trafficType
:
String
=
""
,
restaurantId
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
launch
({
launch
({
when
(
btnId
)
{
when
(
dataBean
.
companyType
)
{
BtnBuilder
.
sureBtn
->
{
0
->
{
// 確認訂單
//本店
// 1、如果是外賣,指派到第三方物流
// 2、如果是自取,狀態改為製作中
repository
.
getDeliveryConfigDTO
(
restaurantId
).
apply
{
var
third
=
false
//獲取配送設置,查看當前單是否是第三方物流
for
(
i
in
0
until
data
.
list
.
size
)
{
if
(
data
.
list
[
i
].
distributionType
==
dataBean
.
deliveryMode
)
{
third
=
data
.
list
[
i
].
type
!=
0
break
}
}
if
(
third
&&
dataBean
.
isDelete
!=
0
)
{
// 如果是第三方物流,調用第三方接口
thirdSend
(
restaurantId
,
dataBean
,
2
,
listener
)
}
else
{
updateOrderAndPrint
(
restaurantId
,
dataBean
,
2
,
listener
)
updateOrderAndPrint
(
restaurantId
,
dataBean
,
2
,
listener
)
}
}
1
->
{
//zeek
thirdSend
(
restaurantId
,
dataBean
,
trafficType
,
2
,
listener
)
}
}
}
2
->
{
BtnBuilder
.
printBtn
->
{
//lalamove
//打印
thirdSend
(
restaurantId
,
dataBean
,
trafficType
,
2
,
listener
)
printOrder
(
PrintCode
,
dataBean
,
listener
)
}
BtnBuilder
.
ProductionCompletedBtn
->
{
//製作完成
repository
.
gsUpdateOrderStatus
(
dataBean
.
ID
,
3
,
dataBean
.
order_type
,
1
,
""
,
""
,
""
,
"0"
,
""
,
1
,
0
).
apply
{
listener
.
invoke
(
getMsgBean
(
ProductionComplete
,
errorMsg
,
code
==
"1"
))
}
}
}
}
}
},
{
},
{
...
@@ -334,6 +313,39 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -334,6 +313,39 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
/**
* 判斷是否需要修改交通工具
*/
fun
getIsUpdateTransportation
(
dataBean
:
OrderDetails
.
DataBean
,
restaurantId
:
Int
,
listener
:
(
List
<
TransportationBean
.
DataX
.
Transportation
>?)
->
Unit
)
{
launch
({
val
data
=
getTransportationConfig
(
restaurantId
)
if
(
data
.
success
)
{
data
.
data
?.
list
?.
let
{
for
(
value
in
it
)
{
if
(
value
.
status
==
1
)
{
//默認交通工具,判斷價格是不是在這個金額範圍內,如果在,則不提示,如果不在,提示用戶修改交通工具
if
(
dataBean
.
PRICE
>
value
.
amountUnder
&&
dataBean
.
PRICE
<
value
.
amountOn
)
{
//價格在範圍內
listener
.
invoke
(
listOf
(
value
))
}
else
{
//價格不在默認交通工具範圍內,回到activity中彈出彈窗,讓用戶選擇交通工具
listener
.
invoke
(
it
)
}
return
@launch
}
}
//如果執行到這一步,可能是沒有默認交通工具
listener
.
invoke
(
it
)
return
@launch
}
}
listener
.
invoke
(
null
)
},
{
listener
.
invoke
(
null
)
})
}
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
({
val
payMultiple
=
ArrayList
<
OrderDetails
.
DataBean
.
PayMultiple
>()
val
payMultiple
=
ArrayList
<
OrderDetails
.
DataBean
.
PayMultiple
>()
...
@@ -383,23 +395,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -383,23 +395,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
})
}
}
fun
converToJson
(
vararg
pair
:
Pair
<
String
,
String
>):
String
{
val
array
=
JSONArray
()
array
.
apply
{
pair
.
forEach
{
val
obj
=
JSONObject
()
obj
.
put
(
it
.
first
,
it
.
second
)
put
(
obj
)
}
}
return
array
.
toString
()
}
/**
/**
* 修改訂單狀態並打印
* 修改訂單狀態並打印
,狀態為0,1,2才打印
*/
*/
private
fun
updateOrderAndPrint
(
restaurantId
:
String
,
dataBean
:
OrderDetails
.
DataBean
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
fun
updateOrderAndPrint
(
restaurantId
:
Int
,
dataBean
:
OrderDetails
.
DataBean
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
launch
({
launch
({
repository
.
gsUpdateOrderStatus
(
dataBean
.
ID
,
status
,
dataBean
.
order_type
,
1
,
""
,
""
,
""
,
"0"
,
""
,
1
,
0
).
apply
{
repository
.
gsUpdateOrderStatus
(
dataBean
.
ID
,
status
,
dataBean
.
order_type
,
1
,
""
,
""
,
""
,
"0"
,
""
,
1
,
0
).
apply
{
if
(
status
==
0
||
status
==
1
||
status
==
2
)
{
if
(
status
==
0
||
status
==
1
||
status
==
2
)
{
...
@@ -429,7 +428,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -429,7 +428,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
launch
({
launch
({
//添加PRJ
//添加PRJ
//單獨包起來,哪怕這接口報錯也不要影響到正常的邏輯
//單獨包起來,哪怕這接口報錯也不要影響到正常的邏輯
repository
.
addPrj
(
dataBean
.
Order_ID
.
toString
(),
restaurantId
,
ids
.
toString
())
repository
.
addPrj
(
dataBean
.
Order_ID
.
toString
(),
restaurantId
.
toString
()
,
ids
.
toString
())
GetInfoUpdateService
.
loginfo
.
append
(
"添加PRJ:orderId:"
+
dataBean
.
Order_ID
.
toString
()
+
"restaurantId:"
+
restaurantId
+
"orderDetailsIds:"
+
ids
.
toString
())
GetInfoUpdateService
.
loginfo
.
append
(
"添加PRJ:orderId:"
+
dataBean
.
Order_ID
.
toString
()
+
"restaurantId:"
+
restaurantId
+
"orderDetailsIds:"
+
ids
.
toString
())
GetInfoUpdateService
.
loginfo
.
append
(
"\n"
)
GetInfoUpdateService
.
loginfo
.
append
(
"\n"
)
},
{
},
{
...
@@ -457,6 +456,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -457,6 +456,8 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
OkHttp3Utils
.
noticePersonnel
(
AppConstans
.
RP_UPDATE_ORDER_STATE_ERROR
,
"修改訂單狀態未成功:$errorMsg"
)
OkHttp3Utils
.
noticePersonnel
(
AppConstans
.
RP_UPDATE_ORDER_STATE_ERROR
,
"修改訂單狀態未成功:$errorMsg"
)
listener
.
invoke
(
getMsgBean
(
OrderDelivery
,
errorMsg
,
false
))
listener
.
invoke
(
getMsgBean
(
OrderDelivery
,
errorMsg
,
false
))
}
}
}
else
if
(
status
==
3
)
{
listener
.
invoke
(
getMsgBean
(
ProductionComplete
,
errorMsg
,
code
==
"1"
))
}
}
}
}
},
{
},
{
...
@@ -466,9 +467,17 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -466,9 +467,17 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
/**
/**
* 獲取交通工具配置
*/
private
suspend
fun
getTransportationConfig
(
restaurantId
:
Int
)
=
withContext
(
Dispatchers
.
IO
)
{
repository
.
getTransportationConfig
(
restaurantId
.
toString
())
}
/**
* 打印訂單
* 打印訂單
*/
*/
private
fun
printOrder
(
code
:
Int
,
dataBean
:
OrderDetails
.
DataBean
,
listener
:
(
MessageBean
)
->
Unit
)
{
fun
printOrder
(
code
:
Int
,
dataBean
:
OrderDetails
.
DataBean
,
listener
:
(
MessageBean
)
->
Unit
)
{
//訂單信息和廚房單,打印前需要修改dataBean的order_type和orderPayType
//訂單信息和廚房單,打印前需要修改dataBean的order_type和orderPayType
MyOrderManage
.
setDataBean
(
dataBean
)
MyOrderManage
.
setDataBean
(
dataBean
)
CC
.
obtainBuilder
(
"Component.Print"
)
CC
.
obtainBuilder
(
"Component.Print"
)
...
@@ -520,7 +529,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -520,7 +529,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
/**
* 第三方派送
* 第三方派送
*/
*/
private
fun
thirdSend
(
restaurantId
:
String
,
dataBean
:
OrderDetails
.
DataBean
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
private
fun
thirdSend
(
restaurantId
:
Int
,
dataBean
:
OrderDetails
.
DataBean
,
trafficType
:
String
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
val
third
=
ThirdItem
()
val
third
=
ThirdItem
()
//將食品數據轉為第三方需要的數據
//將食品數據轉為第三方需要的數據
dataBean
.
PRODUCT_NAME
?.
let
{
dataBean
.
PRODUCT_NAME
?.
let
{
...
@@ -535,12 +544,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -535,12 +544,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
}
}
//調用第三方物流接口
//調用第三方物流接口
callThird
(
dataBean
,
third
,
restaurantId
,
status
,
listener
)
callThird
(
dataBean
,
t
rafficType
,
t
hird
,
restaurantId
,
status
,
listener
)
}
}
private
fun
callThird
(
dataBean
:
OrderDetails
.
DataBean
,
t
hird
:
ThirdItem
,
restaurantId
:
String
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
private
fun
callThird
(
dataBean
:
OrderDetails
.
DataBean
,
t
rafficType
:
String
,
third
:
ThirdItem
,
restaurantId
:
Int
,
status
:
Int
,
listener
:
(
MessageBean
)
->
Unit
)
{
launch
({
launch
({
repository
.
thirdDelivery
(
dataBean
.
ID
.
toString
(),
third
).
apply
{
repository
.
thirdDelivery
(
dataBean
.
ID
.
toString
(),
t
rafficType
,
t
hird
).
apply
{
if
(
success
)
{
if
(
success
)
{
updateOrderAndPrint
(
restaurantId
,
dataBean
,
status
,
listener
)
updateOrderAndPrint
(
restaurantId
,
dataBean
,
status
,
listener
)
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
errMsg
))
{
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
errMsg
))
{
...
@@ -564,7 +573,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -564,7 +573,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//已經指派第三方物流,就調用修改訂單狀態接口
//已經指派第三方物流,就調用修改訂單狀態接口
updateOrderAndPrint
(
restaurantId
,
dataBean
,
status
,
listener
)
updateOrderAndPrint
(
restaurantId
,
dataBean
,
status
,
listener
)
}
else
{
}
else
{
callThird
(
dataBean
,
third
,
restaurantId
,
status
,
listener
)
callThird
(
dataBean
,
t
rafficType
,
t
hird
,
restaurantId
,
status
,
listener
)
}
}
}
}
}
else
{
}
else
{
...
@@ -596,7 +605,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -596,7 +605,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
val
recycler
=
hepler
.
getView
<
RecyclerView
>(
R
.
id
.
rv_delivery
)
val
recycler
=
hepler
.
getView
<
RecyclerView
>(
R
.
id
.
rv_delivery
)
recycler
.
layoutManager
=
GridLayoutManager
(
context
,
4
)
recycler
.
layoutManager
=
GridLayoutManager
(
context
,
4
)
val
deliveryAdapter
=
DeliveryAdapter
(
deliveryBean
!!
.
data
)
val
data
=
ArrayList
<
String
>()
for
(
value
in
deliveryBean
!!
.
data
)
{
data
.
add
(
value
.
userName
)
}
val
deliveryAdapter
=
DeliveryAdapter
(
data
)
recycler
.
adapter
=
deliveryAdapter
recycler
.
adapter
=
deliveryAdapter
deliveryAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
deliveryAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
...
@@ -666,7 +680,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -666,7 +680,11 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
cancelReasons
.
add
(
data
)
cancelReasons
.
add
(
data
)
}
}
val
deliveryAdapter
=
DeliveryAdapter
(
cancelReasons
)
val
data
=
ArrayList
<
String
>()
for
(
value
in
cancelReasons
)
{
data
.
add
(
value
.
userName
)
}
val
deliveryAdapter
=
DeliveryAdapter
(
data
)
recycler
.
adapter
=
deliveryAdapter
recycler
.
adapter
=
deliveryAdapter
deliveryAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
deliveryAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
...
@@ -720,9 +738,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
...
@@ -720,9 +738,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
/**
/**
* 取消物流
* 取消物流
*/
*/
fun
cancelLogistics
(
shopId
:
String
,
orderId
:
String
,
reasonId
:
String
,
reasonDesc
:
String
,
listener
:
(
String
)
->
Unit
)
{
fun
cancelLogistics
(
restaurantId
:
Int
,
orderId
:
String
,
reasonId
:
String
,
reasonDesc
:
String
,
listener
:
(
String
)
->
Unit
)
{
launch
({
launch
({
repository
.
cancelLogistics
(
shopId
,
orderId
,
reasonId
,
reasonDesc
).
apply
{
repository
.
cancelLogistics
(
restaurantId
.
toString
()
,
orderId
,
reasonId
,
reasonDesc
).
apply
{
if
(
success
)
{
if
(
success
)
{
listener
.
invoke
(
"已取消物流"
)
listener
.
invoke
(
"已取消物流"
)
}
else
{
}
else
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/service/GetInfoUpdateService.kt
View file @
ea7060d3
...
@@ -214,13 +214,11 @@ class GetInfoUpdateService : Service() {
...
@@ -214,13 +214,11 @@ class GetInfoUpdateService : Service() {
}
}
//-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
==
6
||
type
==
7
)
{
||
type
==
7
)
{
if
(
type
==
6
)
{
}
else
{
//播放提示音
//播放提示音
initSoundPool
(
R
.
raw
.
newordervocal
)
initSoundPool
(
R
.
raw
.
newordervocal
)
}
}
else
if
(
type
==
8
)
{
initSoundPool
(
R
.
raw
.
raw_logistics_cancel
)
}
}
//收到服务器端传过来的消息text
//收到服务器端传过来的消息text
Log
.
e
(
TAG
,
"onMessage:"
+
text
!!
)
Log
.
e
(
TAG
,
"onMessage:"
+
text
!!
)
...
@@ -280,7 +278,7 @@ class GetInfoUpdateService : Service() {
...
@@ -280,7 +278,7 @@ class GetInfoUpdateService : Service() {
private
var
lastSoundTime
:
Long
=
0L
private
var
lastSoundTime
:
Long
=
0L
fun
initSoundPool
(
resId
:
Int
)
{
fun
initSoundPool
(
resId
:
Int
)
{
val
nowTime
=
System
.
currentTimeMillis
()
//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
val
nowTime
=
System
.
currentTimeMillis
()
//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
if
(
resId
==
R
.
raw
.
newordervocal
)
{
//
if (resId == R.raw.newordervocal) {
if
(
nowTime
-
lastSoundTime
>
5000
)
{
if
(
nowTime
-
lastSoundTime
>
5000
)
{
Log
.
e
(
"eee"
,
"間隔時間"
+
(
nowTime
-
lastSoundTime
))
Log
.
e
(
"eee"
,
"間隔時間"
+
(
nowTime
-
lastSoundTime
))
putTimeLog
(
"現在時間:$nowTime 上次播放時間:$lastSoundTime"
)
putTimeLog
(
"現在時間:$nowTime 上次播放時間:$lastSoundTime"
)
...
@@ -288,15 +286,15 @@ class GetInfoUpdateService : Service() {
...
@@ -288,15 +286,15 @@ class GetInfoUpdateService : Service() {
lastSoundTime
=
nowTime
lastSoundTime
=
nowTime
OtherOrderUtils
.
initSoundPool
(
this
,
resId
)
OtherOrderUtils
.
initSoundPool
(
this
,
resId
)
}
}
}
else
{
//
} 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"
+
System
.
currentTimeMillis
()
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
)
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OrderDetailsActivity.kt
View file @
ea7060d3
...
@@ -2,7 +2,6 @@ package com.gingersoft.gsa.other_order_mode.ui.activity
...
@@ -2,7 +2,6 @@ package com.gingersoft.gsa.other_order_mode.ui.activity
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.View
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.DataBindingUtil
...
@@ -10,8 +9,7 @@ import androidx.lifecycle.Observer
...
@@ -10,8 +9,7 @@ import androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.ViewModelProvider
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.chad.library.adapter.base.BaseQuickAdapter
import
androidx.recyclerview.widget.RecyclerView
import
com.chad.library.adapter.base.listener.OnItemClickListener
import
com.ethanhua.skeleton.Skeleton
import
com.ethanhua.skeleton.Skeleton
import
com.ethanhua.skeleton.ViewSkeletonScreen
import
com.ethanhua.skeleton.ViewSkeletonScreen
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
...
@@ -21,18 +19,18 @@ import com.gingersoft.gsa.cloud.print.bean.OrderDetails
...
@@ -21,18 +19,18 @@ 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.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.BtnBuilder
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
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.Closing
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.DeliveryPrint
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.OrderDelivery
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.OrderDelivery
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.PrintCode
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.PrintCode
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.ProductionComplete
import
com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryAdapter
import
com.gingersoft.gsa.other_order_mode.model.viewModel.PageViewModel.Companion.SendCode
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.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.showWaringDialog
import
com.gingersoft.gsa.other_order_mode.util.showWaringDialog
import
com.qmuiteam.qmui.widget.QMUITopBar
import
com.qmuiteam.qmui.widget.QMUITopBar
import
kotlinx.android.synthetic.main.activity_order_details.*
import
kotlinx.android.synthetic.main.activity_order_details.*
...
@@ -48,6 +46,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -48,6 +46,7 @@ class OrderDetailsActivity : BaseActivity() {
private
var
isRead
:
Int
=
-
1
private
var
isRead
:
Int
=
-
1
private
var
state
:
Int
=
-
1
private
var
state
:
Int
=
-
1
lateinit
var
skeletonScreen
:
ViewSkeletonScreen
lateinit
var
skeletonScreen
:
ViewSkeletonScreen
var
restaurantId
:
Int
=
-
1
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
...
@@ -61,7 +60,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -61,7 +60,7 @@ class OrderDetailsActivity : BaseActivity() {
.
angle
(
20
)
.
angle
(
20
)
.
color
(
R
.
color
.
white
)
.
color
(
R
.
color
.
white
)
.
show
()
.
show
()
restaurantId
=
GsaCloudApplication
.
getRestaurantId
(
this
)
orderId
=
intent
.
getStringExtra
(
"orderId"
)
//訂單id
orderId
=
intent
.
getStringExtra
(
"orderId"
)
//訂單id
orderType
=
intent
.
getIntExtra
(
"orderType"
,
0
)
//訂單類型
orderType
=
intent
.
getIntExtra
(
"orderType"
,
0
)
//訂單類型
orderPayType
=
intent
.
getIntExtra
(
"orderPayType"
,
0
)
//訂單支付方式
orderPayType
=
intent
.
getIntExtra
(
"orderPayType"
,
0
)
//訂單支付方式
...
@@ -86,7 +85,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -86,7 +85,7 @@ class OrderDetailsActivity : BaseActivity() {
}
}
private
fun
PageViewModel
.
getOrderDetails
(
orderId
:
String
,
binding
:
ActivityOrderDetailsBinding
)
{
private
fun
PageViewModel
.
getOrderDetails
(
orderId
:
String
,
binding
:
ActivityOrderDetailsBinding
)
{
orderDetails
.
observe
(
this
@OrderDetailsActivity
,
Observer
{
orderDetails
.
observe
(
this
@OrderDetailsActivity
,
Observer
{
it
->
skeletonScreen
.
hide
()
//隱藏骨架屏
skeletonScreen
.
hide
()
//隱藏骨架屏
if
(
it
?.
data
!=
null
&&
it
.
data
!!
.
isNotEmpty
())
{
if
(
it
?.
data
!=
null
&&
it
.
data
!!
.
isNotEmpty
())
{
//初始化頁面佈局
//初始化頁面佈局
...
@@ -123,6 +122,9 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -123,6 +122,9 @@ class OrderDetailsActivity : BaseActivity() {
if
(
orderDetails
.
isDelete
==
0
)
{
if
(
orderDetails
.
isDelete
==
0
)
{
btnList
.
add
(
BtnBuilder
().
getLogisticsBtn
())
btnList
.
add
(
BtnBuilder
().
getLogisticsBtn
())
}
else
{
}
else
{
if
(
orderDetails
.
companyType
==
2
)
{
btnList
.
add
(
BtnBuilder
().
getTransportationBtn
())
}
btnList
.
add
(
BtnBuilder
().
getAssignDeliveryBtn
())
btnList
.
add
(
BtnBuilder
().
getAssignDeliveryBtn
())
}
}
tv_order_state
.
setTextColor
(
resources
.
getColor
(
R
.
color
.
order_state1_color
))
tv_order_state
.
setTextColor
(
resources
.
getColor
(
R
.
color
.
order_state1_color
))
...
@@ -137,7 +139,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -137,7 +139,7 @@ class OrderDetailsActivity : BaseActivity() {
//自取待取餐,有打印和結賬
//自取待取餐,有打印和結賬
orderStatusText
=
"待取餐"
orderStatusText
=
"待取餐"
btnList
.
add
(
BtnBuilder
().
getClosingBtn
())
btnList
.
add
(
BtnBuilder
().
getClosingBtn
())
tv_order_state
.
setTextColor
(
resources
.
getColor
(
R
.
color
.
order_state3_color
))
tv_order_state
.
setTextColor
(
ContextCompat
.
getColor
(
this
@OrderDetailsActivity
,
R
.
color
.
order_state3_color
))
}
else
{
}
else
{
// 外賣有打印
// 外賣有打印
// 如果是第三方物流,不顯示結賬
// 如果是第三方物流,不顯示結賬
...
@@ -185,6 +187,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -185,6 +187,7 @@ class OrderDetailsActivity : BaseActivity() {
val
orderBtnAdapter
=
OrderDetailsAdapter
(
btnList
)
val
orderBtnAdapter
=
OrderDetailsAdapter
(
btnList
)
rv_order_details_btn
.
adapter
=
orderBtnAdapter
rv_order_details_btn
.
adapter
=
orderBtnAdapter
//亂糟糟的代碼,該優化了
//--------------------------------------------------------------不同按鈕點擊事件----------------------------------------------------------------------------------------
//--------------------------------------------------------------不同按鈕點擊事件----------------------------------------------------------------------------------------
orderBtnAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
orderBtnAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
when
(
btnList
[
position
].
type
)
{
when
(
btnList
[
position
].
type
)
{
...
@@ -197,6 +200,12 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -197,6 +200,12 @@ class OrderDetailsActivity : BaseActivity() {
BtnBuilder
.
cancelBtn
->
BtnBuilder
.
cancelBtn
->
//取消訂單
//取消訂單
cancelOrder
(
orderDetails
)
cancelOrder
(
orderDetails
)
BtnBuilder
.
TransportationBtn
->
{
//lalamove重新選擇運輸工具
selectLalaMove
(
orderDetails
)
{
it
,
orderDetails
->
showSelectTransportation
(
it
,
orderDetails
)
}
}
BtnBuilder
.
closingBtn
->
{
BtnBuilder
.
closingBtn
->
{
//如果是在線支付的訂單,就直接修改訂單狀態
//如果是在線支付的訂單,就直接修改訂單狀態
if
(
orderPayType
!=
1
)
{
if
(
orderPayType
!=
1
)
{
...
@@ -212,98 +221,152 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -212,98 +221,152 @@ class OrderDetailsActivity : BaseActivity() {
intent
.
putExtra
(
"orderDetails"
,
orderDetails
)
intent
.
putExtra
(
"orderDetails"
,
orderDetails
)
startActivityForResult
(
intent
,
1001
)
startActivityForResult
(
intent
,
1001
)
}
}
}
else
->
{
showLoading
()
updateOrderStatusByBtn
(
btnList
[
position
].
type
,
orderDetails
,
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
())
{
msg
->
cancelDialogForLoading
()
when
(
msg
.
code
)
{
DeliveryPrint
.
toString
()
->
{
//訂單已確認,是否打印成功
finish
()
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
msg
.
success
)
{
"打印成功"
}
else
{
"打印失敗"
})
}
}
PrintCode
.
toString
()
->
{
BtnBuilder
.
sureBtn
->
{
// ToastUtils.show(this@OrderDetailsActivity, if (msg.success) {
//確認訂單,判斷是本店還是zeek或是lalamove
// "打印成功"
when
(
orderDetails
.
companyType
)
{
// } else
{
0
,
1
->
{
// "打印失敗"
//本店配送和zeek
// }
)
confirmOrder
(
orderDetails
)
}
}
SendCode
.
toString
()
->
{
2
->
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
msg
.
success
)
{
//lalamove
"已成功指派"
selectLalaMove
(
orderDetails
)
{
it
,
orderDetails
->
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
msg
.
errorMsg
))
{
showIsUpdateTransportation
(
it
,
orderDetails
)
msg
.
errorMsg
}
else
{
"指派送貨失敗"
})
if
(
msg
.
success
)
{
finish
()
}
}
}
}
OrderDelivery
.
toString
()
->
{
//已確認訂單,重新刷新當前頁面
if
(
msg
.
success
)
{
finish
()
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"訂單已確認"
)
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
msg
.
errorMsg
))
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
msg
.
errorMsg
)
}
else
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"訂單確認失敗"
)
}
}
// getOrderDetails(orderId, binding)
}
}
Closing
.
toString
()
->
{
BtnBuilder
.
printBtn
->
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
msg
.
success
)
{
//打印
"結賬成功"
printOrder
(
PrintCode
,
orderDetails
)
{}
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
msg
.
errorMsg
))
{
msg
.
errorMsg
}
else
{
"結賬失敗"
})
}
}
ProductionComplete
.
toString
()
->
{
BtnBuilder
.
ProductionCompletedBtn
->
{
if
(
msg
.
success
)
{
//製作完成
updateOrderAndPrint
(
restaurantId
,
orderDetails
,
3
)
{
if
(
it
.
success
)
{
finish
()
finish
()
}
}
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
msg
.
success
)
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
it
.
success
)
{
"製作完成"
"製作完成"
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
msg
.
errorMsg
))
{
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
it
.
errorMsg
))
{
msg
.
errorMsg
it
.
errorMsg
}
else
{
}
else
{
"修改訂單狀態失敗"
"修改訂單狀態失敗"
})
})
// getOrderDetails(orderId, binding)
}
}
}
else
->
{
else
->
{
showLoading
()
confirmOrder
(
orderDetails
)
}
}
}
}
else
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"獲取訂單詳情失敗"
)
finish
()
}
})
getShipanyAndOrderInfo
(
restaurantId
,
orderId
)
}
private
fun
PageViewModel
.
selectLalaMove
(
orderDetails
:
OrderDetails
.
DataBean
,
black
:
(
it
:
List
<
TransportationBean
.
DataX
.
Transportation
>,
orderDetails
:
OrderDetails
.
DataBean
)
->
Unit
)
{
showLoading
()
getIsUpdateTransportation
(
orderDetails
,
restaurantId
)
{
cancelDialogForLoading
()
cancelDialogForLoading
()
// ToastUtils.show(this@OrderDetailsActivity, "修改訂單狀態失敗")
when
{
it
==
null
->
{
//沒有交通工具
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"未獲取到交通工具"
)
}
}
it
.
size
==
1
->
{
//如果只有一個交通工具,就選這個
confirmOrder
(
orderDetails
,
it
[
0
].
type
.
toString
())
}
else
->
{
//否則彈窗讓用戶手動選擇
black
(
it
,
orderDetails
)
}
}
}
}
}
}
}
}
private
fun
PageViewModel
.
showIsUpdateTransportation
(
it
:
List
<
TransportationBean
.
DataX
.
Transportation
>,
orderDetails
:
OrderDetails
.
DataBean
)
{
showWaringDialog
(
"金額範圍和對應的運輸工具不符,是否修改運輸工具"
,
{
dialog
->
//要修改運輸工具,彈出彈窗讓用戶選擇
showSelectTransportation
(
it
,
orderDetails
)
dialog
.
dismiss
()
},
{
dialog
->
//不修改運輸工具,使用默認的
for
(
value
in
it
)
{
if
(
value
.
status
==
1
)
{
confirmOrder
(
orderDetails
,
value
.
type
.
toString
())
break
}
}
}
dialog
.
dismiss
()
})
}
private
fun
PageViewModel
.
showSelectTransportation
(
it
:
List
<
TransportationBean
.
DataX
.
Transportation
>,
orderDetails
:
OrderDetails
.
DataBean
)
{
val
data
=
ArrayList
<
String
>()
for
(
value
in
it
)
{
data
.
add
(
when
(
value
.
type
)
{
1
->
"摩托車($"
+
value
.
amountUnder
+
"-$"
+
value
.
amountOn
+
")"
2
->
"麵包車($"
+
value
.
amountUnder
+
"-$"
+
value
.
amountOn
+
")"
3
->
"卡車($"
+
value
.
amountUnder
+
"-$"
+
value
.
amountOn
+
")"
else
->
"($"
+
value
.
amountUnder
+
"-$"
+
value
.
amountOn
+
")"
})
}
val
adapter
=
DeliveryAdapter
(
data
)
showSelectDialog
(
"選擇運輸工具"
,
2
,
adapter
as
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>,
{
dialog
->
if
(
adapter
.
selectIndex
==
-
1
)
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"請選擇交通工具"
)
}
else
{
}
else
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"獲取訂單詳情失敗"
)
confirmOrder
(
orderDetails
,
it
[
adapter
.
selectIndex
].
type
.
toString
())
finish
()
}
}
},
{
it
.
dismiss
()
})
})
getShipanyAndOrderInfo
(
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
(),
orderId
)
}
}
private
fun
PageViewModel
.
confirmOrder
(
orderDetails
:
OrderDetails
.
DataBean
,
trafficType
:
String
=
""
)
{
showLoading
()
confirmOrder
(
orderDetails
,
trafficType
,
restaurantId
)
{
msg
->
cancelDialogForLoading
()
when
(
msg
.
code
)
{
DeliveryPrint
.
toString
()
->
{
//訂單已確認,是否打印成功
finish
()
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
if
(
msg
.
success
)
{
"打印成功"
}
else
{
"打印失敗"
})
}
OrderDelivery
.
toString
()
->
{
//已確認訂單,重新刷新當前頁面
if
(
msg
.
success
)
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"訂單已確認"
)
}
else
if
(!
TextUtil
.
isEmptyOrNullOrUndefined
(
msg
.
errorMsg
))
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
msg
.
errorMsg
)
}
else
{
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
"訂單確認失敗"
)
}
finish
()
}
else
->
{
cancelDialogForLoading
()
}
}
}
}
/**
/**
* 取消訂單,獲取取消原因
* 取消訂單,獲取取消原因
*/
*/
private
fun
PageViewModel
.
cancelOrder
(
orderDetails
:
OrderDetails
.
DataBean
)
{
private
fun
PageViewModel
.
cancelOrder
(
orderDetails
:
OrderDetails
.
DataBean
)
{
//獲取取消原因讓用戶選擇
//獲取取消原因讓用戶選擇
showLoading
()
showLoading
()
getCancelReason
(
GsaCloudApplication
.
getBrandId
(
this
@OrderDetailsActivity
),
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
)
,
3
)
{
cancelReson
->
getCancelReason
(
GsaCloudApplication
.
getBrandId
(
this
@OrderDetailsActivity
),
restaurantId
,
3
)
{
cancelReson
->
cancelDialogForLoading
()
cancelDialogForLoading
()
if
(
cancelReson
!=
null
&&
cancelReson
.
data
.
isNotEmpty
())
{
if
(
cancelReson
!=
null
&&
cancelReson
.
data
.
isNotEmpty
())
{
//如果有配置取消原因
//如果有配置取消原因
...
@@ -327,7 +390,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -327,7 +390,7 @@ class OrderDetailsActivity : BaseActivity() {
showLoading
()
showLoading
()
if
(
orderDetails
.
isDelete
==
0
)
{
if
(
orderDetails
.
isDelete
==
0
)
{
//是第三方物流單,先取消物流,再取消訂單
//是第三方物流單,先取消物流,再取消訂單
cancelLogistics
(
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
()
,
orderId
,
reasonId
,
reasonDesc
)
{
cancelLogistics
(
restaurantId
,
orderId
,
reasonId
,
reasonDesc
)
{
cancelOrder
(
GsaCloudApplication
.
getMemberId
(
this
@OrderDetailsActivity
).
toString
(),
GsaCloudApplication
.
getMemberName
(
this
@OrderDetailsActivity
),
orderId
,
reasonId
,
reasonDesc
)
{
cancelOrder
(
GsaCloudApplication
.
getMemberId
(
this
@OrderDetailsActivity
).
toString
(),
GsaCloudApplication
.
getMemberName
(
this
@OrderDetailsActivity
),
orderId
,
reasonId
,
reasonDesc
)
{
cancelDialogForLoading
()
cancelDialogForLoading
()
if
(
it
)
{
if
(
it
)
{
...
@@ -361,7 +424,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -361,7 +424,7 @@ class OrderDetailsActivity : BaseActivity() {
private
fun
PageViewModel
.
cancelLogistics
(
orderDetails
:
OrderDetails
.
DataBean
)
{
private
fun
PageViewModel
.
cancelLogistics
(
orderDetails
:
OrderDetails
.
DataBean
)
{
//獲取取消原因讓用戶選擇
//獲取取消原因讓用戶選擇
showLoading
()
showLoading
()
getCancelReason
(
GsaCloudApplication
.
getBrandId
(
this
@OrderDetailsActivity
),
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
)
,
2
)
{
cancelReson
->
getCancelReason
(
GsaCloudApplication
.
getBrandId
(
this
@OrderDetailsActivity
),
restaurantId
,
2
)
{
cancelReson
->
cancelDialogForLoading
()
cancelDialogForLoading
()
if
(
cancelReson
!=
null
&&
cancelReson
.
data
.
isNotEmpty
())
{
if
(
cancelReson
!=
null
&&
cancelReson
.
data
.
isNotEmpty
())
{
//如果有配置取消原因
//如果有配置取消原因
...
@@ -385,7 +448,7 @@ class OrderDetailsActivity : BaseActivity() {
...
@@ -385,7 +448,7 @@ class OrderDetailsActivity : BaseActivity() {
R
.
id
.
tv_dialog_confirm
->
{
R
.
id
.
tv_dialog_confirm
->
{
dialog
.
dismiss
()
dialog
.
dismiss
()
showLoading
()
showLoading
()
cancelLogistics
(
GsaCloudApplication
.
getRestaurantId
(
this
@OrderDetailsActivity
).
toString
()
,
orderId
,
reasonId
,
reasonDesc
)
{
cancelLogistics
(
restaurantId
,
orderId
,
reasonId
,
reasonDesc
)
{
cancelDialogForLoading
()
cancelDialogForLoading
()
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
it
)
ToastUtils
.
show
(
this
@OrderDetailsActivity
,
it
)
finish
()
finish
()
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/activity/OtherOrderActivity.kt
View file @
ea7060d3
...
@@ -309,7 +309,6 @@ class OtherOrderActivity : BaseActivity() {
...
@@ -309,7 +309,6 @@ class OtherOrderActivity : BaseActivity() {
}
}
})
})
bind
?.
execute
{
bind
?.
execute
{
Log
.
e
(
"eee"
,
"執行"
+
it
)
if
(
it
)
{
if
(
it
)
{
ivDisconnectView
.
visibility
=
View
.
VISIBLE
ivDisconnectView
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
...
...
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/DeliveryAdapter.kt
View file @
ea7060d3
package
com.gingersoft.gsa.other_order_mode.ui.adapter
package
com.gingersoft.gsa.other_order_mode.ui.adapter
import
androidx.core.content.ContextCompat
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.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.R
import
com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryBean
class
DeliveryAdapter
(
data
:
MutableList
<
DeliveryBean
.
Data
>)
:
BaseQuickAdapter
<
DeliveryBean
.
Data
,
BaseViewHolder
>(
R
.
layout
.
other_order_delivery_item
,
data
)
{
class
DeliveryAdapter
(
data
:
MutableList
<
String
>)
:
BaseQuickAdapter
<
String
,
BaseViewHolder
>(
R
.
layout
.
other_order_delivery_item
,
data
)
{
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
DeliveryBean
.
Data
)
{
holder
.
setText
(
R
.
id
.
tv_delivery_name
,
item
.
userName
)
init
{
setOnItemClickListener
{
adapter
,
view
,
position
->
selectIndex
=
position
adapter
.
notifyDataSetChanged
()
}
}
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
String
)
{
holder
.
setText
(
R
.
id
.
tv_delivery_name
,
item
)
if
(
holder
.
adapterPosition
==
selectIndex
)
{
if
(
holder
.
adapterPosition
==
selectIndex
)
{
holder
.
setBackgroundResource
(
R
.
id
.
layout_delivery_item
,
R
.
drawable
.
shape_delivery_item_btn
)
holder
.
setBackgroundResource
(
R
.
id
.
layout_delivery_item
,
R
.
drawable
.
shape_delivery_item_btn
)
holder
.
setTextColor
(
R
.
id
.
tv_delivery_name
,
context
.
resources
.
getColor
(
R
.
color
.
order_state0_color
))
holder
.
setTextColor
(
R
.
id
.
tv_delivery_name
,
ContextCompat
.
getColor
(
context
,
R
.
color
.
order_state0_color
))
}
else
{
}
else
{
holder
.
setBackgroundResource
(
R
.
id
.
layout_delivery_item
,
R
.
drawable
.
shape_delivery_item_btn_normal
)
holder
.
setBackgroundResource
(
R
.
id
.
layout_delivery_item
,
R
.
drawable
.
shape_delivery_item_btn_normal
)
holder
.
setTextColor
(
R
.
id
.
tv_delivery_name
,
context
.
resources
.
getColor
(
R
.
color
.
color_c8
))
holder
.
setTextColor
(
R
.
id
.
tv_delivery_name
,
ContextCompat
.
getColor
(
context
,
R
.
color
.
color_c8
))
}
}
}
}
var
selectIndex
=
-
1
var
selectIndex
=
-
1
}
}
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/ui/adapter/OtherOrdersAdapter.kt
View file @
ea7060d3
...
@@ -35,7 +35,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -35,7 +35,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
return
ViewHolder
(
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
layout_
other
_order_item
,
parent
,
false
))
return
ViewHolder
(
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
layout_
delivery
_order_item
,
parent
,
false
))
}
}
...
@@ -65,10 +65,6 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -65,10 +65,6 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
val
bg
=
GradientDrawable
()
val
bg
=
GradientDrawable
()
bg
.
cornerRadius
=
dp2px
(
5f
).
toFloat
()
bg
.
cornerRadius
=
dp2px
(
5f
).
toFloat
()
holder
.
flBorder
.
visibility
=
View
.
GONE
//隱藏邊框
holder
.
flBorder
.
visibility
=
View
.
GONE
//隱藏邊框
when
{
data
.
STATUS
==
0
->
{
state
=
"待確認"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
//執行動畫
//執行動畫
if
(
data
.
isRead
==
0
)
{
if
(
data
.
isRead
==
0
)
{
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
...
@@ -77,19 +73,15 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -77,19 +73,15 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
holder
.
flBorder
.
visibility
=
View
.
GONE
holder
.
flBorder
.
visibility
=
View
.
GONE
holder
.
flBorder
.
clearAnimation
()
holder
.
flBorder
.
clearAnimation
()
}
}
when
{
data
.
STATUS
==
0
->
{
state
=
"待確認"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
}
}
data
.
STATUS
==
1
->
{
data
.
STATUS
==
1
->
{
state
=
"待確認"
state
=
"待確認"
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
bg
.
setColor
(
getColor
(
R
.
color
.
order_state0_color
))
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
//執行動畫
if
(
data
.
isRead
==
0
)
{
holder
.
flBorder
.
visibility
=
View
.
VISIBLE
//顯示邊框
alphaAnimator
(
holder
.
flBorder
)
}
else
{
holder
.
flBorder
.
visibility
=
View
.
GONE
holder
.
flBorder
.
clearAnimation
()
}
}
}
data
.
STATUS
==
2
->
{
data
.
STATUS
==
2
->
{
state
=
"製作中"
state
=
"製作中"
...
@@ -183,7 +175,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
...
@@ -183,7 +175,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
}
}
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
var
binding
:
Layout
Other
OrderItemBinding
=
DataBindingUtil
.
bind
(
itemView
)
!!
var
binding
:
Layout
Delivery
OrderItemBinding
=
DataBindingUtil
.
bind
(
itemView
)
!!
var
flBorder
:
FrameLayout
=
itemView
.
findViewById
(
R
.
id
.
fl_border
)
var
flBorder
:
FrameLayout
=
itemView
.
findViewById
(
R
.
id
.
fl_border
)
}
}
}
}
\ No newline at end of file
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/util/ViewUtil.kt
View file @
ea7060d3
...
@@ -29,8 +29,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel:
...
@@ -29,8 +29,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel:
}
}
}
}
fun
Activity
.
showSelectDialog
(
title
:
String
,
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
,
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
)
...
...
other_order_mode/src/main/res/raw/raw_logistics_cancel.mp3
0 → 100644
View file @
ea7060d3
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment