|
|
@@ -5,45 +5,77 @@ import com.yingyang.healthconsultation.databinding.ItemConsultationRecordBinding
|
|
|
import com.yingyang.healthconsultation.entity.Record
|
|
|
import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
|
|
|
import com.yingyangfly.baselib.db.DoctorBean
|
|
|
+import com.yingyangfly.baselib.ext.setOnSingleClickListener
|
|
|
import com.yingyangfly.baselib.ext.setTextColorResource
|
|
|
import com.yingyangfly.baselib.ext.show
|
|
|
+import com.yingyangfly.baselib.ext.timeFormat
|
|
|
|
|
|
/**
|
|
|
* 问诊记录adapter
|
|
|
*/
|
|
|
class ConsultationRecordAdapter(override val layoutId: Int = R.layout.item_consultation_record) :
|
|
|
BaseDataBindingAdapter<DoctorBean, ItemConsultationRecordBinding>() {
|
|
|
+
|
|
|
+ var onLeftClickListener: ((bean: DoctorBean) -> Unit)? = null
|
|
|
+
|
|
|
+
|
|
|
+ var onRightClickListener: ((bean: DoctorBean) -> Unit)? = null
|
|
|
+
|
|
|
override fun onBindViewHolder(
|
|
|
binding: ItemConsultationRecordBinding,
|
|
|
item: DoctorBean,
|
|
|
position: Int
|
|
|
) {
|
|
|
binding.data = item
|
|
|
+ binding.tvTime.text = timeFormat(item.createTime)
|
|
|
if (item.status.isNullOrEmpty().not()) {
|
|
|
when (item.status) {
|
|
|
"0" -> {
|
|
|
//0未支付
|
|
|
binding.btnEvaluate.show(true)
|
|
|
binding.btnRecord.show(true)
|
|
|
- binding.btnEvaluate.setBackgroundResource(R.drawable.bg_cancel_order)
|
|
|
+ binding.btnEvaluate.setBackgroundResource(R.drawable.bg_record_cancel_order)
|
|
|
binding.btnEvaluate.setTextColorResource(R.color.color_FFA5A5A5)
|
|
|
binding.btnEvaluate.text = "取消订单"
|
|
|
binding.btnRecord.text = "去支付"
|
|
|
}
|
|
|
"1" -> {
|
|
|
//1待接诊
|
|
|
+ binding.btnEvaluate.show(false)
|
|
|
+ binding.btnRecord.show(true)
|
|
|
+ binding.btnRecord.text = "待医生接诊"
|
|
|
}
|
|
|
"2" -> {
|
|
|
//2接诊中
|
|
|
+ binding.btnEvaluate.show(false)
|
|
|
+ binding.btnRecord.show(true)
|
|
|
+ binding.btnRecord.text = "联系医生"
|
|
|
}
|
|
|
"3" -> {
|
|
|
- //3已拒诊 4已完成
|
|
|
+ //3已拒诊
|
|
|
+ binding.btnEvaluate.show(false)
|
|
|
+ binding.btnRecord.show(true)
|
|
|
+ binding.btnRecord.text = "重新问诊"
|
|
|
}
|
|
|
"4" -> {
|
|
|
//4已完成
|
|
|
+ binding.btnEvaluate.show(true)
|
|
|
+ binding.btnRecord.show(true)
|
|
|
+ binding.btnEvaluate.setBackgroundResource(R.drawable.bg_cancel_order)
|
|
|
+ binding.btnEvaluate.setTextColorResource(R.color.color_FF4A76FF)
|
|
|
+ binding.btnEvaluate.text = "评价"
|
|
|
+ binding.btnRecord.text = "查看问诊记录"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ binding.btnRecord.setOnSingleClickListener {
|
|
|
+ onLeftClickListener?.invoke(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ binding.btnRecord.setOnSingleClickListener {
|
|
|
+ onRightClickListener?.invoke(item)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|