Sfoglia il codice sorgente

风险管理4月6日提交代码-liu.bolan-

Liu.bolan 4 anni fa
parent
commit
f5a0f33a3c

+ 2 - 0
RMA/app/src/main/AndroidManifest.xml

@@ -196,6 +196,8 @@
         <activity android:name=".view.base.home.set.ChangePasswordActivity"/>
 
         <activity android:name=".view.base.login.AgreeMentActivity"/>
+
+        <activity android:name=".view.base.home.warehouse.WarehouseInformationActivity"/>
     </application>
 
 </manifest>

+ 864 - 407
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/HomeFragment.kt

@@ -10,6 +10,7 @@ import android.widget.ImageView
 import androidx.appcompat.app.AppCompatActivity
 import androidx.cardview.widget.CardView
 import androidx.fragment.app.Fragment
+import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.RecyclerView
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
@@ -25,17 +26,20 @@ import cn.muchinfo.rma.view.base.future.trade.GoodsTradeActivity
 import cn.muchinfo.rma.view.base.home.business.BusinessManagementActivity
 import cn.muchinfo.rma.view.base.home.commodity.CommodityInformationActivity
 import cn.muchinfo.rma.view.base.home.contract.ContractActivity
+import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.customerdata.CustomerDataActivity
 import cn.muchinfo.rma.view.base.home.financial.FinancialActivity
 import cn.muchinfo.rma.view.base.home.hedge.HedgePlanActivity
 import cn.muchinfo.rma.view.base.home.reportquery.ReportQueryActivity
 import cn.muchinfo.rma.view.base.home.set.SettingActivity
 import cn.muchinfo.rma.view.base.home.tradingquery.TradingQueryActivity
+import cn.muchinfo.rma.view.base.home.warehouse.WarehouseInformationActivity
 import cn.muchinfo.rma.view.eventbus.EventConstent
 import cn.muchinfo.rma.view.eventbus.MessageEvent
 import com.blankj.utilcode.util.ActivityUtils
 import com.blankj.utilcode.util.ConvertUtils
 import com.blankj.utilcode.util.LogUtils
+import com.blankj.utilcode.util.ToastUtils
 import com.facebook.drawee.view.SimpleDraweeView
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
 import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
@@ -67,7 +71,44 @@ class HomeFragment : BaseFragment<HomeViewModel>() {
     private val researchReportUI: ResearchReportUI by lazy { ResearchReportUI(this, viewModel) }//研报
     private val informationUI: InformationUI by lazy { InformationUI(this, viewModel) }//咨讯
 
-    var isScrollIndexX = 0.0//记录首页导航菜单滚动的位置
+
+    val menuTab : MutableLiveData<Int> = MutableLiveData<Int>().apply { value = 0 }//用于控制菜单页切换后的点点显示
+    lateinit var segment2: QMUITabSegment//用于菜单的tab
+    var selectedTabIndex1: Int = 0//用于菜单的selectedTabIndex
+    private lateinit var viewPager1: ViewPager//用于菜单的viewpager
+    private val firstTabUI: FirstTabUI by lazy { FirstTabUI(this, viewModel) }//首页滑动tab的第一页
+    private val secondTabUI: SecondTabUI by lazy { SecondTabUI(this, viewModel) }//首页滑动tab的第二页
+
+    private val tabsArray1: List<String> by lazy { arrayListOf("", "") }//菜单tab
+
+    private val pagerAdapter1: PagerAdapter by lazy {//菜单tab的adapter
+        object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = tabsArray1[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                if (position == 0) {
+                    return firstTabUI.root.apply {
+                        container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
+                    }
+                } else if (position == 1) {
+                    return secondTabUI.root.apply {
+                        container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
+                    }
+                }
+                return super.instantiateItem(container, position)
+            }
+
+            override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
+                (`object` as? View)?.let { container.removeView(it) }
+            }
+
+            override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
+
+            override fun getCount(): Int = tabsArray1.size
+
+        }
+    }
 
     /**
      * 用户未读标识
@@ -257,426 +298,64 @@ class HomeFragment : BaseFragment<HomeViewModel>() {
 
                             }.lparams(matchParent, autoSize(400))
 
-                            var startX = 0f
-                            var endX = 0f
-
-                            horizontalScrollView {
-                                setOnScrollChangeListener(object : View.OnScrollChangeListener {
-                                    override fun onScrollChange(
-                                        p0: View?,
-                                        p1: Int,
-                                        p2: Int,
-                                        p3: Int,
-                                        p4: Int
-                                    ) {
-                                        val scrollRect = Rect()
-                                        getHitRect(scrollRect)
-                                        LogUtils.eTag("adakhsfkjahsfa11111111", "x = " + p1 + "y = " + p2)
-
+                            tabSegment {
+                                segment2 = this
+                                background = resources.getDrawable(R.color.white)
+                                addOnTabSelectedListener(object :
+                                    QMUITabSegment.OnTabSelectedListener {
+                                    override fun onDoubleTap(index: Int) {}
+                                    override fun onTabReselected(index: Int) {}
+                                    override fun onTabUnselected(index: Int) {}
+                                    override fun onTabSelected(index: Int) {
+                                        selectedTabIndex1 = index
+                                        menuTab.postValue(selectedTabIndex1)
                                     }
                                 })
 
-                                setOnTouchListener(object : View.OnTouchListener{
-                                    override fun onTouch(p0: View?, p1: MotionEvent?): Boolean {
-                                        if (p1?.action == MotionEvent.ACTION_DOWN){
-                                            startX = p1.x
-                                        }else if (p1?.action == MotionEvent.ACTION_UP){
-                                            endX = p1.x
-                                        }
 
-                                        if (startX.minus(endX) > 50){
-                                            LogUtils.eTag("asdhakjhfskjahsdjkas","右滑动" )
-                                        }else if (startX.minus(endX) < -50){
-                                            LogUtils.eTag("asdhakjhfskjahsdjkas","左滑动" )
-                                        }
+                            }.lparams(matchParent, autoSize(0))
+                            viewPager {
+                                background = resources.getDrawable(R.color.white)
+                                viewPager1 = this
+                                adapter = pagerAdapter1
+                            }.lparams(matchParent, autoSize(340))
 
-                                        return false
-                                    }
-                                })
-                                linearLayout {
-                                    verticalLayout {
-                                        linearLayout {
-                                            relativeLayout {
-
-                                                verticalLayout {
-                                                    onThrottleFirstClick {
-                                                        val intent = Intent()
-                                                        intent.setClass(
-                                                            context,
-                                                            CustomerDataActivity::class.java
-                                                        )
-                                                        ActivityUtils.startActivity(intent)
-                                                    }
-                                                    imageView {
-                                                        imageResource = R.mipmap.main_business_1
-                                                    }.lparams(autoSize(72), autoSize(72)) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-
-                                                    textView {
-                                                        text = "客户资料"
-                                                        textColorInt = R.color.black
-                                                        textSizeAuto = 26
-                                                    }.lparams(wrapContent, wrapContent) {
-                                                        topMargin = autoSize(20)
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-                                                }.lparams(matchParent, matchParent)
-
-                                                textView {
-                                                    visibility = View.GONE
-                                                    viewModel.pendingAudit.bindOptional(context) {
-                                                        if (it?.userqty?.toInt() ?: 0 > 99) {
-                                                            text = "99+"
-                                                        } else {
-                                                            text = it?.userqty.toString()
-                                                        }
-                                                        if (it?.userqty?.toInt() == 0) {
-                                                            visibility = View.GONE
-                                                        } else {
-                                                            visibility = View.VISIBLE
-                                                        }
-                                                    }
-                                                    textColorInt = R.color.p_global_write_color
-                                                    textSizeAuto = 15
-                                                    setPadding(
-                                                        autoSize(10),
-                                                        autoSize(6),
-                                                        autoSize(10),
-                                                        autoSize(6)
-                                                    )
-                                                    backgroundDrawable =
-                                                        createRoundRectDrawable("#fe671a", 45)
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    marginStart = autoSize(130)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-
-                                            verticalLayout {
-                                                onThrottleFirstClick {
-                                                    val intent = Intent()
-                                                    intent.setClass(
-                                                        context,
-                                                        CommodityInformationActivity::class.java
-                                                    )
-                                                    ActivityUtils.startActivity(intent)
-                                                }
-                                                imageView {
-                                                    imageResource = R.mipmap.main_business_2
-                                                }.lparams(autoSize(72), autoSize(72)) {
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                }
-
-                                                textView {
-                                                    text = "商品信息"
-                                                    textColorInt = R.color.black
-                                                    textSizeAuto = 26
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    topMargin = autoSize(20)
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-                                            relativeLayout {
-                                                verticalLayout {
-                                                    onThrottleFirstClick {
-                                                        val intent = Intent()
-                                                        intent.setClass(
-                                                            context,
-                                                            ContractActivity::class.java
-                                                        )
-                                                        ActivityUtils.startActivity(intent)
-                                                    }
-                                                    imageView {
-                                                        imageResource = R.mipmap.main_business_3
-                                                    }.lparams(autoSize(72), autoSize(72)) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-
-                                                    textView {
-                                                        text = "现货合同"
-                                                        textColorInt = R.color.black
-                                                        textSizeAuto = 26
-                                                    }.lparams(wrapContent, wrapContent) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                        topMargin = autoSize(20)
-                                                    }
-                                                }.lparams(matchParent, matchParent)
-
-                                                textView {
-                                                    visibility = View.GONE
-                                                    viewModel.pendingAudit.bindOptional(context) {
-                                                        if (it?.spotcontractqty?.toInt() ?: 0 > 99) {
-                                                            text = "99+"
-                                                        } else {
-                                                            text = it?.spotcontractqty.toString()
-                                                        }
-
-                                                        if (it?.spotcontractqty?.toInt() == 0) {
-                                                            visibility = View.GONE
-                                                        } else {
-                                                            visibility = View.VISIBLE
-                                                        }
-                                                    }
-                                                    textColorInt = R.color.p_global_write_color
-                                                    textSizeAuto = 15
-                                                    setPadding(
-                                                        autoSize(10),
-                                                        autoSize(6),
-                                                        autoSize(10),
-                                                        autoSize(6)
-                                                    )
-                                                    backgroundDrawable =
-                                                        createRoundRectDrawable("#fe671a", 45)
-                                                }.lparams(wrapContent, wrapContent) {
-
-                                                    marginStart = autoSize(130)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-                                            relativeLayout {
-                                                verticalLayout {
-                                                    onThrottleFirstClick {
-                                                        val intent = Intent()
-                                                        intent.setClass(
-                                                            context,
-                                                            HedgePlanActivity::class.java
-                                                        )
-                                                        ActivityUtils.startActivity(intent)
-                                                    }
-                                                    imageView {
-                                                        imageResource = R.mipmap.main_business_4
-                                                    }.lparams(autoSize(72), autoSize(72)) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-
-                                                    textView {
-                                                        text = "套保计划"
-                                                        textColorInt = R.color.black
-                                                        textSizeAuto = 26
-                                                    }.lparams(wrapContent, wrapContent) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                        topMargin = autoSize(20)
-                                                    }
-                                                }.lparams(matchParent, matchParent)
-
-                                                textView {
-                                                    visibility = View.GONE
-                                                    viewModel.pendingAudit.bindOptional(context) {
-
-                                                        if (it?.hedgeplanqty?.toInt() ?: 0 > 99) {
-                                                            text = "99+"
-                                                        } else {
-                                                            text = it?.hedgeplanqty.toString()
-                                                        }
-                                                        if (it?.hedgeplanqty?.toInt() == 0) {
-                                                            visibility = View.GONE
-                                                        } else {
-                                                            visibility = View.VISIBLE
-                                                        }
-                                                    }
-                                                    textColorInt = R.color.p_global_write_color
-                                                    textSizeAuto = 15
-                                                    setPadding(
-                                                        autoSize(10),
-                                                        autoSize(6),
-                                                        autoSize(10),
-                                                        autoSize(6)
-                                                    )
-                                                    backgroundDrawable =
-                                                        createRoundRectDrawable("#fe671a", 45)
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    marginStart = autoSize(130)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-                                        }.lparams(matchParent, autoSize(140)) {
-                                            topMargin = autoSize(40)
-                                        }
+                            segment2.setupWithViewPager(viewPager1)
+                            segment2.selectTab(selectedTabIndex1)
 
-                                        linearLayout {
-                                            relativeLayout {
-                                                verticalLayout {
-                                                    onThrottleFirstClick {
-                                                        val intent = Intent()
-                                                        intent.setClass(
-                                                            context,
-                                                            BusinessManagementActivity::class.java
-                                                        )
-                                                        ActivityUtils.startActivity(intent)
-                                                    }
-                                                    imageView {
-                                                        imageResource = R.mipmap.main_business_5
-                                                    }.lparams(autoSize(72), autoSize(72)) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-
-                                                    textView {
-                                                        text = "业务审核"
-                                                        textColorInt = R.color.black
-                                                        textSizeAuto = 26
-                                                    }.lparams(wrapContent, wrapContent) {
-                                                        topMargin = autoSize(20)
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-                                                }.lparams(matchParent, matchParent)
-
-                                                textView {
-                                                    visibility = View.GONE
-                                                    viewModel.pendingAudit.bindOptional(context) {
-                                                        val pty = it?.businessdjqty?.toInt()
-                                                            ?.plus(it.businessjsqty.toInt())
-                                                        if (pty ?: 0 > 99) {
-                                                            text = "99+"
-                                                        } else {
-                                                            text = pty.toString()
-                                                        }
-                                                        if (pty == 0) {
-                                                            visibility = View.GONE
-                                                        } else {
-                                                            visibility = View.VISIBLE
-                                                        }
-                                                    }
-                                                    textColorInt = R.color.p_global_write_color
-                                                    textSizeAuto = 15
-                                                    setPadding(
-                                                        autoSize(10),
-                                                        autoSize(6),
-                                                        autoSize(10),
-                                                        autoSize(6)
-                                                    )
-                                                    backgroundDrawable =
-                                                        createRoundRectDrawable("#fe671a", 45)
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    marginStart = autoSize(130)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-                                            relativeLayout {
-                                                verticalLayout {
-                                                    onThrottleFirstClick {
-                                                        val intent = Intent()
-                                                        intent.setClass(
-                                                            context,
-                                                            FinancialActivity::class.java
-                                                        )
-                                                        ActivityUtils.startActivity(intent)
-                                                    }
-                                                    imageView {
-                                                        imageResource = R.mipmap.main_business_6
-                                                    }.lparams(autoSize(72), autoSize(72)) {
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-
-                                                    textView {
-                                                        text = "财务审核"
-                                                        textColorInt = R.color.black
-                                                        textSizeAuto = 26
-                                                    }.lparams(wrapContent, wrapContent) {
-                                                        topMargin = autoSize(20)
-                                                        gravity = Gravity.CENTER_HORIZONTAL
-                                                    }
-                                                }.lparams(matchParent, matchParent)
-
-                                                textView {
-                                                    visibility = View.GONE
-                                                    viewModel.pendingAudit.bindOptional(context) {
-                                                        val pty = it?.businessfpqty?.toInt()
-                                                            ?.plus(it.businesskxqty.toInt())
-                                                        if (pty ?: 0 > 99) {
-                                                            text = "99+"
-                                                        } else {
-                                                            text = pty.toString()
-                                                        }
-                                                        if (pty == 0) {
-                                                            visibility = View.GONE
-                                                        } else {
-                                                            visibility = View.VISIBLE
-                                                        }
-                                                    }
-                                                    textColorInt = R.color.p_global_write_color
-                                                    textSizeAuto = 15
-                                                    setPadding(
-                                                        autoSize(10),
-                                                        autoSize(6),
-                                                        autoSize(10),
-                                                        autoSize(6)
-                                                    )
-                                                    backgroundDrawable =
-                                                        createRoundRectDrawable("#fe671a", 45)
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    marginStart = autoSize(130)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-
-                                            verticalLayout {
-                                                onThrottleFirstClick {
-                                                    val intent = Intent()
-                                                    intent.setClass(
-                                                        context,
-                                                        TradingQueryActivity::class.java
-                                                    )
-                                                    ActivityUtils.startActivity(intent)
-                                                }
-                                                imageView {
-                                                    imageResource = R.mipmap.main_business_7
-                                                }.lparams(autoSize(72), autoSize(72)) {
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                }
-
-                                                textView {
-                                                    text = "交易查询"
-                                                    textColorInt = R.color.black
-                                                    textSizeAuto = 26
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                    topMargin = autoSize(20)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-                                            verticalLayout {
-                                                onThrottleFirstClick {
-                                                    val intent = Intent()
-                                                    intent.setClass(
-                                                        context,
-                                                        ReportQueryActivity::class.java
-                                                    )
-                                                    ActivityUtils.startActivity(intent)
-                                                }
-                                                imageView {
-                                                    imageResource = R.mipmap.main_business_8
-                                                }.lparams(autoSize(72), autoSize(72)) {
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                }
-
-                                                textView {
-                                                    text = "报表查询"
-                                                    textColorInt = R.color.black
-                                                    textSizeAuto = 26
-                                                }.lparams(wrapContent, wrapContent) {
-                                                    gravity = Gravity.CENTER_HORIZONTAL
-                                                    topMargin = autoSize(20)
-                                                }
-                                            }.lparams(0, matchParent, 1f)
-                                        }.lparams(matchParent, autoSize(140)) {
-                                            topMargin = autoSize(20)
-                                        }
-                                    }.lparams(autoSize(900), autoSize(340))
-                                    verticalLayout {
-
-                                    }.lparams(autoSize(900), autoSize(340))
-                                }
-                            }.lparams(matchParent, autoSize(340))
 
+                            linearLayout {
+                                gravity = Gravity.CENTER_VERTICAL
+                                emptyView()
+                                imageView {
+                                    menuTab.bindOptional(context){
+                                        if (it == 0){
+                                            imageResource = R.drawable.ic_select_point
+                                        }else{
+                                            imageResource = R.drawable.ic_normal_point
+                                        }
+                                    }
+                                }.lparams(autoSize(30), autoSize(30))
+
+                                imageView {
+                                    menuTab.bindOptional(context){
+                                        if (it == 1){
+                                            imageResource = R.drawable.ic_select_point
+                                        }else{
+                                            imageResource = R.drawable.ic_normal_point
+                                        }
+                                    }
+                                }.lparams(autoSize(30), autoSize(30))
 
+                                emptyView()
+                            }.lparams(matchParent, autoSize(40))
 
                             view {
                                 background = resources.getDrawable(R.color.main_hit_bg_color)
                             }.lparams(matchParent, autoSize(24)) {
-                                topMargin = autoSize(64)
+                                topMargin = autoSize(34)
                             }
 
-
                             tabSegment {
                                 segment = this
                                 background = resources.getDrawable(R.color.white)
@@ -840,3 +519,781 @@ class InformationUI(private val baseFragment: Fragment, private val viewModule:
     }
 }
 
+/**
+ * 首页滑动tab的第一页
+ * @property baseFragment Fragment
+ * @property viewModule HomeViewModel
+ * @property root _FrameLayout
+ * @constructor
+ */
+class FirstTabUI(private val baseFragment: Fragment, private val viewModel: HomeViewModel) {
+    val root = _FrameLayout(baseFragment.context!!).apply {
+        verticalLayout {
+            verticalLayout {
+                linearLayout {
+                    relativeLayout {
+
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    CustomerDataActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_1
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "客户资料"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                if (it?.userqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.userqty.toString()
+                                }
+                                if (it?.userqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+
+                    verticalLayout {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.setClass(
+                                context,
+                                CommodityInformationActivity::class.java
+                            )
+                            ActivityUtils.startActivity(intent)
+                        }
+                        imageView {
+                            imageResource = R.mipmap.main_business_2
+                        }.lparams(autoSize(72), autoSize(72)) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+
+                        textView {
+                            text = "商品信息"
+                            textColorInt = R.color.black
+                            textSizeAuto = 26
+                        }.lparams(wrapContent, wrapContent) {
+                            topMargin = autoSize(20)
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    ContractActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_3
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "现货合同"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                topMargin = autoSize(20)
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                if (it?.spotcontractqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.spotcontractqty.toString()
+                                }
+
+                                if (it?.spotcontractqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    HedgePlanActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_4
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "套保计划"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                topMargin = autoSize(20)
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+
+                                if (it?.hedgeplanqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.hedgeplanqty.toString()
+                                }
+                                if (it?.hedgeplanqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                }.lparams(matchParent, autoSize(140)) {
+                    topMargin = autoSize(40)
+                }
+
+                linearLayout {
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    BusinessManagementActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_5
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "业务审核"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                val pty = it?.businessdjqty?.toInt()
+                                    ?.plus(it.businessjsqty.toInt())
+                                if (pty ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = pty.toString()
+                                }
+                                if (pty == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    FinancialActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_6
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "财务审核"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                val pty = it?.businessfpqty?.toInt()
+                                    ?.plus(it.businesskxqty.toInt())
+                                if (pty ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = pty.toString()
+                                }
+                                if (pty == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    verticalLayout {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.setClass(
+                                context,
+                                TradingQueryActivity::class.java
+                            )
+                            ActivityUtils.startActivity(intent)
+                        }
+                        imageView {
+                            imageResource = R.mipmap.main_business_7
+                        }.lparams(autoSize(72), autoSize(72)) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+
+                        textView {
+                            text = "交易查询"
+                            textColorInt = R.color.black
+                            textSizeAuto = 26
+                        }.lparams(wrapContent, wrapContent) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                            topMargin = autoSize(20)
+                        }
+                    }.lparams(0, matchParent, 1f)
+                    verticalLayout {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.setClass(
+                                context,
+                                ReportQueryActivity::class.java
+                            )
+                            ActivityUtils.startActivity(intent)
+                        }
+                        imageView {
+                            imageResource = R.mipmap.main_business_8
+                        }.lparams(autoSize(72), autoSize(72)) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+
+                        textView {
+                            text = "报表查询"
+                            textColorInt = R.color.black
+                            textSizeAuto = 26
+                        }.lparams(wrapContent, wrapContent) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                            topMargin = autoSize(20)
+                        }
+                    }.lparams(0, matchParent, 1f)
+                }.lparams(matchParent, autoSize(140)) {
+                    topMargin = autoSize(20)
+                }
+            }.lparams(autoSize(900), autoSize(340))
+        }
+    }
+}
+
+/**
+ * 首页滑动tab的第二页
+ * @property baseFragment Fragment
+ * @property viewModel HomeViewModel
+ * @property root _FrameLayout
+ * @constructor
+ */
+class SecondTabUI(private val baseFragment: Fragment, private val viewModel: HomeViewModel) {
+    val root = _FrameLayout(baseFragment.context!!).apply {
+        verticalLayout {
+            verticalLayout {
+                linearLayout {
+                    relativeLayout {
+
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(context, WarehouseInformationActivity::class.java)
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.rma_warehouse
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "仓库信息"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                if (it?.userqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.userqty.toString()
+                                }
+                                if (it?.userqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.GONE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                ToastUtils.showLong("库存审核")
+                            }
+                            imageView {
+                                imageResource = R.mipmap.rma_inventory_audit
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "库存审核"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                topMargin = autoSize(20)
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                if (it?.spotcontractqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.spotcontractqty.toString()
+                                }
+
+                                if (it?.spotcontractqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.GONE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                ToastUtils.showLong("库存管理")
+                            }
+                            imageView {
+                                imageResource = R.mipmap.rma_inventory_management
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "库存管理"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                topMargin = autoSize(20)
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                if (it?.spotcontractqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.spotcontractqty.toString()
+                                }
+
+                                if (it?.spotcontractqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.GONE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                ToastUtils.showLong("账户管理")
+                            }
+                            imageView {
+                                imageResource = R.mipmap.rma_account_management
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "账户管理"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                                topMargin = autoSize(20)
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+
+                                if (it?.hedgeplanqty?.toInt() ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = it?.hedgeplanqty.toString()
+                                }
+                                if (it?.hedgeplanqty?.toInt() == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.GONE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                }.lparams(matchParent, autoSize(140)) {
+                    topMargin = autoSize(40)
+                }
+
+                linearLayout {
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    BusinessManagementActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_5
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "业务审核"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                val pty = it?.businessdjqty?.toInt()
+                                    ?.plus(it.businessjsqty.toInt())
+                                if (pty ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = pty.toString()
+                                }
+                                if (pty == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    relativeLayout {
+                        verticalLayout {
+                            onThrottleFirstClick {
+                                val intent = Intent()
+                                intent.setClass(
+                                    context,
+                                    FinancialActivity::class.java
+                                )
+                                ActivityUtils.startActivity(intent)
+                            }
+                            imageView {
+                                imageResource = R.mipmap.main_business_6
+                            }.lparams(autoSize(72), autoSize(72)) {
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+
+                            textView {
+                                text = "财务审核"
+                                textColorInt = R.color.black
+                                textSizeAuto = 26
+                            }.lparams(wrapContent, wrapContent) {
+                                topMargin = autoSize(20)
+                                gravity = Gravity.CENTER_HORIZONTAL
+                            }
+                        }.lparams(matchParent, matchParent)
+
+                        textView {
+                            visibility = View.GONE
+                            viewModel.pendingAudit.bindOptional(context) {
+                                val pty = it?.businessfpqty?.toInt()
+                                    ?.plus(it.businesskxqty.toInt())
+                                if (pty ?: 0 > 99) {
+                                    text = "99+"
+                                } else {
+                                    text = pty.toString()
+                                }
+                                if (pty == 0) {
+                                    visibility = View.GONE
+                                } else {
+                                    visibility = View.VISIBLE
+                                }
+                            }
+                            textColorInt = R.color.p_global_write_color
+                            textSizeAuto = 15
+                            setPadding(
+                                autoSize(10),
+                                autoSize(6),
+                                autoSize(10),
+                                autoSize(6)
+                            )
+                            backgroundDrawable =
+                                createRoundRectDrawable("#fe671a", 45)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(130)
+                        }
+                    }.lparams(0, matchParent, 1f)
+
+                    verticalLayout {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.setClass(
+                                context,
+                                TradingQueryActivity::class.java
+                            )
+                            ActivityUtils.startActivity(intent)
+                        }
+                        imageView {
+                            imageResource = R.mipmap.main_business_7
+                        }.lparams(autoSize(72), autoSize(72)) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+
+                        textView {
+                            text = "交易查询"
+                            textColorInt = R.color.black
+                            textSizeAuto = 26
+                        }.lparams(wrapContent, wrapContent) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                            topMargin = autoSize(20)
+                        }
+                    }.lparams(0, matchParent, 1f)
+                    verticalLayout {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.setClass(
+                                context,
+                                ReportQueryActivity::class.java
+                            )
+                            ActivityUtils.startActivity(intent)
+                        }
+                        imageView {
+                            imageResource = R.mipmap.main_business_8
+                        }.lparams(autoSize(72), autoSize(72)) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                        }
+
+                        textView {
+                            text = "报表查询"
+                            textColorInt = R.color.black
+                            textSizeAuto = 26
+                        }.lparams(wrapContent, wrapContent) {
+                            gravity = Gravity.CENTER_HORIZONTAL
+                            topMargin = autoSize(20)
+                        }
+                    }.lparams(0, matchParent, 1f)
+                }.lparams(matchParent, autoSize(140)) {
+                    topMargin = autoSize(20)
+                }
+            }.lparams(autoSize(900), autoSize(340))
+        }
+    }
+}
+

+ 9 - 0
RMA/app/src/main/res/drawable/ic_normal_point.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="200dp"
+    android:height="200dp"
+    android:viewportWidth="1024"
+    android:viewportHeight="1024">
+  <path
+      android:pathData="M512,512m-160,0a160,160 0,1 0,320 0,160 160,0 1,0 -320,0Z"
+      android:fillColor="#999999"/>
+</vector>

+ 9 - 0
RMA/app/src/main/res/drawable/ic_select_point.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="200dp"
+    android:height="200dp"
+    android:viewportWidth="1024"
+    android:viewportHeight="1024">
+  <path
+      android:pathData="M512,512m-160,0a160,160 0,1 0,320 0,160 160,0 1,0 -320,0Z"
+      android:fillColor="#666666"/>
+</vector>

BIN
RMA/app/src/main/res/mipmap-xhdpi/rma_account_management.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/rma_inventory_audit.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/rma_inventory_management.png


BIN
RMA/app/src/main/res/mipmap-xhdpi/rma_warehouse.png