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()
|
}
|
}
|
}
|
}
|
}
|
}
|