lmw
2023-05-27 ff365ff4346d220edf2ec1d0041f2284befe3870
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.fanghua.driver.ui.main
 
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.sinata.xldutils.utils.clickDelay
import cn.sinata.xldutils.utils.getContent
import com.google.gson.Gson
import com.kuaiyun.emanagercar.ui.base.BaseWebActivity
import com.fanghua.driver.R
import com.fanghua.driver.base.BaseAlipayActivity
import com.fanghua.driver.base.BaseEvent
import com.fanghua.driver.bean.*
import com.fanghua.driver.netUtls.Api
import com.fanghua.driver.netUtls.callNet
import com.fanghua.driver.netUtls.getMapByAny
import com.fanghua.driver.ui.DialogUtil
import com.fanghua.driver.ui.adapter.ReassignAdapter
import com.fanghua.driver.wxapi.WXPayEntryActivity
import kotlinx.android.synthetic.main.activity_reassign.*
import kotlinx.android.synthetic.main.pop_pay.view.*
import org.greenrobot.eventbus.EventBus
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
 
class ReassignActivity : BaseAlipayActivity() {
 
    val orderId by lazy {
        intent.getStringExtra("orderId")
    }
 
    val adapter by lazy {
        ReassignAdapter()
    }
 
    override fun setContentView() {
        setContentView(R.layout.activity_reassign)
    }
 
    override fun initView() {
        setTitleText("转单")
        recycler_view.layoutManager = LinearLayoutManager(this) as RecyclerView.LayoutManager?
        recycler_view.adapter = adapter
        adapter.setOnItemClickListener { view, position ->
            adapter.selectPosition = position
            adapter.notifyDataSetChanged()
        }
 
    }
 
    override fun setOnclick() {
        tv_commit.setOnClickListener {
            if (adapter.selectPosition == -1) {
                toast("请选择改派原因")
                return@setOnClickListener
            }
            if (adapter.selectPosition != -1 && adapter.array[adapter.selectPosition] == "其他" && et_content.getContent().isNullOrEmpty()){
                toast("请输入详细描述")
                return@setOnClickListener
            }
            callGp()
        }
    }
 
 
 
    private fun callGp() {
        var map = getMapByAny()
        map["orderId"] = orderId
        val s = adapter.array[adapter.selectPosition]
        map["cause"] = if (s == "其他") et_content.getContent() else s
        callNet(Api.reassign,map){
            val bean = Gson().fromJson(it, BaseBean::class.java)
            if (bean.resultUtil.code == 10000){
                toast("转单已提交")
                startActivity<MainActivity>()
            }else
                toast(bean.resultUtil.msg)
        }
    }
    }