8.6
liugl
2020-08-06 3f55faa0a1298bc2320d1e749f0b08b25b85d671
app/src/main/java/com/okgoincar/slab/SlabTripActivity.kt
@@ -1,5 +1,6 @@
package com.okgoincar.slab
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Handler
@@ -43,12 +44,48 @@
import kotlinx.android.synthetic.main.dialog_select_pay_type.view.*
import kotlinx.android.synthetic.main.dialog_sure_and_del_slab.view.*
import kotlinx.android.synthetic.main.item_map_market.view.*
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
import java.util.concurrent.TimeUnit
class SlabTripActivity : MySlabBaseActivity() {
    private fun callOver(contexts: Context, travelFee:Double){
        if (MyApplication.currentOrderId.isEmpty()){
            cn.sinata.xldutils.utils.toast("没有进行中的订单,无法结束")
            return
        }
        var map = getMapByAny()
        map["orderId"] = MyApplication.currentOrderId
        map["orderType"] = MyApplication.currentOrderType
        map["travelFee"] = travelFee
        map["lat"] = MyApplication.getLocation().latitude
        map["lon"] = MyApplication.getLocation().longitude
        map["type"] = 1
        callNet(contexts,Api.confirmFees_,map){
            EventBus.getDefault().post(BaseEvent(BaseEvent.SURE_MONEY))
        }
    }
    private fun callStatue(contexts: Context, i: Int) {
        if (MyApplication.currentOrderId.isEmpty()){
            cn.sinata.xldutils.utils.toast("没有进行中的订单,无法开始")
            return
        }
        var map = getMapByAny()
        map["orderId"] = MyApplication.currentOrderId
        map["orderType"] = MyApplication.currentOrderType
        map["state"] = i
        map["lat"] = MyApplication.getLocation().latitude
        map["lon"] = MyApplication.getLocation().longitude
        callNet(contexts, Api.process, map) {
            EventBus.getDefault().post(BaseEvent(BaseEvent.UP_TRIP))
        }
    }
    /***
     * //    流程操作状态(3=开始出发预约点,4=到达预约点,5=开始服务,6=服务结束)
@@ -179,7 +216,17 @@
        }
    }
    private fun onclick() {
        btn_start.clickDelay {
            callStatue(this,5)
        }
        btn_end.clickDelay {
            callOver(this,10.0)
        }
        tv_change.clickDelay {
          changeMode()
        }
@@ -650,7 +697,7 @@
            }
            BaseEvent.SURE_MONEY -> {
                startActivity<SlabOrderOverActivity>("orderId" to orderBean.data.orderId.toString() , "orderType" to orderBean.data.type.toString())
                startActivity<SlabOrderOverActivity>("orderId" to orderBean.data.orderId.toString() , "orderType" to "2")
                finish()
            }
        }