左晓为主开发手持机充值管理机
generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt
@@ -5,6 +5,7 @@
import androidx.lifecycle.lifecycleScope
import com.dayu.baselibrary.net.subscribers.SubscriberListener
import com.dayu.baselibrary.tools.nfc.NFCCallBack
import com.dayu.baselibrary.utils.MornyUtil
import com.dayu.baselibrary.utils.ToastUtil
import com.dayu.general.bean.card.ClearCard
import com.dayu.general.bean.card.UserCard
@@ -86,7 +87,7 @@
                        textData.append("工本费:" + cardFee + "元\n")
                    }
                    if (userCard.balance != 0) {
                        textData.append("充值金额:" + userCard.balance + "元")
                        textData.append("充值金额:" + MornyUtil.changeF2Y(userCard.balance) + "元")
                    }
                    binding?.cardData?.text = textData.toString()
@@ -98,7 +99,12 @@
                    
                    // 显示充值金额
                    if (rechargeAmount > 0) {
                        textData.append("充值金额:" + String.format("%.2f", rechargeAmount) + "元\n")
                        textData.append(
                            "充值金额:" + String.format(
                                "%.2f",
                                rechargeAmount
                            ) + "元\n"
                        )
                    }
                    
                    // 显示赠送金额
@@ -109,7 +115,12 @@
                    // 显示总金额(写入卡内的总余额)
                    if (userCard.balance != 0) {
                        val totalBalanceInYuan = userCard.balance / 100.0 // 转换为元
                        textData.append("卡内总余额:" + String.format("%.2f", totalBalanceInYuan) + "元")
                        textData.append(
                            "卡内总余额:" + String.format(
                                "%.2f",
                                totalBalanceInYuan
                            ) + "元"
                        )
                    }
                    
                    binding?.cardData?.text = textData.toString()