|
|
@@ -16,9 +16,11 @@ import androidx.viewpager.widget.ViewPager
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.AccountData
|
|
|
+import cn.muchinfo.rma.global.data.QuoteGoodsListData
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
import cn.muchinfo.rma.global.database.DataBase
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
+import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText2
|
|
|
@@ -45,7 +47,7 @@ import org.jetbrains.anko.support.v4.viewPager
|
|
|
/**
|
|
|
* 合约交易挂牌操作
|
|
|
*/
|
|
|
-class PurchaseListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
+class SwapsListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
|
@@ -57,6 +59,14 @@ class PurchaseListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
/** 传入的goodscode **/
|
|
|
val goodsCode by lazy { intent.getStringExtra("goodsCode") }
|
|
|
|
|
|
+ //标的合约
|
|
|
+ val quoteGoodsListData by lazy { intent.getParcelableExtra<QuoteGoodsListData>("quoteGoodsListData") as QuoteGoodsListData }
|
|
|
+
|
|
|
+ /** 用于订阅行情的唯一标识 */
|
|
|
+ val thisTag by lazy {
|
|
|
+ "SwapsListedActivity"
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 卖挂ui
|
|
|
*/
|
|
|
@@ -120,6 +130,7 @@ class PurchaseListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
|
|
|
override fun onDestroy() {
|
|
|
super.onDestroy()
|
|
|
+ viewModel.removeSubscriptQuote(thisTag)
|
|
|
EventBus.getDefault().unregister(this)
|
|
|
}
|
|
|
|
|
|
@@ -128,7 +139,11 @@ class PurchaseListedActivity : BaseActivity<SwapsListedViewModel>() {
|
|
|
viewModel.goodsInfo.postValue(
|
|
|
DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId?.toInt() ?: 0)
|
|
|
)
|
|
|
- viewModel.queryQuoteDay(goodsCodes = goodsCode ?: "",isShowLoading = false)
|
|
|
+ viewModel.queryQuoteDay(
|
|
|
+ tag = thisTag,
|
|
|
+ goodsCodes = quoteGoodsListData.refgoodscode ?: "",
|
|
|
+ isShowLoading = false
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
@@ -211,6 +226,15 @@ class SellListedUI(
|
|
|
/** 挂牌数量 **/
|
|
|
lateinit var onePriceInputNumberEdittext: MangeNumberEditText2
|
|
|
|
|
|
+ /** 浮动价时的基差 **/
|
|
|
+ lateinit var basis_price_input: MangeNumberEditText2
|
|
|
+
|
|
|
+ /** 为浮动价挂牌时的估算价 **/
|
|
|
+ lateinit var estimate_price: TextView
|
|
|
+
|
|
|
+ /** 当前的价格类型 1 是固定价 2 是浮动价 **/
|
|
|
+ val priceType: MutableLiveData<Int> = MutableLiveData()
|
|
|
+
|
|
|
/** SeekBar **/
|
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
@@ -220,7 +244,11 @@ class SellListedUI(
|
|
|
//初始化一些数据
|
|
|
fun initializeData() {
|
|
|
selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
- viewModel.queryContractTradePosition(accountid = GlobalDataCollection.instance?.accountId.toString(),goodsId = goodsId ?: "")
|
|
|
+ viewModel.queryContractTradePosition(
|
|
|
+ accountid = GlobalDataCollection.instance?.accountId.toString(),
|
|
|
+ goodsId = goodsId ?: ""
|
|
|
+ )
|
|
|
+ priceType.postValue(1)
|
|
|
}
|
|
|
|
|
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
|
@@ -228,11 +256,7 @@ class SellListedUI(
|
|
|
verticalLayout {
|
|
|
initializeData()
|
|
|
linearLayout {
|
|
|
- viewModel.tradePositionData.bindOptional(context){
|
|
|
- val maxNumber = it?.enableqty?.toInt() ?: 0
|
|
|
- //对最大可摘进行赋值
|
|
|
- viewModel.maxSellListedingNumber.postValue(maxNumber.toString())
|
|
|
- }
|
|
|
+
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
activity.creatAccountDataSheetDialog(
|
|
|
@@ -276,11 +300,154 @@ class SellListedUI(
|
|
|
|
|
|
itemView()
|
|
|
|
|
|
- verticalLayout {
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "价格类型"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ checkBox {
|
|
|
+ isChecked = true
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ isChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buttonDrawable = null
|
|
|
+ background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ if (b) {
|
|
|
+ priceType.postValue(1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
|
|
|
+ textView {
|
|
|
+ text = "固定价"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ checkBox {
|
|
|
+
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 1) {
|
|
|
+ isChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buttonDrawable = null
|
|
|
+ background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ if (b) {
|
|
|
+ priceType.postValue(2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ text = "浮动价"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "基差"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ numberEditText {
|
|
|
+ basis_price_input = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)
|
|
|
+ }
|
|
|
+ text = "0"
|
|
|
+ setTextColor(R.color.buy_hall_color)
|
|
|
+ }.lparams(0, autoSize(72), 1f){
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ if (basis_price_input.text.toString().isNullOrEmpty().not()) {
|
|
|
+ text = "估算价" + NumberUtils.roundNum(
|
|
|
+ it?.getPrice()?.plus(basis_price_input.text.toString().toDouble())
|
|
|
+ ?: 0.0, 2
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ estimate_price = this
|
|
|
+ text = "估算价--"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(250)
|
|
|
+ topMargin = autoSize(30)
|
|
|
+ bottomMargin = autoSize(30)
|
|
|
}
|
|
|
|
|
|
linearLayout {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 1) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
@@ -293,19 +460,32 @@ class SellListedUI(
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
numberEditText {
|
|
|
- viewModel.quoteDayData.bindOptional(context){
|
|
|
- text = NumberUtils.roundNum(it?.getPrice()?.toString(),viewModel.goodsInfo.value?.decimalplace ?: 2)
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ text = NumberUtils.roundNum(
|
|
|
+ it?.getPrice()?.toString(),
|
|
|
+ viewModel.goodsInfo.value?.decimalplace ?: 2
|
|
|
+ )
|
|
|
}
|
|
|
- viewModel.goodsInfo.bindOptional(context){
|
|
|
+ viewModel.goodsInfo.bindOptional(context) {
|
|
|
decimal = it?.decimalplace ?: 2
|
|
|
}
|
|
|
text = "0"
|
|
|
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)
|
|
|
+ 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
|
|
|
+ )
|
|
|
}
|
|
|
+
|
|
|
+ viewModel.maxSellListedingNumber.postValue(
|
|
|
+ viewModel.usedAccountData.value?.canUserAmount?.div(
|
|
|
+ value?.toString()?.toDouble() ?: 1.0
|
|
|
+ )?.toInt().toString()
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
setTextColor(R.color.buy_hall_color)
|
|
|
@@ -340,8 +520,14 @@ 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)
|
|
|
+ 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
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -372,7 +558,8 @@ class SellListedUI(
|
|
|
setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
|
|
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
onePriceInputNumberEdittext.text = NumberUtils.roundNum(
|
|
|
- viewModel.maxSellListedingNumber.value?.toDouble()?.times(p1.div(100.0))
|
|
|
+ viewModel.maxSellListedingNumber.value?.toDouble()
|
|
|
+ ?.times(p1.div(100.0))
|
|
|
.toString(), 0
|
|
|
)
|
|
|
}
|
|
|
@@ -420,7 +607,14 @@ class SellListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "挂牌金额"
|
|
|
+ priceType.bindOptional(context){
|
|
|
+ if (it == 1){//固定价
|
|
|
+ text = "挂牌金额"
|
|
|
+ }else{//浮动价
|
|
|
+ text = "挂牌金额"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
|
@@ -428,6 +622,24 @@ class SellListedUI(
|
|
|
}
|
|
|
//公式 :挂牌金额*挂牌数量*合约单位
|
|
|
textView {
|
|
|
+ viewModel.quoteDayData.bindOptional(context){
|
|
|
+ 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
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
one_delisting_amount = this
|
|
|
text = "--"
|
|
|
textSizeAuto = 29
|
|
|
@@ -435,6 +647,17 @@ class SellListedUI(
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
+ textView {
|
|
|
+ viewModel.usedAccountData.bindOptional(context) {
|
|
|
+ text = "可用资金" + NumberUtils.roundNum(it?.canUserAmount.toString(), 2)
|
|
|
+ }
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ topMargin = autoSize(20)
|
|
|
+ marginStart = autoSize(250)
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
verticalEmptyView()
|
|
|
|
|
|
@@ -459,7 +682,16 @@ class SellListedUI(
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
|
|
|
+ var marketMaxSub = 0.0
|
|
|
+ if (priceType.value == 2){
|
|
|
+ if (basis_price_input.text.toString().isNullOrEmpty().not()){
|
|
|
+ marketMaxSub = basis_price_input.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
viewModel.commit(
|
|
|
+ marketMaxSub = marketMaxSub,
|
|
|
+ pricetype = priceType.value ?: 1,
|
|
|
goodsInfo = viewModel.goodsInfo.value ?: GoodsInfo(),
|
|
|
isListed = true,
|
|
|
orderPrice = onePriceInputEdittext.text.toString(),
|
|
|
@@ -522,6 +754,15 @@ class BuyListedUI(
|
|
|
/** 挂牌数量 **/
|
|
|
lateinit var onePriceInputNumberEdittext: MangeNumberEditText2
|
|
|
|
|
|
+ /** 浮动价时的基差 **/
|
|
|
+ lateinit var basis_price_input: MangeNumberEditText2
|
|
|
+
|
|
|
+ /** 为浮动价挂牌时的估算价 **/
|
|
|
+ lateinit var estimate_price: TextView
|
|
|
+
|
|
|
+ /** 当前的价格类型 1 是固定价 2 是浮动价 **/
|
|
|
+ val priceType: MutableLiveData<Int> = MutableLiveData()
|
|
|
+
|
|
|
/** SeekBar **/
|
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
@@ -530,6 +771,7 @@ class BuyListedUI(
|
|
|
|
|
|
//初始化一些数据
|
|
|
fun initializeData() {
|
|
|
+ priceType.postValue(1)
|
|
|
selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
}
|
|
|
|
|
|
@@ -586,6 +828,153 @@ class BuyListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
+ text = "价格类型"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ checkBox {
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ isChecked = true
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ isChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buttonDrawable = null
|
|
|
+ background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ if (b) {
|
|
|
+ priceType.postValue(1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "固定价"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ checkBox {
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 1) {
|
|
|
+ isChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buttonDrawable = null
|
|
|
+ background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
+ setOnCheckedChangeListener { compoundButton, b ->
|
|
|
+ if (b) {
|
|
|
+ priceType.postValue(2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(41), autoSize(41)) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 5) {//普通交易商
|
|
|
+ visibility = View.GONE
|
|
|
+ } else if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2) {//掉期交易商
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ text = "浮动价"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
+ text = "基差"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+ }.lparams(autoSize(250), wrapContent)
|
|
|
+
|
|
|
+ numberEditText {
|
|
|
+ basis_price_input = this
|
|
|
+ setOnTextChangeListener { view, value ->
|
|
|
+ viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)
|
|
|
+ }
|
|
|
+ text = "0"
|
|
|
+ setTextColor(R.color.buy_hall_color)
|
|
|
+ }.lparams(0, autoSize(72), 1f) {
|
|
|
+ marginEnd = autoSize(110)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ textView {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 2) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ if (basis_price_input.text.toString().isNullOrEmpty().not()) {
|
|
|
+ text = "估算价" + NumberUtils.roundNum(
|
|
|
+ it?.getPrice()?.plus(basis_price_input.text.toString().toDouble())
|
|
|
+ ?: 0.0, 2
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ estimate_price = this
|
|
|
+ text = "估算价--"
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(250)
|
|
|
+ topMargin = autoSize(30)
|
|
|
+ bottomMargin = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ priceType.bindOptional(context) {
|
|
|
+ if (it == 1) {
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ } else {
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ textView {
|
|
|
text = "挂牌价格"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
@@ -595,19 +984,25 @@ class BuyListedUI(
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
numberEditText {
|
|
|
- viewModel.quoteDayData.bindOptional(context){
|
|
|
- text = NumberUtils.roundNum(it?.getPrice()?.toString(),viewModel.goodsInfo.value?.decimalplace ?: 2)
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ text = NumberUtils.roundNum(
|
|
|
+ it?.getPrice()?.toString(),
|
|
|
+ viewModel.goodsInfo.value?.decimalplace ?: 2
|
|
|
+ )
|
|
|
}
|
|
|
- viewModel.goodsInfo.bindOptional(context){
|
|
|
+ viewModel.goodsInfo.bindOptional(context) {
|
|
|
decimal = it?.decimalplace ?: 2
|
|
|
}
|
|
|
+ text = "0"
|
|
|
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(
|
|
|
+ onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ )
|
|
|
.times(viewModel.goodsInfo.value?.agreeunit ?: 1), 2
|
|
|
)
|
|
|
}
|
|
|
@@ -652,9 +1047,10 @@ class BuyListedUI(
|
|
|
) {
|
|
|
one_delisting_amount.text = NumberUtils.roundNum(
|
|
|
value.toString().toDouble().times(
|
|
|
- onePriceInputEdittext.text.toString().toDouble().times(
|
|
|
- viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
- )
|
|
|
+ onePriceInputEdittext.text.toString().toDouble()
|
|
|
+ .times(
|
|
|
+ viewModel.goodsInfo.value?.agreeunit ?: 1
|
|
|
+ )
|
|
|
), 2
|
|
|
)
|
|
|
}
|
|
|
@@ -736,7 +1132,14 @@ class BuyListedUI(
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "挂牌金额"
|
|
|
+ priceType.bindOptional(context){
|
|
|
+ if (it == 1){//固定价
|
|
|
+ text = "挂牌金额"
|
|
|
+ }else{//浮动价
|
|
|
+ text = "挂牌金额"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
|
@@ -744,6 +1147,24 @@ class BuyListedUI(
|
|
|
}
|
|
|
//公式 :挂牌金额*挂牌数量*合约单位
|
|
|
textView {
|
|
|
+ viewModel.quoteDayData.bindOptional(context){
|
|
|
+ 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
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
one_delisting_amount = this
|
|
|
text = "--"
|
|
|
textSizeAuto = 29
|
|
|
@@ -769,14 +1190,17 @@ class BuyListedUI(
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (onePriceInputEdittext.text.toString()
|
|
|
- .isNullOrEmpty() || onePriceInputEdittext.text.toString()
|
|
|
- .toDouble() == 0.0
|
|
|
- ) {
|
|
|
- ToastUtils.showLong("请输入挂牌金额")
|
|
|
- return@onThrottleFirstClick
|
|
|
+ if (priceType.value == 2) {
|
|
|
+ if (onePriceInputEdittext.text.toString()
|
|
|
+ .isNullOrEmpty() || onePriceInputEdittext.text.toString()
|
|
|
+ .toDouble() == 0.0
|
|
|
+ ) {
|
|
|
+ ToastUtils.showLong("请输入挂牌价格")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if (onePriceInputNumberEdittext.text.toString()
|
|
|
.isNullOrEmpty() || onePriceInputNumberEdittext.text.toString()
|
|
|
.toDouble() == 0.0
|
|
|
@@ -785,7 +1209,16 @@ class BuyListedUI(
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
|
|
|
+ var marketMaxSub = 0.0
|
|
|
+ if (priceType.value == 2){
|
|
|
+ if (basis_price_input.text.toString().isNullOrEmpty().not()){
|
|
|
+ marketMaxSub = basis_price_input.text.toString().toDouble()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
viewModel.commit(
|
|
|
+ marketMaxSub = marketMaxSub,
|
|
|
+ pricetype = priceType.value ?: 1,
|
|
|
goodsInfo = viewModel.goodsInfo.value ?: GoodsInfo(),
|
|
|
isListed = true,
|
|
|
orderPrice = onePriceInputEdittext.text.toString(),
|