| | |
| | | import com.xianning.driver.base.BaseEvent |
| | | import com.xianning.driver.bean.AgreeBean |
| | | import com.xianning.driver.bean.AlipayBean |
| | | import com.xianning.driver.bean.AlipayBean2 |
| | | import com.xianning.driver.bean.OrderBean |
| | | import com.xianning.driver.netUtls.Api |
| | | import com.xianning.driver.netUtls.callNet |
| | |
| | | intent.getStringExtra("orderType") |
| | | } |
| | | |
| | | val money by lazy { |
| | | intent.getStringExtra("money") |
| | | } |
| | | |
| | | val orderId by lazy { |
| | | intent.getStringExtra("orderId") |
| | | } |
| | | |
| | | val driverId by lazy { |
| | | intent.getStringExtra("driverId") |
| | | } |
| | | |
| | | val adapter by lazy { |
| | |
| | | } |
| | | |
| | | override fun initView() { |
| | | setTitleText("取消订单") |
| | | // tv_Right.text = "改派说明" |
| | | setTitleText("改派订单") |
| | | tv_Right.text = "改派说明" |
| | | tv_ask.text = "您为什么改派行程?" |
| | | if (orderType == "4" || orderType == "5"){ |
| | | adapter.array.removeAt(0) |
| | | adapter.array.add(0,"客户原因") |
| | |
| | | override fun setOnclick() { |
| | | tv_commit.setOnClickListener { |
| | | if (adapter.selectPosition == -1) { |
| | | toast("请选择取消原因") |
| | | toast("请选择改派原因") |
| | | return@setOnClickListener |
| | | } |
| | | if (adapter.selectPosition != -1 && adapter.array[adapter.selectPosition] == "其他" && et_content.getContent().isNullOrEmpty()){ |
| | | toast("请输入详细描述") |
| | | return@setOnClickListener |
| | | } |
| | | showPat() |
| | | if (!money.isNullOrEmpty()) { |
| | | // showPatTypeDialog() |
| | | showPat("3") |
| | | |
| | | } else { |
| | | showPat("") |
| | | } |
| | | } |
| | | tv_Right.clickDelay { |
| | | callHtml { |
| | | BaseWebActivity.to(mContext,it,"改派说明","1") |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun callHtml(click: (s: String) -> Unit) { |
| | | var map = getMapByAny() |
| | | map["type"] = 10 |
| | | callNet(Api.queryByType, map) { |
| | | var data = gson.fromJson<AgreeBean>(it, AgreeBean::class.java) |
| | | click(data.data.content) |
| | | } |
| | | } |
| | | |
| | | private fun callGp(payType: String) { |
| | | var map = getMapByAny() |
| | | if (!driverId.isNullOrEmpty()) |
| | | map["newDriverId"] = driverId |
| | | map["orderIds"] = orderId |
| | | map["reason"] = adapter.array[adapter.selectPosition] |
| | | if (!et_content.getContent().isNullOrEmpty()){ |
| | | map["remark"] = et_content.getContent() |
| | | } |
| | | if (!money.isNullOrEmpty()) { |
| | | map["payType"] = payType |
| | | map["money"] = money |
| | | } |
| | | callNet(Api.reassignOrderCrossCityReassign,map){ |
| | | if (payType == "2") { |
| | | var data = gson.fromJson<AlipayBean2>(it, AlipayBean2::class.java) |
| | | payV2(data.data.orderString) |
| | | } |
| | | if (payType == "1"){ |
| | | var data = gson.fromJson<AlipayBean2>(it, AlipayBean2::class.java) |
| | | WXPayEntryActivity.to(this,1,data.data) |
| | | } |
| | | if (payType == "3" || payType.isEmpty()) { |
| | | toast("改派申请已提交") |
| | | EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString())) |
| | | finish() |
| | | } |
| | | } |
| | | } |
| | | |
| | | private fun showPat() { |
| | | private fun showPat(payType: String) { |
| | | if (orderType == "3"){ |
| | | callGp(payType) |
| | | return |
| | | } |
| | | var map = getMapByAny() |
| | | map["orderId"] = orderId |
| | | map["orderType"] = orderType |
| | |
| | | if (!et_content.getContent().isNullOrEmpty()){ |
| | | map["remark"] = et_content.getContent() |
| | | } |
| | | callNet(Api.addCancelOrder, map) { |
| | | toast("订单已取消") |
| | | EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString())) |
| | | finish() |
| | | if (!money.isNullOrEmpty()) { |
| | | map["payType"] = payType |
| | | map["money"] = money |
| | | } |
| | | callNet(Api.reassign, map) { |
| | | if (payType == "2") { |
| | | var data = gson.fromJson<AlipayBean2>(it, AlipayBean2::class.java) |
| | | payV2(data.data.orderString) |
| | | } |
| | | if (payType == "1"){ |
| | | var data = gson.fromJson<AlipayBean2>(it, AlipayBean2::class.java) |
| | | WXPayEntryActivity.to(this,1,data.data) |
| | | } |
| | | if (payType == "3" || payType.isEmpty()) { |
| | | toast("改派申请已提交") |
| | | EventBus.getDefault().post(BaseEvent(BaseEvent.REAGASSIGN_SUCCESS,orderId!!.toString(),orderId!!.toString())) |
| | | finish() |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | private fun showPatTypeDialog() { |
| | | var pop = DialogUtil.getPopupwindow(this, R.layout.pop_pay) |
| | | pop.showDown(window.decorView) |
| | | pop.contentView.btn_money.clickDelay { |
| | | showPat("3") |
| | | pop.dismiss() |
| | | } |
| | | pop.contentView.button_cancel.clickDelay { |
| | | pop.dismiss() |
| | | } |
| | | |
| | | pop.contentView.btn_album.clickDelay { |
| | | showPat("1") |
| | | } |
| | | |
| | | pop.contentView.btn_alipay.clickDelay { |
| | | showPat("2") |
| | | pop.dismiss() |
| | | } |
| | | } |
| | | |