钱包列表

This commit is contained in:
lijia 2024-04-17 09:02:24 +08:00
parent a53d5553cd
commit 8e29418137
9 changed files with 223 additions and 97 deletions

View File

@ -5,6 +5,7 @@ import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.dahe.gldriver.R
import com.dahe.glex.bean.WaterInfo
import com.dahe.glex.bean.WayBillBean
/**
@ -13,8 +14,16 @@ import com.dahe.glex.bean.WayBillBean
* @Date 2024/2/1 10:41
* @Description TODO
*/
class WalletAdapter : BaseQuickAdapter<WayBillBean, QuickViewHolder>() {
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WayBillBean?) {
class WalletAdapter : BaseQuickAdapter<WaterInfo, QuickViewHolder>() {
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WaterInfo?) {
holder.run {
setText(
R.id.tvTitle,
if (item?.businessType == "2") """运单结算:${item?.waybillNum}""" else "提现"
)
setText(R.id.tvMoney, if (item?.businessType == "2") """+${item?.amount}""" else """-${item?.amount}""")
setText(R.id.tvCarType, item?.opTime)
}
}
override fun onCreateViewHolder(

View File

@ -49,6 +49,7 @@ data class UserDetail(
var auditStatus: String="",
var driverBankcardAddress: String="",
var driverBankcardNumber: String="",
var driverBankcardName: String="",
var driverBankcardPhotoUrl: String="",
var driverId: String="",
var idcardAddress: String="",
@ -81,3 +82,20 @@ data class UserDetail(
var updateTime: String=""
)
data class WalletInfo(
val acctBal: String,
val accumulatedRevenue: String,
val actualBal: String,
val bankCountNum: String,
val freezeBal: String
)
data class WaterInfo(
val amount: String,
val businessType: String,
val waybillNum: String,
val id: String,
val opTime: String,
val withdrawalsStatus: String
)

View File

@ -139,7 +139,7 @@ interface Api {
* @param imgUrl String
* @return Observable<CommonResponseBean<OcrPersonBean>>
*/
@GET(BASE_URL+"ocr/aliyunOcr/recognizeCarNumber")
@GET(BASE_URL + "ocr/aliyunOcr/recognizeCarNumber")
fun recognizeCarNumber(
@Query("imgUrl") imgUrl: String
): Observable<CommonResponseBean<OcrPersonBean>>
@ -473,6 +473,23 @@ interface Api {
@GET(BASE_URL + "driver/opinions/getDriverOpinionsStatInfo")
fun driverRate(): Observable<CommonResponseBean<RateBean>>
/**
* 查询余额信息
* @return Observable<CommonResponseBean<RateBean>>
*/
@GET(BASE_URL + "driver/driver/getDriverBalance")
fun getDriverBalance(): Observable<CommonResponseBean<WalletInfo>>
/**
* 查询司机资金流水
* @return Observable<CommonResponseBean<RateBean>>
*/
@GET(BASE_URL + "driver/driver/selectDriverCapitalFlows")
fun selectDriverCapitalFlows(
@Query("pageNum") pageNum: Int = 1,
@Query("pageSize") pageSize: Int = 20
): Observable<CommonResponseBean<MutableList<WaterInfo>>>
/**
* 查看单据
@ -526,8 +543,8 @@ interface Api {
* 获取易签宝实名认证
* @return Observable<CommonResponseBean<QuestionBean>>
*/
@GET(BASE_URL+"driver/driver/getESignPsnAuthUrl")
fun getESignPsnAuthUrl():Observable<CommonResponseBean<FaceBean>>
@GET(BASE_URL + "driver/driver/getESignPsnAuthUrl")
fun getESignPsnAuthUrl(): Observable<CommonResponseBean<FaceBean>>
companion object {
// String BASE_URL = "https://tmstest.dahehuoyun.com/";

View File

@ -27,6 +27,7 @@ import com.dahe.gldriver.utils.AppVersionUtils
import com.dahe.gldriver.utils.SPUtils
import com.dahe.gldriver.utils.UserUtils
import com.dahe.glex.bean.UserBean
import com.dahe.glex.bean.WalletInfo
import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean
@ -199,6 +200,20 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
refreshView()
}
}))
DataManager.getInstance().getDriverBalance()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<WalletInfo>() {
override fun onSuccess(t: CommonResponseBean<WalletInfo>) {
super.onSuccess(t)
binding.run {
tvWalletBa.text = t.data.acctBal
tvBankNum.text = t.data.bankCountNum
tvIncome.text = t.data.accumulatedRevenue
}
}
}))
}
private fun refreshView() {

View File

@ -6,7 +6,9 @@ import android.view.View
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.CarsAdapter
import com.dahe.gldriver.adapter.RateAdapter
import com.dahe.gldriver.adapter.WalletAdapter
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.databinding.ActivityWalletBinding
@ -16,8 +18,11 @@ import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.account.authperson.EditBankCardActivity
import com.dahe.gldriver.utils.CommonPopUtils
import com.dahe.glex.bean.UserDetail
import com.dahe.glex.bean.WalletInfo
import com.dahe.glex.bean.WaterInfo
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ActivityUtils
@ -33,11 +38,15 @@ import io.reactivex.rxjava3.schedulers.Schedulers
* @Date 2024/2/1 09:41
* @Description 钱包
*/
class WalletActivity : BaseActivity<ActivityWalletBinding>() {
class WalletActivity : BaseActivity<ActivityWalletBinding>(), RefreshCallBack {
lateinit var adapter: WalletAdapter
override fun initView(savedInstanceState: Bundle?) {
setStatusHeightParams(binding.rlTop)
setTitleBar("钱包", true, true)
binding.run {
setRefresh(refresh, this@WalletActivity)
tvLeft.setOnClickListener {
ActivityUtils.startActivity(mContext, EditBankCardActivity::class.java)
}
@ -45,22 +54,11 @@ class WalletActivity : BaseActivity<ActivityWalletBinding>() {
getCurrBank()
}
}
initRec()
}
override fun initDate() {
var datas = mutableListOf<WayBillBean>(
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean(),
WayBillBean()
)
var adapter = binding.recycler.run {
private fun initRec() {
adapter = binding.recycler.run {
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
addItemDecoration(
RecycleViewDivider(
@ -71,9 +69,52 @@ class WalletActivity : BaseActivity<ActivityWalletBinding>() {
)
adapter = WalletAdapter()
adapter as WalletAdapter
}.apply {
isStateViewEnable = true
}
}
adapter.submitList(datas)
override fun initDate() {
getWalletInfo()
getWaterList()
}
private fun getWalletInfo() {
DataManager.getInstance().getDriverBalance()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<WalletInfo>() {
override fun onSuccess(t: CommonResponseBean<WalletInfo>) {
super.onSuccess(t)
binding.run {
tvCanCash.text = t.data.actualBal
tvAllCash.text = t.data.acctBal
tvInCome.text = t.data.accumulatedRevenue
}
}
}))
}
private fun getWaterList() {
DataManager.getInstance().selectDriverCapitalFlows(mRefreshPage,mRefreshCount)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<WaterInfo>>() {
override fun onSuccess(t: CommonResponseBean<MutableList<WaterInfo>>) {
super.onSuccess(t)
if (t.data == null || t.data.size == 0) {
adapter.submitList(null)
adapter.setStateViewLayout(mContext, R.layout.empty_view)
} else {
adapter?.submitList(t.data)
}
setFinishRefresh(
binding.refresh,
t.total > mRefreshPage * mRefreshCount
)
}
}))
}
@ -98,4 +139,8 @@ class WalletActivity : BaseActivity<ActivityWalletBinding>() {
}
}))
}
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
initDate()
}
}

View File

@ -34,7 +34,7 @@ class InputMoneyPop(
val btnOk = findViewById<Button>(R.id.btnOk)
tvName.text = """提现到
|${userInfo.driverBankcardAddress}${userInfo.driverBankcardNumber.substring(userInfo.driverBankcardNumber.length - 4)}
|${userInfo.driverBankcardName}${userInfo.driverBankcardNumber.substring(userInfo.driverBankcardNumber.length - 4)}
""".trimMargin()
etMoney.setSelection(etMoney.length())

View File

@ -13,80 +13,94 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlMoney"
android:layout_width="@dimen/dp_345"
android:layout_height="@dimen/dp_185"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_110"
android:background="@drawable/money_bg"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_22">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="可提现金额(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvCanCash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_32"
android:text="8556.52"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_88"
android:text="总余额(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvAllCash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_114"
android:text="10556.52"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvInCome"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_88"
android:text="累计收益(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvInCome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_114"
android:layout_marginRight="@dimen/dp_50"
android:text="10556.52"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_marginTop="@dimen/dp_12"
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id="@+id/refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rlMoney"
android:layout_marginBottom="@dimen/dp_56"/>
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_110">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlMoney"
android:layout_width="@dimen/dp_345"
android:layout_height="@dimen/dp_185"
android:layout_gravity="center_horizontal"
android:background="@drawable/money_bg"
android:paddingLeft="@dimen/dp_13"
android:paddingTop="@dimen/dp_22">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="可提现金额(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvCanCash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_32"
android:text="8556.52"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_88"
android:text="总余额(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvAllCash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_114"
android:text="10556.52"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvInCome"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_88"
android:text="累计收益(元)"
android:textColor="@color/white"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvInCome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="@dimen/dp_80"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/dp_114"
android:layout_marginRight="@dimen/dp_50"
android:text="0"
android:textColor="@color/white"
android:textSize="@dimen/sp_24" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:layout_weight="1" />
</LinearLayout>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_56"

View File

@ -156,6 +156,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/tvWalletBa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
@ -183,9 +184,10 @@
android:orientation="vertical">
<TextView
android:id="@+id/tvBankNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:text="1"
android:textColor="@color/black"
android:textSize="@dimen/sp_20"
android:textStyle="bold"></TextView>
@ -207,6 +209,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/tvIncome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2643.5"

View File

@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_70"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@color/white"
@ -24,9 +25,10 @@
android:layout_weight="1">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="运费结算204554127412"
tools:text="运费结算204554127412"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/sp_15" />
@ -51,14 +53,17 @@
android:gravity="center_horizontal">
<TextView
android:id="@+id/tvMoney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+2000"
tools:text="+2000"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/sp_15" />
<TextView
android:visibility="gone"
android:id="@+id/tvBal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"