From cece79bf75a9b672b33b772acffca209eecfc8f2 Mon Sep 17 00:00:00 2001
From: zuoxiao <lf_zuo@163.com>
Date: 星期四, 26 六月 2025 08:27:25 +0800
Subject: [PATCH] refactor(generallibrary):优化补卡界面布局和样式- 调整了卡片信息展示区域的样式,包括背景色、文字颜色等 - 优化了输入区域的布局结构,减小了控件间距和尺寸- 更新了确认补卡按钮的样式 - 统一了文字大小和颜色,提高了可读性
---
generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt | 54 +++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt
index 7d370bd..3f6fcb8 100644
--- a/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt
+++ b/generallibrary/src/main/java/com/dayu/general/activity/NewCard2Activity.kt
@@ -47,7 +47,7 @@
private var paymentMethod: String = "鐜伴噾"
// 鏀粯鏂瑰紡ID
- private var paymentId: Long = 0
+ private var paymentId: String = ""
// 鏀粯鏂瑰紡鍒楄〃
private var paymentMethodList: List<PaymentMethod> = listOf()
@@ -172,17 +172,48 @@
ApiManager.getInstance().requestGetLoading(
this,
"terminal/paymentmethod/get",
- PaymentMethodResponse::class.java,
+ Any::class.java,
null,
- object : SubscriberListener<BaseResponse<PaymentMethodResponse>>() {
- override fun onNext(response: BaseResponse<PaymentMethodResponse>) {
+ object : SubscriberListener<BaseResponse<Any>>() {
+ override fun onNext(response: BaseResponse<Any>) {
if (response.success) {
- // 鑾峰彇鏀粯鏂瑰紡鍒楄〃
- val paymentMethods = response.content?.obj ?: listOf()
- if (paymentMethods.isNotEmpty()) {
- paymentMethodList = paymentMethods
- // 鏇存柊鏀粯鏂瑰紡鏄剧ず
- updatePaymentMethodRadioGroup()
+ try {
+ // 瀹夊叏鍦板鐞嗚繑鍥炵殑content锛屾湇鍔″櫒杩斿洖鐨勬槸ArrayList<LinkedHashMap>
+ val paymentMethods = mutableListOf<PaymentMethod>()
+ val content = response.content
+
+ if (content is List<*>) {
+ content.forEach { item ->
+ if (item is Map<*, *>) {
+ val id = item["id"]?.toString() ?: ""
+ val name = item["name"]?.toString() ?: ""
+ if (id.isNotEmpty() && name.isNotEmpty()) {
+ paymentMethods.add(PaymentMethod(id, name))
+ }
+ }
+ }
+ }
+
+ if (paymentMethods.isNotEmpty()) {
+ paymentMethodList = paymentMethods
+ // 鏇存柊鏀粯鏂瑰紡鏄剧ず
+ updatePaymentMethodRadioGroup()
+ } else {
+ Toast.makeText(
+ this@NewCard2Activity,
+ "鑾峰彇鏀粯鏂瑰紡澶辫触锛氳繑鍥炴暟鎹负绌�",
+ Toast.LENGTH_SHORT
+ ).show()
+ }
+ } catch (e: Exception) {
+ android.util.Log.e("NewCard2Activity", "瑙f瀽鏀粯鏂瑰紡鏁版嵁澶辫触", e)
+ android.util.Log.e("NewCard2Activity", "鍘熷鏁版嵁绫诲瀷: ${response.content?.javaClass?.name}")
+ android.util.Log.e("NewCard2Activity", "鍘熷鏁版嵁鍐呭: ${response.content}")
+ Toast.makeText(
+ this@NewCard2Activity,
+ "瑙f瀽鏀粯鏂瑰紡鏁版嵁澶辫触: ${e.message}",
+ Toast.LENGTH_SHORT
+ ).show()
}
} else {
Toast.makeText(
@@ -195,6 +226,7 @@
override fun onError(e: Throwable?) {
super.onError(e)
+ android.util.Log.e("NewCard2Activity", "缃戠粶璇锋眰澶辫触", e)
Toast.makeText(
this@NewCard2Activity,
"鑾峰彇鏀粯鏂瑰紡澶辫触: ${e?.message ?: "缃戠粶寮傚父"}",
@@ -345,7 +377,7 @@
clientId = clientId,
cardFee = cardFee,
remark = binding.newCardRemark.text.toString(),
- paymentMethod = paymentId.toInt(),
+ paymentMethod = paymentId.toLongOrNull()?.toInt() ?: 0,
isReported = true,
isCardWritten = false, // 鍒濆璁剧疆涓篺alse锛屽啓鍗℃垚鍔熷悗鍐嶆洿鏂颁负true
operatorId = orderId,
--
Gitblit v1.8.0