Commit f598e606 by Wyh Committed by 宁斌

6.05 自取製作完成

parent 7db7fc6d
...@@ -320,8 +320,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -320,8 +320,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
else -> 2 else -> 2
} }
// if (data.order_type == 2) { // if (data.order_type == 2) {
// 是外賣 // 是外賣
if (status == 3) { if (status == 3) {
//指派送貨,自取是製作完成
if (data.order_type == 2) {
if (orderDetails.data!![0].isDelete != 0) { if (orderDetails.data!![0].isDelete != 0) {
if (deliveryBean != null && deliveryBean!!.data.isNotEmpty()) { if (deliveryBean != null && deliveryBean!!.data.isNotEmpty()) {
selectorDelivery(listener, context, data, status, isPush) selectorDelivery(listener, context, data, status, isPush)
...@@ -332,54 +334,60 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -332,54 +334,60 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//第三方的單,執行重印功能 //第三方的單,執行重印功能
printOrder(orderDetails, data, context, listener) printOrder(orderDetails, data, context, listener)
} }
} else if (status == 4) { } else {
//結賬,彈窗確認是否結賬 //自取
if (orderDetails.data!![0].isDelete == 0) { repository.gsUpdateOrderStatus(data.Id.toString(), status, data.order_type, 1, "", "", "", "0", "", 1, 0).apply {
//第三方物流單,沒有結賬,重印 listener.invoke(code == "1")
printOrder(orderDetails, data, context, listener) }
} else { }
object : DialogUtils(context, R.layout.other_order_pause_orders) { } else if (status == 4) {
override fun initLayout(hepler: ViewHepler, dialog: Dialog) { //結賬,彈窗確認是否結賬
hepler.setText(R.id.tv_warning_title, "是否確認結賬?") if (orderDetails.data!![0].isDelete == 0) {
hepler.getView<TextView>(R.id.tv_dialog_confirm).setOnClickListener { //第三方物流單,沒有結賬,重印
dialog.dismiss() printOrder(orderDetails, data, context, listener)
launch({ } else {
// updateOrderStatus(data.Id.toString(), "", status, "", "", isPush, data.order_type).apply { 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) // listener.invoke(success)
// } // }
repository.gsUpdateOrderStatus(data.Id.toString(), status, data.order_type, 3, "", "", "", "0", "", 1, 0).apply { repository.gsUpdateOrderStatus(data.Id.toString(), status, data.order_type, 3, "", "", "", "0", "", 1, 0).apply {
listener.invoke(code == "1") listener.invoke(code == "1")
} }
}, { }, {
}) })
}
hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
dialog.dismiss()
listener.invoke(false)
}
} }
}.createDialogView().show() hepler.getView<TextView>(R.id.tv_dialog_cancel).setOnClickListener {
} dialog.dismiss()
} else { listener.invoke(false)
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
} }
} }
}.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, isPush, data.order_type, context, listener)
} else {
updateOrderAndPrint(data, status, isPush, orderDetails, context, listener)
}
} }
if (third) {
// 如果是第三方物流,調用第三方接口
thirdSend(data, orderDetails, status, isPush, data.order_type, context, listener)
} else {
updateOrderAndPrint(data, status, isPush, orderDetails, context, listener)
}
}
// } else { // } else {
// // 自取的確認訂單 // // 自取的確認訂單
// repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply { // repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply {
...@@ -599,12 +607,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -599,12 +607,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
fun getCancelReason(restaurantId: String, type: String){ fun getCancelReason(restaurantId: String, type: String) {
launch({ launch({
repository.getCancelReason(restaurantId, type).apply { repository.getCancelReason(restaurantId, type).apply {
} }
},{ }, {
}) })
} }
......
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