|
|
@@ -6,7 +6,7 @@ import cn.muchinfo.rma.global.data.*
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
import cn.muchinfo.rma.netManage.base.InteractiveException
|
|
|
import cn.muchinfo.rma.view.MyApplication
|
|
|
-import cn.muchinfo.rma.view.autoWidget.remove
|
|
|
+import cn.muchinfo.rma.view.autoWidget.toArrayList
|
|
|
import cn.muchinfo.rma.view.base.BaseViewModel
|
|
|
import com.blankj.utilcode.util.LogUtils
|
|
|
import kotlinx.coroutines.GlobalScope
|
|
|
@@ -44,10 +44,10 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
|
|
|
//摘牌时选择的买卖大厅实体
|
|
|
val selectData : MutableLiveData<OrderQuoteDetailData> = MutableLiveData()
|
|
|
+
|
|
|
//弹出摘牌dialog
|
|
|
val showPriceDialog : MutableLiveData<Boolean> = MutableLiveData<Boolean>().apply { value = false }
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 查询买大厅数据
|
|
|
*/
|
|
|
@@ -57,8 +57,12 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
put("goodsid",goodsid)
|
|
|
put("buyorsell","0")
|
|
|
}
|
|
|
- MyApplication.getInstance()?.swapsManager?.queryTjmdTradeOrderDetail(params = params){isSuccess, respData, error ->
|
|
|
+ MyApplication.getInstance()?.swapsManager?.queryTjmdTradeOrderDetail(params = params){ isSuccess, respData, _ ->
|
|
|
if (isSuccess){
|
|
|
+ val newDataList = respData?.toArrayList()
|
|
|
+ newDataList?.sortWith(Comparator { t1, t2 ->
|
|
|
+ (t2.orderprice?.toDouble()?.minus(t1.orderprice?.toDouble() ?: 0.0))?.toInt() ?: 0
|
|
|
+ })
|
|
|
businessBuyHallDataList.postValue(respData)
|
|
|
}
|
|
|
}
|
|
|
@@ -73,8 +77,14 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
put("goodsid",goodsid)
|
|
|
put("buyorsell","1")
|
|
|
}
|
|
|
- MyApplication.getInstance()?.swapsManager?.queryTjmdTradeOrderDetail(params = params){isSuccess, respData, error ->
|
|
|
+ MyApplication.getInstance()?.swapsManager?.queryTjmdTradeOrderDetail(params = params){ isSuccess, respData, _ ->
|
|
|
if (isSuccess){
|
|
|
+ val newDataList = respData?.toArrayList()
|
|
|
+ newDataList?.sortWith(Comparator { t1, t2 ->
|
|
|
+ (t1.marketmaxsub?.toDouble()?.minus(t2?.marketmaxsub?.toDouble() ?: 0.0))?.toInt() ?: 0
|
|
|
+// ((t1.orderprice?.toDouble()?.plus(t1?.marketmaxsub?.toDouble() ?: 0.0))?.times(100))?.minus((t2.orderprice?.toDouble() ?: 0.0).plus(t2?.marketmaxsub?.toDouble() ?: 0.0))?.times(100)))
|
|
|
+
|
|
|
+ })
|
|
|
businessSellHallDataList.postValue(respData)
|
|
|
}
|
|
|
}
|
|
|
@@ -85,7 +95,7 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
put("loginID", GlobalDataCollection.instance?.loginRsp?.loginID.toString())
|
|
|
}
|
|
|
- MyApplication.getInstance()?.initializeManager?.getTaAccounts(params = params) { isSuccess, respData, error ->
|
|
|
+ MyApplication.getInstance()?.initializeManager?.getTaAccounts(params = params) { isSuccess, respData, _ ->
|
|
|
if (isSuccess) {
|
|
|
GlobalDataCollection.instance?.accountDataList = respData
|
|
|
resetAccountData()
|
|
|
@@ -173,7 +183,7 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
val params = mutableMapOf<String, String>().apply {
|
|
|
put("goodsCodes", goodsCodes)
|
|
|
}
|
|
|
- MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
|
|
|
+ MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, _ ->
|
|
|
if (isSuccess) {
|
|
|
if (respData?.isEmpty()?.not() == true) {
|
|
|
quoteDayData.postValue(respData[0])
|
|
|
@@ -207,7 +217,7 @@ class SwapsBusinessHallViewModel : BaseViewModel(){
|
|
|
GlobalScope.launch {
|
|
|
MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
|
|
|
tag = tag, goodsCodeSet = goodsCodes
|
|
|
- ) { isCompleted, err ->
|
|
|
+ ) { _, _ ->
|
|
|
LogUtils.eTag("dingyuehangqing", goodsCodes)
|
|
|
}
|
|
|
}
|