|
|
@@ -18,7 +18,6 @@ import androidx.viewpager.widget.ViewPager
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
import cn.muchinfo.rma.global.data.*
|
|
|
-import cn.muchinfo.rma.global.database.DataBase
|
|
|
import cn.muchinfo.rma.global.toPercentage
|
|
|
import cn.muchinfo.rma.global.toWanPercentage
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
@@ -26,11 +25,9 @@ import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText2
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
-import cn.muchinfo.rma.view.base.app.FutureConstent
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
|
|
|
-import cn.muchinfo.rma.view.base.home.spotmarket.SpotMarketPriceViewHolder
|
|
|
import cn.muchinfo.rma.view.eventbus.EventConstent
|
|
|
import cn.muchinfo.rma.view.eventbus.MessageEvent
|
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
@@ -55,6 +52,7 @@ import org.jetbrains.anko.support.v4.viewPager
|
|
|
/**
|
|
|
* 华南顺通 买卖大厅
|
|
|
*/
|
|
|
+@Suppress("DEPRECATION")
|
|
|
class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
@@ -73,7 +71,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
val orderQuoteData by lazy { intent.getParcelableExtra<OrderQuoteData>("data") as OrderQuoteData }
|
|
|
|
|
|
//涨跌幅
|
|
|
- lateinit var applies : TextView
|
|
|
+ lateinit var applies: TextView
|
|
|
|
|
|
/** 用于订阅行情的唯一标识 */
|
|
|
val thisTag by lazy {
|
|
|
@@ -219,7 +217,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
viewModel.resetAccountData()
|
|
|
viewModel.querydetailsWarehouseWrPosition(orderQuoteData)
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
- viewModel.getFinancingSelectData(orderQuoteData)
|
|
|
+ viewModel.getFinancingSelectData(orderQuoteData, pricetype ?: "")
|
|
|
openDialogByListed()
|
|
|
//头部标题
|
|
|
linearLayout {
|
|
|
@@ -263,7 +261,6 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
emptyView()
|
|
|
|
|
|
-
|
|
|
imageView {
|
|
|
onThrottleFirstClick {
|
|
|
if (pricetype == "1") {//一口价
|
|
|
@@ -291,7 +288,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
onThrottleFirstClick {
|
|
|
val intent = Intent()
|
|
|
intent.putExtra("data", orderQuoteData)
|
|
|
- intent.putExtra("isCircle","0")
|
|
|
+ intent.putExtra("isCircle", "0")
|
|
|
intent.putExtra("type", type)
|
|
|
intent.putExtra("goodsId", orderQuoteData.goodsid)
|
|
|
intent.setClass(context, BusinessHallDetailsActivity::class.java)
|
|
|
@@ -529,24 +526,26 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
emptyView()
|
|
|
|
|
|
textView {
|
|
|
- viewModel.quoteDayData.bindOptional(context){
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
val riseFall = it?.getPrice()?.minus(it.presettle)
|
|
|
- if (riseFall ?: 0.0 > 0.0){
|
|
|
+ if (riseFall ?: 0.0 > 0.0) {
|
|
|
textColorInt = R.color.rma_red_color
|
|
|
applies.textColorInt = R.color.rma_red_color
|
|
|
- }else if (riseFall ?: 0.0 < 0.0){
|
|
|
+ } else if (riseFall ?: 0.0 < 0.0) {
|
|
|
textColorInt = R.color.rma_green_color
|
|
|
applies.textColorInt = R.color.rma_green_color
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
applies.textColorInt = R.color.rma_black_33
|
|
|
}
|
|
|
- if (it?.presettle == 0.0){
|
|
|
+ if (it?.presettle == 0.0) {
|
|
|
applies.text = "-"
|
|
|
- }else{
|
|
|
- applies.text = NumberUtils.roundNum(riseFall?.div(it.presettle)?.times(100) ?: 0.0,2) + "%"
|
|
|
+ } else {
|
|
|
+ applies.text = NumberUtils.roundNum(
|
|
|
+ riseFall?.div(it.presettle)?.times(100) ?: 0.0, 2
|
|
|
+ ) + "%"
|
|
|
}
|
|
|
- text = NumberUtils.roundNum(it?.getPrice() ?: 0.0,2)
|
|
|
+ text = NumberUtils.roundNum(it?.getPrice() ?: 0.0, 2)
|
|
|
}
|
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
@@ -635,10 +634,10 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
gravity = Gravity.CENTER_HORIZONTAL
|
|
|
imageView {
|
|
|
viewModel.priceUpDown.bindOptional(context) {
|
|
|
- if (it == true) {//收起
|
|
|
- imageResource = R.mipmap.yrdz_up_icon
|
|
|
+ imageResource = if (it == true) {//收起
|
|
|
+ R.mipmap.yrdz_up_icon
|
|
|
} else {
|
|
|
- imageResource = R.mipmap.yrdz_down_icon
|
|
|
+ R.mipmap.yrdz_down_icon
|
|
|
}
|
|
|
}
|
|
|
imageResource = R.mipmap.yrdz_down_icon
|
|
|
@@ -725,10 +724,10 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
chartview {
|
|
|
viewModel.priceUpDown.bindOptional(context) {
|
|
|
- if (it == true) {//收起
|
|
|
- visibility = View.VISIBLE
|
|
|
+ visibility = if (it == true) {//收起
|
|
|
+ View.VISIBLE
|
|
|
} else {
|
|
|
- visibility = View.GONE
|
|
|
+ View.GONE
|
|
|
}
|
|
|
}
|
|
|
visibility = View.GONE
|
|
|
@@ -873,10 +872,10 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
- if (buySelldata.buyorsell == "0") {
|
|
|
- visibility = View.GONE
|
|
|
+ visibility = if (buySelldata.buyorsell == "0") {
|
|
|
+ View.GONE
|
|
|
} else {
|
|
|
- visibility = View.VISIBLE
|
|
|
+ View.VISIBLE
|
|
|
}
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
|
@@ -903,7 +902,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
maxpickNumber.postValue(
|
|
|
Math.min(
|
|
|
it?.enableqty?.toDouble() ?: 0.0,
|
|
|
- buySelldata?.orderqty?.toDouble() ?: 0.0
|
|
|
+ buySelldata.orderqty?.toDouble() ?: 0.0
|
|
|
)
|
|
|
)
|
|
|
text = it?.ladingbillid + "(" + it?.enableqty + it?.enumdicname + ")"
|
|
|
@@ -1116,8 +1115,11 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
one_delisting_amount = this
|
|
|
- text = buySelldata.fixedprice?.toDouble()?.times(buySelldata.delistminqty?.toDouble() ?: 1.0).toString() + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
- buySelldata.fixedprice?.toDouble()?.times(buySelldata.delistminqty?.toDouble() ?: 1.0)?.times(
|
|
|
+ text = buySelldata.fixedprice?.toDouble()
|
|
|
+ ?.times(buySelldata.delistminqty?.toDouble() ?: 1.0)
|
|
|
+ .toString() + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ buySelldata.fixedprice?.toDouble()
|
|
|
+ ?.times(buySelldata.delistminqty?.toDouble() ?: 1.0)?.times(
|
|
|
marginValue
|
|
|
) ?: 0.0, 2
|
|
|
) + ")"
|
|
|
@@ -1280,10 +1282,10 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
}
|
|
|
gravity = Gravity.CENTER
|
|
|
backgroundResource = R.drawable.qhj_main_blue_bg
|
|
|
- if (buySelldata.buyorsell == "0") {
|
|
|
- text = "卖出"
|
|
|
+ text = if (buySelldata.buyorsell == "0") {
|
|
|
+ "卖出"
|
|
|
} else {
|
|
|
- text = "买入"
|
|
|
+ "买入"
|
|
|
}
|
|
|
textSizeAuto = 38
|
|
|
textColorInt = R.color.white
|
|
|
@@ -1646,7 +1648,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "估算总价"
|
|
|
+ text = "估算价"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
|
@@ -1679,7 +1681,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "估算总额"
|
|
|
+ text = "估算金额"
|
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
|
@@ -1698,7 +1700,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
text = NumberUtils.roundNum(
|
|
|
floatDelistingAmount ?: 0.0,
|
|
|
2
|
|
|
- ) + "(需履约保证金" + NumberUtils.roundNum(
|
|
|
+ ) + "(履约保证金" + NumberUtils.roundNum(
|
|
|
floatDelistingAmount?.times(
|
|
|
marginValue
|
|
|
) ?: 0.0, 2
|
|
|
@@ -1909,7 +1911,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
) {
|
|
|
|
|
|
val dialog1 by lazy {
|
|
|
- SelectFincningDialog(this@BusinessHallActivity, viewModel, data)
|
|
|
+ SelectFincningDialog(pricetype, this@BusinessHallActivity, viewModel, data)
|
|
|
}
|
|
|
|
|
|
/** 摘牌数量 **/
|
|
|
@@ -1929,10 +1931,21 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
+ lateinit var float_total_amount : TextView//估算金额
|
|
|
+
|
|
|
+ //浮动价挂牌金额
|
|
|
+ val listed_price: MutableLiveData<Double> = MutableLiveData()
|
|
|
+
|
|
|
createCustomDialog(cancelable = false) { dialog ->
|
|
|
selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
|
|
|
backgroundColor = Color.parseColor("#5f000000")
|
|
|
maxpickNumber.postValue(buyOrSelldata.orderqty?.toDouble())
|
|
|
+ viewModel.quoteDayData.bindOptional(context) {
|
|
|
+ //行情下发计算挂牌金额 = (基差价格+期货合约价)
|
|
|
+ listed_price.postValue(
|
|
|
+ buyOrSelldata.pricemove.toString().toDouble().plus(it?.getPrice() ?: 0.0)
|
|
|
+ )
|
|
|
+ }
|
|
|
verticalLayout {
|
|
|
backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
|
|
|
|
|
|
@@ -2001,7 +2014,7 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
- visibility = if (type == "1") {
|
|
|
+ visibility = if (pricetype == "1") {
|
|
|
View.VISIBLE
|
|
|
} else {
|
|
|
View.GONE
|
|
|
@@ -2051,6 +2064,34 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
itemView()
|
|
|
|
|
|
linearLayout {
|
|
|
+ visibility = if (pricetype == "2") {
|
|
|
+ View.VISIBLE
|
|
|
+ } else {
|
|
|
+ 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)
|
|
|
+
|
|
|
+ textView {
|
|
|
+ listed_price.bindOptional(context) {
|
|
|
+ text = NumberUtils.roundNum(it ?: 0.0, 2)
|
|
|
+ }
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.buy_hall_color
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ itemView()
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
@@ -2103,14 +2144,19 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
onePriceInputNumberEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not()) {
|
|
|
+ viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)
|
|
|
float_delisting_amount.text =
|
|
|
NumberUtils.roundNum(
|
|
|
buyOrSelldata.fixedprice?.toDouble()
|
|
|
?.times(value.toString().toDouble())
|
|
|
?: 0.0, 2
|
|
|
)
|
|
|
- if (viewModel.slectfinancingData.value?.accountid.isNullOrEmpty().not()){
|
|
|
- viewModel.slectfinancingData.postValue(viewModel.slectfinancingData.value)//为驱动履约保证金再次变化数额
|
|
|
+ if (viewModel.slectfinancingData.value?.accountid.isNullOrEmpty()
|
|
|
+ .not()
|
|
|
+ ) {
|
|
|
+ viewModel.slectfinancingData.postValue(
|
|
|
+ viewModel.slectfinancingData.value
|
|
|
+ )//为驱动履约保证金再次变化数额
|
|
|
}
|
|
|
one_seekbar.progress = value.toDouble()
|
|
|
.div(maxpickNumber.value ?: 0.0)
|
|
|
@@ -2235,6 +2281,45 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
+ if (pricetype == "2"){
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }else{
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ textView {
|
|
|
+ text = "估算金额"
|
|
|
+ textSizeAuto = 34
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ }.lparams(autoSize(214), wrapContent) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "--"
|
|
|
+ listed_price.bindOptional(context) {
|
|
|
+ val floatDelistingAmount =
|
|
|
+ it?.times(
|
|
|
+ onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
+ )
|
|
|
+ if (floatDelistingAmount != 0.0) {
|
|
|
+ text = NumberUtils.roundNum(
|
|
|
+ floatDelistingAmount ?: 0.0, 2
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ float_total_amount = this
|
|
|
+ textSizeAuto = 29
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ }.lparams(matchParent, autoSize(143))
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ if (pricetype == "1"){
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }else{
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
text = "摘牌金额"
|
|
|
textSizeAuto = 34
|
|
|
@@ -2268,13 +2353,13 @@ class BusinessHallActivity : BaseActivity<BusinessHallViewModel>() {
|
|
|
|
|
|
textView {
|
|
|
viewModel.slectfinancingData.bindOptional(context) {
|
|
|
- if (float_delisting_amount.text.toString()
|
|
|
+ if (float_total_amount.text.toString()
|
|
|
.isNullOrEmpty()
|
|
|
) {
|
|
|
text = "--"
|
|
|
} else {
|
|
|
text = NumberUtils.roundNum(
|
|
|
- float_delisting_amount.text.toString().toDouble()
|
|
|
+ float_total_amount.text.toString().toDouble()
|
|
|
.times(it?.marginratio?.toDouble() ?: 0.0), 2
|
|
|
)
|
|
|
}
|