成功订单页面

This commit is contained in:
2026-02-12 12:44:30 +08:00
parent f562abc12f
commit b034e9371f
11 changed files with 300 additions and 104 deletions
@@ -21,8 +21,8 @@ class PurchaseOrderViewModel @Inject constructor(
/**
* 采购订单-供应商列表
*/
private val _supplierList = MutableStateFlow<List<SupplierInfo?>>(emptyList())
val supplierList: StateFlow<List<SupplierInfo?>> = _supplierList
private val _supplierList = MutableStateFlow<List<SupplierInfo>?>(emptyList())
val supplierList: StateFlow<List<SupplierInfo>?> = _supplierList
private val _firstOperate = MutableStateFlow<Boolean>(true)
val firstOperate:StateFlow<Boolean> = _firstOperate
@@ -33,6 +33,14 @@ class PurchaseOrderViewModel @Inject constructor(
/**
* 获取采购订单-供应商列表
*/
fun getOrderListNew(pageNum: Int = 1, pageSize: Int = 5, block:(List<SupplierInfo>?)-> Unit) {
launch {
val response = repository.getReceiveList(pageNum, pageSize)
block(
if (parseResponse(response)) response.result else null
)
}
}
fun getOrderList(pageNum: Int = 1, pageSize: Int = 5) {
if (pageNum != 1) {
launch {
@@ -45,7 +53,7 @@ class PurchaseOrderViewModel @Inject constructor(
response.result?.let {
updateCanLoadMore(it.size >= pageSize)
Timber.d("加载更多 canLoadMore =${it.size >= pageSize}")
_supplierList.value = _supplierList.value + it
_supplierList.value = _supplierList.value?.plus(it)
}
}
updateFirstState(false)
@@ -54,9 +62,9 @@ class PurchaseOrderViewModel @Inject constructor(
launchWithLoading {
val response = repository.getReceiveList(pageNum, pageSize)
if (parseResponse(response)) {
response.result?.let {
_supplierList.value = it
}
_supplierList.value = response.result ?: emptyList()
} else {
_supplierList.value = null
}
updateFirstState(false)
}