Ver Fonte

解决部分bug:买卖大厅排序问题

yu.jie há 3 anos atrás
pai
commit
3ddacaf65c

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/global/data/TjmdTradeOrderDetailData.kt

@@ -19,7 +19,7 @@ data class TjmdTradeOrderDetailData(
     @SerializedName("pricemode")
     val pricemode : String? = "",//取价方式 - 1:市价 2: 限价 3:浮动价
     @SerializedName("orderprice")
-    val orderprice : String? = "",//委托价格
+    var orderprice : String? = "",//委托价格
     @SerializedName("orderqty")
     val orderqty : String? = "",//委托数量
     @SerializedName("userid")

+ 27 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/swaps/business/SwapsBusinessHallActivity.kt

@@ -491,9 +491,21 @@ class SwapsSellHallUI(
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
-                    businessSellHallAdapter.setNewData(it)
+                    businessSellHallAdapter.setNewData( it?.sortedByDescending { it.orderprice })
                 }
             }
+
+            viewModel.quoteDayData.bindOptional(context){
+                val price = it?.getPrice()
+
+                viewModel.businessSellHallDataList.value?.forEach{
+                    if(it.pricemode == "3"){
+                        it.orderprice = price.toString()
+                    }
+                }
+                // 每笔行情来 要重新排序
+                businessSellHallAdapter.setNewData(  viewModel.businessSellHallDataList.value?.sortedByDescending { it.orderprice })
+            }
         }
     }
 
@@ -591,7 +603,7 @@ class SwapsBuyHallUI(
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            viewModel.businessBuyHallDataList.bindOptional(context) {
+            viewModel.businessBuyHallDataList.bindOptional(context) { it ->
                 if (it?.isEmpty() == true || it?.size == 0) {
                     statusLayout.showEmpty()
                 } else {
@@ -599,8 +611,20 @@ class SwapsBuyHallUI(
                         swipeToLayout.finishRefresh()
                     }
                     statusLayout.showSuccess()
-                    businessBuyHallAdapter.setNewData(it)
+                    businessBuyHallAdapter.setNewData( it?.sortedBy { it.orderprice })
+                }
+            }
+
+            viewModel.quoteDayData.bindOptional(context){
+                val price = it?.getPrice()
+
+                viewModel.businessBuyHallDataList.value?.forEach{
+                    if(it.pricemode == "3"){
+                        it.orderprice = price.toString()
+                    }
                 }
+                // 每笔行情来 要重新排序
+                businessBuyHallAdapter.setNewData( viewModel.businessBuyHallDataList.value?.sortedBy { it.orderprice })
             }
         }
     }