18034727885
2026-08-07 bbc64160643c4ed818eb574831dc303b0a979089
app/src/main/java/com/driver/igotrip/ui/main/ReassignActivity.kt
@@ -4,6 +4,7 @@
import android.widget.EditText
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.sinata.rxnetty.LogHelper
import cn.sinata.xldutils.utils.clickDelay
import cn.sinata.xldutils.utils.getContent
import com.driver.emanagercar.ui.base.BaseWebActivity
@@ -11,8 +12,8 @@
import com.driver.igotrip.base.BaseAlipayActivity
import com.driver.igotrip.base.BaseEvent
import com.driver.igotrip.bean.AgreeBean
import com.driver.igotrip.bean.StringBean
import com.driver.igotrip.bean.OrderBean
import com.driver.igotrip.bean.StringBean
import com.driver.igotrip.netUtls.Api
import com.driver.igotrip.netUtls.callNet
import com.driver.igotrip.netUtls.getMapByAny
@@ -57,9 +58,9 @@
        adapter.array.add(getString(R.string.car_problom))
        adapter.array.add(getString(R.string.ther))
        tv_Right.text = getString(R.string.改派说明)
        if (orderType == "4" || orderType == "5"){
        if (orderType == "4" || orderType == "5") {
            adapter.array.removeAt(0)
            adapter.array.add(0,getString(R.string.客户原因))
            adapter.array.add(0, getString(R.string.客户原因))
        }
        recycler_view.layoutManager = LinearLayoutManager(this) as RecyclerView.LayoutManager?
        recycler_view.adapter = adapter
@@ -76,7 +77,9 @@
                toast(getString(R.string.请选择改派原因))
                return@setOnClickListener
            }
            if (adapter.selectPosition != -1 && adapter.array[adapter.selectPosition] == getString(R.string.其他) && et_content.getContent().isNullOrEmpty()){
            if (adapter.selectPosition != -1 && adapter.array[adapter.selectPosition] == getString(R.string.其他) && et_content.getContent()
                    .isNullOrEmpty()
            ) {
                toast(getString(R.string.请输入详细描述))
                return@setOnClickListener
            }
@@ -89,13 +92,13 @@
        tv_Right.clickDelay {
            callHtml {
                BaseWebActivity.to(mContext,it,getString(R.string.改派说明),"1")
                BaseWebActivity.to(mContext, it, getString(R.string.改派说明), "1")
            }
        }
    }
    fun callHtml(click: (s: String) -> Unit) {
        var map = getMapByAny()
        val map = getMapByAny()
        map["type"] = 10
        callNet(Api.queryByType, map) {
            var data = gson.fromJson<AgreeBean>(it, AgreeBean::class.java)
@@ -104,7 +107,7 @@
    }
    private fun showPat(payType: String) {
        if (orderType == "3"){
        if (orderType == "3") {
            callGp(payType)
            return
        }
@@ -112,55 +115,63 @@
        map["orderId"] = orderId
        map["orderType"] = orderType
        map["reason"] = adapter.array[adapter.selectPosition]
        if (!et_content.getContent().isNullOrEmpty()){
        if (!et_content.getContent().isNullOrEmpty()) {
            map["remark"] = et_content.getContent()
        }
        if (!money.isNullOrEmpty()) {
            map["payType"] = payType
            map["money"] = money
        }
        callNet(Api.reassign, map) {
        callNet(Api.reassign, map, clickAction = {
            if (payType == "2") {
                var data = gson.fromJson<StringBean>(it, StringBean::class.java)
                LogHelper.logRecord("订单改派支付宝支付订单成功orderId:${orderId} orderType:${orderType} data:${it}")
                val data = gson.fromJson<StringBean>(it, StringBean::class.java)
                payV2(data.data)
            }
            if (payType == "1"){
            if (payType == "1") {
            }
            if (payType == "3" || payType.isEmpty()) {
                LogHelper.logRecord("订单改派余额支付成功申请已提交orderId:${orderId} orderType:${orderType}")
                toast(getString(R.string.改派申请已提交))
                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString()))
                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS, orderId, orderType))
                finish()
            }
        }
        }, clickActionError = { code, msg ->
            LogHelper.logRecord("订单改派创建支付订单失败orderId:${orderId} orderType:${orderType} code:${code} msg:${msg}")
        })
    }
    private fun callGp(payType: String) {
        var map = getMapByAny()
        map["orderIds"] = orderId
        map["reason"] = adapter.array[adapter.selectPosition]
        if (!et_content.getContent().isNullOrEmpty()){
        if (!et_content.getContent().isNullOrEmpty()) {
            map["remark"] = et_content.getContent()
        }
        if (!money.isNullOrEmpty()) {
            map["payType"] = payType
            map["money"] = money
        }
        callNet(Api.reassignOrderCrossCityReassign,map){
        callNet(Api.reassignOrderCrossCityReassign, map, clickAction = {
            if (payType == "2") {
                var data = gson.fromJson<StringBean>(it, StringBean::class.java)
                LogHelper.logRecord("订单改派支付宝支付订单成功orderId:${orderId} orderType:${orderType} data:${it}")
                val data = gson.fromJson<StringBean>(it, StringBean::class.java)
                payV2(data.data)
            }
            if (payType == "1"){
            if (payType == "1") {
            }
            if (payType == "3" || payType.isEmpty()) {
                LogHelper.logRecord("订单改派余额支付成功申请已提交orderId:${orderId} orderType:${orderType}")
                toast(getString(R.string.改派申请已提交))
                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString()))
                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS, orderId, orderType))
                finish()
            }
        }
        }, clickActionError = { code, msg ->
            LogHelper.logRecord("订单改派创建支付订单失败orderId:${orderId} orderType:${orderType} code:${code} msg:${msg}")
        })
    }
@@ -168,6 +179,7 @@
        var pop = DialogUtil.getPopupwindow(this, R.layout.pop_pay)
        pop.showDown(window.decorView)
        pop.contentView.find<View>(R.id.btn_money).clickDelay {
            LogHelper.logRecord("订单改派余额支付orderId:${orderId} orderType:${orderType}")
            showPat("3")
            pop.dismiss()
        }
@@ -177,19 +189,22 @@
        pop.contentView.find<View>(R.id.btn_album).clickDelay {
//            showPat("1")
            val content = RemarkData("改派原因啊","这个是备注",com.driver.igotrip.utils.Cache.CacheKey.getUserId())
            val path = "pages/appPay/appPay?orderId=$orderId&orderType=$orderType&type=3&content="+gson.toJson(content)+"&uid="+com.driver.igotrip.utils.Cache.CacheKey.getUserId()+"&userType=2"
            WXPayEntryActivity.toWx(this,intent,path)
            LogHelper.logRecord("订单改派跳转小程序支付orderId:${orderId} orderType:${orderType}")
            val content = RemarkData("改派原因啊", "这个是备注", com.driver.igotrip.utils.Cache.CacheKey.getUserId())
            val path =
                "pages/appPay/appPay?orderId=$orderId&orderType=$orderType&type=3&content=" + gson.toJson(content) + "&uid=" + com.driver.igotrip.utils.Cache.CacheKey.getUserId() + "&userType=2"
            WXPayEntryActivity.toWx(this, intent, path)
            pop.dismiss()
        }
        pop.contentView.find<View>(R.id.btn_alipay).clickDelay {
            LogHelper.logRecord("订单改派支付宝支付orderId:${orderId} orderType:${orderType}")
            showPat("2")
            pop.dismiss()
        }
    }
    public class RemarkData(reason:String,remark:String,uid:String){
    public class RemarkData(reason: String, remark: String, uid: String) {
        //        ="+"改派原因啊"+"&remark="+"这个是备注
        var reason = reason
        var remark = remark
@@ -199,39 +214,26 @@
    override fun aliPaySuccess() {
        super.aliPaySuccess()
        toast(getString(R.string.改派申请已提交))
        EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString()))
        EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS, orderId, orderType))
        finish()
    }
    override fun onResume() {
        super.onResume()
//        var map = getMapByAny()
//        map["orderId"] = orderId
//        map["orderType"] = orderType
//        callNet(Api.queryOrderInfo, map) {
//            var orderBean = gson.fromJson(it, OrderBean::class.java)
//            if(orderBean.data.orderState == 11){
//                toast(getString(R.string.改派申请已提交))
//                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS))
//                finish()
//            }
//        }
    }
    override fun onRestart() {
        super.onRestart()
        var map = getMapByAny()
        val map = getMapByAny()
        map["orderId"] = orderId
        map["orderType"] = orderType
        callNet(Api.queryOrderInfo, map) {
           var orderBean = gson.fromJson(it, OrderBean::class.java)
           if(orderBean.data.orderState == 11){
               toast(getString(R.string.改派申请已提交))
               EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString()))
               finish()
           }
        }
        callNet(Api.queryOrderInfo, map, clickAction = {
            val orderBean = gson.fromJson(it, OrderBean::class.java)
            LogHelper.logRecord("订单改派查询订单成功orderId:${orderId} orderType:${orderType} data:${it}")
            if (orderBean.data.orderState == 11) {
                toast(getString(R.string.改派申请已提交))
                LogHelper.logRecord("订单改派申请已提交成功orderId:${orderId} orderType:${orderType}")
                EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS, orderId, orderType))
                finish()
            }
        }, clickActionError = { code, msg ->
            LogHelper.logRecord("订单改派查询订单失败orderId:${orderId} orderType:${orderType} code:${code} msg:${msg}")
        })
    }
}