|
|
@@ -151,6 +151,7 @@ class SwapsListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
EventBus.getDefault().register(this)
|
|
|
createLoadingDialog(hintStr = "").bindTaskStatus(this, viewModel.loadingDialogStatus)
|
|
|
viewModel.resetAccountData()
|
|
|
+ viewModel.queryTjmdTodayAccountMargin(goodsId = goodsId ?: "")
|
|
|
initializeData()
|
|
|
initMenuData()
|
|
|
verticalLayout {
|
|
|
@@ -238,8 +239,8 @@ class SellListedUI(
|
|
|
/** SeekBar **/
|
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
- /** 挂牌金额 **/
|
|
|
- lateinit var one_delisting_amount: TextView
|
|
|
+ /** 价格变动监听 ***/
|
|
|
+ val valueChange : MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
//初始化一些数据
|
|
|
fun initializeData() {
|
|
|
@@ -393,7 +394,7 @@ class SellListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
- text = "基差"
|
|
|
+ text = "点差"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -404,7 +405,7 @@ class SellListedUI(
|
|
|
numberEditText {
|
|
|
basis_price_input = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
- viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
text = "0"
|
|
|
setTextColor(R.color.buy_hall_color)
|
|
|
@@ -461,6 +462,7 @@ class SellListedUI(
|
|
|
|
|
|
numberEditText {
|
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
text = NumberUtils.roundNum(
|
|
|
it?.getPrice()?.toString(),
|
|
|
viewModel.goodsInfo.value?.decimalplace ?: 2
|
|
|
@@ -473,14 +475,7 @@ class SellListedUI(
|
|
|
onePriceInputEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not() && value.toString().toDouble() != 0.0) {
|
|
|
- if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
- value.toString().toDouble().times(
|
|
|
- onePriceInputNumberEdittext.text.toString()?.toDouble()
|
|
|
- )?.times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
viewModel.maxSellListedingNumber.postValue(
|
|
|
viewModel.usedAccountData.value?.canUserAmount?.div(
|
|
|
value?.toString()?.toDouble() ?: 1.0
|
|
|
@@ -520,15 +515,7 @@ class SellListedUI(
|
|
|
}
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not()) {
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
- .not()
|
|
|
- ) {
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
- value.toString().toDouble().times(
|
|
|
- onePriceInputEdittext.text.toString()?.toDouble()
|
|
|
- )?.times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
|
|
|
- )
|
|
|
- }
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
}
|
|
|
setTextColor(R.color.buy_hall_color)
|
|
|
@@ -611,7 +598,7 @@ class SellListedUI(
|
|
|
if (it == 1){//固定价
|
|
|
text = "挂牌金额"
|
|
|
}else{//浮动价
|
|
|
- text = "挂牌金额"
|
|
|
+ text = "估算金额"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -622,25 +609,50 @@ class SellListedUI(
|
|
|
}
|
|
|
//公式 :挂牌金额*挂牌数量*合约单位
|
|
|
textView {
|
|
|
- viewModel.quoteDayData.bindOptional(context){
|
|
|
- if (priceType.value == 2){
|
|
|
- var basis = 0.0
|
|
|
+ valueChange.bindOptional(context){
|
|
|
+ val infoc = viewModel.tjmdTodayAccountMarginData.value?.infoc
|
|
|
+ if (priceType.value == 2){//浮动价
|
|
|
+ var basis = 0.0//输入的点差
|
|
|
if (basis_price_input.text.toString().isNullOrEmpty()){
|
|
|
basis = 0.0
|
|
|
}else{
|
|
|
basis = basis_price_input.text.toString().toDouble()
|
|
|
}
|
|
|
- text = NumberUtils.roundNum(
|
|
|
- (it?.getPrice()?.plus(basis))?.times(
|
|
|
- onePriceInputEdittext.text.toString().toDouble()
|
|
|
- .times(
|
|
|
- viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
- )
|
|
|
- ) ?: 0.0, 2
|
|
|
+ var numberInput = 0.0//输入的数量
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ numberInput = 0.0
|
|
|
+ }else{
|
|
|
+ numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ val amount = (viewModel.quoteDayData.value?.getPrice()?.plus(basis))?.times(
|
|
|
+ numberInput.times(
|
|
|
+ viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
+ )
|
|
|
+ ) ?: 0.0
|
|
|
+ text = NumberUtils.roundNum(amount, 2) + "需履约保证金 :" + infoc?.getMargainValue(amout = amount,number = numberInput,goodsid = goodsId)
|
|
|
+ }else if (priceType.value == 1){//固定价
|
|
|
+ var priceInput = 0.0//输入的固定价
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ priceInput = 0.0
|
|
|
+ }else{
|
|
|
+ priceInput = onePriceInputEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ var numberInput = 0.0//输入的数量
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ numberInput = 0.0
|
|
|
+ }else{
|
|
|
+ numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+
|
|
|
+ val amount = priceInput.times(
|
|
|
+ numberInput.times(
|
|
|
+ viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
+ )
|
|
|
)
|
|
|
+ text = NumberUtils.roundNum(amount, 2) + "需履约保证金 :" + infoc?.getMargainValue(amout = amount,number = numberInput,goodsid = goodsId)
|
|
|
}
|
|
|
}
|
|
|
- one_delisting_amount = this
|
|
|
+
|
|
|
text = "--"
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -649,7 +661,7 @@ class SellListedUI(
|
|
|
|
|
|
textView {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
+ text = "可用资金" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.canUserAmount.toString()), 2)
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -766,8 +778,8 @@ class BuyListedUI(
|
|
|
/** SeekBar **/
|
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
- /** 挂牌金额 **/
|
|
|
- lateinit var one_delisting_amount: TextView
|
|
|
+ /** 价格变动监听 ***/
|
|
|
+ val valueChange : MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
//初始化一些数据
|
|
|
fun initializeData() {
|
|
|
@@ -916,7 +928,7 @@ class BuyListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
- text = "基差"
|
|
|
+ text = "点差"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(wrapContent, wrapContent) {
|
|
|
@@ -927,7 +939,7 @@ class BuyListedUI(
|
|
|
numberEditText {
|
|
|
basis_price_input = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
- viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
text = "0"
|
|
|
setTextColor(R.color.buy_hall_color)
|
|
|
@@ -985,6 +997,7 @@ class BuyListedUI(
|
|
|
|
|
|
numberEditText {
|
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
text = NumberUtils.roundNum(
|
|
|
it?.getPrice()?.toString(),
|
|
|
viewModel.goodsInfo.value?.decimalplace ?: 2
|
|
|
@@ -997,15 +1010,7 @@ class BuyListedUI(
|
|
|
onePriceInputEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not() && value.toString().toDouble() != 0.0) {
|
|
|
- if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty().not()) {
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
- value.toString().toDouble()
|
|
|
- .times(
|
|
|
- onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
- )
|
|
|
- .times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
|
|
|
- )
|
|
|
- }
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
viewModel.maxBuyListedingNumber.postValue(
|
|
|
viewModel.usedAccountData.value?.canUserAmount?.div(
|
|
|
value?.toString()?.toDouble() ?: 1.0
|
|
|
@@ -1042,18 +1047,7 @@ class BuyListedUI(
|
|
|
onePriceInputNumberEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not()) {
|
|
|
- if (onePriceInputEdittext.text.toString().isNullOrEmpty()
|
|
|
- .not()
|
|
|
- ) {
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
- value.toString().toDouble().times(
|
|
|
- onePriceInputEdittext.text.toString().toDouble()
|
|
|
- .times(
|
|
|
- viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
- )
|
|
|
- ), 2
|
|
|
- )
|
|
|
- }
|
|
|
+ valueChange.postValue(valueChange.value)
|
|
|
}
|
|
|
}
|
|
|
setTextColor(R.color.buy_hall_color)
|
|
|
@@ -1136,7 +1130,7 @@ class BuyListedUI(
|
|
|
if (it == 1){//固定价
|
|
|
text = "挂牌金额"
|
|
|
}else{//浮动价
|
|
|
- text = "挂牌金额"
|
|
|
+ text = "估算金额"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1147,25 +1141,50 @@ class BuyListedUI(
|
|
|
}
|
|
|
//公式 :挂牌金额*挂牌数量*合约单位
|
|
|
textView {
|
|
|
- viewModel.quoteDayData.bindOptional(context){
|
|
|
- if (priceType.value == 2){
|
|
|
- var basis = 0.0
|
|
|
+ valueChange.bindOptional(context){
|
|
|
+ val infoc = viewModel.tjmdTodayAccountMarginData.value?.infoc
|
|
|
+ if (priceType.value == 2){//浮动价
|
|
|
+ var basis = 0.0//输入的点差
|
|
|
if (basis_price_input.text.toString().isNullOrEmpty()){
|
|
|
basis = 0.0
|
|
|
}else{
|
|
|
basis = basis_price_input.text.toString().toDouble()
|
|
|
}
|
|
|
- text = NumberUtils.roundNum(
|
|
|
- (it?.getPrice()?.plus(basis))?.times(
|
|
|
- onePriceInputEdittext.text.toString().toDouble()
|
|
|
- .times(
|
|
|
- viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
- )
|
|
|
- ) ?: 0.0, 2
|
|
|
+ var numberInput = 0.0//输入的数量
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ numberInput = 0.0
|
|
|
+ }else{
|
|
|
+ numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ val amount = (viewModel.quoteDayData.value?.getPrice()?.plus(basis))?.times(
|
|
|
+ numberInput.times(
|
|
|
+ viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
+ )
|
|
|
+ ) ?: 0.0
|
|
|
+ text = NumberUtils.roundNum(amount, 2) + "需履约保证金 :" + infoc?.getMargainValue(amout = amount,number = numberInput,goodsid = goodsId)
|
|
|
+ }else if (priceType.value == 1){//固定价
|
|
|
+ var priceInput = 0.0//输入的固定价
|
|
|
+ if (onePriceInputEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ priceInput = 0.0
|
|
|
+ }else{
|
|
|
+ priceInput = onePriceInputEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ var numberInput = 0.0//输入的数量
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
+ numberInput = 0.0
|
|
|
+ }else{
|
|
|
+ numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ }
|
|
|
+
|
|
|
+ val amount = priceInput.times(
|
|
|
+ numberInput.times(
|
|
|
+ viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
+ )
|
|
|
)
|
|
|
+ text = NumberUtils.roundNum(amount, 2) + "需履约保证金 :" + infoc?.getMargainValue(amout = amount,number = numberInput,goodsid = goodsId)
|
|
|
}
|
|
|
}
|
|
|
- one_delisting_amount = this
|
|
|
+
|
|
|
text = "--"
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -1174,7 +1193,7 @@ class BuyListedUI(
|
|
|
|
|
|
textView {
|
|
|
viewModel.usedAccountData.bindOptional(context) {
|
|
|
- text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
+ text = "可用资金" + NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.canUserAmount.toString()), 2)
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|