| | |
| | | import com.dayu.qihealonelibrary.card.UserCard; |
| | | import com.dayu.qihealonelibrary.databinding.ActivityRechargeQhaBinding; |
| | | import com.dayu.qihealonelibrary.dbBean.AdminDataBean; |
| | | import com.dayu.qihealonelibrary.dbBean.ElectricPriceBean; |
| | | import com.dayu.qihealonelibrary.dbBean.UserCardBean; |
| | | import com.dayu.qihealonelibrary.tools.NfcReadHelper; |
| | | import com.dayu.qihealonelibrary.utils.CardCommon; |
| | |
| | | UserCardBean userCardBean; |
| | | int waterPrice; |
| | | String rechageWater;//充值的水量 |
| | | ElectricPriceBean priceBean; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | if (!data.isEmpty()) { |
| | | if (!TextUtils.isEmpty(cardNumber)) { |
| | | setUserData(cardType, cardNumber, data); |
| | | if(priceBean!=null){ |
| | | binding.redRechargeElectric.setText("电量单价:"+priceBean.getPrice()+"元/度"); |
| | | } |
| | | } else { |
| | | TipUtil.show(this, "读取卡片失败,请重新贴卡"); |
| | | } |
| | |
| | | // binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + " 次"); |
| | | // binding.redTotalWater.setText("总用水量:" + MornyUtil.changeF2Y(userCard.getTotalWater()) + " 吨"); |
| | | // binding.redTotalPower.setText("总用电量:" + MornyUtil.changeF2Y(userCard.getTotalElectric()) + " 度"); |
| | | // binding.redRemainderBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + " 元"); |
| | | binding.redRemainderBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + " 元"); |
| | | binding.redRemainderWater.setText("剩余水量:" + MornyUtil.changeF2Y(userCard.getSurplusWater()) + " 吨"); |
| | | binding.redWaterPrice.setText("每立方米水价格:" + MornyUtil.changeF2Y(adminData.getWaterPrice()) + " 元"); |
| | | // binding.redWaterPrice.setText("每立方米水价格:" + MornyUtil.changeF2Y(adminData.getWaterPrice()) + " 元"); |
| | | } |
| | | |
| | | } else { |
| | | TipUtil.show(this, "不是本区域卡"); |
| | | TipUtil.show(this, "非本区域卡\n不能充值!!!"); |
| | | } |
| | | |
| | | |
| | |
| | | private void initView() { |
| | | try { |
| | | adminData = baseDao.adminDao().findFirst(); |
| | | priceBean = baseDao.electricPriceDao().findFirst(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | CrashReport.postCatchedException(e); |
| | |
| | | intent.putExtra("cardNumber", cardNumber); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("userCardBean", userCardBean); |
| | | intent.putExtra("rechageWater", rechageWater); |
| | | // intent.putExtra("rechageWater", rechageWater); |
| | | startActivity(intent); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "请输入充值金额(元)"); |
| | |
| | | String morny = editText.getText().toString(); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | rechageWater = MornyUtil.intDiv(MornyUtil.changeY2F(editText.getText().toString()), waterPrice); |
| | | binding.redRechargeWater.setText("充值水量:" + rechageWater + " 立方米(吨)"); |
| | | // binding.redRechargeWater.setText("充值水量:" + rechageWater + " 立方米(吨)"); |
| | | } |
| | | |
| | | |