| | |
| | | binding.tvUserName.text = info.userName ?: "未知" |
| | | binding.tvPhone.text = info.phone ?: "未绑定" |
| | | |
| | | // 根据status字段显示状态 |
| | | val statusText = when (info.state) { |
| | | 1 -> "正常" |
| | | 2 -> "挂失" |
| | | 3 -> "锁定" |
| | | else -> "未知" |
| | | // 根据state字段显示状态 |
| | | val (statusText, statusColor) = when (info.state) { |
| | | 1 -> Pair("正常", android.graphics.Color.parseColor("#4CAF50")) // 绿色 |
| | | 2 -> Pair("已注销", android.graphics.Color.parseColor("#FF5722")) // 深橙色 |
| | | 3 -> Pair("已挂失", android.graphics.Color.parseColor("#FF9800")) // 橙色 |
| | | 4 -> Pair("无效卡片", android.graphics.Color.parseColor("#F44336")) // 红色 |
| | | else -> Pair("未知状态", android.graphics.Color.parseColor("#9E9E9E")) // 灰色 |
| | | } |
| | | binding.tvCardStatus.text = statusText |
| | | binding.tvCardStatus.setTextColor(statusColor) |
| | | if (info.state == 3) { |
| | | binding.btnCancelCard.visibility = android.view.View.GONE |
| | | } else { |
| | | binding.btnCancelCard.visibility = android.view.View.VISIBLE |
| | | } |
| | | } |
| | | } |