|
|
@@ -8,10 +8,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
import cn.muchinfo.rma.R
|
|
|
-import cn.muchinfo.rma.global.data.ChangeLogData
|
|
|
-import cn.muchinfo.rma.global.data.MiddleGoodsChangeLogData
|
|
|
-import cn.muchinfo.rma.global.data.MiddleGoodsData
|
|
|
-import cn.muchinfo.rma.global.data.WrStandardData
|
|
|
+import cn.muchinfo.rma.global.data.*
|
|
|
import cn.muchinfo.rma.global.isBlankString
|
|
|
import cn.muchinfo.rma.global.toPercentage
|
|
|
import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
@@ -30,26 +27,27 @@ import org.jetbrains.anko.support.v4.viewPager
|
|
|
/**
|
|
|
* 套保品种详情
|
|
|
*/
|
|
|
-class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>(){
|
|
|
+class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>() {
|
|
|
|
|
|
/**
|
|
|
* 数据
|
|
|
*/
|
|
|
- val data: MiddleGoodsData by lazy {
|
|
|
- intent.getParcelableExtra<MiddleGoodsData>("data") as MiddleGoodsData
|
|
|
+ val data: MiddleGoodsDetail by lazy {
|
|
|
+ intent.getParcelableExtra<MiddleGoodsDetail>("data") as MiddleGoodsDetail
|
|
|
}
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
|
|
|
|
- /** 商品详情 **/
|
|
|
- private val goodsDetailsUI by lazy { GoodsDetailsUI(this,viewModel,data) }
|
|
|
+// /** 商品详情 **/
|
|
|
+// private val goodsDetailsUI by lazy { GoodsDetailsUI(this, viewModel, data) }
|
|
|
+
|
|
|
/** 变更记录 **/
|
|
|
- private val changeRecordUI by lazy { ChangeRecordUI(this,viewModel, data) }
|
|
|
+ private val changeRecordUI by lazy { ChangeRecordUI(this, viewModel, data) }
|
|
|
private val tabsArray: List<String> by lazy {
|
|
|
arrayListOf(
|
|
|
- "商品详情", "变更记录"
|
|
|
+ /* "商品详情",*/ "变更记录"
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -61,21 +59,21 @@ class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>(
|
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
|
when (position) {
|
|
|
0 -> {
|
|
|
- return goodsDetailsUI.root.apply {
|
|
|
+ return changeRecordUI.root.apply {
|
|
|
container.addView(
|
|
|
this,
|
|
|
ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
- 1 -> {
|
|
|
+ /*1 -> {
|
|
|
return changeRecordUI.root.apply {
|
|
|
container.addView(
|
|
|
this,
|
|
|
ViewGroup.LayoutParams(matchParent, matchParent)
|
|
|
)
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
else -> return super.instantiateItem(container, position)
|
|
|
}
|
|
|
}
|
|
|
@@ -109,19 +107,19 @@ class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>(
|
|
|
background = resources.getDrawable(R.color.rma_pass_status)//rma_pass_status已通过背景色
|
|
|
|
|
|
imageView {
|
|
|
- if (data.isvalid == "1"){
|
|
|
+ if (data.mg?.isvalid == "1") {
|
|
|
imageResource = R.mipmap.rma_pass_status
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
imageResource = R.mipmap.rma_wait_status
|
|
|
}
|
|
|
}.lparams(autoSize(38), autoSize(38)) {
|
|
|
marginStart = autoSize(37)
|
|
|
}
|
|
|
textView {
|
|
|
- if (data.isvalid == "1"){
|
|
|
+ if (data.mg?.isvalid == "1") {
|
|
|
textColorInt = R.color.rma_green_color
|
|
|
text = "正常"
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
textColorInt = R.color.rma_yellow_text_color
|
|
|
text = "停用"
|
|
|
}
|
|
|
@@ -133,6 +131,7 @@ class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>(
|
|
|
}.lparams(matchParent, autoSize(60))
|
|
|
|
|
|
tabSegment {
|
|
|
+ visibility = View.GONE
|
|
|
segment = this
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
addOnTabSelectedListener(object :
|
|
|
@@ -180,40 +179,50 @@ class HedgeSpeciesDetailsActivity : BaseActivity<CommodityInformationViewModel>(
|
|
|
* @property root _FrameLayout
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class GoodsDetailsUI(
|
|
|
- private val activity : AppCompatActivity,
|
|
|
- private val viewModel: CommodityInformationViewModel,
|
|
|
- private val data : MiddleGoodsData
|
|
|
-){
|
|
|
-
|
|
|
- init {
|
|
|
- viewModel.queryMiddleGoodsDetailList(data.middlegoodsid ?: "") {
|
|
|
- viewModel.avalidGoodsDetailsData.postValue(this)
|
|
|
- }
|
|
|
- }
|
|
|
- val root = _FrameLayout(activity).apply {
|
|
|
- verticalLayout {
|
|
|
- contentItem(itemTile = "套保品种名称",itemContent = data.middlegoodsname ?: "")
|
|
|
- viewItemUI()
|
|
|
- contentItem(itemTile = "套保品种代码",itemContent = data.middlegoodscode ?: "")
|
|
|
- viewItemUI()
|
|
|
- contentItem(itemTile = "单位",itemContent = data.enumdicname ?: "")
|
|
|
- viewItemUI()
|
|
|
- contentItem(itemTile = "套保比例",itemContent = data.needhedgeratio?.toDouble()?.times(100).toString() ?: "")
|
|
|
- viewModel.avalidGoodsDetailsData.bindOptional(context){list ->
|
|
|
- list?.forEach {
|
|
|
- viewItemUI()
|
|
|
- contentItem(itemTile = "期货品种" + list.indexOf(it).plus(1),itemContent = it.goodsgroupname?.isBlankString() ?: "")
|
|
|
- contentItem(itemTile = "期货品种系数" + list.indexOf(it).plus(1),itemContent = it.convertratio ?: "")
|
|
|
- }
|
|
|
- }
|
|
|
- viewItemUI()
|
|
|
-
|
|
|
- contentItem(itemTile = "备注",itemContent = "--")//TODO 需要加字段
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+//class GoodsDetailsUI(
|
|
|
+// private val activity: AppCompatActivity,
|
|
|
+// private val viewModel: CommodityInformationViewModel,
|
|
|
+// private val data: MiddleGoodsDetail
|
|
|
+//) {
|
|
|
+//
|
|
|
+// init {
|
|
|
+// viewModel.queryMiddleGoodsDetailList(data.middlegoodsid ?: "") {
|
|
|
+// viewModel.avalidGoodsDetailsData.postValue(this)
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// val root = _FrameLayout(activity).apply {
|
|
|
+// verticalLayout {
|
|
|
+// contentItem(itemTile = "套保品种名称", itemContent = data.middlegoodsname ?: "")
|
|
|
+// viewItemUI()
|
|
|
+// contentItem(itemTile = "套保品种代码", itemContent = data.middlegoodscode ?: "")
|
|
|
+// viewItemUI()
|
|
|
+// contentItem(itemTile = "单位", itemContent = data.enumdicname ?: "")
|
|
|
+// viewItemUI()
|
|
|
+// contentItem(
|
|
|
+// itemTile = "套保比例",
|
|
|
+// itemContent = data.needhedgeratio?.toDouble()?.times(100).toString() ?: ""
|
|
|
+// )
|
|
|
+// viewModel.avalidGoodsDetailsData.bindOptional(context) { list ->
|
|
|
+// list?.forEach {
|
|
|
+// viewItemUI()
|
|
|
+// contentItem(
|
|
|
+// itemTile = "期货品种" + list.indexOf(it).plus(1),
|
|
|
+// itemContent = it.goodsgroupname?.isBlankString() ?: ""
|
|
|
+// )
|
|
|
+// contentItem(
|
|
|
+// itemTile = "期货品种系数" + list.indexOf(it).plus(1),
|
|
|
+// itemContent = it.convertratio ?: ""
|
|
|
+// )
|
|
|
+// }
|
|
|
+// }
|
|
|
+// viewItemUI()
|
|
|
+//
|
|
|
+// contentItem(itemTile = "备注", itemContent = "--")//TODO 需要加字段
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
/**
|
|
|
* 变更记录
|
|
|
@@ -224,18 +233,19 @@ class GoodsDetailsUI(
|
|
|
* @constructor
|
|
|
*/
|
|
|
class ChangeRecordUI(
|
|
|
- private val activity : AppCompatActivity,
|
|
|
+ private val activity: AppCompatActivity,
|
|
|
private val viewModel: CommodityInformationViewModel,
|
|
|
- private val data : MiddleGoodsData
|
|
|
-){
|
|
|
+ private val data: MiddleGoodsDetail
|
|
|
+) {
|
|
|
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
|
|
|
- private val spotVarietiesNormalAdapter: BaseAdapter<MiddleGoodsChangeLogData, ChangeLogViewHolder> = BaseAdapter { _, _ -> ChangeLogViewHolder(activity) }
|
|
|
+ private val spotVarietiesNormalAdapter: BaseAdapter<MiddleGoodsChangeLogData, ChangeLogViewHolder> =
|
|
|
+ BaseAdapter { _, _ -> ChangeLogViewHolder(activity) }
|
|
|
|
|
|
init {
|
|
|
- viewModel.queryMiddleGoodsChangeLog(middlegoodsid = data.middlegoodsid ?: "")
|
|
|
+ viewModel.queryMiddleGoodsChangeLog(middlegoodsid = data.mg?.middlegoodsid ?: "")
|
|
|
}
|
|
|
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
@@ -248,18 +258,29 @@ class ChangeRecordUI(
|
|
|
textColorInt = R.color.hint_text_color
|
|
|
textSizeAuto = 23
|
|
|
}.lparams(autoSize(225), autoSize(100))
|
|
|
- textView {
|
|
|
- gravity = Gravity.CENTER
|
|
|
- text = "修改前套保比例"
|
|
|
- textColorInt = R.color.hint_text_color
|
|
|
- textSizeAuto = 23
|
|
|
+
|
|
|
+ verticalLayout {
|
|
|
+ textView {
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "修改前套保比例"
|
|
|
+ textColorInt = R.color.hint_text_color
|
|
|
+ textSizeAuto = 23
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
+ textView {
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ text = "修改后套保比例"
|
|
|
+ textColorInt = R.color.hint_text_color
|
|
|
+ textSizeAuto = 23
|
|
|
+ }.lparams(wrapContent, wrapContent)
|
|
|
}.lparams(autoSize(225), autoSize(100))
|
|
|
+
|
|
|
textView {
|
|
|
gravity = Gravity.CENTER
|
|
|
- text = "修改后套保比例"
|
|
|
+ text = "备注"
|
|
|
textColorInt = R.color.hint_text_color
|
|
|
textSizeAuto = 23
|
|
|
}.lparams(autoSize(225), autoSize(100))
|
|
|
+
|
|
|
textView {
|
|
|
gravity = Gravity.CENTER
|
|
|
text = "修改人"
|
|
|
@@ -276,7 +297,9 @@ class ChangeRecordUI(
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
- viewModel.queryMiddleGoodsChangeLog(middlegoodsid = data.middlegoodsid ?: "")
|
|
|
+ viewModel.queryMiddleGoodsChangeLog(
|
|
|
+ middlegoodsid = data.mg?.middlegoodsid ?: ""
|
|
|
+ )
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
@@ -289,11 +312,11 @@ class ChangeRecordUI(
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- viewModel.middleChangeLogDataList.bindOptional(context){
|
|
|
- if (it?.isEmpty() == true || it?.size == 0){
|
|
|
+ viewModel.middleChangeLogDataList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
statusLayout.showEmpty()
|
|
|
- }else {
|
|
|
- if (swipeToLayout.getIsRefreshing()){
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
swipeToLayout.finishRefresh()
|
|
|
}
|
|
|
statusLayout.showSuccess()
|
|
|
@@ -304,7 +327,7 @@ class ChangeRecordUI(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
|
|
|
+fun _LinearLayout.contentItem(itemTile: String, itemContent: String) {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
background = resources.getDrawable(R.color.white)
|
|
|
@@ -314,7 +337,7 @@ fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
|
|
|
text = itemTile
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(35)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(120))
|
|
|
@@ -323,7 +346,7 @@ fun _LinearLayout.contentItem(itemTile : String,itemContent : String){
|
|
|
text = itemContent
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(35)
|
|
|
}
|
|
|
|