package com.future.dispatch.ui.order
|
|
import com.example.oktrip.netUtls.callNet
|
import com.example.oktrip.netUtls.getMapByAny
|
import com.future.dispatch.R
|
import com.future.dispatch.base.MyBaseActivity
|
import com.future.dispatch.bean.OrderDetailBean
|
import com.future.dispatch.netUtls.Api
|
import com.future.dispatch.utils.clickDelay
|
import com.future.dispatch.utils.doubleTwo
|
import com.future.dispatch.utils.gone
|
import com.future.dispatch.utils.visible
|
import kotlinx.android.synthetic.main.activity_city_detail.*
|
import org.jetbrains.anko.startActivity
|
|
/***
|
* 专车详情
|
*/
|
class CityDetailActivity: MyBaseActivity() {
|
|
|
val orderId by lazy {
|
intent.getStringExtra("orderId")
|
}
|
|
|
override fun setContentView() {
|
setContentView(R.layout.activity_city_detail)
|
}
|
|
override fun initView() {
|
setTitleText("待结单-以出发-已取消")
|
tv_cancel.gone()
|
ll_line.gone()
|
callOrder()
|
}
|
|
private fun callOrder() {
|
var map = getMapByAny()
|
map["orderId"] = orderId
|
map["orderType"] = 2
|
callNet(Api.queryOrderInfo,map){
|
var bean = gson.fromJson<OrderDetailBean>(it,OrderDetailBean::class.java)
|
bean.data?.let { itBean ->
|
setTitleText(getStateStr(itBean.state))
|
tv_time.text = itBean.orderTime
|
tv_order_number.text = itBean.orderNumber
|
tv_order_by_to.text = itBean.orderSourceStr
|
tv_trevel_time.text = itBean.travelTime
|
tv_order_name.text = itBean.user
|
tv_order_car_people.text = itBean.passengers
|
tv_order_type.text = if(itBean.travelType == 1) "拼车" else "包车"
|
tv_start.text = itBean.startAddress
|
tv_end.text = itBean.endAddress
|
tv_line.text = itBean.line
|
tv_people_num.text = itBean.peopleNumber.toString()+"人乘车"
|
tv_zw_num.text = getSeatStr(itBean.seatNumber)
|
tv_remark.text = itBean.remark
|
tv_money.text = "¥"+doubleTwo(itBean.orderMoney)
|
tv_order_car.text = itBean.driver
|
tv_order_car_in.text = itBean.car
|
tv_order_track.text = itBean.originalDriver
|
if (itBean.state in 1..4){
|
tv_cancel.visible()
|
}
|
if (itBean.state == 6 || itBean.state == 9){
|
ll_line.visible()
|
}
|
if (itBean.originalDriver.isEmpty()){
|
tv_order_track.gone()
|
}
|
}
|
}
|
}
|
|
private fun getSeatStr(seatNumber: String): String? {
|
var str = ""
|
for (item in seatNumber.split(",")){
|
if (str.isEmpty()){
|
str = item+"号"
|
}else{
|
str = str+","+item+"号"
|
}
|
}
|
return str
|
}
|
|
|
override fun setOnclick() {
|
tv_cancel.clickDelay {
|
var map = getMapByAny()
|
map["orderId"] = orderId
|
map["orderType"] = 2
|
callNet(Api.cancelOrder,map){
|
onBackPressed()
|
}
|
}
|
|
ll_line.clickDelay {
|
startActivity<AMapLineActivity>("orderId" to orderId)
|
}
|
|
|
|
}
|
|
// 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 ""
|
// }
|
|
fun getStateStr(state:Int): String? {
|
return statueString[state]
|
}
|
|
var statueString = arrayListOf("","待接单","待出发","待到达预约地点","待乘客上车","服务中","已完成","待支付","待评价","评价完成","已取消","改派中","取消待支付")
|
|
}
|