lmw
2023-05-12 f67802a41f9e01444d1115f34ecc6e1beb05fc3b
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
package com.fuban.user.ui.trip
 
import android.app.Activity
import android.widget.RadioButton
import androidx.core.os.bundleOf
import cn.sinata.xldutils.utils.myToast
import com.fuban.user.R
import com.fuban.user.network.HttpManager
import com.fuban.user.network.request
import com.fuban.user.ui.TransparentStatusBarActivity
import com.fuban.user.dialog.TipDialog
import kotlinx.android.synthetic.main.activity_complain.*
import org.jetbrains.anko.find
 
/**
 * 取消订单
 */
class ComplainActivity : TransparentStatusBarActivity() {
 
    override fun setContentView(): Int = R.layout.activity_complain
 
    override fun initClick() {
        rg.setOnCheckedChangeListener { group, checkedId ->
            reason = find<RadioButton>(checkedId).text.toString()
            if (checkedId == R.id.rb_8) {//其他理由
                reason = "其他"
            }
        }
 
        tv_action.setOnClickListener {
            if (reason.isEmpty()) {
                myToast("请选择投诉原因")
                return@setOnClickListener
            }
            if (rg.checkedRadioButtonId == R.id.rb_8) {
                val content = et_content.text.toString()
                if (content.isEmpty()) {
                    myToast("请输入详细描述")
                    return@setOnClickListener
                }
            }
            val tipDialog = TipDialog()
            tipDialog.arguments = bundleOf("msg" to "是否确认投诉该司机?","ok" to "确认投诉","cancel" to "取消")
            tipDialog.setCallback(object :TipDialog.OnClickCallback{
                override fun onOk() {
                    submit()
                }
 
                override fun onCancel() {
                }
            })
            tipDialog.show(supportFragmentManager,"complain")
        }
    }
 
    override fun initView() {
        title = "投诉"
    }
 
    private val id by lazy {
        intent.getIntExtra("id", 0)
    }
 
    private val orderId by lazy {
        intent.getIntExtra("orderId", 0)
    }
 
    private var reason = ""
 
 
    private fun submit() {
        showDialog()
        val content = et_content.text.toString()
        HttpManager.complaintService(id,content,reason).request(this){ _, _->
            setResult(Activity.RESULT_OK)
            val tipDialog = TipDialog()
            tipDialog.arguments = bundleOf("msg" to "我们已收到您的投诉,我们会尽快安排处理,感谢您的投诉与建议!","isAlert" to true,"ok" to "确定")
            tipDialog.setDismissCallback(object :TipDialog.OnDismiss{
                override fun onDismiss() {
                    finish()
                }
            })
            tipDialog.show(supportFragmentManager,"tip")
        }
    }
}