8.7
liugl
2020-08-07 386c12bc80d17252ea05b7bf1cb2e85db2e46767
app/src/main/java/com/okgoincar/slab/SlabTripActivity.kt
@@ -26,6 +26,7 @@
import com.okgoincar.base.AMapKit.initMap
import com.okgoincar.base.AMapKit.moveCamera
import com.okgoincar.base.BaseEvent
import com.okgoincar.base.MoneyBroadCastReceiver
import com.okgoincar.base.MyApplication
import com.okgoincar.base.gpsnav.GPSNaviActivity
import com.okgoincar.bean.OrderBean
@@ -47,43 +48,18 @@
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
import java.lang.Exception
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))
        }
        MoneyBroadCastReceiver.callOver(contexts, travelFee)
    }
    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))
        }
        MoneyBroadCastReceiver.callStatue(contexts, i)
    }
@@ -186,6 +162,7 @@
                    if (it.status == 10 || it.status == 12) {
                        Handler(Looper.getMainLooper()).post {
                            toast("用户已取消订单")
                            MyApplication.getTTsManager().setVideoText("用户已取消订单")
                            MyApplication.currentOrderType = ""
                            MyApplication.currentOrderId = ""
                            finish()
@@ -215,7 +192,6 @@
            tv_change.setBackgroundResource(R.drawable.bg_login)
        }
    }
    private fun onclick() {
@@ -697,9 +673,15 @@
            }
            BaseEvent.SURE_MONEY -> {
                startActivity<SlabOrderOverActivity>("orderId" to orderBean.data.orderId.toString() , "orderType" to "2")
                startActivity<SlabOrderOverActivity>(
                    "orderId" to orderBean.data.orderId.toString(),
                    "orderType" to "2"
                )
                finish()
            }
            BaseEvent.ERROR_INFO -> {
                onBackPressed()
            }
        }
    }
}