package com.future.dispatch.ui.order.change_order
|
|
import com.example.oktrip.netUtls.callNet
|
import com.future.dispatch.R
|
import com.future.dispatch.base.BaseEvent
|
import com.future.dispatch.base.MyBaseActivity
|
import com.future.dispatch.bean.ReassignDetailBean
|
import com.future.dispatch.netUtls.Api
|
import com.future.dispatch.utils.clickDelay
|
import com.future.dispatch.utils.getMapByAny
|
import com.future.dispatch.utils.gone
|
import com.future.dispatch.utils.visible
|
import kotlinx.android.synthetic.main.activity_right_away.*
|
import org.jetbrains.anko.startActivity
|
import org.jetbrains.anko.toast
|
|
/**
|
* @ClassName RightAwayActivity
|
* @Description 立即处理
|
* @Author Administrator
|
* @Date 2020/10/9 14:56
|
* @Version 1.0
|
*/
|
class RightAwayActivity: MyBaseActivity() {
|
|
val id by lazy {
|
intent.getStringExtra("id")
|
}
|
|
val type by lazy {
|
intent.getStringExtra("type")
|
}
|
|
override fun setContentView() {
|
setContentView(R.layout.activity_right_away)
|
}
|
|
override fun initView() {
|
ll_ressign_people.gone()
|
ll_ressign_new.gone()
|
if (type == "2"){
|
ll_bottom.gone()
|
setTitleText("改派详情")
|
}else{
|
ll_bottom.visible()
|
setTitleText("立即处理")
|
}
|
callDetail()
|
}
|
|
private fun callDetail() {
|
var map = getMapByAny()
|
map["id"] = id
|
callNet(Api.queryReassignInfo,map){
|
var bean = gson.fromJson<ReassignDetailBean>(it,ReassignDetailBean::class.java)
|
tv_time.text = bean.data.applyTime
|
tv_driver.text = bean.data.applyDriver
|
tv_reason.text = bean.data.reason
|
tv_in_order_name.text = bean.data.user
|
tv_to_time.text = bean.data.travelTime
|
tv_start_address.text = bean.data.startAddress
|
tv_end_address.text = bean.data.endAddress
|
tv_statue.text = getStateStr(bean.data.state)
|
tv_ressign_statue.text = getStatue(bean.data.status)
|
tv_ressign_people.text = bean.data.reviewer
|
tv_ressign_new.text = bean.data.nowDriver
|
if (bean.data.status == 3){
|
ll_ressign_people.visible()
|
ll_ressign_new.visible()
|
}
|
if (bean.data.status in 1..2){
|
ll_bottom.visible()
|
}else{
|
ll_bottom.gone()
|
}
|
tv_ressign_new_type.text = getOrderType(bean.data.orderType)
|
}
|
}
|
|
private fun getStatue(status: Int): String {
|
when(status){
|
1 -> return "提交申请"
|
2 -> return "已支付"
|
3 -> return "已改派"
|
4 -> return "已取消"
|
5 -> return "已拒绝"
|
}
|
return ""
|
}
|
|
private fun getOrderType(orderType: Int): String {
|
when(orderType){
|
1 -> {
|
return "专车订单"
|
}
|
2 -> {
|
return "出租车订单"
|
}
|
3 -> {
|
return "跨城订单"
|
}
|
4 -> {
|
return "同城小件订单"
|
}
|
5 -> {
|
return "跨城小件订单"
|
}
|
7 -> {
|
return "接送机/站订单"
|
}
|
}
|
return ""
|
}
|
|
|
fun getStateStr(state:Int): String? {
|
when (state) {
|
1 -> return "待接单"
|
2, 3, 4, 5, 12 -> return "司机已接单"
|
6, 7, 8, 9 -> return "已完成"
|
10 -> return "已取消"
|
11 -> return "改派中"
|
}
|
return ""
|
}
|
|
override fun setOnclick() {
|
|
tv_now_change.clickDelay {
|
startActivity<ChangeNowActivity>("reassignId" to id)
|
}
|
|
tv_cancel.clickDelay {
|
cancelOrder()
|
}
|
|
tv_none.clickDelay {
|
noneRessage()
|
}
|
}
|
|
private fun noneRessage() {
|
var map = getMapByAny()
|
map["id"] = id
|
callNet(Api.refuseReassign,map){
|
toast("拒绝成功")
|
callDetail()
|
}
|
}
|
|
private fun cancelOrder() {
|
var map = getMapByAny()
|
map["id"] = id
|
callNet(Api.cancelReassign,map){
|
toast("取消成功")
|
callDetail()
|
}
|
}
|
|
override fun onEventMainThread(event: BaseEvent?) {
|
super.onEventMainThread(event)
|
when(event!!.code){
|
BaseEvent.FILTER_CHANGE_ORDER -> {
|
finish()
|
}
|
}
|
}
|
}
|