liugl
2021-01-14 40f9ac00ec5e4d6363450d1c8e0b0937cc0b1de4
app/src/main/java/com/okgoincar/slab/cargo/CargoActivity.kt
@@ -173,29 +173,36 @@
    }
    private fun addSockectCancel() {
        MyApplication.addOrderView(object : MyApplication.OrderStatueView {
            override fun orderInfo(data: OrderSimpleData?) {
                data?.let {
                    if (it.status == 10 || it.status == 11) {
                        Handler(Looper.getMainLooper()).post {
                            if (it.status == 10){
                                toast("用户已取消订单")
                                MyApplication.getTTsManager().setVideoText("用户已取消订单")
                            }else{
                                toast("用户已改派订单")
                                MyApplication.getTTsManager().setVideoText("用户已改派订单")
                            }
                            finish()
        MyApplication.addOrderView(orderView)
    }
    var orderView = object : MyApplication.OrderStatueView {
        override fun orderInfo(data: OrderSimpleData?) {
            data?.let {
                if (it.status == 10 || it.status == 11) {
                    Handler(Looper.getMainLooper()).post {
                        if (it.status == 10){
                            toast("用户已取消订单")
                            MyApplication.getTTsManager().setVideoText("用户已取消订单")
                        }else{
                            toast("用户已改派订单")
                            MyApplication.getTTsManager().setVideoText("用户已改派订单")
                        }
                        finish()
                    }
                    if (it.orderType == 4 || it.orderType == 5 && it.orderId.toString() == orderId) {
                        Handler(Looper.getMainLooper()).post {
                            initView()
                        }
                }
                if (it.orderType == 4 || it.orderType == 5 && it.orderId.toString() == orderId) {
                    Handler(Looper.getMainLooper()).post {
                        initView()
                    }
                }
            }
        })
        }
    }
    override fun finish() {
        MyApplication.removeOrderView(orderView)
        super.finish()
    }
    override fun onBackPressed() {
@@ -269,6 +276,10 @@
        }
        tv_gap_money.clickDelay {
            if (orderBean.data.orderState == 12){
                toast("用户已支付差价,不能修改")
                return@clickDelay
            }
            showGaoMoneyDialog()
        }
@@ -281,8 +292,11 @@
                        showStatueMapUI(it)
                    }
                    5, 6 -> {
                        it.data.orderState = 6
                        showChangeCargoDialog()
                        sendCode {
                            it.data.orderState = 6
                            showChangeCargoDialog()
                        }
                    }
                    12 -> {
                        it.data.orderState = 5
@@ -311,6 +325,13 @@
        }
    }
    private fun sendCode(function: () -> Unit) {
        var map = getMapByAny()
        map["orderId"] = orderId
        callNet(true,Api.sendVerificationCode, map) {
            function()
        }
    }
    private fun callNumberCargo(num: String, click: () -> Unit) {
@@ -543,7 +564,9 @@
                tv_red_money.gone()
            }
            tv_phone.text = orderBean.data.phone
//            tv_gap_money.text = "¥"+doubleTwo(num.toDouble())+"差价(点击修改)"
            if (!it.data.differenceMoney.isNullOrEmpty() && it.data.differenceMoney.toDouble() > 0){
                tv_gap_money.text = "¥"+doubleTwo(it.data.differenceMoney.toDouble())+"差价(点击修改)"
            }
            showStatueMapUI(it)
        }
    }