|
|
@@ -14,6 +14,7 @@ import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.GlobalDataCollection
|
|
|
+import cn.muchinfo.rma.global.data.ContractTradePositionData
|
|
|
import cn.muchinfo.rma.global.database.DataBase
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
@@ -42,37 +43,37 @@ import org.jetbrains.anko.support.v4.viewPager
|
|
|
/**
|
|
|
* 合约订单页面
|
|
|
*/
|
|
|
-class ContractOrdersActivity : BaseActivity<ContractOrdersViewModel>(){
|
|
|
+class ContractOrdersActivity : BaseActivity<ContractOrdersViewModel>() {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
|
|
|
|
//合约汇总单
|
|
|
- val positionUI by lazy { PositionUI(this,viewModel) }
|
|
|
+ val positionUI by lazy { PositionUI(this, viewModel) }
|
|
|
|
|
|
//委托单
|
|
|
- val orderUI by lazy { OrderUI(this,viewModel) }
|
|
|
+ val orderUI by lazy { OrderUI(this, viewModel) }
|
|
|
|
|
|
//协议单
|
|
|
- val agreementUI by lazy { AgreementUI(this,viewModel) }
|
|
|
+ val agreementUI by lazy { AgreementUI(this, viewModel) }
|
|
|
|
|
|
//成交单
|
|
|
- val traderUI by lazy { TraderUI(this,viewModel) }
|
|
|
+ val traderUI by lazy { TraderUI(this, viewModel) }
|
|
|
|
|
|
//交收单
|
|
|
- val deliveryUI by lazy { DeliveryUI(this,viewModel) }
|
|
|
+ val deliveryUI by lazy { DeliveryUI(this, viewModel) }
|
|
|
|
|
|
//viewpager的适配器
|
|
|
- private var newPagerAdapter : PagerAdapter? = null
|
|
|
+ private var newPagerAdapter: PagerAdapter? = null
|
|
|
|
|
|
//tabSegment标题
|
|
|
- private val newTabsArray : ArrayList<String> = arrayListOf()
|
|
|
+ private val newTabsArray: ArrayList<String> = arrayListOf()
|
|
|
|
|
|
//暂存的页面组
|
|
|
- private val uiList : ArrayList<_FrameLayout> = arrayListOf()
|
|
|
+ private val uiList: ArrayList<_FrameLayout> = arrayListOf()
|
|
|
|
|
|
- fun initMenuData(){
|
|
|
+ fun initMenuData() {
|
|
|
|
|
|
newTabsArray.add("订单汇总")
|
|
|
uiList.add(positionUI.root)
|
|
|
@@ -119,7 +120,7 @@ class ContractOrdersActivity : BaseActivity<ContractOrdersViewModel>(){
|
|
|
fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
|
|
|
val goodsids = quoteMessageEvent.goodsid
|
|
|
//如果推送的goodsid包含当前页面的goodsid,则进行页面刷新
|
|
|
- if (selectedTabIndex == 0){
|
|
|
+ if (selectedTabIndex == 0) {
|
|
|
positionUI.refresh(quoteMessageEvent = quoteMessageEvent)
|
|
|
}
|
|
|
|
|
|
@@ -198,7 +199,10 @@ class ContractOrdersActivity : BaseActivity<ContractOrdersViewModel>(){
|
|
|
* @property viewModel SpotWareHouseViewModel
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class PositionUI(private val activity : AppCompatActivity, private val viewModel: ContractOrdersViewModel) : ContractPositionContentAdapter.OnContentScrollListener {
|
|
|
+class PositionUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: ContractOrdersViewModel
|
|
|
+) : ContractPositionContentAdapter.OnContentScrollListener {
|
|
|
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
@@ -206,14 +210,27 @@ class PositionUI(private val activity : AppCompatActivity, private val viewModel
|
|
|
lateinit var recyclerView: RecyclerView
|
|
|
|
|
|
|
|
|
- fun refresh(quoteMessageEvent: QuoteMessageEvent){
|
|
|
+ fun refresh(quoteMessageEvent: QuoteMessageEvent) {
|
|
|
quoteMessageEvent.goodsid.forEach { goodid ->
|
|
|
//找到相应商品信息
|
|
|
- val goodsInfo =
|
|
|
- viewModel.positionDataList.value?.find { it.refgoodsId == goodid }
|
|
|
- viewModel.positionDataList.value?.indexOf(goodsInfo)?.let {
|
|
|
- if (it != -1) {//刷新相应item
|
|
|
- contractPositionContentAdapter.notifyItemChanged(it)
|
|
|
+ var goodsInfo: ContractTradePositionData?
|
|
|
+
|
|
|
+ viewModel.positionDataList.value?.forEach { data ->
|
|
|
+ if (data.refgoodsId == 0) {
|
|
|
+ goodsInfo =
|
|
|
+ viewModel.positionDataList.value?.find { data.goodsid == goodid.toString() }
|
|
|
+ viewModel.positionDataList.value?.indexOf(goodsInfo)?.let {
|
|
|
+ if (it != -1) {//刷新相应item
|
|
|
+ contractPositionContentAdapter.notifyItemChanged(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ goodsInfo = viewModel.positionDataList.value?.find { data.refgoodsId == goodid }
|
|
|
+ viewModel.positionDataList.value?.indexOf(goodsInfo)?.let {
|
|
|
+ if (it != -1) {//刷新相应item
|
|
|
+ contractPositionContentAdapter.notifyItemChanged(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -356,7 +373,10 @@ class PositionUI(private val activity : AppCompatActivity, private val viewModel
|
|
|
* @property viewModel SpotWareHouseViewModel
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class OrderUI(private val activity : AppCompatActivity, private val viewModel: ContractOrdersViewModel) : ContractOrderContentAdapter.OnContentScrollListener {
|
|
|
+class OrderUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: ContractOrdersViewModel
|
|
|
+) : ContractOrderContentAdapter.OnContentScrollListener {
|
|
|
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
@@ -369,7 +389,7 @@ class OrderUI(private val activity : AppCompatActivity, private val viewModel: C
|
|
|
|
|
|
val contractOrderContentAdapter by lazy {
|
|
|
ContractOrderContentAdapter(
|
|
|
- activity,viewModel
|
|
|
+ activity, viewModel
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -383,8 +403,8 @@ class OrderUI(private val activity : AppCompatActivity, private val viewModel: C
|
|
|
verticalLayout {
|
|
|
viewModel.queryContractOrderTitle(Constant.table_mobile_hnst_hydd_wt)
|
|
|
contractOrderContentAdapter.setOnContentScrollListener(this@OrderUI)
|
|
|
- viewModel.showCancelDialog.bindOptional(context){
|
|
|
- if (it == true){
|
|
|
+ viewModel.showCancelDialog.bindOptional(context) {
|
|
|
+ if (it == true) {
|
|
|
activity.createWarningDialog {
|
|
|
setTitle("温馨提示")
|
|
|
setMessage("确定撤销此委托吗?")
|
|
|
@@ -399,7 +419,7 @@ class OrderUI(private val activity : AppCompatActivity, private val viewModel: C
|
|
|
marketid = data1?.marketid?.toInt() ?: 0,
|
|
|
accountid = GlobalDataCollection.instance?.accountId ?: 0,
|
|
|
oldOrderId = data1?.orderid?.toLong() ?: 0
|
|
|
- ){
|
|
|
+ ) {
|
|
|
//撤单成功后再次请求申请单
|
|
|
viewModel.queryContractTradeOrderDetail()
|
|
|
}
|
|
|
@@ -527,7 +547,10 @@ class OrderUI(private val activity : AppCompatActivity, private val viewModel: C
|
|
|
* @property viewModel SpotWareHouseViewModel
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class TraderUI(private val activity : AppCompatActivity, private val viewModel: ContractOrdersViewModel) : ContractTraderContentAdapter.OnContentScrollListener {
|
|
|
+class TraderUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: ContractOrdersViewModel
|
|
|
+) : ContractTraderContentAdapter.OnContentScrollListener {
|
|
|
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
@@ -671,7 +694,10 @@ class TraderUI(private val activity : AppCompatActivity, private val viewModel:
|
|
|
* @property viewModel SpotWareHouseViewModel
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class DeliveryUI(private val activity : AppCompatActivity, private val viewModel: ContractOrdersViewModel) : ContractDeliveryContentAdapter.OnContentScrollListener {
|
|
|
+class DeliveryUI(
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
+ private val viewModel: ContractOrdersViewModel
|
|
|
+) : ContractDeliveryContentAdapter.OnContentScrollListener {
|
|
|
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
@@ -684,7 +710,7 @@ class DeliveryUI(private val activity : AppCompatActivity, private val viewModel
|
|
|
|
|
|
val contractDeliveryContentAdapter by lazy {
|
|
|
ContractDeliveryContentAdapter(
|
|
|
- activity,viewModel
|
|
|
+ activity, viewModel
|
|
|
)
|
|
|
}
|
|
|
|