|
|
@@ -20,7 +20,6 @@ import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
import cn.muchinfo.rma.global.data.futureOrders.FutureHoldData
|
|
|
import cn.muchinfo.rma.global.database.AppDatabase
|
|
|
-import cn.muchinfo.rma.global.database.DataBase
|
|
|
import cn.muchinfo.rma.global.room.Builder
|
|
|
import cn.muchinfo.rma.global.toPercentage
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
@@ -39,7 +38,6 @@ import cn.muchinfo.rma.view.eventbus.MessageEvent
|
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
import cn.muchinfo.rma.view.eventbus.TradeMessageEvent
|
|
|
import com.blankj.utilcode.util.ConvertUtils
|
|
|
-import com.blankj.utilcode.util.LogUtils
|
|
|
import com.blankj.utilcode.util.TimeUtils
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
@@ -432,10 +430,10 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
numberEditText {
|
|
|
priceInputEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
-// if (value.isNotEmpty()){
|
|
|
-// viewModel.priceOrderType.postValue(FutureConstent.eOrderPriceSelectType_BidPrice)
|
|
|
-//
|
|
|
-// }
|
|
|
+ if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_BidPrice){
|
|
|
+ buy_more_text.setText(value)
|
|
|
+ sort_selling_text.setText(value)
|
|
|
+ }
|
|
|
}
|
|
|
//拿到商品信息后对输入框进行初始化
|
|
|
goodsInfoData.bindOptional(context) {
|
|
|
@@ -768,7 +766,7 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_Opposite) {//对手价/买多取卖一价
|
|
|
setText(it?.ask.toString())
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_OppositeOne) {//超价1/买多取卖一价(参照ios)
|
|
|
- setText(it?.ask.toString())
|
|
|
+ setText(setExceedPrice(it?.ask ?:0.0,0))
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_BidPrice) {//指定价就是限价--限价只需要在选择限价时赋值,其他行情推送不赋值
|
|
|
// setText(it?.last.toString())
|
|
|
}
|
|
|
@@ -781,7 +779,8 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_Opposite) {//对手价/买多取卖一价
|
|
|
setText(quoteData?.ask.toString())
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_OppositeOne) {//超价/买多取卖一价(参照ios)
|
|
|
- setText(quoteData?.ask.toString())
|
|
|
+// setText(quoteData?.ask.toString())
|
|
|
+ setText(setExceedPrice(quoteData?.ask ?:0.0,0))
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_BidPrice) {//指定价就是限价
|
|
|
setText(quoteData?.last.toString())
|
|
|
}
|
|
|
@@ -839,7 +838,7 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_Opposite) {//对手价/卖多取买一价
|
|
|
setText(it?.ask.toString())
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_OppositeOne) {//超价1/卖多取买一价(参照ios)
|
|
|
- setText(it?.ask.toString())
|
|
|
+ setText(setExceedPrice(it?.bid ?: 0.0,1))
|
|
|
} else if (viewModel.priceOrderType.value == FutureConstent.eOrderPriceSelectType_BidPrice) {//指定价就是限价--限价只需要在选择限价时赋值,其他行情推送不赋值
|
|
|
// setText(it?.last.toString())
|
|
|
}
|
|
|
@@ -852,7 +851,8 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_Opposite) {//对手价/卖多取买一价
|
|
|
setText(quoteData?.bid.toString())
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_OppositeOne) {//超价/卖多取买一价(参照ios)
|
|
|
- setText(quoteData?.bid.toString())
|
|
|
+ setText(setExceedPrice(quoteData?.bid ?:0.0,1))
|
|
|
+
|
|
|
} else if (it == FutureConstent.eOrderPriceSelectType_BidPrice) {//指定价就是限价
|
|
|
setText(quoteData?.last.toString())
|
|
|
}
|
|
|
@@ -1036,6 +1036,32 @@ class GoodsTradeActivity : BaseActivity<GoodsTradeViewModel>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ fun setExceedPrice(price : Double,buyorsell : Int) : String{
|
|
|
+ val quoteDayData = viewModel.quoteDayData.value
|
|
|
+ var LimitPrice = ""
|
|
|
+ var setp = 0.0
|
|
|
+ val overDot = GlobalDataCollection.instance?.loginQueryData?.systemParams?.find {
|
|
|
+ it.paramcode == "148"
|
|
|
+ }?.paramvalue
|
|
|
+ setp = if ("0" == overDot) { //如果没有拿到超价点数则按照原来的计算吧
|
|
|
+ goodsInfoData.value?.quoteminunit?.toDouble() ?:0.0 * Math.pow(
|
|
|
+ 10.0,
|
|
|
+ -(goodsInfoData.value?.decimalplace?.toDouble() ?:0.0)
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ goodsInfoData.value?.quoteminunit?.toDouble() ?:0.0 * Math.pow(
|
|
|
+ 10.0,
|
|
|
+ -(goodsInfoData.value?.decimalplace?.toDouble() ?:0.0)
|
|
|
+ ) * java.lang.Double.valueOf(overDot)
|
|
|
+ }
|
|
|
+ if (buyorsell == 0){//买
|
|
|
+ LimitPrice = NumberUtils.roundNum(quoteDayData?.ask?.plus(setp).toString(),goodsInfoData.value?.decimalplace ?:2)
|
|
|
+ }else {//卖
|
|
|
+ LimitPrice = NumberUtils.roundNum(quoteDayData?.ask?.minus(setp).toString(),goodsInfoData.value?.decimalplace ?:2)
|
|
|
+ }
|
|
|
+ return LimitPrice
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 操作请求
|
|
|
* @param buyOrSell Int 0买1卖
|