|
@@ -18,6 +18,7 @@ import cn.muchinfo.rma.global.data.TjmdTradeOrderDetailData
|
|
|
import cn.muchinfo.rma.global.data.WrTradeOrderDetailData
|
|
import cn.muchinfo.rma.global.data.WrTradeOrderDetailData
|
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
|
|
|
import cn.muchinfo.rma.global.database.DataBase
|
|
import cn.muchinfo.rma.global.database.DataBase
|
|
|
|
|
+import cn.muchinfo.rma.global.utils.VIewUtils
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
|
|
import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI2
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
@@ -28,6 +29,7 @@ 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.emptyView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
|
|
import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
|
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
import com.blankj.utilcode.util.ToastUtils
|
|
|
|
|
+import kotlinx.android.synthetic.main.list_head.view.*
|
|
|
import mtp.polymer.com.autowidget.dialog.creatAccountDataSheetDialog
|
|
import mtp.polymer.com.autowidget.dialog.creatAccountDataSheetDialog
|
|
|
import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
|
import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
@@ -61,10 +63,12 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
"SwapsDelistingActivity"
|
|
"SwapsDelistingActivity"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/** 摘牌数量 **/
|
|
/** 摘牌数量 **/
|
|
|
lateinit var onePriceInputNumberEdittext: MangeNumberEditText2
|
|
lateinit var onePriceInputNumberEdittext: MangeNumberEditText2
|
|
|
|
|
|
|
|
|
|
+ /** 挂牌单为浮动价,且选择买入价格方式为限价时的价格输入框 **/
|
|
|
|
|
+ lateinit var limit_price_edittext : MangeNumberEditText2
|
|
|
|
|
+
|
|
|
/** SeekBar **/
|
|
/** SeekBar **/
|
|
|
lateinit var one_seekbar: SeekBar
|
|
lateinit var one_seekbar: SeekBar
|
|
|
|
|
|
|
@@ -77,8 +81,8 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
/** 是否选择限价 **/
|
|
/** 是否选择限价 **/
|
|
|
lateinit var limit_price_checkbox : CheckBox
|
|
lateinit var limit_price_checkbox : CheckBox
|
|
|
|
|
|
|
|
- /** 挂牌价格类型为浮动价是输入的买入价格 **/
|
|
|
|
|
- lateinit var buy_price_input : MangeNumberEditText2
|
|
|
|
|
|
|
+ /** 若挂牌单为浮动价时,可以选择为市价或者限价挂单 **/
|
|
|
|
|
+ val priceType : MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
|
|
/** 对页面数据进行初始化 **/
|
|
/** 对页面数据进行初始化 **/
|
|
|
fun initializeData(){
|
|
fun initializeData(){
|
|
@@ -89,6 +93,16 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}else{
|
|
}else{
|
|
|
viewModel.maxDelistedingNumber.postValue(data.orderqty)//摘买时直接取值挂牌数量
|
|
viewModel.maxDelistedingNumber.postValue(data.orderqty)//摘买时直接取值挂牌数量
|
|
|
}
|
|
}
|
|
|
|
|
+ if (data.pricemode == "3"){
|
|
|
|
|
+ priceType.postValue(1)
|
|
|
|
|
+ }else if (data.pricemode == "2"){
|
|
|
|
|
+ priceType.postValue(2)//挂牌单为固定价是,摘牌类型只能为限价
|
|
|
|
|
+ }
|
|
|
|
|
+ viewModel.queryQuoteDay(
|
|
|
|
|
+ tag = thisTag,
|
|
|
|
|
+ goodsCodes = quoteGoodsListData.refgoodscode ?: "",
|
|
|
|
|
+ isShowLoading = false
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@SuppressLint("SetTextI18n")
|
|
@SuppressLint("SetTextI18n")
|
|
@@ -190,7 +204,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
|
|
textView {
|
|
textView {
|
|
|
- text = "浮动价"
|
|
|
|
|
|
|
+ if (data.pricemode == "3"){
|
|
|
|
|
+ text = "浮动价"
|
|
|
|
|
+ }else if (data.pricemode == "2"){
|
|
|
|
|
+ text = "固定价"
|
|
|
|
|
+ }
|
|
|
textSizeAuto = 34
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_black_33
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
}.lparams(wrapContent, wrapContent)
|
|
@@ -199,6 +217,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
itemView()
|
|
itemView()
|
|
|
|
|
|
|
|
verticalLayout {
|
|
verticalLayout {
|
|
|
|
|
+ if (data.pricemode == "3"){//挂牌单为浮动价时才显示价格选择
|
|
|
|
|
+ visibility = View.VISIBLE
|
|
|
|
|
+ }else if (data.pricemode == "2"){//固定价时不显示买入价格选择
|
|
|
|
|
+ visibility = View.GONE
|
|
|
|
|
+ }
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
@@ -213,11 +236,13 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}.lparams(autoSize(250), wrapContent)
|
|
}.lparams(autoSize(250), wrapContent)
|
|
|
|
|
|
|
|
checkBox {
|
|
checkBox {
|
|
|
|
|
+ isChecked = true
|
|
|
market_price_checkbox = this
|
|
market_price_checkbox = this
|
|
|
buttonDrawable = null
|
|
buttonDrawable = null
|
|
|
background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
setOnCheckedChangeListener { compoundButton, b ->
|
|
setOnCheckedChangeListener { compoundButton, b ->
|
|
|
if (b){
|
|
if (b){
|
|
|
|
|
+ priceType.postValue(1)//设置为市价
|
|
|
limit_price_checkbox.isChecked = false
|
|
limit_price_checkbox.isChecked = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -236,6 +261,7 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
background = resources.getDrawable(R.drawable.yrdz_check_select_backgrond)
|
|
|
setOnCheckedChangeListener { compoundButton, b ->
|
|
setOnCheckedChangeListener { compoundButton, b ->
|
|
|
if (b){
|
|
if (b){
|
|
|
|
|
+ priceType.postValue(1)//设置为限价
|
|
|
market_price_checkbox.isChecked = false
|
|
market_price_checkbox.isChecked = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -252,15 +278,25 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}.lparams(matchParent, autoSize(143))
|
|
}.lparams(matchParent, autoSize(143))
|
|
|
|
|
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
|
|
+ visibility = View.GONE
|
|
|
|
|
+ priceType.bindOptional(context){
|
|
|
|
|
+ if (it == 2){
|
|
|
|
|
+ visibility = View.VISIBLE
|
|
|
|
|
+ }else{
|
|
|
|
|
+ visibility = View.GONE
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
view {
|
|
view {
|
|
|
|
|
|
|
|
}.lparams(autoSize(250), autoSize(143))
|
|
}.lparams(autoSize(250), autoSize(143))
|
|
|
|
|
|
|
|
numberEditText {
|
|
numberEditText {
|
|
|
- text = "1"
|
|
|
|
|
- buy_price_input = this
|
|
|
|
|
|
|
+ viewModel.quoteDayData.bindOptional(context){
|
|
|
|
|
+ text = NumberUtils.roundNum(it?.getPrice() ?: 0.0,2)
|
|
|
|
|
+ }
|
|
|
|
|
+ limit_price_edittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
setOnTextChangeListener { view, value ->
|
|
|
-
|
|
|
|
|
|
|
+ viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)//对盘面数据进行重新赋值以驱动估算价格的计算
|
|
|
}
|
|
}
|
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(36)
|
|
marginEnd = autoSize(36)
|
|
@@ -270,6 +306,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
|
|
|
|
|
// 价格为固定价时就为挂牌价格
|
|
// 价格为固定价时就为挂牌价格
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
|
|
+ if (data.pricemode == "3"){//挂牌单为浮动价时不显示挂牌价格
|
|
|
|
|
+ visibility = View.GONE
|
|
|
|
|
+ }else if (data.pricemode == "2"){//固定价时显示挂牌价格
|
|
|
|
|
+ visibility = View.VISIBLE
|
|
|
|
|
+ }
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
linearLayout {
|
|
linearLayout {
|
|
@@ -314,6 +355,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
itemView()
|
|
itemView()
|
|
|
|
|
|
|
|
linearLayout {
|
|
linearLayout {
|
|
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2){//登录用户为掉期交易商时只能整单摘
|
|
|
|
|
+ visibility = View.GONE
|
|
|
|
|
+ }else{//登录用户为普通交易商时摘牌时能修改摘牌数量
|
|
|
|
|
+ visibility = View.VISIBLE
|
|
|
|
|
+ }
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
verticalLayout {
|
|
verticalLayout {
|
|
|
textView {
|
|
textView {
|
|
@@ -335,10 +381,9 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
onePriceInputNumberEdittext = this
|
|
onePriceInputNumberEdittext = this
|
|
|
setOnTextChangeListener { view, value ->
|
|
setOnTextChangeListener { view, value ->
|
|
|
if (value.isNullOrEmpty().not()) {
|
|
if (value.isNullOrEmpty().not()) {
|
|
|
- one_delisting_amount.text = NumberUtils.roundNum(value?.toString()?.toDouble()?.times(data.orderprice?.toDouble() ?: 1.0)?.times(viewModel.goodsInfo.value?.agreeunit ?: 1)?.toString(),2)
|
|
|
|
|
|
|
+ viewModel.quoteDayData.postValue(viewModel.quoteDayData.value)//对盘面数据进行重新赋值以驱动估算价格的计算
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
}.lparams(0, autoSize(72), 1f) {
|
|
|
marginEnd = autoSize(36)
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
}
|
|
@@ -414,7 +459,11 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
background = resources.getDrawable(R.color.white)
|
|
background = resources.getDrawable(R.color.white)
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
textView {
|
|
|
- text = "摘牌金额"
|
|
|
|
|
|
|
+ if (data.pricemode == "3"){
|
|
|
|
|
+ text = "估算金额"
|
|
|
|
|
+ }else if (data.pricemode == "2"){
|
|
|
|
|
+ text = "摘牌金额"
|
|
|
|
|
+ }
|
|
|
textSizeAuto = 34
|
|
textSizeAuto = 34
|
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
}.lparams(autoSize(214), wrapContent) {
|
|
@@ -422,8 +471,30 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
textView {
|
|
textView {
|
|
|
|
|
+ if (data.pricemode == "2"){//挂牌单据为固定价时
|
|
|
|
|
+ text = NumberUtils.roundNum(data.orderprice?.toDouble()?.times(data.orderqty?.toDouble() ?: 0.0) ?: 0.0,2)
|
|
|
|
|
+ }
|
|
|
|
|
+ viewModel.quoteDayData.bindOptional(context){
|
|
|
|
|
+ if (data.pricemode == "3"){//挂牌单据为浮动价时,才会有估算金额,并且选择为市价时根据行情变动,选择为限价时根据输入的限价价格变动
|
|
|
|
|
+ if (onePriceInputNumberEdittext.text.toString().isNullOrEmpty()){
|
|
|
|
|
+ text = "--"
|
|
|
|
|
+ }else{
|
|
|
|
|
+ val numberInput = onePriceInputNumberEdittext.text.toString().toDouble()
|
|
|
|
|
+ if (priceType.value == 1){//市价计算
|
|
|
|
|
+ text = NumberUtils.roundNum(it?.getPrice()?.times(numberInput) ?: 0.0,2)
|
|
|
|
|
+ }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)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
one_delisting_amount = this
|
|
one_delisting_amount = this
|
|
|
- text = "--"
|
|
|
|
|
textSizeAuto = 29
|
|
textSizeAuto = 29
|
|
|
textColorInt = R.color.rma_black_33
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent)
|
|
}.lparams(wrapContent, wrapContent)
|
|
@@ -447,20 +518,42 @@ class SwapsDelistingActivity : BaseActivity<SwapsDelistingViewModel>(){
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
onThrottleFirstClick {
|
|
|
- if (onePriceInputNumberEdittext.text.toString()
|
|
|
|
|
- .isNullOrEmpty() || onePriceInputNumberEdittext.text.toString()
|
|
|
|
|
- .toDouble() == 0.0
|
|
|
|
|
- ) {
|
|
|
|
|
- ToastUtils.showLong("请输入摘牌数量")
|
|
|
|
|
- return@onThrottleFirstClick
|
|
|
|
|
|
|
+ var delistNumber = ""
|
|
|
|
|
+ var delistPrice = ""
|
|
|
|
|
+ if (GlobalDataCollection.instance?.loginQueryData?.userInfo?.usertype == 2){//掉期交易商只能整单摘
|
|
|
|
|
+ delistNumber = data.orderqty ?: "0"
|
|
|
|
|
+ }else{//普通交易商可以修改数量摘
|
|
|
|
|
+ if (onePriceInputNumberEdittext.text.toString()
|
|
|
|
|
+ .isNullOrEmpty() || onePriceInputNumberEdittext.text.toString()
|
|
|
|
|
+ .toDouble() == 0.0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ ToastUtils.showLong("请输入摘牌数量")
|
|
|
|
|
+ return@onThrottleFirstClick
|
|
|
|
|
+ }
|
|
|
|
|
+ delistNumber = onePriceInputNumberEdittext.text.toString()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (data.pricemode == "2"){
|
|
|
|
|
+ delistPrice = data.orderprice ?: "0"
|
|
|
|
|
+ }else if (data.pricemode == "3"){
|
|
|
|
|
+ if (priceType.value == 1){//市价
|
|
|
|
|
+ delistPrice = viewModel.quoteDayData.value?.getPrice().toString()
|
|
|
|
|
+ }else{//限价
|
|
|
|
|
+ if (limit_price_edittext.text.toString().isNullOrEmpty()){
|
|
|
|
|
+ ToastUtils.showLong("请输入摘牌金额")
|
|
|
|
|
+ return@onThrottleFirstClick
|
|
|
|
|
+ }
|
|
|
|
|
+ delistPrice = limit_price_edittext.text.toString()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
viewModel.commit(
|
|
viewModel.commit(
|
|
|
|
|
+ pricetype = priceType.value ?: 1,
|
|
|
relatedID = data.orderid ?: "",
|
|
relatedID = data.orderid ?: "",
|
|
|
goodsInfo = viewModel.goodsInfo.value ?: GoodsInfo(),
|
|
goodsInfo = viewModel.goodsInfo.value ?: GoodsInfo(),
|
|
|
isListed = false,
|
|
isListed = false,
|
|
|
- orderPrice = data.orderprice ?: "1",
|
|
|
|
|
- qty = onePriceInputNumberEdittext.text.toString(),
|
|
|
|
|
|
|
+ orderPrice = delistPrice,
|
|
|
|
|
+ qty = delistNumber,
|
|
|
type = type ?: "",
|
|
type = type ?: "",
|
|
|
accountId = selectAccountData.value?.accountid ?: 0
|
|
accountId = selectAccountData.value?.accountid ?: 0
|
|
|
){
|
|
){
|