|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.muchinfo.rma.view.base.main.castsurely
|
|
|
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.content.Intent
|
|
|
import android.graphics.Typeface
|
|
|
import android.os.Bundle
|
|
|
@@ -7,10 +8,16 @@ import android.view.Gravity
|
|
|
import android.view.View
|
|
|
import cn.muchinfo.rma.R
|
|
|
import cn.muchinfo.rma.global.MTPEnums
|
|
|
+import cn.muchinfo.rma.global.data.RSTriggerLogData
|
|
|
+import cn.muchinfo.rma.global.data.RStrategyData
|
|
|
+import cn.muchinfo.rma.global.database.DataBase
|
|
|
+import cn.muchinfo.rma.lifecycle.bindOptional
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
import cn.muchinfo.rma.view.base.future.trade.itemView
|
|
|
import cn.muchinfo.rma.view.base.home.contract.emptyView
|
|
|
+import com.blankj.utilcode.util.ActivityUtils
|
|
|
import mtp.polymer.com.autowidget.adapter.BaseAdapter
|
|
|
import mtp.polymer.com.autowidget.dialog.SelectData
|
|
|
import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
|
|
|
@@ -26,10 +33,13 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
private lateinit var swipeToLayout: SwipeToLoadLayout
|
|
|
private lateinit var statusLayout: StatusLayout
|
|
|
|
|
|
+ //定投记录
|
|
|
+ private val data by lazy { intent.getParcelableExtra<RStrategyData>("RStrategyData") as RStrategyData }
|
|
|
+
|
|
|
/**
|
|
|
* 定投列表适配器
|
|
|
*/
|
|
|
- private val myCastSurelyAdapter: BaseAdapter<String, CastSurelyDetailsViewHolder> =
|
|
|
+ private val myCastSurelyAdapter: BaseAdapter<RSTriggerLogData, CastSurelyDetailsViewHolder> =
|
|
|
BaseAdapter { _, _ ->
|
|
|
CastSurelyDetailsViewHolder(
|
|
|
this,
|
|
|
@@ -37,9 +47,11 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
verticalLayout {
|
|
|
+ viewModel.queryRSTriggerLog(data.regularlystrategyid ?: "")
|
|
|
background = resources.getDrawable(R.color.main_title_bg_color)
|
|
|
//页面标题
|
|
|
topBar {
|
|
|
@@ -47,28 +59,57 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
commonTitle {
|
|
|
text = "定投详情"
|
|
|
}
|
|
|
- // 新增市价录入
|
|
|
- commonMenuButton(R.mipmap.qhj_dian_dian) {
|
|
|
- val selectDataList = arrayListOf(
|
|
|
- SelectData(
|
|
|
- id = "1",
|
|
|
- value = "修改"
|
|
|
- ),
|
|
|
- SelectData(
|
|
|
- id = "2",
|
|
|
- value = "暂停"
|
|
|
- ),
|
|
|
- SelectData(
|
|
|
- id = "3",
|
|
|
- value = "终止"
|
|
|
- ),
|
|
|
- SelectData(
|
|
|
- id = "4",
|
|
|
- value = "取消"
|
|
|
+ if (data.regularlystrategystatus != "3"){
|
|
|
+ // 新增市价录入
|
|
|
+ commonMenuButton(R.mipmap.qhj_dian_dian) {
|
|
|
+ val selectDataList = arrayListOf<SelectData>()
|
|
|
+ if (data.regularlystrategystatus == "1"){//策略状态 - 1:正常 2:暂停 3:终止
|
|
|
+ selectDataList.add(
|
|
|
+ SelectData(
|
|
|
+ id = "1",
|
|
|
+ value = "修改"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ selectDataList.add(
|
|
|
+ SelectData(
|
|
|
+ id = "2",
|
|
|
+ value = "暂停"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ selectDataList.add(
|
|
|
+ SelectData(
|
|
|
+ id = "3",
|
|
|
+ value = "终止"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }else if (data.regularlystrategystatus == "2"){
|
|
|
+ selectDataList.add(
|
|
|
+ SelectData(
|
|
|
+ id = "5",
|
|
|
+ value = "恢复"
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+ selectDataList.add(
|
|
|
+ SelectData(
|
|
|
+ id = "4",
|
|
|
+ value = "取消"
|
|
|
+ )
|
|
|
)
|
|
|
- )
|
|
|
- creatBottomSheetNoTitleDialog(selectDataList) {
|
|
|
+ creatBottomSheetNoTitleDialog(selectDataList) {
|
|
|
+ if (this.id == "1"){
|
|
|
+ val intent = Intent()
|
|
|
+ intent.putExtra("type","2")
|
|
|
+ intent.setClass(context,AddCastSurelyActivity::class.java)
|
|
|
+ ActivityUtils.startActivity(intent)
|
|
|
+ } else if (this.id == "2"){//暂停
|
|
|
+
|
|
|
+ }else if (this.id == "3"){//终止
|
|
|
|
|
|
+ }else if (this.id == "5"){//恢复
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -76,7 +117,7 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
linearLayout {
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "黄金"
|
|
|
+ text = data.goodsname
|
|
|
textSizeAuto = 43
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
}.lparams(wrapContent, wrapContent){
|
|
|
@@ -86,6 +127,7 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
emptyView()
|
|
|
|
|
|
imageView {
|
|
|
+ visibility = View.GONE
|
|
|
imageResource = R.mipmap.rma_more
|
|
|
}.lparams(autoSize(30), autoSize(30)){
|
|
|
marginEnd = autoSize(36)
|
|
|
@@ -106,7 +148,7 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- text = "2300.23"
|
|
|
+ text = NumberUtils.roundNum(data.triggertotalamount,2)
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
textSizeAuto = 36
|
|
|
typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
|
|
@@ -118,7 +160,7 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
verticalLayout {
|
|
|
gravity = Gravity.CENTER_HORIZONTAL
|
|
|
textView {
|
|
|
- text = "累计定投(克)"
|
|
|
+ text = "累计定投(" + data.enumdicname + ")"
|
|
|
textColorInt = R.color.qhj_hint_text_color
|
|
|
textSizeAuto = 29
|
|
|
}.lparams(wrapContent, wrapContent){
|
|
|
@@ -126,7 +168,8 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- text = "19g"
|
|
|
+ val qtydecimalplace = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data?.goodsid?.toInt() ?: 0).qtydecimalplace
|
|
|
+ text = NumberUtils.roundNum(data?.triggertotalqty?.toDouble()?.times(qtydecimalplace).toString(),qtydecimalplace)
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
textSizeAuto = 36
|
|
|
typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
|
|
@@ -146,7 +189,7 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- text = "10期"
|
|
|
+ text = data.triggersuccesstimes
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
textSizeAuto = 36
|
|
|
typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
|
|
@@ -160,7 +203,18 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
background = createRoundRectDrawable("#E5EFF5", 3)
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
- text = "定投计划:每月1日定投2g"
|
|
|
+ val qtydecimalplace = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data.goodsid?.toInt() ?: 0).qtydecimalplace
|
|
|
+ if (data.regularlystrategystatus == "1"){//1:正常 2:暂停 3:终止
|
|
|
+ if (data.regularlymode == "1"){//按数量
|
|
|
+ text = data.nexttriggerdate + "(" + data.regularlycyclevalue + ")将从余额扣款定投" + data.nexttriggerqty?.toDouble()?.times(qtydecimalplace) + data.enumdicname
|
|
|
+ }else{//按金额
|
|
|
+ text = data.nexttriggerdate + "(" + data.regularlycyclevalue + ")将从余额扣款定投" + NumberUtils.roundNum(data.nexttriggeramount,2)
|
|
|
+ }
|
|
|
+ }else if (data.regularlystrategystatus == "2"){
|
|
|
+ text = "定投已暂停"
|
|
|
+ }else if (data.regularlystrategystatus == "3"){
|
|
|
+ text = "定投已终止"
|
|
|
+ }
|
|
|
textColorInt = R.color.rma_zhushi_text_color
|
|
|
textSizeAuto = 31
|
|
|
}.lparams(wrapContent, wrapContent){
|
|
|
@@ -170,8 +224,11 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
emptyView()
|
|
|
|
|
|
textView {
|
|
|
-// backgroundResource = R.drawable.qhj_transparent_bg
|
|
|
-// background = createRoundRectDrawable("#2794FF", 5)
|
|
|
+ if (data.regularlystrategystatus == "1"){
|
|
|
+ visibility = View.VISIBLE
|
|
|
+ }else{
|
|
|
+ visibility = View.GONE
|
|
|
+ }
|
|
|
gravity = Gravity.CENTER
|
|
|
text = "进行中"
|
|
|
textColorInt = R.color.rma_blue_color
|
|
|
@@ -204,14 +261,14 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
statusLayout = this
|
|
|
// bindTaskStatus(viewModule.status)
|
|
|
setRetryAction {
|
|
|
-
|
|
|
+ viewModel.queryRSTriggerLog(data.regularlystrategyid ?: "")
|
|
|
}
|
|
|
swipeToLoadLayout {
|
|
|
swipeToLayout = this
|
|
|
setEnableRefresh(true)
|
|
|
setEnableLoadMore(false)
|
|
|
setOnRefreshListener {
|
|
|
-
|
|
|
+ viewModel.queryRSTriggerLog(data.regularlystrategyid ?: "")
|
|
|
}
|
|
|
setEnableScrollContentWhenLoaded(false)
|
|
|
setEnableLoadMoreWhenContentNotFull(false)
|
|
|
@@ -226,7 +283,17 @@ class CastSurelyDetailsActivity : BaseActivity<MyCastSurelyViewModel>() {
|
|
|
emptyView(hint = resources.getString(R.string.now_no_data))
|
|
|
}).lparams(matchParent, matchParent)
|
|
|
|
|
|
- myCastSurelyAdapter.setNewData(arrayListOf("1","2","3","4","5"))
|
|
|
+ viewModel.castSurelyLogDataList.bindOptional(context) {
|
|
|
+ if (it?.isEmpty() == true || it?.size == 0) {
|
|
|
+ statusLayout.showEmpty()
|
|
|
+ } else {
|
|
|
+ if (swipeToLayout.getIsRefreshing()) {
|
|
|
+ swipeToLayout.finishRefresh()
|
|
|
+ }
|
|
|
+ statusLayout.showSuccess()
|
|
|
+ myCastSurelyAdapter.setNewData(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|