|
@@ -108,7 +108,7 @@ class PlatinumBuyOrSellUI(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//刷新单据
|
|
//刷新单据
|
|
|
- fun refresh(quoteMessageEvent: QuoteMessageEvent){
|
|
|
|
|
|
|
+ fun refresh(quoteMessageEvent: QuoteMessageEvent) {
|
|
|
/** 行情推送过来的goodsid **/
|
|
/** 行情推送过来的goodsid **/
|
|
|
quoteMessageEvent.goodsid.forEach { goodid ->
|
|
quoteMessageEvent.goodsid.forEach { goodid ->
|
|
|
//找到相应商品信息
|
|
//找到相应商品信息
|
|
@@ -238,7 +238,9 @@ class PlatinumBuyOrSellUI(
|
|
|
|
|
|
|
|
//行情变化后根据不同的价格类型分别对赋值
|
|
//行情变化后根据不同的价格类型分别对赋值
|
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
|
- if (trade_price_edittext.text.toString().isNullOrEmpty() || trade_price_edittext.text.toString() == "0") {
|
|
|
|
|
|
|
+ if (trade_price_edittext.text.toString()
|
|
|
|
|
+ .isNullOrEmpty() || trade_price_edittext.text.toString() == "0"
|
|
|
|
|
+ ) {
|
|
|
if (type == "1") {
|
|
if (type == "1") {
|
|
|
setText(
|
|
setText(
|
|
|
NumberUtils.roundNum(
|
|
NumberUtils.roundNum(
|
|
@@ -267,7 +269,7 @@ class PlatinumBuyOrSellUI(
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
- if (type == "2"){
|
|
|
|
|
|
|
+ if (type == "2") {
|
|
|
return@onThrottleFirstClick
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
}
|
|
|
val selectDataList = arrayListOf(
|
|
val selectDataList = arrayListOf(
|
|
@@ -290,7 +292,7 @@ class PlatinumBuyOrSellUI(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
imageView {
|
|
imageView {
|
|
|
- if (type == "2"){
|
|
|
|
|
|
|
+ if (type == "2") {
|
|
|
visibility = View.GONE
|
|
visibility = View.GONE
|
|
|
}
|
|
}
|
|
|
imageResource = R.mipmap.qhj_trade_numberamout_select
|
|
imageResource = R.mipmap.qhj_trade_numberamout_select
|
|
@@ -304,7 +306,7 @@ class PlatinumBuyOrSellUI(
|
|
|
setOnTextChangeListener { view, value ->
|
|
setOnTextChangeListener { view, value ->
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- viewModel.goodsInfoData.bindOptional(context){
|
|
|
|
|
|
|
+ viewModel.goodsInfoData.bindOptional(context) {
|
|
|
setDecimal(it?.qtydecimalplace ?: 1)
|
|
setDecimal(it?.qtydecimalplace ?: 1)
|
|
|
}
|
|
}
|
|
|
setText("0")
|
|
setText("0")
|
|
@@ -314,9 +316,15 @@ class PlatinumBuyOrSellUI(
|
|
|
GlobalDataCollection.instance?.goodsExInfoDataArrayList?.find { it.goodsid == data?.goodsid.toString() }
|
|
GlobalDataCollection.instance?.goodsExInfoDataArrayList?.find { it.goodsid == data?.goodsid.toString() }
|
|
|
if (goodsExData?.goodsid?.isNotEmpty() == true) {
|
|
if (goodsExData?.goodsid?.isNotEmpty() == true) {
|
|
|
if (selectPayType.value?.id == "1") {//按数量
|
|
if (selectPayType.value?.id == "1") {//按数量
|
|
|
- setMin(goodsExData.regularlybuyminqty?.toDouble()?.div(Math.pow(10.0,data?.qtydecimalplace?.toDouble() ?: 2.0)) ?: 0.0)
|
|
|
|
|
- setStep(goodsExData.regularlybuyminqty?.toDouble()?.div(Math.pow(10.0,data?.qtydecimalplace?.toDouble() ?: 2.0)) ?: 0.01)
|
|
|
|
|
- setText(goodsExData.regularlybuyminqty?.toDouble()?.div(Math.pow(10.0,data?.qtydecimalplace?.toDouble() ?: 2.0)).toString())
|
|
|
|
|
|
|
+ setMin(
|
|
|
|
|
+ goodsExData.regularlybuyminqty?.toDouble() ?: 1.0
|
|
|
|
|
+ )
|
|
|
|
|
+ setStep(
|
|
|
|
|
+ goodsExData.regularlybuyminqty?.toDouble() ?: 1.0
|
|
|
|
|
+ )
|
|
|
|
|
+ setText(
|
|
|
|
|
+ goodsExData.regularlybuyminqty?.toDouble().toString()
|
|
|
|
|
+ )
|
|
|
} else {//按金额
|
|
} else {//按金额
|
|
|
setMin(goodsExData.regularlybuyminamount?.toDouble() ?: 0.0)
|
|
setMin(goodsExData.regularlybuyminamount?.toDouble() ?: 0.0)
|
|
|
setStep(
|
|
setStep(
|
|
@@ -358,7 +366,7 @@ class PlatinumBuyOrSellUI(
|
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
|
text = NumberUtils.roundNum(
|
|
text = NumberUtils.roundNum(
|
|
|
NumberUtils.doubleDistortion(it?.ask.toString()),
|
|
NumberUtils.doubleDistortion(it?.ask.toString()),
|
|
|
- 2
|
|
|
|
|
|
|
+ viewModel.goodsInfoData.value?.decimalplace ?: 2
|
|
|
)//卖一
|
|
)//卖一
|
|
|
}
|
|
}
|
|
|
text = "0"
|
|
text = "0"
|
|
@@ -386,7 +394,7 @@ class PlatinumBuyOrSellUI(
|
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
viewModel.quoteDayData.bindOptional(context) {
|
|
|
text = NumberUtils.roundNum(
|
|
text = NumberUtils.roundNum(
|
|
|
NumberUtils.doubleDistortion(it?.bid.toString()),
|
|
NumberUtils.doubleDistortion(it?.bid.toString()),
|
|
|
- 2
|
|
|
|
|
|
|
+ viewModel.goodsInfoData.value?.decimalplace ?: 2
|
|
|
)//买一
|
|
)//买一
|
|
|
}
|
|
}
|
|
|
text = "0"
|
|
text = "0"
|
|
@@ -413,10 +421,15 @@ class PlatinumBuyOrSellUI(
|
|
|
}
|
|
}
|
|
|
textView {
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
- if (trade_price_edittext.text.toString().toDouble() < viewModel.goodsExData.value?.minamount?.toDouble() ?: 0.0){
|
|
|
|
|
- ToastUtils.showLong("最小交易金额不能小于" + viewModel.goodsExData.value?.minamount)
|
|
|
|
|
- return@onThrottleFirstClick
|
|
|
|
|
|
|
+ if (selectPayType.value?.id == "2") {
|
|
|
|
|
+ if (trade_number_or_amount.text.toString()
|
|
|
|
|
+ .toDouble() < viewModel.goodsExData.value?.minamount?.toDouble() ?: 0.0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ ToastUtils.showLong("最小交易金额不能小于" + viewModel.goodsExData.value?.minamount)
|
|
|
|
|
+ return@onThrottleFirstClick
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
creatOrderDetailsDialog(
|
|
creatOrderDetailsDialog(
|
|
|
type = "1",
|
|
type = "1",
|
|
|
orderPrice = trade_price_edittext.text.toString(),
|
|
orderPrice = trade_price_edittext.text.toString(),
|
|
@@ -450,6 +463,15 @@ class PlatinumBuyOrSellUI(
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
|
|
+ if (selectPayType.value?.id == "2") {
|
|
|
|
|
+ if (trade_number_or_amount.text.toString()
|
|
|
|
|
+ .toDouble() < viewModel.goodsExData.value?.minamount?.toDouble() ?: 0.0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ ToastUtils.showLong("最小交易金额不能小于" + viewModel.goodsExData.value?.minamount)
|
|
|
|
|
+ return@onThrottleFirstClick
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
creatOrderDetailsDialog(
|
|
creatOrderDetailsDialog(
|
|
|
type = "3",
|
|
type = "3",
|
|
|
orderPrice = trade_price_edittext.text.toString(),
|
|
orderPrice = trade_price_edittext.text.toString(),
|
|
@@ -479,10 +501,11 @@ class PlatinumBuyOrSellUI(
|
|
|
|
|
|
|
|
textView {
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
|
|
+
|
|
|
val intent = Intent()
|
|
val intent = Intent()
|
|
|
intent.putExtra("goodsId", goodsId)
|
|
intent.putExtra("goodsId", goodsId)
|
|
|
intent.putExtra("outGoodsCode", outGoodsCode)
|
|
intent.putExtra("outGoodsCode", outGoodsCode)
|
|
|
- intent.putExtra("type","3")
|
|
|
|
|
|
|
+ intent.putExtra("type", "3")
|
|
|
intent.setClass(context, AddCastSurelyActivity::class.java)
|
|
intent.setClass(context, AddCastSurelyActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
ActivityUtils.startActivity(intent)
|
|
|
}
|
|
}
|