From 08bfe3072377b53c60e0952f00c26bce2e5b4bc0 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期三, 18 六月 2025 17:05:55 +0800 Subject: [PATCH] feat(card): 添加卡片返还功能- 新增 CardReturnActivity 用于执行卡片返还操作 - 在 BSCardFragment 中添加返还按钮,跳转到 CardReturnActivity - 在 CardOperationType 中添加 ReturnCard 类型 - 修改 CardReadActivity,优化卡片信息显示逻辑 - 更新 CardWriteSuccessActivity,支持返还成功提示 - 新增 ic_morny_back 图标用于返还操作 --- generallibrary/src/main/res/drawable/ic_supplement.xml | 9 generallibrary/src/main/res/drawable/ic_morny_back.xml | 9 generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt | 3 generallibrary/src/main/java/com/dayu/general/activity/CardReadActivity.kt | 34 - generallibrary/src/main/AndroidManifest.xml | 10 generallibrary/src/main/java/com/dayu/general/activity/CardWriteSuccessActivity.kt | 64 +++ generallibrary/src/main/res/layout/fragment_card.xml | 49 ++ generallibrary/src/main/res/layout/activity_card_return.xml | 412 ++++++++++++++++++++++++ generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt | 36 + generallibrary/src/main/java/com/dayu/general/activity/CardReturnActivity.kt | 392 +++++++++++++++++++++++ generallibrary/src/main/java/com/dayu/general/tool/CardOperationType.kt | 2 11 files changed, 977 insertions(+), 43 deletions(-) diff --git a/generallibrary/src/main/AndroidManifest.xml b/generallibrary/src/main/AndroidManifest.xml index d5b9ade..019d8dc 100644 --- a/generallibrary/src/main/AndroidManifest.xml +++ b/generallibrary/src/main/AndroidManifest.xml @@ -117,6 +117,16 @@ </intent-filter> </activity> + <activity android:name=".activity.CardReturnActivity" + android:exported="false" + android:launchMode="singleTop"> + <intent-filter> + <action android:name="android.nfc.action.ACTION_NDEF_DISCOVERED" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="text/plain" /> + </intent-filter> + </activity> + <meta-data android:name="BUGLY_APP_VERSION" android:value="7.1" /> diff --git a/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt b/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt index 09aae1d..7cd9a2e 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/BSCardFragment.kt @@ -55,6 +55,9 @@ context?.let { CardReadActivity.start(it) } } binding.homeReverse.setOnClickListener { + context?.let { CardReturnActivity.start(it) } + } + binding.homeCancelCard.setOnClickListener { context?.let { CardCancelActivity.start(it) } } } diff --git a/generallibrary/src/main/java/com/dayu/general/activity/CardReadActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/CardReadActivity.kt index 07015c8..986451b 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/CardReadActivity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/CardReadActivity.kt @@ -4,16 +4,16 @@ import android.content.Intent import android.os.Bundle import com.dayu.baselibrary.net.subscribers.SubscriberListener -import com.dayu.baselibrary.utils.ToastUtil +import com.dayu.baselibrary.utils.MornyUtil import com.dayu.baselibrary.view.TipDialog import com.dayu.baselibrary.view.TitleBar +import com.dayu.general.bean.card.UserCard import com.dayu.general.bean.net.CardInfoResult import com.dayu.general.databinding.ActivityCardReadBinding import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse -import com.dayu.general.tool.NfcReadHelper -import com.dayu.general.bean.card.UserCard import com.dayu.general.tool.CardCommon +import com.dayu.general.tool.NfcReadHelper /** * @author: zuo @@ -275,19 +275,11 @@ userCard.let { card -> // 浣欓杞崲涓哄厓锛堝師濮嬫暟鎹彲鑳芥槸鍒嗭級 - val balanceInYuan = if (card.balance > 1000) { - String.format("%.2f", card.balance / 100.0) - } else { - card.balance.toString() - } - binding.tvCardBalance.text = "${balanceInYuan}鍏�" + + binding.tvCardBalance.text = MornyUtil.changeF2Y(card.balance.toInt()) + "鍏�" // 浣跨敤瀹屾暣鐨勭敤鎴风紪鍙� binding.tvUserNumber.text = cardInfo?.cardNum - - // 鍗$墖鐘舵�侊紙鍋囪姝e父鐘舵�侊紝鍥犱负UserCard涓病鏈夌姸鎬佸瓧娈碉級 - binding.tvCardStatus.text = "姝e父" - binding.tvCardStatus.setTextColor(android.graphics.Color.parseColor("#4CAF50")) // 鍏呭�兼椂闂翠綔涓烘渶鍚庝娇鐢ㄦ椂闂� if (card.rechargeDate != null) { @@ -306,14 +298,16 @@ binding.tvPhone.text = info.phone ?: "鏈粦瀹�" binding.tvIdCard.text = info.userCode ?: "鏈綍鍏�" // 浣跨敤userCode浣滀负韬唤璇佸彿鐨勬浛浠� - // 鏍规嵁status瀛楁鏄剧ず鐘舵�� - val statusText = when (info.state) { - 1 -> "姝e父" - 2 -> "鎸傚け" - 3 -> "閿佸畾" - else -> "鏈煡" + // 鏍规嵁state瀛楁鏄剧ず鐘舵�� + val (statusText, statusColor) = when (info.state) { + 1 -> Pair("姝e父", 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) } } diff --git a/generallibrary/src/main/java/com/dayu/general/activity/CardReturnActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/CardReturnActivity.kt new file mode 100644 index 0000000..708154a --- /dev/null +++ b/generallibrary/src/main/java/com/dayu/general/activity/CardReturnActivity.kt @@ -0,0 +1,392 @@ +package com.dayu.general.activity + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import com.dayu.baselibrary.net.subscribers.SubscriberListener +import com.dayu.baselibrary.utils.MornyUtil +import com.dayu.baselibrary.utils.ToastUtil +import com.dayu.baselibrary.view.TipDialog +import com.dayu.baselibrary.view.TitleBar +import com.dayu.general.BaseApplication +import com.dayu.general.bean.card.UserCard +import com.dayu.general.bean.net.CardInfoResult +import com.dayu.general.bean.net.CardReturnResult +import com.dayu.general.databinding.ActivityCardReturnBinding +import com.dayu.general.net.ApiManager +import com.dayu.general.net.BaseResponse +import com.dayu.general.tool.CardCommon +import com.dayu.general.tool.CardOperationType +import com.dayu.general.tool.NfcReadHelper + +/** + * @author: zuo + * @desc: 杩旇繕Activity + * @since: 2025/6/17 + */ +class CardReturnActivity : BaseNfcActivity() { + private lateinit var binding: ActivityCardReturnBinding + private var cardNumber: String? = null + private var cardInfo: CardInfoResult? = null + private var userCard: UserCard? = null + + companion object { + /** + * 鍚姩杩旇繕Activity + */ + fun start(context: Context) { + val intent = Intent(context, CardReturnActivity::class.java) + context.startActivity(intent) + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityCardReturnBinding.inflate(layoutInflater) + setContentView(binding.root) + + initView() + } + + private fun initView() { + // 璁剧疆TitleBar鐨勮繑鍥炴寜閽偣鍑讳簨浠� + binding.titleBar.setOnItemclickListner(TitleBar.ClickType_LEFT_IMAGE) { + finish() + } + + // 璁剧疆杩旇繕鎸夐挳鐐瑰嚮浜嬩欢 + binding.btnReturn.setOnClickListener { + performCardReturn() + } + } + + /** + * 閲嶇疆鍒拌鍗$姸鎬� + */ + private fun resetToReadingState() { + binding.scrollReadCard.visibility = android.view.View.VISIBLE + binding.cardInfoContainer.visibility = android.view.View.GONE + binding.bottomButtonContainer.visibility = android.view.View.GONE + cardNumber = null + cardInfo = null + binding.etReturnAmount.setText("") + binding.etRemarks.setText("") + } + + /** + * 鏄剧ず纭瀵硅瘽妗� + */ + private fun showConfirmDialog(message: String, onConfirm: () -> Unit) { + val confirmDialog = TipDialog(this, message) { + onConfirm() + } + confirmDialog.show() + } + + override fun onNfcBack(intent: Intent?) { + intent?.let { + // 澶勭悊姝e父鐨勮鍗℃搷浣� + handleNfcIntent(it) + } ?: run { + showConfirmDialog("NFC鏁版嵁寮傚父锛岃閲嶆柊鍒峰崱") { + } + } + } + + /** + * 澶勭悊NFC鍒峰崱淇℃伅 + */ + private fun handleNfcIntent(intent: Intent) { + try { + // 妫�鏌ntent涓槸鍚﹀寘鍚玁FC Tag + if (intent.getParcelableExtra<android.nfc.Tag>(android.nfc.NfcAdapter.EXTRA_TAG) == null) { + showConfirmDialog("鏈娴嬪埌NFC鍗$墖锛岃纭繚鍗$墖宸叉纭斁缃�") { + } + return + } + + val nfcAdapter = NfcReadHelper.getInstance(intent, this) + val cardTypeAndCardNumber = nfcAdapter.getCardTypeAndCardNumber() + if (cardTypeAndCardNumber.isNullOrBlank() || !cardTypeAndCardNumber.contains(",")) { + showConfirmDialog("鍗$墖淇℃伅璇诲彇澶辫触锛岃閲嶆柊鍒峰崱") { + } + return + } + val parts = cardTypeAndCardNumber.split(",") + if (parts.size < 2) { + showConfirmDialog("鍗$墖淇℃伅鏍煎紡寮傚父锛岃閲嶆柊鍒峰崱") { + } + return + } + val cardNumber = parts[0] + val cardType = parts[1] + this.cardNumber = cardNumber + if (cardNumber.isBlank()) { + showConfirmDialog("鍗″彿涓虹┖锛屾棤娉曡繘琛屾搷浣滐紝璇烽噸鏂板埛鍗�") { + } + return + } + + // 鏍规嵁鍗$墖绫诲瀷杩涜涓嶅悓澶勭悊 + when (cardType) { + CardCommon.USER_CARD_TYPE_1, + CardCommon.USER_CARD_TYPE_2, + CardCommon.USER_CARD_TYPE_3 -> { + // 鐢ㄦ埛鍗★細瑙f瀽鍗″唴鏁版嵁骞惰皟鐢ㄦ帴鍙� + handleUserCard(cardNumber, cardType, nfcAdapter) + } + + else -> { + // 绠$悊绫诲崱涓嶆敮鎸佽繑杩� + showConfirmDialog("璇ュ崱鐗囩被鍨嬩笉鏀寔杩旇繕鎿嶄綔") { + resetToReadingState() + } + } + } + } catch (e: Exception) { + showConfirmDialog("璇诲崱寮傚父锛�${e.message}") { + } + e.printStackTrace() + } + } + + /** + * 澶勭悊鐢ㄦ埛鍗� + */ + private fun handleUserCard(cardNumber: String, cardType: String, nfcAdapter: NfcReadHelper) { + // 瑙f瀽鐢ㄦ埛鍗℃暟鎹� + val userCard = nfcAdapter.getUserCardData() + if (userCard == null) { + showConfirmDialog("瑙f瀽鍗$墖鏁版嵁澶辫触锛岃閲嶆柊鍒峰崱") { + } + return + } + + // 杈撳嚭鐢ㄦ埛鍗″唴鎵�鏈変俊鎭埌鏃ュ織 + android.util.Log.d("CardReturnActivity", "=== 鐢ㄦ埛鍗′俊鎭� ===") + android.util.Log.d("CardReturnActivity", "鍗″彿: $cardNumber") + android.util.Log.d("CardReturnActivity", "鍗$墖绫诲瀷: $cardType") + android.util.Log.d("CardReturnActivity", "鍗″唴浣欓: ${userCard.balance}") + android.util.Log.d("CardReturnActivity", "==================") + this.userCard = userCard + // 鏍规嵁鍗″彿鑾峰彇鍗$墖璇︾粏淇℃伅 + getCardInfo(cardNumber, cardType, userCard) + } + + /** + * 鑾峰彇鍗$墖璇︾粏淇℃伅锛堢敤鎴峰崱涓撶敤锛� + */ + private fun getCardInfo(cardNumber: String, cardType: String, userCard: UserCard) { + val map = mutableMapOf<String, Any>() + map["cardAddr"] = cardNumber + ApiManager.getInstance().requestGetLoading( + this, + "terminal/card/readCard", + CardInfoResult::class.java, + map, + object : SubscriberListener<BaseResponse<CardInfoResult>>() { + override fun onNext(t: BaseResponse<CardInfoResult>) { + if (t.success) { + // 璇诲崱鎴愬姛锛屾樉绀虹敤鎴峰崱璇︾粏淇℃伅 + showUserCardInfo(t.content, cardNumber, cardType, userCard) + } else { + // 澶勭悊鑾峰彇澶辫触鐨勬儏鍐� + handleCardInfoError(t.code, t.msg) + } + } + + override fun onError(e: Throwable?) { + super.onError(e) + showConfirmDialog("鑾峰彇鍗′俊鎭け璐�: ${e?.message ?: "缃戠粶寮傚父锛岃妫�鏌ョ綉缁滆繛鎺�"}") { + } + } + } + ) + } + + /** + * 鏄剧ず鐢ㄦ埛鍗$墖淇℃伅锛堝寘鍚崱鍐呮暟鎹拰鎺ュ彛杩斿洖鏁版嵁锛� + */ + private fun showUserCardInfo( + cardInfo: CardInfoResult?, + cardNumber: String, + cardType: String, + userCard: UserCard + ) { + // 闅愯棌璇诲崱鎻愮ず锛屾樉绀轰俊鎭尯鍩熷拰搴曢儴鎸夐挳 + binding.scrollReadCard.visibility = android.view.View.GONE + binding.cardInfoContainer.visibility = android.view.View.VISIBLE + binding.bottomButtonContainer.visibility = android.view.View.VISIBLE + + this.cardInfo = cardInfo + binding.tvCardNumber.text = cardNumber + + userCard.let { card -> + // 浣欓杞崲涓哄厓锛堝師濮嬫暟鎹彲鑳芥槸鍒嗭級 + binding.tvCardBalance.text = MornyUtil.changeF2Y(card.balance) + "鍏�" + } + + // 鏄剧ず鏈嶅姟鍣ㄦ暟鎹� + cardInfo?.let { info -> + binding.tvUserName.text = info.userName ?: "鏈煡" + binding.tvPhone.text = info.phone ?: "鏈粦瀹�" + + // 鏍规嵁state瀛楁鏄剧ず鐘舵�� + val (statusText, statusColor) = when (info.state) { + 1 -> Pair("姝e父", 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) + } + } + + /** + * 澶勭悊鍗′俊鎭幏鍙栭敊璇� + */ + private fun handleCardInfoError(code: String?, msg: String?) { + val errorMessage: String = when (code) { + "1001" -> { + "璇ュ崱鐗囨湭鍦ㄧ郴缁熶腑娉ㄥ唽锛屾棤娉曡繘琛岃繑杩樻搷浣溿��" + } + + else -> { + when { + msg.isNullOrBlank() -> "鑾峰彇鍗′俊鎭け璐ワ紝璇烽噸鏂板埛鍗¢噸璇曘��" + msg.contains("鏁版嵁涓嶅瓨鍦�") -> "璇ュ崱鐗囨湭鍦ㄧ郴缁熶腑娉ㄥ唽锛屾棤娉曡繘琛岃繑杩樻搷浣溿��" + msg.contains("缃戠粶") -> "缃戠粶杩炴帴寮傚父锛岃妫�鏌ョ綉缁滆繛鎺ュ悗閲嶆柊鍒峰崱銆�" + msg.contains("瓒呮椂") -> "缃戠粶璇锋眰瓒呮椂锛岃閲嶆柊鍒峰崱閲嶈瘯銆�" + else -> "鑾峰彇鍗′俊鎭け璐ワ細$msg\n\n璇烽噸鏂板埛鍗¢噸璇曘��" + } + } + } + + // 鏄剧ず閿欒淇℃伅鐨勫璇濇 + showConfirmDialog(errorMessage) { + resetToReadingState() + } + } + + /** + * 鎵ц杩旇繕鎿嶄綔 + */ + private fun performCardReturn() { + // 楠岃瘉杈撳叆 + val returnAmountStr = binding.etReturnAmount.text.toString().trim() + val remarks = binding.etRemarks.text.toString().trim() + + // 杩旇繕閲戦楠岃瘉锛堝繀濉級 + if (returnAmountStr.isEmpty()) { + ToastUtil.show("璇疯緭鍏ヨ繑杩橀噾棰�") + return + } + + val returnAmount = try { + val amount = returnAmountStr.toDouble() + if (amount <= 0) { + ToastUtil.show("杩旇繕閲戦蹇呴』澶т簬0") + return + } + amount + } catch (e: NumberFormatException) { + ToastUtil.show("璇疯緭鍏ユ湁鏁堢殑杩旇繕閲戦") + return + } + + // 澶囨敞澶勭悊锛堥潪蹇呭~锛� + val finalRemarks = if (remarks.isEmpty()) { + "杩旇繕" // 濡傛灉鏈緭鍏ュ娉紝浣跨敤榛樿鍊� + } else { + remarks + } + + callReturnCardApi(returnAmount, finalRemarks) + + } + + /** + * 璋冪敤杩旇繕API鎺ュ彛 + */ + private fun callReturnCardApi(returnAmount: Double, finalRemarks: String) { + if (cardNumber.isNullOrBlank()) { + ToastUtil.show("鍗″彿淇℃伅寮傚父锛岃閲嶆柊鍒峰崱") + return + } + + // 鑾峰彇褰撳墠鍗″唴浣欓锛堜互鍒嗕负鍗曚綅锛� + val currentBalance = userCard?.balance?.let { MornyUtil.changeF2Y(it) } ?: 0 + + val map = mutableMapOf<String, Any>() + map["cardNum"] = cardInfo?.cardNum.toString() + map["supplementMoney"] = returnAmount.toString() + map["balance"] = currentBalance.toString() + map["remarks"] = finalRemarks + map["operator"] = BaseApplication.userId + + ApiManager.getInstance().requestPostLoading( + this, + "terminal/card/supplement", + CardReturnResult::class.java, + map, + object : SubscriberListener<BaseResponse<CardReturnResult>>() { + override fun onNext(t: BaseResponse<CardReturnResult>) { + if (t.success && t.content != null) { + // 杩旇繕鎴愬姛锛岃烦杞埌鍐欏崱鐣岄潰 + startWriteCardActivity(t.content!!, returnAmount, userCard!!) + } else { + // 杩旇繕澶辫触 + val errorMsg = if (t.msg.isNullOrBlank()) "杩旇繕澶辫触锛岃閲嶈瘯" else t.msg + showConfirmDialog("杩旇繕澶辫触锛�$errorMsg") { + } + } + } + + override fun onError(e: Throwable?) { + super.onError(e) + showConfirmDialog("杩旇繕璇锋眰澶辫触: ${e?.message ?: "缃戠粶寮傚父锛岃妫�鏌ョ綉缁滆繛鎺�"}") { + } + } + } + ) + } + + /** + * 璺宠浆鍒板啓鍗$晫闈㈣繘琛屽崱鍐呭鏇存柊 + */ + private fun startWriteCardActivity( + returnResult: CardReturnResult, + returnAmount: Double, + userCard: UserCard + ) { + // 鍒涘缓鏇存柊鍚庣殑鐢ㄦ埛鍗℃暟鎹� + val updatedUserCard = UserCard().apply { + // 澶嶅埗鍘熸湁灞炴�� + cardType = userCard.cardType + areaNumber = userCard.areaNumber + userCode = userCard.userCode + userCodeNumber = userCard.userCodeNumber + phoneNumber = userCard.phoneNumber + projectCode = userCard.projectCode + surplusWater = userCard.surplusWater + waterPrice = userCard.waterPrice + electricPrice = userCard.electricPrice + rechargeDate = userCard.rechargeDate + + // 浣跨敤杩斿洖鐨勬柊浣欓 + balance = MornyUtil.changeY2F(returnResult.balance.toString()) + } + + val intent = Intent(this, NfcWreatActivity::class.java).apply { + putExtra("cardAddr", cardNumber) + putExtra("operationTypeCode", CardOperationType.ReturnCard.code) // 浣跨敤杩旇繕绫诲瀷杩涜鍐欏崱 + putExtra("orderNumber", returnResult.orderNo) + putExtra("returnAmount", returnAmount) + putExtra("userCard", updatedUserCard as java.io.Serializable) + } + startActivity(intent) + finish() + } +} \ No newline at end of file diff --git a/generallibrary/src/main/java/com/dayu/general/activity/CardWriteSuccessActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/CardWriteSuccessActivity.kt index 73182db..7023d35 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/CardWriteSuccessActivity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/CardWriteSuccessActivity.kt @@ -1,8 +1,8 @@ package com.dayu.general.activity -import android.content.Intent import android.os.Bundle import com.dayu.general.databinding.ActivityCardWriteSuccessBinding +import com.dayu.general.tool.CardOperationType /** * @author: zuo @@ -13,32 +13,70 @@ private lateinit var binding: ActivityCardWriteSuccessBinding private var cardNumber: String? = null + private var operationTypeCode: Int = -1 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityCardWriteSuccessBinding.inflate(layoutInflater) setContentView(binding.root) - // 鑾峰彇浼犲叆鐨勫崱鍙� + // 鑾峰彇浼犲叆鐨勫崱鍙峰拰鎿嶄綔绫诲瀷 cardNumber = intent.getStringExtra("cardNumber") + operationTypeCode = intent.getIntExtra("operationTypeCode", -1) initView() } private fun initView() { - // 璁剧疆鏍囬 - binding.titleBar.setCenterText("閿�鍗℃垚鍔�") + val operationType = CardOperationType.fromCode(operationTypeCode) - // 璁剧疆鎴愬姛淇℃伅 - binding.successTitle.text = "閿�鍗℃垚鍔�" - - // 璁剧疆璇︾粏淇℃伅 - val message = if (cardNumber.isNullOrBlank()) { - "鍗$墖宸叉垚鍔熼攢鍗″苟娓呴櫎鍐呭\n璇ュ崱鐗囧皢鏃犳硶鍐嶆浣跨敤" - } else { - "鍗$墖宸叉垚鍔熼攢鍗″苟娓呴櫎鍐呭\n鍗″彿锛�$cardNumber\n璇ュ崱鐗囧皢鏃犳硶鍐嶆浣跨敤" + // 鏍规嵁鎿嶄綔绫诲瀷璁剧疆涓嶅悓鐨勬爣棰樺拰淇℃伅 + when (operationType) { + CardOperationType.CancelCard -> { + // 璁剧疆鏍囬 + binding.titleBar.setCenterText("閿�鍗℃垚鍔�") + + // 璁剧疆鎴愬姛淇℃伅 + binding.successTitle.text = "閿�鍗℃垚鍔�" + + // 璁剧疆璇︾粏淇℃伅 + val message = if (cardNumber.isNullOrBlank()) { + "鍗$墖宸叉垚鍔熼攢鍗″苟娓呴櫎鍐呭\n璇ュ崱鐗囧皢鏃犳硶鍐嶆浣跨敤" + } else { + "鍗$墖宸叉垚鍔熼攢鍗″苟娓呴櫎鍐呭\n鍗″彿锛�$cardNumber\n璇ュ崱鐗囧皢鏃犳硶鍐嶆浣跨敤" + } + binding.successMessage.text = message + } + + CardOperationType.ReturnCard -> { + // 璁剧疆鏍囬 + binding.titleBar.setCenterText("杩旇繕鎴愬姛") + + // 璁剧疆鎴愬姛淇℃伅 + binding.successTitle.text = "杩旇繕鎴愬姛" + + // 璁剧疆璇︾粏淇℃伅 + val message = if (cardNumber.isNullOrBlank()) { + "鍗$墖杩旇繕鎿嶄綔宸叉垚鍔熷畬鎴怽n鍗″唴浣欓宸叉洿鏂�" + } else { + "鍗$墖杩旇繕鎿嶄綔宸叉垚鍔熷畬鎴怽n鍗″彿锛�$cardNumber\n鍗″唴浣欓宸叉洿鏂�" + } + binding.successMessage.text = message + } + + else -> { + // 榛樿鏄剧ず鍐欏崱鎴愬姛 + binding.titleBar.setCenterText("鍐欏崱鎴愬姛") + binding.successTitle.text = "鍐欏崱鎴愬姛" + + val message = if (cardNumber.isNullOrBlank()) { + "鍗$墖鎿嶄綔宸叉垚鍔熷畬鎴�" + } else { + "鍗$墖鎿嶄綔宸叉垚鍔熷畬鎴怽n鍗″彿锛�$cardNumber" + } + binding.successMessage.text = message + } } - binding.successMessage.text = message // 璁剧疆鐐瑰嚮纭畾鎸夐挳鍚庡叧闂〉闈� binding.btnConfirm.setOnClickListener { diff --git a/generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt b/generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt index 3bf4fce..af6c1dc 100644 --- a/generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt +++ b/generallibrary/src/main/java/com/dayu/general/activity/NfcWreatActivity.kt @@ -9,17 +9,15 @@ import com.dayu.baselibrary.utils.ToastUtil import com.dayu.general.bean.card.ClearCard import com.dayu.general.bean.card.UserCard -import com.dayu.general.tool.CardCommon -import com.dayu.general.tool.CardOperationType +import com.dayu.general.dao.BaseDaoSingleton import com.dayu.general.databinding.ActivityNfcWriteGeBinding import com.dayu.general.net.ApiManager import com.dayu.general.net.BaseResponse +import com.dayu.general.tool.CardOperationType import com.dayu.general.tool.NfcReadHelper import com.dayu.general.tool.NfcWreatHelper -import com.dayu.general.dao.BaseDaoSingleton import com.tencent.bugly.crashreport.CrashReport import kotlinx.coroutines.launch -import java.lang.StringBuilder /** * @author: zuo @@ -39,6 +37,9 @@ // 閿�鍗$浉鍏充俊鎭� private var refundAmount = 0.0 private var cardBalance = 0.0 + + // 杩旇繕鐩稿叧淇℃伅 + private var returnAmount = 0.0 //璁㈠崟缂栧彿 var orderNumber = "" @@ -70,6 +71,9 @@ // 鑾峰彇閿�鍗$浉鍏充俊鎭� refundAmount = intent?.getDoubleExtra("refundAmount", 0.0) ?: 0.0 cardBalance = intent?.getDoubleExtra("cardBalance", 0.0) ?: 0.0 + + // 鑾峰彇杩旇繕鐩稿叧淇℃伅 + returnAmount = intent?.getDoubleExtra("returnAmount", 0.0) ?: 0.0 if (intent?.hasExtra("cardFee") == true) { cardFee = intent?.getIntExtra("cardFee", 0) ?: 0 @@ -162,6 +166,14 @@ binding?.cardData?.text = textData.toString() } + CardOperationType.ReturnCard -> { + var textData = StringBuilder() + textData.append("杩旇繕\n") + textData.append("鍗″唴浣欓锛�" + MornyUtil.changeF2Y(userCard.balance) + "鍏僜n") + textData.append("杩旇繕閲戦锛�" + returnAmount + "鍏�") + binding?.cardData?.text = textData.toString() + } + CardOperationType.CheckCard -> TODO() CardOperationType.DeductCard -> TODO() CardOperationType.ReplaceCard -> TODO() @@ -245,6 +257,21 @@ }) } + CardOperationType.ReturnCard -> { + nfcWreatHelper.writeUserDataAsync(userCard, object : NFCCallBack { + override fun isSusses(flag: Boolean, msg: String?) { + // 纭繚Toast鍦ㄤ富绾跨▼涓皟鐢� + runOnUiThread { + if (flag) { + postCardData(cardAddr) + } else { + ToastUtil.show("杩旇繕鍐欏崱澶辫触: ${msg ?: "鏈煡閿欒"}") + } + } + } + }) + } + CardOperationType.CheckCard -> TODO() CardOperationType.DeductCard -> TODO() CardOperationType.ReplaceCard -> TODO() @@ -278,6 +305,7 @@ finish() Intent(this@NfcWreatActivity, CardWriteSuccessActivity::class.java).apply { putExtra("cardNumber", cardNumber) + putExtra("operationTypeCode", operationTypeCode) startActivity(this) } } diff --git a/generallibrary/src/main/java/com/dayu/general/tool/CardOperationType.kt b/generallibrary/src/main/java/com/dayu/general/tool/CardOperationType.kt index 7e665e6..efc0c1e 100644 --- a/generallibrary/src/main/java/com/dayu/general/tool/CardOperationType.kt +++ b/generallibrary/src/main/java/com/dayu/general/tool/CardOperationType.kt @@ -12,6 +12,7 @@ object DeductCard : CardOperationType(5, "琛ユ墸") object CleanCard : CardOperationType(6, "娓呴浂鍗�") object CheckCard : CardOperationType(7, "妫�鏌ュ崱") + object ReturnCard : CardOperationType(8, "杩旇繕") companion object { fun fromCode(code: Int): CardOperationType? { @@ -23,6 +24,7 @@ 5 -> DeductCard 6 -> CleanCard 7 -> CheckCard + 8 -> ReturnCard else -> null } } diff --git a/generallibrary/src/main/res/drawable/ic_morny_back.xml b/generallibrary/src/main/res/drawable/ic_morny_back.xml new file mode 100644 index 0000000..b78dc02 --- /dev/null +++ b/generallibrary/src/main/res/drawable/ic_morny_back.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="200dp" + android:height="200dp" + android:viewportWidth="1024" + android:viewportHeight="1024"> + <path + android:pathData="M860.7,81.9L163.3,81.9c-39.4,0 -69.6,30.2 -69.6,69.6v720.9c0,39.4 30.2,69.6 69.6,69.6h697.3c39.4,0 69.6,-30.2 69.6,-69.6L930.3,151.6c0,-39.4 -30.2,-69.6 -69.6,-69.6zM711.7,837.6l-4.6,4.6 -9.2,7.2c-9.2,0 -16.4,-4.6 -21,-13.8 -74.2,-120.8 -188.4,-104.4 -232.4,-102.4v72.2c0,32.8 -21,34.8 -27.6,34.8 -11.8,0 -21,-7.2 -25.6,-11.8l-153.6,-160.3c-2.6,-2.6 -18.4,-16.4 -18.4,-34.8 0,-16.4 13.8,-32.8 16.4,-34.8l151,-151 4.6,-2.6c16.4,-7.2 30.2,-4.6 37.4,4.6 7.2,7.2 7.2,16.4 7.2,21l2.6,90.6c269.8,11.8 279,214 281.1,260.6 -0.5,1.5 -0.5,11.3 -7.7,15.9zM802.8,246.8l-76.8,116.2h65c7.2,4.6 9.2,11.8 9.2,21 0,9.2 -2.6,13.8 -9.2,21h-81.4v32.8h81.4c7.2,4.6 9.2,11.8 9.2,21 0,9.2 -2.6,13.8 -9.2,21h-81.4L709.6,563.2c2.6,23 -9.2,37.4 -30.2,37.4 -21,0 -32.8,-11.8 -32.8,-37.4L646.7,479.2h-81.4c-9.2,-4.6 -11.8,-11.8 -11.8,-21s4.6,-16.4 11.8,-21h81.4L646.7,404.5h-81.4c-7.2,-4.6 -11.8,-11.8 -11.8,-21s4.6,-13.8 11.8,-21h63l-76.8,-116.2c-7.2,-13.8 -2.6,-25.6 13.8,-34.8 13.8,-9.2 27.6,-4.6 37.4,9.2l74.2,116.2 76.8,-116.2c9.2,-13.8 21,-18.4 34.8,-11.8 14.3,7.7 18.9,19.5 14.3,37.9z" + android:fillColor="#009ad6"/> +</vector> diff --git a/generallibrary/src/main/res/drawable/ic_supplement.xml b/generallibrary/src/main/res/drawable/ic_supplement.xml new file mode 100644 index 0000000..31eadaa --- /dev/null +++ b/generallibrary/src/main/res/drawable/ic_supplement.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="220dp" + android:height="180dp" + android:viewportWidth="1024" + android:viewportHeight="1024"> + <path + android:pathData="M725.3,501.3c65.9,0 127.8,26.2 173.5,71.9A244.6,244.6 0,0 1,970.7 746.7a244.6,244.6 0,0 1,-71.9 173.5A244.6,244.6 0,0 1,725.3 992a244.6,244.6 0,0 1,-173.5 -71.9A244.6,244.6 0,0 1,480 746.7c0,-65.9 26.2,-127.8 71.9,-173.5A244.6,244.6 0,0 1,725.3 501.3zM768,53.3A117.3,117.3 0,0 1,885.3 170.7l0,311.2a308.1,308.1 0,0 0,-146.9 -44.3L725.3,437.3c-11.6,0 -23.2,0.6 -34.6,1.9A32,32 0,0 0,661.3 394.7h-298.7a32,32 0,0 0,0 64h249.5a309.2,309.2 0,0 0,-105.6 69.2A308.4,308.4 0,0 0,416 746.7a308.4,308.4 0,0 0,96.1 224.1L256,970.7A117.3,117.3 0,0 1,138.7 853.3L138.7,170.7A117.3,117.3 0,0 1,256 53.3h512zM784.8,633.6L741.1,633.6a10.1,10.1 0,0 0,-6 1.6,5.1 5.1,0 0,0 -2.2,4.4c0,1.7 0.6,3.5 1.9,5.3l2.6,4.1a16.1,16.1 0,0 1,2.1 7.6v194c0,2.9 0.9,5.2 2.6,6.9a9.4,9.4 0,0 0,6.9 2.6h35.8a9.4,9.4 0,0 0,6.9 -2.6,9.4 9.4,0 0,0 2.6,-6.9v-98.4c0,-0.9 0.3,-1.5 1.1,-1.9a5.3,5.3 0,0 1,2.7 -0.6c1.7,0 2.6,0.6 2.8,1.9l10.7,52.5c1.3,5.7 4.7,8.5 10.1,8.5h23.3c5.7,0 8.5,-2.6 8.5,-7.6a9.6,9.6 0,0 0,-0.3 -2.8l-18.9,-94.7c-0.9,-5.6 -4.2,-8.5 -10.1,-8.5h-23.6c-4.2,0 -6.3,-2.1 -6.3,-6.3L794.2,643a9.4,9.4 0,0 0,-2.5 -6.9,9.4 9.4,0 0,0 -6.9,-2.5zM696.7,671.4h-88.7a9.4,9.4 0,0 0,-7 2.5,9.4 9.4,0 0,0 -2.5,7v10.7c0,3 0.9,5.2 2.6,6.9a9.4,9.4 0,0 0,6.9 2.6h34.3c1.7,0 3,0.3 3.9,1.1a3.3,3.3 0,0 1,1.4 2.7c0,1 -0.5,2.3 -1.5,3.8l-46.3,63.9c-1.7,2.3 -2.5,4.3 -2.5,6 0,1.7 0.7,3 2.2,4.1a10.1,10.1 0,0 0,6 1.6h15.1c4.2,0 6.3,2.1 6.3,6.3v60.1c0,2.9 0.9,5.2 2.5,6.9a9.4,9.4 0,0 0,6.9 2.5h34.9a9.4,9.4 0,0 0,6.9 -2.6,9.4 9.4,0 0,0 2.6,-6.9v-41.2c0,-1.7 0.3,-3 1.1,-3.9a3.3,3.3 0,0 1,2.7 -1.4c1.3,0 2.6,0.6 4.1,1.9l9.4,8.8c2.1,2.1 4.2,3.2 6.3,3.2 1.7,0 3,-0.7 3.9,-2.2a11,11 0,0 0,1.4 -6v-17a14.2,14.2 0,0 0,-4.7 -11.3c-1.3,-1.3 -1.9,-2.4 -1.9,-3.5 0,-1.7 0.9,-3.2 2.8,-4.4a12.1,12.1 0,0 0,5.7 -10.7v-18.6a10.1,10.1 0,0 0,-1.6 -6,5.1 5.1,0 0,0 -4.4,-2.2 9.7,9.7 0,0 0,-5.4 1.9l-11.3,7.3a13,13 0,0 1,-6.9 2.8c-0.6,0 -0.9,-0.3 -0.9,-0.9 0,-2.1 0.9,-4.3 2.5,-6.6l18.9,-25.8a21.2,21.2 0,0 0,3.8 -11.9v-21.7a9.4,9.4 0,0 0,-2.5 -7,9.4 9.4,0 0,0 -6.9,-2.5zM666.2,634.2h-28a16.5,16.5 0,0 0,-7.7 1.6c-2,1 -3,2.2 -3,3.4 0,0.9 0.4,1.9 1.3,3 0.8,1.2 1.4,2.2 1.8,3l6.6,13.9c2.1,4.6 5.9,6.9 11.3,6.9h27.7c2.7,0 4.7,-0.6 6.1,-1.7a5.7,5.7 0,0 0,2 -4.6,11.9 11.9,0 0,0 -0.9,-4.7l-6.3,-13.6a11.1,11.1 0,0 0,-11 -7.3zM426.7,522.7L362.7,522.7a32,32 0,1 0,0 64L426.7,586.7a32,32 0,1 0,0 -64zM416,117.3h-64L352,128A117.3,117.3 0,0 0,469.3 245.3h85.3A117.3,117.3 0,0 0,672 128v-10.7h-64L608,128c0,29.4 -23.9,53.3 -53.3,53.3h-85.3l-5.5,-0.3A53.3,53.3 0,0 1,416 128v-10.7z" + android:fillColor="#009ad6"/> +</vector> diff --git a/generallibrary/src/main/res/layout/activity_card_return.xml b/generallibrary/src/main/res/layout/activity_card_return.xml new file mode 100644 index 0000000..37be2b2 --- /dev/null +++ b/generallibrary/src/main/res/layout/activity_card_return.xml @@ -0,0 +1,412 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@color/base_green_bg"> + + <com.dayu.baselibrary.view.TitleBar + android:id="@+id/titleBar" + android:layout_width="match_parent" + android:layout_height="@dimen/dimen_title_height" + android:background="@color/title_bar_bg" + android:elevation="4dp" + app:centerText="杩旇繕" + app:leftImage="@mipmap/icon_back" /> + + <!-- 璇诲崱鎻愮ず鍖哄煙 - 鍏ㄥ睆鏄剧ず --> + <ScrollView + android:id="@+id/scroll_read_card" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@+id/titleBar" + android:fillViewport="true" + android:visibility="visible"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="16dp"> + + <LinearLayout + android:id="@+id/card_read_LL" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:orientation="vertical"> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginBottom="16dp" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp"> + + <TextView + android:id="@+id/tv_title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="100dp" + android:gravity="center" + android:text="杩旇繕鎿嶄綔" + android:layout_marginTop="20dp" + android:textColor="@color/base_blue_bg" + android:textSize="@dimen/big_text_size" + android:textStyle="bold" /> + + <TextView + android:id="@+id/tv_subtitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/tv_title" + android:layout_marginBottom="20dp" + android:gravity="center" + android:text="璇峰皢闇�瑕佽繑杩樼殑鍗$墖璐村湪璁惧涓婅繘琛岃鍙�" + android:textColor="#333333" + android:textSize="@dimen/text_size" + android:textStyle="bold" /> + + <ImageView + android:id="@+id/iv_nfc" + android:layout_width="120dp" + android:layout_height="120dp" + android:layout_below="@+id/tv_subtitle" + android:layout_centerHorizontal="true" + android:layout_marginBottom="20dp" + android:scaleType="fitCenter" + android:src="@mipmap/nfc_write" /> + + <TextView + android:id="@+id/tv_tip" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/iv_nfc" + android:gravity="center" + android:text="璇蜂繚鎸佹墜鎸佹満鍜屽崱鐗囦笉瑕佺Щ鍔�" + android:textColor="#666666" + android:textSize="@dimen/new_card_size" /> + + </RelativeLayout> + </androidx.cardview.widget.CardView> + </LinearLayout> + + </LinearLayout> + </ScrollView> + + <!-- 鍗$墖淇℃伅鏄剧ず鍖哄煙 - 甯﹀浐瀹氬簳閮ㄦ寜閽� --> + <LinearLayout + android:id="@+id/card_info_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_above="@+id/bottom_button_container" + android:layout_below="@+id/titleBar" + android:orientation="vertical" + android:visibility="gone"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:fillViewport="true" + android:padding="12dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <!-- 鍗$墖淇℃伅鍖哄煙 --> + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="12dp"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:gravity="" + android:text="鍗$墖淇℃伅" + android:textColor="@color/base_blue_bg" + android:textSize="16sp" + android:textStyle="bold" /> + + <!-- 鎸佸崱浜� --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="1dp" + android:background="#F8F9FA" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> + + <TextView + android:layout_width="80dp" + android:layout_height="wrap_content" + android:text="鎸佸崱浜猴細" + android:textColor="#333333" + android:textSize="14sp" /> + + <TextView + android:id="@+id/tv_user_name" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="--" + android:textColor="#666666" + android:textSize="14sp" /> + </LinearLayout> + + <!-- 鍗″彿 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="1dp" + android:background="#FFFFFF" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> + + <TextView + android:layout_width="80dp" + android:layout_height="wrap_content" + android:text="鍗″湴鍧�锛�" + android:textColor="#333333" + android:textSize="14sp" /> + + <TextView + android:id="@+id/tv_card_number" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="--" + android:textColor="#666666" + android:textSize="14sp" /> + </LinearLayout> + + <!-- 鍗$墖鐘舵�� --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="1dp" + android:background="#F8F9FA" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> + + <TextView + android:layout_width="80dp" + android:layout_height="wrap_content" + android:text="鍗$墖鐘舵�侊細" + android:textColor="#333333" + android:textSize="14sp" /> + + <TextView + android:id="@+id/tv_card_status" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="姝e父" + android:textColor="#4CAF50" + android:textSize="14sp" /> + </LinearLayout> + + <!-- 鍗″唴浣欓 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="1dp" + android:background="#FFFFFF" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> + + <TextView + android:layout_width="80dp" + android:layout_height="wrap_content" + android:text="鍗″唴浣欓锛�" + android:textColor="#333333" + android:textSize="14sp" /> + + <TextView + android:id="@+id/tv_card_balance" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="0.00鍏�" + android:textColor="#FF6B35" + android:textSize="14sp" + android:textStyle="bold" /> + </LinearLayout> + + <!-- 鎵嬫満鍙� --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="#F8F9FA" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="8dp"> + + <TextView + android:layout_width="80dp" + android:layout_height="wrap_content" + android:text="鎵嬫満鍙凤細" + android:textColor="#333333" + android:textSize="14sp" /> + + <TextView + android:id="@+id/tv_phone" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="--" + android:textColor="#666666" + android:textSize="14sp" /> + </LinearLayout> + + </LinearLayout> + </androidx.cardview.widget.CardView> + + <!-- 杩旇繕鎿嶄綔鍖哄煙 --> + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:cardCornerRadius="8dp" + app:cardElevation="2dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="12dp"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:gravity="" + android:text="杩旇繕鎿嶄綔" + android:textColor="@color/base_blue_bg" + android:textSize="16sp" + android:textStyle="bold" /> + + <!-- 杩旇繕閲戦鍜屽娉ㄥ苟鎺掓樉绀� --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <!-- 杩旇繕閲戦杈撳叆 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginEnd="6dp" + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="6dp" + android:text="杩旇繕閲戦锛堝厓锛�: *" + android:textColor="#333333" + android:textSize="14sp" + android:textStyle="bold" /> + + <EditText + android:id="@+id/et_return_amount" + android:layout_width="match_parent" + android:layout_height="40dp" + android:layout_marginTop="5dp" + android:background="@drawable/edit_text_bg" + android:hint="璇疯緭鍏ヨ繑杩橀噾棰�" + android:inputType="numberDecimal" + android:padding="8dp" + android:textColor="#333333" + android:textColorHint="#999999" + android:textSize="14sp" /> + </LinearLayout> + + <!-- 澶囨敞杈撳叆 --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:layout_weight="1" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="6dp" + android:text="澶囨敞:" + android:textColor="#333333" + android:textSize="14sp" + android:textStyle="bold" /> + + <EditText + android:id="@+id/et_remarks" + android:layout_width="match_parent" + android:layout_height="80dp" + android:layout_marginTop="5dp" + android:background="@drawable/edit_text_bg" + android:hint="璇疯緭鍏ヨ繑杩樺娉�" + android:inputType="text" + android:minLines="2" + android:padding="8dp" + android:textColor="#333333" + android:textColorHint="#999999" + android:textSize="14sp" /> + </LinearLayout> + + </LinearLayout> + + </LinearLayout> + </androidx.cardview.widget.CardView> + + </LinearLayout> + </ScrollView> + </LinearLayout> + + <!-- 搴曢儴鎸夐挳鍖哄煙 --> + <LinearLayout + android:id="@+id/bottom_button_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:background="#FFFFFF" + android:elevation="4dp" + android:orientation="vertical" + android:padding="16dp" + android:visibility="gone"> + + <!-- 杩旇繕鎸夐挳 --> + <Button + android:id="@+id/btn_return" + android:layout_width="match_parent" + android:layout_height="48dp" + android:background="@drawable/button_green_bg" + android:text="纭杩旇繕" + android:textColor="#FFFFFF" + android:textSize="@dimen/big_text_size" + android:textStyle="bold" /> + + </LinearLayout> + +</RelativeLayout> \ No newline at end of file diff --git a/generallibrary/src/main/res/layout/fragment_card.xml b/generallibrary/src/main/res/layout/fragment_card.xml index 9323298..4796514 100644 --- a/generallibrary/src/main/res/layout/fragment_card.xml +++ b/generallibrary/src/main/res/layout/fragment_card.xml @@ -264,14 +264,14 @@ <ImageView android:layout_width="55dp" android:layout_height="55dp" - android:src="@drawable/xiaoka" /> + android:src="@drawable/ic_morny_back" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="6dp" android:gravity="center" - android:text="閿�鍗�" + android:text="杩旇繕" android:textColor="@color/text_selecter_color" android:textSize="14sp" /> </LinearLayout> @@ -301,9 +301,9 @@ android:padding="12dp"> <ImageView - android:layout_width="55dp" + android:layout_width="65dp" android:layout_height="55dp" - android:src="@drawable/bukou" /> + android:src="@drawable/ic_supplement" /> <TextView android:layout_width="wrap_content" @@ -316,11 +316,48 @@ </LinearLayout> </androidx.cardview.widget.CardView> + <androidx.cardview.widget.CardView + android:id="@+id/home_cancel_card" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" + android:clickable="true" + android:focusable="true" + android:foreground="?android:attr/selectableItemBackground" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:layout_constraintEnd_toStartOf="@+id/home_manage" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/home_reverse"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical" + android:padding="12dp"> + + <ImageView + android:layout_width="55dp" + android:layout_height="55dp" + android:src="@drawable/xiaoka" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:gravity="center" + android:text="閿�鍗�" + android:textColor="@color/text_selecter_color" + android:textSize="14sp" /> + </LinearLayout> + </androidx.cardview.widget.CardView> <androidx.cardview.widget.CardView android:id="@+id/home_manage" - android:layout_width="match_parent" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="6dp" android:layout_marginTop="16dp" @@ -333,7 +370,7 @@ app:cardElevation="3dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - + app:layout_constraintStart_toEndOf="@+id/home_cancel_card" app:layout_constraintTop_toBottomOf="@+id/home_deduction" app:layout_constraintVertical_bias="0.0"> -- Gitblit v1.8.0