lmw
2023-06-16 03972ad1d3ce6ffe0be0395c0a4d5dcb4474031f
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.kuanzhai.user.ui.mine
 
import android.app.Activity
import android.text.Editable
import android.text.TextWatcher
import cn.sinata.xldutils.clickDelay
import cn.sinata.xldutils.gone
import cn.sinata.xldutils.utils.myToast
import cn.sinata.xldutils.visible
import com.kuanzhai.user.R
import com.kuanzhai.user.dialog.RefuseDialog
import com.kuanzhai.user.interfaces.StringCallback
import com.kuanzhai.user.network.HttpManager
import com.kuanzhai.user.network.request
import com.kuanzhai.user.ui.TransparentStatusBarActivity
import kotlinx.android.synthetic.main.activity_order_check_detail.*
 
class OrderCheckDetailActivity:TransparentStatusBarActivity() {
    override fun setContentView() = R.layout.activity_order_check_detail
 
    private val id by lazy { intent.getStringExtra("id") }
 
    override fun initClick() {
        tv_refuse.clickDelay {
            val reason = et_content.text.toString()
            if (reason.isEmpty()){
                myToast("请输入拒绝原因")
            }else
                HttpManager.approveOrder(id,2,reason).request(this) { _, _ ->
                    myToast("操作成功")
                    setResult(Activity.RESULT_OK)
                    finish()
                }
        }
        tv_action.clickDelay {
            HttpManager.approveOrder(id,1,null).request(this) { _, _ ->
                myToast("操作成功")
                setResult(Activity.RESULT_OK)
                finish()
            }
        }
    }
 
    override fun initView() {
        et_content.addTextChangedListener(object :TextWatcher{
            override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
 
            }
 
            override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
            }
 
            override fun afterTextChanged(s: Editable?) {
                tv_limit.text = "${s?.length?:0}/50"
            }
        })
        showDialog()
        getDetail()
    }
 
    private fun getDetail(){
        HttpManager.approveOrderDetail(id).request(this){_,data->
            data?.apply {
                tv_start.text = startAddress
                tv_end.text = endAddress
                tv_pay_way.text = if (calType == 1) "单程计费" else "包车计费"
                tv_passenger.text = "${peopleNum}\n${peopleItems.filter { it.name.isNotEmpty() }.joinToString ("\n"){ "${it.name} ${it.phone}" }}"
                tv_reason.text = reasonTypeNames
                tv_pay_type.text = if (payWay == 1) "自费" else "企业支付"
                tv_car.text = serverCardName
                when (auditStatus){
                    1->{
                        et_content.isEnabled = false
                        tv_refuse.gone()
                        tv_action.gone()
                        tv_result.visible()
                        tv_result.text = "审核通过"
                    }
                    2->{
                        gp_refuse.visible()
                        et_content.isEnabled = false
                        tv_refuse.gone()
                        tv_action.gone()
                        tv_result.visible()
                        tv_result.text = "审核拒绝"
                        et_content.setText(auditRemark)
                    }
                    else->{
                        gp_refuse.visible()
                        tv_refuse.visible()
                        tv_action.visible()
                    }
                }
            }
        }
    }
}