|
|
@@ -10,6 +10,7 @@ import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import androidx.annotation.RequiresApi
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
+import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
|
@@ -18,6 +19,7 @@ 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.global.utils.TimeUtils
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
@@ -26,22 +28,28 @@ import cn.muchinfo.rma.view.base.hnstmain.contractorders.adapter.ContractDeliver
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.contractorders.adapter.ContractOrderContentAdapter
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.contractorders.adapter.ContractPositionContentAdapter
|
|
|
import cn.muchinfo.rma.view.base.hnstmain.contractorders.adapter.ContractTraderContentAdapter
|
|
|
+import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
|
|
|
import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
|
|
|
import com.blankj.utilcode.util.ConvertUtils
|
|
|
import com.blankj.utilcode.util.LogUtils
|
|
|
import com.blankj.utilcode.util.SPUtils
|
|
|
+import com.blankj.utilcode.util.ToastUtils
|
|
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
|
import mtp.polymer.com.autowidget.dialog.createWarningDialog
|
|
|
+import mtp.polymer.com.autowidget.dialog.showDataSelectDialog
|
|
|
import mtp.polymer.com.autowidget.utils.bindTaskStatus
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
|
import org.jetbrains.anko.*
|
|
|
import org.jetbrains.anko.support.v4.viewPager
|
|
|
+import java.text.SimpleDateFormat
|
|
|
+import java.util.*
|
|
|
+import kotlin.collections.ArrayList
|
|
|
|
|
|
/**
|
|
|
* 合约订单页面
|
|
|
@@ -404,6 +412,12 @@ class OrderUI(
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ //开始日期
|
|
|
+ val startData : MutableLiveData<String> = MutableLiveData<String>().apply { value = "" }
|
|
|
+
|
|
|
+ //结束日期
|
|
|
+ val endData : MutableLiveData<String> = MutableLiveData<String>().apply { value = "" }
|
|
|
+
|
|
|
override fun onScroll(event: MotionEvent?) {
|
|
|
//处理单个item滚动时,顶部tab需要联动
|
|
|
if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
@@ -414,6 +428,106 @@ class OrderUI(
|
|
|
verticalLayout {
|
|
|
viewModel.queryContractOrderTitle(Constant.table_mobile_hnst_hydd_wt)
|
|
|
contractOrderContentAdapter.setOnContentScrollListener(this@OrderUI)
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.showDataSelectDialog(type = "1") {
|
|
|
+ startData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_time_click_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ startData.bindOptional(context){
|
|
|
+ text = it
|
|
|
+ }
|
|
|
+ text = "开始日期"
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(18)
|
|
|
+ }
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38)){
|
|
|
+ marginEnd = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(67),1f) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "-"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ marginEnd = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.showDataSelectDialog(type = "1") {
|
|
|
+ endData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_time_click_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ endData.bindOptional(context){
|
|
|
+ text = it
|
|
|
+ }
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(18)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38))
|
|
|
+ }.lparams(0, autoSize(67),1f) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ textView {
|
|
|
+ setPadding(20,0,20,0)
|
|
|
+ backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (startData.value.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请选择开始日期")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (endData.value.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请选择结束时间")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ // 时间区间不能超过31天
|
|
|
+ if (TimeUtils.dateDiff(startData.value, endData.value, "yyyy-MM-dd") > 31) {
|
|
|
+ ToastUtils.showLong("时间区间不能超过31天")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ viewModel.queryContractTradeOrderDetail(begindate = startData.value ?: "",enddate = endData.value ?: "")
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "查询"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, autoSize(67)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
viewModel.showCancelDialog.bindOptional(context) {
|
|
|
if (it == true) {
|
|
|
activity.createWarningDialog {
|
|
|
@@ -432,7 +546,7 @@ class OrderUI(
|
|
|
oldOrderId = data1?.orderid?.toLong() ?: 0
|
|
|
) {
|
|
|
//撤单成功后再次请求申请单
|
|
|
- viewModel.queryContractTradeOrderDetail()
|
|
|
+ viewModel.queryContractTradeOrderDetail(begindate = startData.value ?: "",enddate = endData.value ?: "")
|
|
|
}
|
|
|
|
|
|
viewModel.showCancelDialog.postValue(false)
|
|
|
@@ -502,7 +616,7 @@ class OrderUI(
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(true)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContractTradeOrderDetail()
|
|
|
+ viewModel.queryContractTradeOrderDetail(begindate = startData.value ?: "",enddate = endData.value ?: "")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
@@ -578,6 +692,12 @@ class TraderUI(
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ //开始日期
|
|
|
+ val startData : MutableLiveData<String> = MutableLiveData<String>().apply { value = "" }
|
|
|
+
|
|
|
+ //结束日期
|
|
|
+ val endData : MutableLiveData<String> = MutableLiveData<String>().apply { value = "" }
|
|
|
+
|
|
|
override fun onScroll(event: MotionEvent?) {
|
|
|
//处理单个item滚动时,顶部tab需要联动
|
|
|
if (null != horScrollview) horScrollview.onTouchEvent(event)
|
|
|
@@ -588,6 +708,106 @@ class TraderUI(
|
|
|
verticalLayout {
|
|
|
viewModel.queryContractTraderTitle(Constant.table_mobile_hnst_hydd_cj)
|
|
|
contractTraderContentAdapter.setOnContentScrollListener(this@TraderUI)
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.showDataSelectDialog(type = "1") {
|
|
|
+ startData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_time_click_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ startData.bindOptional(context){
|
|
|
+ text = it
|
|
|
+ }
|
|
|
+ text = "开始日期"
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(18)
|
|
|
+ }
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38)){
|
|
|
+ marginEnd = autoSize(10)
|
|
|
+ }
|
|
|
+
|
|
|
+ }.lparams(0, autoSize(67),1f) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ textView {
|
|
|
+ text = "-"
|
|
|
+ textSizeAuto = 31
|
|
|
+ textColorInt = R.color.rma_black_33
|
|
|
+ }.lparams(wrapContent, wrapContent){
|
|
|
+ marginStart = autoSize(30)
|
|
|
+ marginEnd = autoSize(30)
|
|
|
+ }
|
|
|
+
|
|
|
+ linearLayout {
|
|
|
+ onThrottleFirstClick {
|
|
|
+ activity.showDataSelectDialog(type = "1") {
|
|
|
+ endData.postValue(this)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backgroundResource = R.drawable.rma_time_click_bg
|
|
|
+ gravity = Gravity.CENTER_VERTICAL
|
|
|
+ textView {
|
|
|
+ endData.bindOptional(context){
|
|
|
+ text = it
|
|
|
+ }
|
|
|
+ textColorInt = R.color.rma_hint_text_color_ccc
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
+ marginStart = autoSize(18)
|
|
|
+ }
|
|
|
+
|
|
|
+ emptyView()
|
|
|
+
|
|
|
+ imageView {
|
|
|
+ imageResource = R.mipmap.rma_search_by_time
|
|
|
+ }.lparams(autoSize(38), autoSize(38))
|
|
|
+ }.lparams(0, autoSize(67),1f) {
|
|
|
+ marginStart = autoSize(36)
|
|
|
+ marginEnd = autoSize(36)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ textView {
|
|
|
+ setPadding(20,0,20,0)
|
|
|
+ backgroundDrawable = createCommonBottomRoundBg(color = "#2481DD", corner = 5)
|
|
|
+ onThrottleFirstClick {
|
|
|
+ if (startData.value.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请选择开始日期")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ if (endData.value.isNullOrEmpty()){
|
|
|
+ ToastUtils.showLong("请选择结束时间")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ // 时间区间不能超过31天
|
|
|
+ if (TimeUtils.dateDiff(startData.value, endData.value, "yyyy-MM-dd") > 31) {
|
|
|
+ ToastUtils.showLong("时间区间不能超过31天")
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+ viewModel.queryContractTradeDetail(begindate = startData.value ?: "",enddate = endData.value ?: "")
|
|
|
+ }
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "查询"
|
|
|
+ textColorInt = R.color.white
|
|
|
+ textSizeAuto = 31
|
|
|
+ }.lparams(wrapContent, autoSize(67)) {
|
|
|
+ marginStart = autoSize(32)
|
|
|
+ marginEnd = autoSize(32)
|
|
|
+ }
|
|
|
+ }.lparams(matchParent, autoSize(100))
|
|
|
+
|
|
|
linearLayout {
|
|
|
linearLayout {
|
|
|
|
|
|
@@ -649,7 +869,7 @@ class TraderUI(
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(true)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryContractTradeDetail()
|
|
|
+ viewModel.queryContractTradeDetail(begindate = startData.value ?: "",enddate = endData.value ?: "")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|