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
4c931510
Commit
4c931510
authored
Jul 17, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c1d4845a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
104 deletions
+4
-104
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
+4
-104
No files found.
other_order_mode/src/main/java/com/gingersoft/gsa/other_order_mode/model/viewModel/PageViewModel.kt
View file @
4c931510
...
...
@@ -6,6 +6,7 @@ import android.util.Log
import
android.view.Gravity
import
android.view.WindowManager
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
...
...
@@ -337,107 +338,6 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
/**
* 待確認--- 確認之後狀態變為 製作中,按鈕顯示:自取:製作完成,外賣:指派送貨----自取的狀態為待取餐,按鈕為結賬,外賣的狀態為派送中,按鈕顯示結賬
* 更新訂單信息,自取或是外賣
* status 0,1待確認
* 2 已確認,外賣是指派送單,自取是製作完成
*/
fun
updateOrderStatus
(
context
:
Context
,
data
:
OrderList
.
DataBeanX
.
DataBean
,
orderDetails
:
OrderDetails
,
listener
:
(
Boolean
)
->
Unit
)
{
// launch({
// val status = when (data.STATUS) {//如果以前的狀態是0,則修改為2。。。。
// 0 -> 2
// 1 -> 2
// 2 -> 3
// 3 -> 4
// else -> 0
// }
// val isPush = when (status) {
// 2 -> 2
// 3 -> 1
// 4 -> 0
// else -> 2
// }
//// if (data.order_type == 2) {
// // 是外賣
// if (status == 3) {
// //指派送貨,自取是製作完成
// if (data.order_type == 2) {
// if (orderDetails.data!![0].isDelete != 0) {
// if (deliveryBean != null && deliveryBean!!.data.isNotEmpty()) {
// selectorDelivery(listener, context, data, status, isPush)
// } else {
// ToastUtils.show(context, "沒有送貨員信息")
// }
// } else {
// //第三方的單,執行重印功能
// printOrder(orderDetails, data, context, listener)
// }
// } else {
// //自取
// repository.gsUpdateOrderStatus(data.Id.toString(), status, data.order_type, 1, "", "", "", "0", "", 1, 0).apply {
// listener.invoke(code == "1")
// }
// }
// } else if (status == 4) {
// //結賬,彈窗確認是否結賬
// if (orderDetails.data!![0].isDelete == 0) {
// //第三方物流單,沒有結賬,重印
// printOrder(orderDetails, data, context, listener)
// } else {
// object : DialogUtils(context, R.layout.other_order_pause_orders) {
// override fun initLayout(hepler: ViewHepler, dialog: Dialog) {
// hepler.setText(R.id.tv_warning_title, "是否確認結賬?")
// hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener {
// dialog.dismiss()
// launch({
// // updateOrderStatus(data.Id.toString(), "", status, "", "", isPush, data.order_type).apply {
//// listener.invoke(success)
//// }
// repository.gsUpdateOrderStatus(data.Id.toString(), status, data.order_type, 3, "", "", "", "0", "", 1, 0).apply {
// listener.invoke(code == "1")
// }
// }, {
//
// })
// }
// hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
// dialog.dismiss()
// listener.invoke(false)
// }
// }
// }.createDialogView().show()
// }
// } else {
// showLoading(context)
// // 確認訂單
// var third = false
// if (deliveryConfig != null) {
// for (i in 0 until deliveryConfig!!.data.list.size) {
// if (deliveryConfig!!.data.list[i].distributionType == data.deliveryMode) {
// third = deliveryConfig!!.data.list[i].type == 1
// break
// }
// }
// }
// if (third) {
// // 如果是第三方物流,調用第三方接口
// thirdSend(data, orderDetails, status, context, listener)
// } else {
// updateOrderAndPrint(data, status, context, listener)
// }
// }
//// } else {
//// // 自取的確認訂單
//// repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply {
//// listener.invoke(success)
//// }
//// }
// }, {
//
// })
}
/**
* 修改訂單狀態並打印
*/
private
suspend
fun
updateOrderAndPrint
(
restaurantId
:
String
,
dataBean
:
OrderDetails
.
DataBean
,
status
:
Int
,
listener
:
(
Int
,
Boolean
)
->
Unit
)
{
...
...
@@ -468,7 +368,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
launch
({
//單獨包起來,哪怕這接口報錯也不要影響到正常的邏輯
repository
.
addPrj
(
dataBean
.
Order_ID
.
toString
(),
restaurantId
,
ids
.
toString
()
,
GsaCloudApplication
.
getMemberId
(
GsaCloudApplication
.
getAppContext
()).
toString
()
)
repository
.
addPrj
(
dataBean
.
Order_ID
.
toString
(),
restaurantId
,
ids
.
toString
())
GetInfoUpdateService
.
loginfo
.
append
(
"添加PRJ:orderId:"
+
dataBean
.
Order_ID
.
toString
()
+
"restaurantId:"
+
restaurantId
+
"orderDetailsIds:"
+
ids
.
toString
())
GetInfoUpdateService
.
loginfo
.
append
(
"\n"
)
},
{
...
...
@@ -609,7 +509,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
deliveryAdapter
.
selectIndex
=
position
adapter
.
notifyDataSetChanged
()
confirmBtn
.
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
shape_green_btn
)
confirmBtn
.
background
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
shape_green_btn
)
}
confirmBtn
.
setOnClickListener
{
...
...
@@ -678,7 +578,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
deliveryAdapter
.
selectIndex
=
position
adapter
.
notifyDataSetChanged
()
confirmBtn
.
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
shape_green_btn
)
confirmBtn
.
background
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
shape_green_btn
)
}
confirmBtn
.
setOnClickListener
{
...
...
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