|
|
@@ -81,6 +81,9 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
/** 是否选择限价 **/
|
|
|
lateinit var limit_price_checkbox : CheckBox
|
|
|
|
|
|
+ /** 价格变动监听 ***/
|
|
|
+ val valueChange : MutableLiveData<Int> = MutableLiveData<Int>().apply { value = 1 }
|
|
|
+
|
|
|
/** 若挂牌单为浮动价时,可以选择为市价或者限价挂单 **/
|
|
|
val priceType : MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
@@ -262,7 +265,7 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
setOnCheckedChangeListener { compoundButton, b ->
|
|
|
if (b){
|
|
|
- priceType.postValue(1)//设置为限价
|
|
|
+ priceType.postValue(2)//设置为限价
|
|
|
market_price_checkbox.isChecked = false
|
|
|
}
|
|
|
}
|
|
|
@@ -297,13 +300,13 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}
|
|
|
limit_price_edittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
- viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)//对盘面数据进行重新赋值以驱动估算价格的计算
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
- }.lparams(matchParent, autoSize(286))
|
|
|
+ }.lparams(matchParent, wrapContent)
|
|
|
|
|
|
// 价格为固定价时就为挂牌价格
|
|
|
linearLayout {
|
|
|
@@ -382,7 +385,7 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
onePriceInputNumberEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not()) {
|
|
|
- viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)//对盘面数据进行重新赋值以驱动估算价格的计算
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
}
|
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
|
@@ -472,35 +475,22 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- if (data.pricemode == "2"){//挂牌单据为固定价时
|
|
|
- val amout = data.orderprice?.toDouble()?.times(data.orderqty?.toDouble() ?: 0.0)
|
|
|
- val infoc = viewModel.tjmdTodayAccountMarginData.value?.infoc
|
|
|
- if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2){
|
|
|
- text = NumberUtils.roundNum(amout ?: 0.0,2) + "需履约保证金 : " + infoc?.getMargainValue(amout = amout ?: 0.0,number = data.orderqty?.toDouble() ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
- }else{
|
|
|
- var numberInput = 0.0
|
|
|
- if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
- numberInput = 0.0
|
|
|
- }else{
|
|
|
- numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
- }
|
|
|
- text = NumberUtils.roundNum(amout ?: 0.0,2) + "需履约保证金 : " + infoc?.getMargainValue(amout = amout ?: 0.0,number = numberInput,goodsid = goodsId ?: "0")
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
viewModel.quoteDayData.bindOptional(context){
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
+ }
|
|
|
+ valueChange.bindOptional(context){
|
|
|
if (data.pricemode == "3"){//挂牌单据为浮动价时,才会有估算金额,并且选择为市价时根据行情变动,选择为限价时根据输入的限价价格变动
|
|
|
val infoc = viewModel.tjmdTodayAccountMarginData.value?.infoc
|
|
|
if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2){
|
|
|
val numberInput = data.orderqty?.toDouble() ?: 0.0
|
|
|
if (priceType.value == 1){//市价计算
|
|
|
- text = NumberUtils.roundNum(it?.getPrice()?.times(numberInput) ?: 0.0,2) + "需履约保证金 :" + infoc?.getMargainValue(amout = it?.getPrice()?.times(numberInput) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
+ text = NumberUtils.roundNum(viewModel.quoteDayData.value?.getPrice()?.times(numberInput) ?: 0.0,2) + " 需履约保证金 :" + infoc?.getMargainValue(amout = viewModel.quoteDayData.value?.getPrice()?.times(numberInput) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
}else{//限价计算
|
|
|
if (limit_price_edittext.text.toString().isNullOrEmpty()){
|
|
|
text = "--"
|
|
|
}else{
|
|
|
val limit_price = limit_price_edittext.text.toString().toDouble()
|
|
|
- text = NumberUtils.roundNum(limit_price.times(numberInput),2) + "需履约保证金 :" + infoc?.getMargainValue(amout = limit_price.times(numberInput),number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
+ text = NumberUtils.roundNum(limit_price.times(numberInput),2) + " 需履约保证金 :" + infoc?.getMargainValue(amout = limit_price.times(numberInput),number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
@@ -509,18 +499,33 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}else{
|
|
|
val numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
if (priceType.value == 1){//市价计算
|
|
|
- text = NumberUtils.roundNum(it?.getPrice()?.times(numberInput) ?: 0.0,2) + "需履约保证金 :" + infoc?.getMargainValue(amout = it?.getPrice()?.times(numberInput) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
+ text = NumberUtils.roundNum(viewModel.quoteDayData.value?.getPrice()?.times(numberInput) ?: 0.0,2) + " 需履约保证金 :" + infoc?.getMargainValue(amout = viewModel.quoteDayData.value?.getPrice()?.times(numberInput) ?: 0.0,number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
}else{//限价计算
|
|
|
if (limit_price_edittext.text.toString().isNullOrEmpty()){
|
|
|
text = "--"
|
|
|
}else{
|
|
|
val limit_price = limit_price_edittext.text.toString().toDouble()
|
|
|
- text = NumberUtils.roundNum(limit_price.times(numberInput),2) + "需履约保证金 :" + infoc?.getMargainValue(amout = limit_price.times(numberInput),number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
+ text = NumberUtils.roundNum(limit_price.times(numberInput),2) + " 需履约保证金 :" + infoc?.getMargainValue(amout = limit_price.times(numberInput),number = numberInput ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ }else if (data.pricemode == "2"){//挂牌单据为固定价时
|
|
|
+ var numberInput = 0.0
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ numberInput = 0.0
|
|
|
+ }else{
|
|
|
+ numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ val amout = data.orderprice?.toDouble()?.times(numberInput?.toDouble() ?: 0.0)
|
|
|
+ val infoc = viewModel.tjmdTodayAccountMarginData.value?.infoc
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2){
|
|
|
+ text = NumberUtils.roundNum(amout ?: 0.0,2) + " 需履约保证金 : " + infoc?.getMargainValue(amout = amout ?: 0.0,number = data.orderqty?.toDouble() ?: 0.0,goodsid = goodsId ?: "0")
|
|
|
+ }else{
|
|
|
+ text = NumberUtils.roundNum(amout ?: 0.0,2) + " 需履约保证金 : " + infoc?.getMargainValue(amout = amout ?: 0.0,number = numberInput,goodsid = goodsId ?: "0")
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
one_delisting_amount = this
|