| package com.dayu.qihealonelibrary.activity; | 
|   | 
| import android.os.Bundle; | 
| import android.text.TextUtils; | 
| import android.view.LayoutInflater; | 
| import android.view.View; | 
|   | 
| import com.dayu.baselibrary.utils.MornyUtil; | 
| import com.dayu.qihealonelibrary.card.UserCard; | 
| import com.dayu.qihealonelibrary.databinding.ActivityRechargeDetailQhaBinding; | 
|   | 
| import java.util.Calendar; | 
|   | 
| /** | 
|  * Created by Android Studio. | 
|  * author: zuo | 
|  * Date: 2023-11-21 | 
|  * Time: 15:01 | 
|  * 备注:写卡后的详情页 | 
|  */ | 
| public class RechargeDetailActivityQHAlone extends QHAloneBaseActivity { | 
|   | 
|     ActivityRechargeDetailQhaBinding binding; | 
|     UserCard userCard; | 
|     String statu; | 
|     String userName; | 
|     String morny; | 
|     String rechageWater; | 
|     String cardNumber; | 
|   | 
|     @Override | 
|     protected void onCreate(Bundle savedInstanceState) { | 
|         super.onCreate(savedInstanceState); | 
|   | 
|         binding = ActivityRechargeDetailQhaBinding.inflate(LayoutInflater.from(this)); | 
|         setContentView(binding.getRoot()); | 
|   | 
|         try { | 
|             userCard = (UserCard) getIntent().getSerializableExtra("userCard"); | 
|             statu = getIntent().getStringExtra("statu"); | 
|             userName = getIntent().getStringExtra("userName"); | 
|             if (getIntent().hasExtra("morny")) { | 
|                 morny = getIntent().getStringExtra("morny"); | 
|                 rechageWater = getIntent().getStringExtra("rechageWater"); | 
|             } | 
|             if (getIntent().hasExtra("cardNumber")) { | 
|                 cardNumber = getIntent().getStringExtra("cardNumber"); | 
|             } | 
|             setUserData(userName, statu); | 
|         } catch (Exception e) { | 
|             throw new RuntimeException(e); | 
|         } | 
|   | 
|     } | 
|   | 
|     private void setUserData(String userName, String statu) { | 
|         int balance = userCard.getBalance(); | 
|         if (!TextUtils.isEmpty(morny)) { | 
|             binding.tip.setText("充值成功!"); | 
|             balance = userCard.getBalance(); | 
|             binding.redRemainderMorny.setText("充值金额:" + morny + " 元"); | 
|             binding.redRechargeWater.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); | 
|         } else { | 
|             binding.tip.setText("开卡成功!"); | 
|             balance = userCard.getBalance(); | 
|             binding.redRemainderMorny.setVisibility(View.GONE); | 
|             binding.redRechargeWater.setVisibility(View.GONE); | 
|         } | 
|         binding.redName.setText("用户姓名:" + userName); | 
| //        binding.redRemainderBlance.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); | 
|         binding.redSurplusWater.setText("剩余水量:" + MornyUtil.changeF2Y(userCard.getSurplusWater()) + " 吨"); | 
|         binding.redStatu.setText("卡状态:" + statu); | 
|         if (userCard != null) { | 
|             binding.redInitCode.setText("当前卡号:" + cardNumber); | 
|             Calendar calendar = userCard.getRechargeDate(); | 
|             if (calendar != null) { | 
|                 int year = calendar.get(Calendar.YEAR); | 
|                 int month = calendar.get(Calendar.MONTH); // 月份从0开始,所以需要加1 | 
|                 int day = calendar.get(Calendar.DAY_OF_MONTH); | 
|   | 
|                 binding.redRechargeDate.setText("本卡最后购水日期:" + year + month + day); | 
|             } else { | 
|                 binding.redRechargeDate.setText("本卡最后购水日期:无"); | 
|             } | 
|   | 
| //            binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + ""); | 
|         } | 
|     } | 
| } |