Commit f598e606 by Wyh Committed by 宁斌

6.05 自取製作完成

parent 7db7fc6d
......@@ -320,8 +320,10 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
else -> 2
}
// if (data.order_type == 2) {
// 是外賣
if (status == 3) {
// 是外賣
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)
......@@ -332,54 +334,60 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//第三方的單,執行重印功能
printOrder(orderDetails, data, context, listener)
}
} 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 {
} 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")
}
}, {
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
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, 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 {
// // 自取的確認訂單
// repository.updateSelfOrderStatus(data.Id.toString(), status.toString(), GsaCloudApplication.getRestaurantId(context).toString()).apply {
......@@ -599,12 +607,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
fun getCancelReason(restaurantId: String, type: String){
fun getCancelReason(restaurantId: String, type: String) {
launch({
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