提现逻辑完善
This commit is contained in:
@@ -1021,6 +1021,11 @@
|
||||
android:configChanges="screenSize|orientation|keyboardHidden|mcc|mnc|locale|touchscreen|screenLayout|keyboard|navigation|fontScale|uiMode|smallestScreenSize|layoutDirection"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".earn.activity.GoldDetailActivity"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden|mcc|mnc|locale|touchscreen|screenLayout|keyboard|navigation|fontScale|uiMode|smallestScreenSize|layoutDirection"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -27,8 +27,8 @@ class EarnRecordViewModel : BaseViewModel() {
|
||||
val getConfigWithdrawLiveData: MutableLiveData<ConfigWithdrawInfo?> = _getConfigWithdrawLiveData
|
||||
|
||||
//提现
|
||||
private val _exchangeLiveData = MutableLiveData<String?>()
|
||||
val exchangeLiveData: MutableLiveData<String?> = _exchangeLiveData
|
||||
private val _exchangeLiveData = MutableLiveData<Any?>()
|
||||
val exchangeLiveData: MutableLiveData<Any?> = _exchangeLiveData
|
||||
|
||||
//绑定提现账号
|
||||
private val _boundLiveData = MutableLiveData<String?>()
|
||||
@@ -93,10 +93,6 @@ class EarnRecordViewModel : BaseViewModel() {
|
||||
fun exchange(goldNum: Long, payPwd: String) {
|
||||
safeLaunch(
|
||||
true,
|
||||
onError = {
|
||||
it.message.toast()
|
||||
_exchangeLiveData.value = null
|
||||
},
|
||||
block = {
|
||||
_exchangeLiveData.value = EarnModel.exchange(goldNum, payPwd)
|
||||
}
|
||||
|
@@ -85,13 +85,9 @@ class EarnWithdrawActivity : BaseViewBindingActivity<ActivityEarnWithdrawBinding
|
||||
}
|
||||
|
||||
earnRecordModel.exchangeLiveData.observe(this) { exchange ->
|
||||
exchange?.let {
|
||||
passWordFragment?.dismissAllowingStateLoss()
|
||||
toast(getString(R.string.withdraw_success))
|
||||
finish()
|
||||
} ?: run {
|
||||
passWordFragment?.dismissAllowingStateLoss()
|
||||
}
|
||||
passWordFragment?.dismissAllowingStateLoss()
|
||||
toast(getString(R.string.withdraw_success))
|
||||
finish()
|
||||
}
|
||||
|
||||
binding.csWithdrawAccount.setOnClickListener { view ->
|
||||
@@ -120,7 +116,7 @@ class EarnWithdrawActivity : BaseViewBindingActivity<ActivityEarnWithdrawBinding
|
||||
)
|
||||
tipDialog.show()
|
||||
} else if (binding.edGold.text.toString().toLong() < it.minGolds) {
|
||||
toast("至少需要兌換${it.minGolds}金幣")
|
||||
toast("至少需要提現${it.minGolds}金幣")
|
||||
} else if (binding.edGold.text.toString().toLong() > it.maxGolds) {
|
||||
toast("提現不能超過${it.maxGolds}金幣")
|
||||
} else {
|
||||
@@ -155,7 +151,7 @@ class EarnWithdrawActivity : BaseViewBindingActivity<ActivityEarnWithdrawBinding
|
||||
override fun onTextChanged(psw: String?) {
|
||||
val password = passWordFragment?.password?.password ?: ""
|
||||
if (password.length == 6) {
|
||||
earnRecordModel.exchange(binding.edGold.text.toString().toLong(), password)
|
||||
earnRecordModel.exchange(binding.edGold.text.toString().toLong(), DESAndBase64(password))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package com.yizhuan.erban.earn.activity
|
||||
|
||||
import com.netease.nim.uikit.StatusBarUtil
|
||||
import com.yizhuan.erban.R
|
||||
import com.yizhuan.erban.base.BaseViewBindingActivity
|
||||
import com.yizhuan.erban.databinding.ActivityGoldDetailBinding
|
||||
|
||||
/**
|
||||
* 金币明细
|
||||
*/
|
||||
class GoldDetailActivity : BaseViewBindingActivity<ActivityGoldDetailBinding>() {
|
||||
|
||||
override fun init() {
|
||||
initTitleBar(getString(R.string.gold_detail))
|
||||
}
|
||||
|
||||
override fun needSteepStateBar() = true
|
||||
|
||||
override fun setStatusBar() {
|
||||
super.setStatusBar()
|
||||
StatusBarUtil.transparencyBar(this)
|
||||
StatusBarUtil.StatusBarLightMode(this)
|
||||
}
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable-xhdpi/bg_gold_detail.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/bg_gold_detail.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_gold_detail_date_left.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_gold_detail_date_left.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 762 B |
BIN
app/src/main/res/drawable-xhdpi/ic_gold_detail_date_right.webp
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_gold_detail_date_right.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 774 B |
152
app/src/main/res/layout/activity_gold_detail.xml
Normal file
152
app/src/main/res/layout/activity_gold_detail.xml
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/color_white"
|
||||
tools:context=".earn.activity.GoldDetailActivity">
|
||||
|
||||
<com.yizhuan.erban.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_30" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@color/color_F4F0FE"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_gold_detail_date_left" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDateLeft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:textColor="@color/color_6D6B89"
|
||||
android:textSize="@dimen/sp_15"
|
||||
tools:text="2022-09-23" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/layout_dialog_custom_time_picker_01"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rvDateRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:textColor="@color/color_6D6B89"
|
||||
android:textSize="@dimen/sp_15"
|
||||
tools:text="2022-09-23" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:src="@drawable/ic_gold_detail_date_right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:background="@drawable/bg_gold_detail"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/members_sum_up_as_gold"
|
||||
android:textColor="@color/color_572714"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:text="0"
|
||||
android:textSize="@dimen/text_size_24"
|
||||
android:textColor="@color/color_572714"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:background="@color/color_F0F5F6"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:paddingEnd="@dimen/dp_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp">
|
||||
|
||||
<TextView
|
||||
android:text="@string/member"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/belong_room"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/have_exchange_gold"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/settleable_gold_coin"
|
||||
android:textSize="@dimen/sp_14"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textStyle="bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -635,5 +635,6 @@
|
||||
<color name="color_ECC36A">#ECC36A</color>
|
||||
<color name="color_ACB8D9">#ACB8D9</color>
|
||||
<color name="color_CBB788">#CBB788</color>
|
||||
<color name="color_F4F0FE">#F4F0FE</color>
|
||||
|
||||
</resources>
|
||||
|
@@ -4984,5 +4984,11 @@
|
||||
<string name="exchange_gold_to_diamond">兌換金幣獲得鉆石</string>
|
||||
<string name="consume_gold">消耗金幣</string>
|
||||
<string name="consume_gold_num">%s金幣</string>
|
||||
<string name="gold_detail">金幣明細</string>
|
||||
<string name="members_sum_up_as_gold">成員總結算金幣</string>
|
||||
<string name="member">成員</string>
|
||||
<string name="belong_room">所屬房間</string>
|
||||
<string name="have_exchange_gold">已兌換金幣</string>
|
||||
<string name="settleable_gold_coin">可結算金幣</string>
|
||||
|
||||
</resources>
|
@@ -40,7 +40,7 @@ object EarnModel : BaseModel() {
|
||||
api.getConfigWithdrawInfo()
|
||||
}
|
||||
|
||||
suspend fun exchange(goldNum: Long, payPwd: String): String? =
|
||||
suspend fun exchange(goldNum: Long, payPwd: String): Any? =
|
||||
launchRequest {
|
||||
api.exchange(goldNum, payPwd)
|
||||
}
|
||||
@@ -107,7 +107,7 @@ object EarnModel : BaseModel() {
|
||||
suspend fun exchange(
|
||||
@Query("goldNum") goldNum: Long,
|
||||
@Query("payPwd") payPwd: String
|
||||
): ServiceResult<String>
|
||||
): ServiceResult<Any>
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
Reference in New Issue
Block a user