소스 검색

风险管理9月18日提交代码-liu.bolan-天津掉期

Liu.bolan 4 년 전
부모
커밋
c989c37aa3
29개의 변경된 파일3908개의 추가작업 그리고 53개의 파일을 삭제
  1. 8 8
      RMA/app/build.gradle
  2. 2 0
      RMA/app/src/main/AndroidManifest.xml
  3. 9 9
      RMA/app/src/main/java/cn/muchinfo/rma/global/GlobalDataCollection.kt
  4. 14 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt
  5. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt
  6. 165 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/SpotAuditActivity.kt
  7. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/SpotAuditViewModel.kt
  8. 145 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/contract/ContractAuditFragment.kt
  9. 265 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditFragment.kt
  10. 132 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditViewModel.kt
  11. 292 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryViewholder.kt
  12. 138 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/hedgeplan/HedgePlanFragment.kt
  13. 251 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceFragment.kt
  14. 131 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceViewModel.kt
  15. 285 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceViewholder.kt
  16. 20 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementFragment.kt
  17. 153 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementViewModel.kt
  18. 307 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/contraceui/ContractUI.kt
  19. 351 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/contraceui/SpotContractAdapter.java
  20. 143 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/purchasesale/PurchaseSaleFragment.kt
  21. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/purchasesale/PurchaseSaleViewModel.kt
  22. 184 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/report/ReportFragment.kt
  23. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/report/ReportViewModel.kt
  24. 47 22
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleFragment.kt
  25. 157 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleViewModel.kt
  26. 309 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/contract/ContractUI.kt
  27. 351 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/contract/SpotSellContractAdapter.java
  28. 7 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/SpotFragment.kt
  29. 4 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyFragment.kt

+ 8 - 8
RMA/app/build.gradle

@@ -19,8 +19,8 @@ android {
         applicationId "cn.muchinfo.rma"
         minSdkVersion 24
         targetSdkVersion 30
-        versionCode 50028
-        versionName "5.0.28"
+        versionCode 50029
+        versionName "5.0.29"
         multiDexEnabled true
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         //指定room.schemaLocation生成的文件路径
@@ -34,7 +34,7 @@ android {
 
     productFlavors{
         // app1
-        app1 {
+        fxgl {
             // 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中)
             applicationId "cn.muchinfo.rma"
             // 自动生成@string/app_name为demo
@@ -43,7 +43,7 @@ android {
             manifestPlaceholders = [app_icon : "@mipmap/ic_launcher_rma"]
         }
         // app2
-        app2 {
+        qhj {
             // 解释同app1
             applicationId "cn.muchinfo.qhj"
             resValue "string","app_name","千海金"
@@ -51,7 +51,7 @@ android {
         }
 
         // app3
-        app3 {
+        yrdz {
             // 解释同app1
             applicationId "cn.muchinfo.yrdz"
             resValue "string","app_name","云融"
@@ -59,7 +59,7 @@ android {
         }
 
         // 天津麦顿
-        app4 {
+        tjmd {
             // 解释同app1
             applicationId "cn.muchinfo.tjmd"
             resValue "string","app_name","掉期市场"
@@ -69,7 +69,7 @@ android {
 
     buildTypes {
         release {
-            minifyEnabled true
+            minifyEnabled false
             signingConfig signingConfigs.release
             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
         }
@@ -109,7 +109,7 @@ android {
     applicationVariants.all { variant ->
         variant.outputs.all {
             //在这里修改apk文件名
-            outputFileName = "fxgl-${variant.name}-v${variant.versionName}.apk"
+            outputFileName = "${variant.name}-v${variant.versionName}.apk"
         }
     }
 

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

@@ -469,6 +469,8 @@
         <activity android:name=".view.base.yrdzpurchase.swaps.listed.SwapsListedActivity"/>
 
         <activity android:name=".view.base.hnstmain.contractorders.unwind.AgreementUnwindActivity"/>
+
+        <activity android:name=".view.base.home.spotaudit.SpotAuditActivity"/>
     </application>
 
 </manifest>

+ 9 - 9
RMA/app/src/main/java/cn/muchinfo/rma/global/GlobalDataCollection.kt

@@ -19,27 +19,27 @@ class GlobalDataCollection : BaseGlobalData() {
      * 获取一级菜单的权限
      */
     fun getFirstLevelMenu(code : String) : Boolean{
-        return true
-//        return ermcpRoleFuncMenuDataArrayList.find { code == it.code }?.isshow ?: false
+//        return true
+        return ermcpRoleFuncMenuDataArrayList.find { code == it.code }?.isshow ?: false
     }
 
     /**
      * 获取二级菜单的权限
      */
     fun getSecondLevelMenu(firstCode : String,secondCode : String) : Boolean{
-        return true
-//        val secondChildList = ermcpRoleFuncMenuDataArrayList.find { firstCode == it.code }?.children
-//        return secondChildList?.find { secondCode == it.code }?.isshow ?: false
+//        return true
+        val secondChildList = ermcpRoleFuncMenuDataArrayList.find { firstCode == it.code }?.children
+        return secondChildList?.find { secondCode == it.code }?.isshow ?: false
     }
 
     /**
      * 获取三级菜单权限
      */
     fun getThreeLevelMenu(firstCode : String,secondCode : String,threeCode : String) : Boolean{
-        return true
-//        val secondChildList = ermcpRoleFuncMenuDataArrayList.find { firstCode == it.code }?.children
-//        val threeChildList = secondChildList?.find { secondCode == it.code }?.children
-//        return threeChildList?.find { threeCode == it.code }?.isshow ?: false
+//        return true
+        val secondChildList = ermcpRoleFuncMenuDataArrayList.find { firstCode == it.code }?.children
+        val threeChildList = secondChildList?.find { secondCode == it.code }?.children
+        return threeChildList?.find { threeCode == it.code }?.isshow ?: false
     }
 
     /**

+ 14 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/MainActivity.kt

@@ -25,6 +25,7 @@ import cn.muchinfo.rma.view.base.main.SeaKingMainFragment
 import cn.muchinfo.rma.view.base.platinumtreasure.PlatinumTreasureFragment
 import cn.muchinfo.rma.view.base.procurement.ProcurementFragment
 import cn.muchinfo.rma.view.base.recycling.RecyclingFragment
+import cn.muchinfo.rma.view.base.report.ReportFragment
 import cn.muchinfo.rma.view.base.sale.SaleFragment
 import cn.muchinfo.rma.view.base.spot.SpotFragment
 import cn.muchinfo.rma.view.base.warehousereceipt.WarehouseReceiptFragment
@@ -87,6 +88,11 @@ class MainActivity : BaseActivity<MainViewModel>() {
         ExposureFragment()
     }
 
+    /** 报表 **/
+    val reportFragment by lazy {
+        ReportFragment()
+    }
+
     /** 千海金我的页面 ***/
     val seaKingMainFragment by lazy {
         SeaKingMainFragment()
@@ -163,12 +169,12 @@ class MainActivity : BaseActivity<MainViewModel>() {
         newNormalIcon.add(R.mipmap.main_tab_1)
         newSelectIcon.add(R.mipmap.rma_select_main_tab_1)
 
-//        if (GlobalDataCollection.instance?.getFirstLevelMenu("client_spots") == true) {
+        if (GlobalDataCollection.instance?.getFirstLevelMenu("client_spots") == true) {
             newFragments.add(spotFragment)
             newTabText.add("现货")
             newNormalIcon.add(R.mipmap.main_tab_2)
             newSelectIcon.add(R.mipmap.rma_select_main_tab_2)
-//        }
+        }
 
 //        if (GlobalDataCollection.instance?.getFirstLevelMenu("client_po") == true) {
 //            newFragments.add(procurementFragment)
@@ -254,6 +260,12 @@ class MainActivity : BaseActivity<MainViewModel>() {
             newSelectIcon.add(R.mipmap.qhj_main_tab_select)
         }
 
+        if (GlobalDataCollection.instance?.getFirstLevelMenu("client_report") == true) {
+            newFragments.add(reportFragment)
+            newTabText.add("报表")
+            newNormalIcon.add(R.mipmap.qhj_main_tab_normal)
+            newSelectIcon.add(R.mipmap.qhj_main_tab_select)
+        }
 
     }
 

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt

@@ -7,7 +7,7 @@ object Constant {
      * 获取基础url的接口
      */
 //    const val baseurl = "http://103.40.249.123:38280/cfg?key=mtp_20" // 天津麦顿
-//    const val baseurl = "http://103.40.249.123:28280/cfg?key=mtp_20"//云融大宗
+    const val baseurl = "http://103.40.249.123:28280/cfg?key=mtp_20"//云融大宗
 //    const val baseurl = "http://103.40.249.123:8280/cfg?key=mtp_20"//千海金外盘
 //    const val baseurl = "http://103.40.249.127:28280/cfg?key=mtp_20"
 
@@ -30,7 +30,7 @@ object Constant {
 //    const val baseurl = "http://192.168.31.136:8080/cfg?key=test_136"//黄老板 华南顺通
 
 //    const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176"//黄老板 天津麦顿调试
-    const val baseurl = "http://192.168.31.167:8080/cfg?key=test_167"//黄老板 平安云平台(企业风管)
+//    const val baseurl = "http://192.168.31.167:8080/cfg?key=test_167"//黄老板 平安云平台(企业风管)
 
     /**
      * 用sp存储基础url的key

+ 165 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/SpotAuditActivity.kt

@@ -0,0 +1,165 @@
+package cn.muchinfo.rma.view.base.home.spotaudit
+
+import android.os.Bundle
+import androidx.annotation.NonNull
+import androidx.annotation.Nullable
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentPagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.home.spotaudit.contract.ContractAuditFragment
+import cn.muchinfo.rma.view.base.home.spotaudit.delivery.DeliveryAuditFragment
+import cn.muchinfo.rma.view.base.home.spotaudit.hedgeplan.HedgePlanFragment
+import cn.muchinfo.rma.view.base.home.spotaudit.someprice.SomePriceFragment
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 现货审核页面
+ */
+class SpotAuditActivity : BaseActivity<SpotAuditViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    /**
+     * 合同审核
+     */
+    private val contractAuditFragment by lazy { ContractAuditFragment() }
+
+    /**
+     * 点价审核
+     */
+    private val somePriceFragment by lazy { SomePriceFragment() }
+
+    /**
+     * 交收审核
+     */
+    private val deliveryAuditFragment by lazy { DeliveryAuditFragment() }
+
+    /**
+     * 计划审核
+     */
+    private val hedgePlanFragment by lazy { HedgePlanFragment() }
+
+    //viewpager的适配器
+    private var newPagerAdapter: FragmentPagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //viewpager绑定的页面集合
+    private val newTabFragment: ArrayList<Fragment> = arrayListOf()
+
+    fun initMenuData() {
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_contract") == true){
+            newTabsArray.add("合同审核")
+            newTabFragment.add(contractAuditFragment)
+        }
+
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_point") == true) {
+            newTabsArray.add("点价审核")
+            newTabFragment.add(somePriceFragment)
+        }
+
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_settle") == true) {
+            newTabsArray.add("交收审核")
+            newTabFragment.add(deliveryAuditFragment)
+        }
+
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_hedgeplan") == true) {
+            newTabsArray.add("计划审核")
+            newTabFragment.add(hedgePlanFragment)
+        }
+
+        newPagerAdapter = object : FragmentPagerAdapter(
+            getAppCompatActivity().supportFragmentManager,
+            BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
+        ) {
+            @NonNull
+            override fun getItem(position: Int): Fragment {
+                return newTabFragment[position]
+            }
+
+            override fun getCount(): Int {
+                return newTabFragment.size
+            }
+
+            @Nullable
+            override fun getPageTitle(position: Int): CharSequence? {
+                return newTabsArray[position]
+            }
+        }
+    }
+
+
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "现货审核"
+                }
+//                commonMenuButton(R.mipmap.rma_search) {
+//                    val intent = Intent()
+//                    intent.setClass(context, InvoiceRegisterActivity::class.java)
+//                    ActivityUtils.startActivity(intent)
+//                }
+            }
+            tabSegment {
+                // 设置
+                segment = 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) {
+                        selectedTabIndex = index
+                    }
+                })
+                setIndicator(
+                    QMUITabIndicator(
+                        QMUIDisplayHelper.dp2px(context, 2),
+                        false,
+                        true
+                    )
+                )
+
+                setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(19f))
+            }.lparams(matchParent, autoSize(80))
+
+            view {
+                background = resources.getDrawable(R.color.main_hit_bg_color)
+            }.lparams(matchParent, autoSize(1)) {
+                marginStart = autoSize(32)
+                marginEnd = autoSize(32)
+            }
+            viewPager {
+                id = R.id.view_pager1
+                background = resources.getDrawable(R.color.white)
+                viewPager = this
+                adapter = newPagerAdapter
+            }.lparams(matchParent, matchParent)
+            //真的是,不搞个id就不行
+//                findViewById<ViewPager>(R.id.view_pager).adapter = newPagerAdapter
+            segment.setupWithViewPager(viewPager)
+            segment.selectTab(0)
+
+        }
+    }
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/SpotAuditViewModel.kt

@@ -0,0 +1,12 @@
+package cn.muchinfo.rma.view.base.home.spotaudit
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 现货审核主页面viewmodel
+ */
+class SpotAuditViewModel : BaseViewModel(){
+
+
+
+}

+ 145 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/contract/ContractAuditFragment.kt

@@ -0,0 +1,145 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.contract
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.tabSegment
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.contract.ContractViewModel
+import cn.muchinfo.rma.view.base.home.contract.PerformanceUI
+import cn.muchinfo.rma.view.base.home.contract.ToAuditUI
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 现货审核-合同审核页面
+ * @property segment QMUITabSegment
+ * @property selectedTabIndex Int
+ * @property viewPager ViewPager
+ * @property toAuditUI ToAuditUI
+ * @property performanceUI PerformanceUI
+ * @property newPagerAdapter PagerAdapter?
+ * @property newTabsArray ArrayList<String>
+ * @property uiList ArrayList<_FrameLayout>
+ */
+class ContractAuditFragment : BaseFragment<ContractViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待审核
+    private val toAuditUI by lazy { ToAuditUI(this.getAppCompatActivity(),viewModel) }
+    //履约中
+    private val performanceUI by lazy { PerformanceUI(this.getAppCompatActivity(),viewModel) }
+
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_contract",threeCode = "client_spotsaduit_contract_unaduit") == true){
+            newTabsArray.add("待审核")
+            uiList.add(toAuditUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_contract",threeCode = "client_spotsaduit_contract_aduited") == true){
+            newTabsArray.add("已审核")
+            uiList.add(performanceUI.root)
+        }
+
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+                    setIndicator(
+                        QMUITabIndicator(
+                            QMUIDisplayHelper.dp2px(context, 2),
+                            false,
+                            true
+                        )
+                    )
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(0)
+            }
+        }.view
+    }
+
+}

+ 265 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditFragment.kt

@@ -0,0 +1,265 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.delivery
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+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.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.business.creatBusinessUI
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 现货审核-交收审核页面
+ */
+class DeliveryAuditFragment : BaseFragment<DeliveryAuditViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待审核
+    private val settlementToAuditUI by lazy { SettlementToAuditUI(this.getAppCompatActivity(),viewModel) }
+
+    //已审核
+    private val settlementApprovedUI by lazy { SettlementApprovedUI(this.getAppCompatActivity(),viewModel) }
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_point",threeCode = "client_spotsaduit_point_unaduit") == true){
+            newTabsArray.add("待审核")
+            uiList.add(settlementToAuditUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_point",threeCode = "client_spotsaduit_point_aduited") == true){
+            newTabsArray.add("已审核")
+            uiList.add(settlementApprovedUI.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+                    setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(selectedTabIndex)
+            }
+        }.view
+    }
+
+}
+
+
+/**
+ * 交收
+ * @property activity AppCompatActivity
+ * @property viewModel BusinessManagementViewModel
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property unSubmitAdapter BaseAdapter<BusinessManagementData, BusinessManagementViewholder>
+ * @property root _FrameLayout
+ * @constructor
+ */
+
+class SettlementToAuditUI(
+    private val activity: AppCompatActivity,
+    private val viewModel : DeliveryAuditViewModel
+){
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val unSubmitAdapter: BaseAdapter<BusinessData, DeliveryViewholder> = BaseAdapter { _, _ -> DeliveryViewholder(activity, viewModel,"1") }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryBusinessJS()
+            creatBusinessUI("2")
+
+            view {
+                background = resources.getDrawable(R.color.line_hint_color)
+            }.lparams(matchParent, autoSize(1))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryBusinessJS()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = unSubmitAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.somePriceToAuditList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    unSubmitAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}
+
+
+/**
+ * 交收
+ * @property activity AppCompatActivity
+ * @property viewModel BusinessManagementViewModel
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property unSubmitAdapter BaseAdapter<BusinessManagementData, BusinessManagementViewholder>
+ * @property root _FrameLayout
+ * @constructor
+ */
+
+class SettlementApprovedUI(
+    private val activity: AppCompatActivity,
+    private val viewModel : DeliveryAuditViewModel
+){
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val unSubmitAdapter: BaseAdapter<BusinessData, DeliveryViewholder> = BaseAdapter { _, _ -> DeliveryViewholder(activity, viewModel,"2") }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryBusinessJS()
+            creatBusinessUI("2")
+
+            view {
+                background = resources.getDrawable(R.color.line_hint_color)
+            }.lparams(matchParent, autoSize(1))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryBusinessJS()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = unSubmitAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.somePriceApprovedList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    unSubmitAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}
+

+ 132 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryAuditViewModel.kt

@@ -0,0 +1,132 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.delivery
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.ErmcpMI1
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.autoWidget.toArrayList
+import cn.muchinfo.rma.view.base.BaseViewModel
+import com.blankj.utilcode.util.TimeUtils
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+
+/**
+ * 现货审核-交收审核viewmodel
+ */
+class DeliveryAuditViewModel : BaseViewModel(){
+
+    /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    /**
+     * 交收-待审核列表 applystatus String?申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+     */
+    val somePriceToAuditList: MutableLiveData<List<BusinessData>> = MutableLiveData()
+
+    /**
+     * 交收-待审核列表 applystatus String?申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+     */
+    val somePriceApprovedList: MutableLiveData<List<BusinessData>> = MutableLiveData()
+
+
+    /**
+     * 对于列表点击展开后的数据处理
+     * @param index Int 点击的item数据在列表的index
+     * @param type String 点击的列表类型 1 是待审核 2是已审核
+     *
+     */
+    fun resetDataList(index: Int, type: String) {
+        val datanewlist = arrayListOf<BusinessData>()
+        when (type) {
+            "1" -> {
+                somePriceToAuditList.value?.forEach {
+                    if (index == somePriceToAuditList.value?.indexOf(it)) {
+                        if (it.indexSelect == 0) {
+                            datanewlist.add(it.copy(indexSelect = 1))
+                        } else {
+                            datanewlist.add(it.copy(indexSelect = 0))
+                        }
+                    } else {
+                        datanewlist.add(it.copy(indexSelect = 0))
+                    }
+                }
+                somePriceToAuditList.postValue(datanewlist)
+            }
+            "2" -> {
+                somePriceApprovedList.value?.forEach {
+                    if (index == somePriceApprovedList.value?.indexOf(it)) {
+                        if (it.indexSelect == 0) {
+                            datanewlist.add(it.copy(indexSelect = 1))
+                        } else {
+                            datanewlist.add(it.copy(indexSelect = 0))
+                        }
+                    } else {
+                        datanewlist.add(it.copy(indexSelect = 0))
+                    }
+                }
+                somePriceApprovedList.postValue(datanewlist)
+            }
+        }
+    }
+
+    /**
+     * 请求业务管理结算列表
+     */
+    fun queryBusinessJS() {
+        val params = mutableMapOf<String, String>().apply {
+            put("UserId", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+
+        MyApplication.getInstance()?.businessManager?.queryBusinessJSEx(params) { isSuccess, respData, _ ->
+            if (isSuccess){
+                respData?.toArrayList()?.sortWith(Comparator { t1, t2 ->
+                    (TimeUtils.string2Millis(t2.applytime) - TimeUtils.string2Millis(t1.applytime)).toInt()
+                })
+                respData?.toArrayList()?.sortWith(Comparator { t1, t2 ->
+                    (TimeUtils.string2Millis(t1.applystatus) - TimeUtils.string2Millis(t2.applystatus)).toInt()
+                })
+                val toAuditList = arrayListOf<BusinessData>()
+                val approvedList = arrayListOf<BusinessData>()
+                respData?.forEach {
+                    if (it.applystatus == "1" || it.applystatus == "3"){
+                        toAuditList.add(it)
+                    }else if (it.applystatus == "2"){
+                        approvedList.add(it)
+                    }
+                }
+                somePriceToAuditList.postValue(toAuditList)
+                somePriceApprovedList.postValue(approvedList)
+            }
+        }
+    }
+
+    /***
+     * 合同操作请求
+     * @param info ContractOperateApplyInfo 操作信息
+     * @param operateType Int 操作类型
+     * @param remark String 备注
+     * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>
+     */
+    fun contractOperaOrder(
+        info: ErmcpMI1.ContractOperateApplyInfo= ErmcpMI1.ContractOperateApplyInfo.newBuilder().build(),
+        operateApplyID : Long = 0,
+        operateType: Int = 0,
+        remark: String = "",
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        MyApplication.getInstance()?.contractManager?.orderPerationContract(info = info,operateApplyID = operateApplyID,operateType = operateType,remark = remark){isCompleted, err ->
+            if (isCompleted){
+                ToastUtils.showLong("请求成功")
+                loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                isSuccess(true)
+            }else{
+                loadingDialogStatus.postValue(TaskUiModel.failed(InteractiveException(errorMessage = err?.message!!)))
+            }
+        }
+    }
+}

+ 292 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/delivery/DeliveryViewholder.kt

@@ -0,0 +1,292 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.delivery
+
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.graphics.Typeface
+import android.text.TextUtils
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.global.isShowTimeString
+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.home.business.SettlementAuditActivity
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ActivityUtils
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 交收页面viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel [ERROR : null type]
+ * @property type String
+ * @property itemSize IntArray
+ * @constructor
+ */
+class DeliveryViewholder(private val activity: AppCompatActivity, private val viewModel: DeliveryAuditViewModel, private val type : String) : BaseViewHolder<BusinessData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+
+            onThrottleShortFirstClick {
+                viewModel.resetDataList(dataIndex, type)
+            }
+            data.bindOptional(context) {
+                if (it?.indexSelect == 0) {
+                    backgroundResource = R.color.white
+                } else if (it?.indexSelect == 1) {
+                    backgroundResource = R.color.rma_list_select_color
+                }
+            }
+
+            linearLayout {
+                verticalLayout {
+                    linearLayout {
+                        /** 点价登记时间/结算登记时间 **/
+                        textView {
+                            data.bindOptional(context){
+                               text = it?.applytime?.isShowTimeString("MM/dd HH:mm")
+                            }
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 29
+                            typeface = Typeface.defaultFromStyle(Typeface.BOLD)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(35)
+                            topMargin = autoSize(25)
+                        }
+
+                        emptyView()
+
+                        imageView {
+                            data.bindOptional(context) {
+                                if (it?.indexSelect == 0) {
+                                    imageResource = R.mipmap.rma_down
+                                } else if (it?.indexSelect == 1) {
+                                    imageResource = R.mipmap.rma_up
+                                }
+                            }
+                        }.lparams(autoSize(36), autoSize(36)) {
+                            marginEnd = autoSize(25)
+                            topMargin = autoSize(25)
+                        }
+                    }.lparams(matchParent, wrapContent)
+                    /** 点价审核时间/结算审核时间 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.audittime?.isShowTimeString("MM/dd HH:mm")
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(35)
+                        topMargin = autoSize(15)
+                    }
+
+                }.lparams(autoSize(335), autoSize(120))
+
+                verticalLayout {
+                    /** 合同类型 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getContractType(it?.contracttype ?: "1")
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                    }
+                    /** 合同编号 **/
+                    textView {
+                        data.bindOptional(context){
+                            text =  it?.contractno
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+
+                }.lparams(autoSize(150), autoSize(120))
+
+                /** 点价价格/结算类型 **/
+                verticalLayout {
+                    textView {
+                        data.bindOptional(context) {
+                            if (type == "1"){
+                                text = it?.pricedPrice
+                            }else{
+                                text = it?.reckontype
+                            }
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                        gravity = Gravity.RIGHT
+                    }
+                    /** 点价金额/结算类型值 **/
+                    textView {
+                        data.bindOptional(context){
+                            if (type == "1"){
+                                text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.amount),2)
+                            }else{
+                                text = it?.reckonvalue
+                            }
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(15)
+                        gravity = Gravity.RIGHT
+                    }
+                }.lparams(autoSize(145), autoSize(120))
+
+                verticalLayout {
+                    /** 状态 */
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getBusinessManagementStatus(it?.applystatus ?: "")
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                        marginEnd = autoSize(35)
+                        gravity = Gravity.RIGHT
+                    }
+
+                }.lparams(autoSize(250), autoSize(120))
+
+            }.lparams(matchParent, autoSize(120))
+
+            linearLayout {
+                data.bindOptional(context) {
+                    if (it?.indexSelect == 0) {
+                        visibility = View.GONE
+                    } else if (it?.indexSelect == 1) {
+                        visibility = View.VISIBLE
+                    }
+                }
+                gravity = Gravity.CENTER_VERTICAL
+
+                emptyView()
+
+                textView {
+                    data.bindOptional(context){
+                        if (type == "1"){
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_point",threeCode = "client_business_point_cancel") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }else{
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_settle",threeCode = "client_business_settle_cancel") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
+                    }
+                    onThrottleFirstClick {
+                        viewModel.contractOperaOrder(operateApplyID = data.value?.operateapplyid?.toLong() ?: 0,operateType = 4){
+                            viewModel.queryBusinessJS()
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    text = "撤回"
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+
+                textView {
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("type","1")
+                        intent.setClass(context,SettlementAuditActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    data.bindOptional(context){
+                        if (type == "1"){
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_point",threeCode = "client_business_point_check") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }else{
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_settle",threeCode = "client_business_settle_check") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
+                    }
+                    text = if (type == "1"){
+                        "点价审核"
+                    }else{
+                        "交收审核"
+                    }
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(168), autoSize(48)) {
+                    marginEnd = autoSize(24)
+                }
+
+                textView {
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("type","2")
+                        intent.setClass(context, SettlementAuditActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    textResource = R.string.details
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(72))
+        }
+    }
+
+}

+ 138 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/hedgeplan/HedgePlanFragment.kt

@@ -0,0 +1,138 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.hedgeplan
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.tabSegment
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.hedge.ExecutionUI
+import cn.muchinfo.rma.view.base.home.hedge.HedgePlanViewModel
+import cn.muchinfo.rma.view.base.home.hedge.ToAuditUI
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 现货审核-计划审核页面
+ * @property segment QMUITabSegment
+ * @property selectedTabIndex Int
+ * @property viewPager ViewPager
+ * @property toAuditUI ToAuditUI
+ * @property executionUI ExecutionUI
+ * @property newPagerAdapter PagerAdapter?
+ * @property newTabsArray ArrayList<String>
+ * @property uiList ArrayList<_FrameLayout>
+ */
+class HedgePlanFragment : BaseFragment<HedgePlanViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待审核
+    private val toAuditUI by lazy { ToAuditUI(this.getAppCompatActivity(), viewModel, "1") }
+    //已审核
+    private val executionUI by lazy { ExecutionUI(this.getAppCompatActivity(), viewModel, "2") }
+
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_hedgeplan",threeCode = "client_spotsaduit_hedgeplan_unaduit") == true){
+            newTabsArray.add("待审核")
+            uiList.add(toAuditUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_hedgeplan",threeCode = "client_spotsaduit_hedgeplan_auited") == true){
+            newTabsArray.add("已审核")
+            uiList.add(executionUI.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+                    setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, autoSize(2000))
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(selectedTabIndex)
+            }
+        }.view
+    }
+
+}

+ 251 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceFragment.kt

@@ -0,0 +1,251 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.someprice
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+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.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.business.BusinessManagementViewModel
+import cn.muchinfo.rma.view.base.home.business.BusinessManagementViewholder
+import cn.muchinfo.rma.view.base.home.business.creatBusinessUI
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import mtp.polymer.com.autowidget.adapter.BaseAdapter
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 现货审核-点价审核页面
+ * @property someToAuditPriceUI SomeToAuditPriceUI
+ */
+class SomePriceFragment : BaseFragment<SomePriceViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待审核
+    private val someToAuditPriceUI by lazy { SomeToAuditPriceUI(this.getAppCompatActivity(),viewModel) }
+
+    //已审核
+    private val someApprovedPriceUI by lazy { SomeApprovedPriceUI(this.getAppCompatActivity(),viewModel) }
+
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_point",threeCode = "client_spotsaduit_point_unaduit") == true){
+            newTabsArray.add("待审核")
+            uiList.add(someToAuditPriceUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spotsaduit",secondCode = "client_spotsaduit_point",threeCode = "client_spotsaduit_point_aduited") == true){
+            newTabsArray.add("已审核")
+            uiList.add(someApprovedPriceUI.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+                    setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(selectedTabIndex)
+            }
+        }.view
+    }
+
+}
+
+
+/**
+ * 点价-待审核
+ */
+class SomeToAuditPriceUI(
+    private val activity: AppCompatActivity,
+    private val viewModel : SomePriceViewModel
+){
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val unSubmitAdapter: BaseAdapter<BusinessData, SomePriceViewholder> = BaseAdapter { _, _ -> SomePriceViewholder(activity, viewModel,"1") }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryBusinessDJ()
+            creatBusinessUI("1")
+
+            view {
+                background = resources.getDrawable(R.color.line_hint_color)
+            }.lparams(matchParent, autoSize(1))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryBusinessDJ()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = unSubmitAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.somePriceToAuditList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    unSubmitAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}
+
+
+/**
+ * 点价-已审核
+ */
+class SomeApprovedPriceUI(
+    private val activity: AppCompatActivity,
+    private val viewModel : SomePriceViewModel
+){
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    private val unSubmitAdapter: BaseAdapter<BusinessData, SomePriceViewholder> = BaseAdapter { _, _ -> SomePriceViewholder(activity, viewModel,"2") }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryBusinessDJ()
+            creatBusinessUI("1")
+
+            view {
+                background = resources.getDrawable(R.color.line_hint_color)
+            }.lparams(matchParent, autoSize(1))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryBusinessDJ()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = unSubmitAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.somePriceApprovedList.bindOptional(context){
+                if (it?.isEmpty() == true || it?.size == 0){
+                    statusLayout.showEmpty()
+                }else {
+                    if (swipeToLayout.getIsRefreshing()){
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    unSubmitAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+}

+ 131 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceViewModel.kt

@@ -0,0 +1,131 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.someprice
+
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.netManage.base.InteractiveException
+import cn.muchinfo.rma.protobuf.protoclasses.ErmcpMI1
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.autoWidget.toArrayList
+import cn.muchinfo.rma.view.base.BaseViewModel
+import com.blankj.utilcode.util.TimeUtils
+import com.blankj.utilcode.util.ToastUtils
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+
+/**
+ * 现货审核-交收审核viewmodel
+ */
+class SomePriceViewModel : BaseViewModel(){
+
+    /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    /**
+     * 交收-待审核列表 applystatus String?申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+     */
+    val somePriceToAuditList: MutableLiveData<List<BusinessData>> = MutableLiveData()
+
+    /**
+     * 交收-待审核列表 applystatus String?申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
+     */
+    val somePriceApprovedList: MutableLiveData<List<BusinessData>> = MutableLiveData()
+
+    /**
+     * 对于列表点击展开后的数据处理
+     * @param index Int 点击的item数据在列表的index
+     * @param type String 点击的列表类型 1 是待审核 2是已审核
+     *
+     */
+    fun resetDataList(index: Int, type: String) {
+        val datanewlist = arrayListOf<BusinessData>()
+        when (type) {
+            "1" -> {
+                somePriceToAuditList.value?.forEach {
+                    if (index == somePriceToAuditList.value?.indexOf(it)) {
+                        if (it.indexSelect == 0) {
+                            datanewlist.add(it.copy(indexSelect = 1))
+                        } else {
+                            datanewlist.add(it.copy(indexSelect = 0))
+                        }
+                    } else {
+                        datanewlist.add(it.copy(indexSelect = 0))
+                    }
+                }
+                somePriceToAuditList.postValue(datanewlist)
+            }
+            "2" -> {
+                somePriceApprovedList.value?.forEach {
+                    if (index == somePriceApprovedList.value?.indexOf(it)) {
+                        if (it.indexSelect == 0) {
+                            datanewlist.add(it.copy(indexSelect = 1))
+                        } else {
+                            datanewlist.add(it.copy(indexSelect = 0))
+                        }
+                    } else {
+                        datanewlist.add(it.copy(indexSelect = 0))
+                    }
+                }
+                somePriceApprovedList.postValue(datanewlist)
+            }
+        }
+    }
+
+    /**
+     * 请求业务管理点价列表
+     */
+    fun queryBusinessDJ() {
+        val params = mutableMapOf<String, String>().apply {
+            put("UserId", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+        MyApplication.getInstance()?.businessManager?.queryBusinessDJ(params) { isSuccess, respData, _ ->
+            if (isSuccess){
+                respData?.toArrayList()?.sortWith(Comparator { t1, t2 ->
+                    (TimeUtils.string2Millis(t2.applytime) - TimeUtils.string2Millis(t1.applytime)).toInt()
+                })
+                respData?.toArrayList()?.sortWith(Comparator { t1, t2 ->
+                    (TimeUtils.string2Millis(t1.applystatus) - TimeUtils.string2Millis(t2.applystatus)).toInt()
+                })
+                val toAuditList = arrayListOf<BusinessData>()
+                val approvedList = arrayListOf<BusinessData>()
+                respData?.forEach {
+                    if (it.applystatus == "1" || it.applystatus == "3"){
+                        toAuditList.add(it)
+                    }else if (it.applystatus == "2"){
+                        approvedList.add(it)
+                    }
+                }
+                somePriceToAuditList.postValue(toAuditList)
+                somePriceApprovedList.postValue(approvedList)
+            }
+        }
+    }
+
+    /***
+     * 合同操作请求
+     * @param info ContractOperateApplyInfo 操作信息
+     * @param operateType Int 操作类型
+     * @param remark String 备注
+     * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>
+     */
+    fun contractOperaOrder(
+        info: ErmcpMI1.ContractOperateApplyInfo= ErmcpMI1.ContractOperateApplyInfo.newBuilder().build(),
+        operateApplyID : Long = 0,
+        operateType: Int = 0,
+        remark: String = "",
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        MyApplication.getInstance()?.contractManager?.orderPerationContract(info = info,operateApplyID = operateApplyID,operateType = operateType,remark = remark){isCompleted, err ->
+            if (isCompleted){
+                ToastUtils.showLong("请求成功")
+                loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                isSuccess(true)
+            }else{
+                loadingDialogStatus.postValue(TaskUiModel.failed(InteractiveException(errorMessage = err?.message!!)))
+            }
+        }
+    }
+
+}

+ 285 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/spotaudit/someprice/SomePriceViewholder.kt

@@ -0,0 +1,285 @@
+package cn.muchinfo.rma.view.base.home.spotaudit.someprice
+
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.graphics.Typeface
+import android.text.TextUtils
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.ViewEnumUtils
+import cn.muchinfo.rma.global.data.BusinessData
+import cn.muchinfo.rma.global.isShowTimeString
+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.home.business.MidpointsAuditActivity
+import cn.muchinfo.rma.view.base.home.business.SettlementAuditActivity
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ActivityUtils
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+class SomePriceViewholder(private val activity: AppCompatActivity, private val viewModel: SomePriceViewModel, private val type : String) : BaseViewHolder<BusinessData>(activity) {
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    @SuppressLint("SetTextI18n")
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+
+            onThrottleShortFirstClick {
+                viewModel.resetDataList(dataIndex, type)
+            }
+            data.bindOptional(context) {
+                if (it?.indexSelect == 0) {
+                    backgroundResource = R.color.white
+                } else if (it?.indexSelect == 1) {
+                    backgroundResource = R.color.rma_list_select_color
+                }
+            }
+
+            linearLayout {
+                verticalLayout {
+                    linearLayout {
+                        /** 点价登记时间/结算登记时间 **/
+                        textView {
+                            data.bindOptional(context){
+                               text = it?.applytime?.isShowTimeString("MM/dd HH:mm")
+                            }
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 29
+                            typeface = Typeface.defaultFromStyle(Typeface.BOLD)
+                        }.lparams(wrapContent, wrapContent) {
+                            marginStart = autoSize(35)
+                            topMargin = autoSize(25)
+                        }
+
+                        emptyView()
+
+                        imageView {
+                            data.bindOptional(context) {
+                                if (it?.indexSelect == 0) {
+                                    imageResource = R.mipmap.rma_down
+                                } else if (it?.indexSelect == 1) {
+                                    imageResource = R.mipmap.rma_up
+                                }
+                            }
+                        }.lparams(autoSize(36), autoSize(36)) {
+                            marginEnd = autoSize(25)
+                            topMargin = autoSize(25)
+                        }
+                    }.lparams(matchParent, wrapContent)
+                    /** 点价审核时间/结算审核时间 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.audittime?.isShowTimeString("MM/dd HH:mm")
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(35)
+                        topMargin = autoSize(15)
+                    }
+
+                }.lparams(autoSize(335), autoSize(120))
+
+                verticalLayout {
+                    /** 合同类型 **/
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getContractType(it?.contracttype ?: "1")
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                    }
+                    /** 合同编号 **/
+                    textView {
+                        data.bindOptional(context){
+                            text =  it?.contractno
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent)
+
+                }.lparams(autoSize(150), autoSize(120))
+
+                /** 点价价格/结算类型 **/
+                verticalLayout {
+                    textView {
+                        data.bindOptional(context) {
+                            if (type == "1"){
+                                text = it?.pricedPrice
+                            }else{
+                                text = it?.reckontype
+                            }
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                        gravity = Gravity.RIGHT
+                    }
+                    /** 点价金额/结算类型值 **/
+                    textView {
+                        data.bindOptional(context){
+                            if (type == "1"){
+                                text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.amount),2)
+                            }else{
+                                text = it?.reckonvalue
+                            }
+                        }
+                        textSizeAuto = 22
+                        textColorInt = R.color.hint_text_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(15)
+                        gravity = Gravity.RIGHT
+                    }
+                }.lparams(autoSize(145), autoSize(120))
+
+                verticalLayout {
+                    /** 状态 */
+                    textView {
+                        data.bindOptional(context){
+                            text = ViewEnumUtils.getBusinessManagementStatus(it?.applystatus ?: "")
+                        }
+                        textSizeAuto = 29
+                        textColorInt = R.color.rma_black_33
+                        maxLines = 1
+                        ellipsize = TextUtils.TruncateAt.END
+                    }.lparams(wrapContent, wrapContent) {
+                        topMargin = autoSize(25)
+                        marginEnd = autoSize(35)
+                        gravity = Gravity.RIGHT
+                    }
+
+                }.lparams(autoSize(250), autoSize(120))
+
+            }.lparams(matchParent, autoSize(120))
+
+            linearLayout {
+                data.bindOptional(context) {
+                    if (it?.indexSelect == 0) {
+                        visibility = View.GONE
+                    } else if (it?.indexSelect == 1) {
+                        visibility = View.VISIBLE
+                    }
+                }
+                gravity = Gravity.CENTER_VERTICAL
+
+                emptyView()
+
+                textView {
+                    data.bindOptional(context){
+                        if (type == "1"){
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_point",threeCode = "client_business_point_cancel") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }else{
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_settle",threeCode = "client_business_settle_cancel") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
+                    }
+                    onThrottleFirstClick {
+                        viewModel.contractOperaOrder(operateApplyID = data.value?.operateapplyid?.toLong() ?: 0,operateType = 4){
+                            viewModel.queryBusinessDJ()
+                        }
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    text = "撤回"
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+
+                textView {
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("type","1")
+                        intent.setClass(context, MidpointsAuditActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    data.bindOptional(context){
+                        if (type == "1"){
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_point",threeCode = "client_business_point_check") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }else{
+                            //判断是否有相应权限显示该功能
+                            if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_business",secondCode = "client_business_settle",threeCode = "client_business_settle_check") == true){
+                                if (it?.applystatus == "1"){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
+                    }
+                    text = if (type == "1"){
+                        "点价审核"
+                    }else{
+                        "交收审核"
+                    }
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(168), autoSize(48)) {
+                    marginEnd = autoSize(24)
+                }
+
+                textView {
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("data",data.value)
+                        intent.putExtra("type","2")
+                        intent.setClass(context,MidpointsAuditActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    backgroundResource = R.drawable.rma_item_click_bg
+                    gravity = Gravity.CENTER
+                    textResource = R.string.details
+                    textColorInt = R.color.rma_item_click_color
+                    textSizeAuto = 26
+                }.lparams(autoSize(120), autoSize(48)) {
+                    marginEnd = autoSize(36)
+                }
+            }.lparams(matchParent, autoSize(72))
+        }
+    }
+
+}

+ 20 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementFragment.kt

@@ -11,9 +11,12 @@ import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseFragment
 import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.procurement.contraceui.SpotBuyFinishUI
+import cn.muchinfo.rma.view.base.procurement.contraceui.SpotBuyUnSubmitUI
 import cn.muchinfo.rma.view.eventbus.EventConstent
 import cn.muchinfo.rma.view.eventbus.MessageEvent
 import com.blankj.utilcode.util.ConvertUtils
@@ -47,6 +50,12 @@ class ProcurementFragment : BaseFragment<ProcurementViewModel>() {
     private val settlementUI by lazy { SettlementUI(this, viewModel) }
     private val allUI by lazy { newAllUI(this, viewModel) }
 
+    //新增合同
+    private val spotBuyUnSubmitUI by lazy { SpotBuyUnSubmitUI(this.getAppCompatActivity(),viewModel) }
+
+    //已完成
+    private val spotBuyFinishUI by lazy { SpotBuyFinishUI(this.getAppCompatActivity(),viewModel) }
+
     //viewpager的适配器
     private var newPagerAdapter : PagerAdapter? = null
 
@@ -57,17 +66,22 @@ class ProcurementFragment : BaseFragment<ProcurementViewModel>() {
     private val uiList : ArrayList<_FrameLayout> = arrayListOf()
 
     fun initMenuData(){
-        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_po",secondCode = "client_po_unpoint") == true){
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_purchase",threeCode = "client_spots_purchase_point") == true){
             newTabsArray.add("待点价")
             uiList.add(priceUI.root)
         }
-        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_po",secondCode = "client_po_settle") == true){
-            newTabsArray.add("履约交收")
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_purchase",threeCode = "client_spots_purchase_settle") == true){
+            newTabsArray.add("交收")
             uiList.add(settlementUI.root)
         }
-        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_po",secondCode = "client_po_all") == true){
-            newTabsArray.add("全部")
-            uiList.add(allUI.root)
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_purchase",threeCode = "client_spots_purchase_new") == true){
+            newTabsArray.add("新增合同")
+            uiList.add(spotBuyUnSubmitUI.root)
+        }
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_purchase",threeCode = "client_spots_purchase_complete") == true){
+            newTabsArray.add("已完成")
+            uiList.add(spotBuyFinishUI.root)
         }
         newPagerAdapter = object : PagerAdapter() {
 

+ 153 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/ProcurementViewModel.kt

@@ -1,15 +1,19 @@
 package cn.muchinfo.rma.view.base.procurement
 
 import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.business.contract.SpotContractInfo
 import cn.muchinfo.rma.global.*
 
 import cn.muchinfo.rma.global.data.*
+import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.app.Constant
 import com.blankj.utilcode.util.TimeUtils
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
 
 import mtp.polymer.com.autowidget.utils.TaskUiModel
 import java.util.*
@@ -71,6 +75,155 @@ class ProcurementViewModel : BaseViewModel() {
      */
     val applyRecordTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
 
+    //未提交头部数据
+    val unSubmitTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    //已完结
+    val finishTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    /**
+     * 客户合同列表未提交数据
+     */
+    val unSubmitList: MutableLiveData<List<ContractData>> = MutableLiveData()
+
+    /**
+     * 客户合同列表已完成数据
+     */
+    val finishList: MutableLiveData<List<ContractData>> = MutableLiveData()
+    /**
+     * 查询采购列表头部数据
+     * @param tableKey String
+     */
+    fun queryContractTitle(tableKey: String, type: String) {
+        val params = mutableMapOf<String, String>().apply {
+            put("tableKey", tableKey)
+            put("tableType", "3")
+        }
+        MyApplication.getInstance()?.commonManager?.queryTableDefine(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isNotEmpty() == true){
+                    val newlist = respData.get(0).columns.toArrayList()
+                    newlist.sortWith(Comparator { t1, t2 ->
+                        t1.autoid?.toInt()?.minus(t2.autoid?.toInt() ?: 0) ?: 0
+                    })
+                    if (type == "1"){
+                        unSubmitTitle.postValue(newlist)
+                    } else if (type == "4"){
+                        finishTitle.postValue(newlist)
+                    }
+                    querySpotContract(type)
+                }
+            }
+        }
+    }
+
+
+
+    /**
+     * 现货合同查询
+     * @param QueryType String 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
+     */
+    fun querySpotContract(QueryType: String) {
+
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put(
+                "usertype",
+                GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: ""
+            )
+            put("querytype", QueryType)
+        }
+
+        MyApplication.getInstance()?.contractManager?.queryContract(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                when (QueryType) {
+                    "1" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t1.updatetime) - TimeUtils.string2Millis(t2.updatetime)).toInt()
+                        })
+                        unSubmitList.postValue(resetContraData(newList ?: arrayListOf()))
+                    }
+
+                    "4" -> {
+                        finishList.postValue(resetContraData(respData ?: arrayListOf()))
+                    }
+                }
+            } else {
+                loadingDialogStatus.value =
+                    TaskUiModel.failed(InteractiveException(errorMessage = error?.message ?: ""))
+            }
+        }
+    }
+
+    /**
+     * 合同操作申请
+     * @param contractInfo SpotContractInfo 参数
+     * @param OperateType String 操作类型 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+     * @param Remark String 备注
+     * @param SpotContractID String  现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)(修改时传入)
+     */
+    fun orderContract(
+        contractInfo: SpotContractInfo = SpotContractInfo(),
+        OperateType: String,
+        Remark: String = "",
+        SpotContractID: String = "",
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ) {
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.contractManager?.orderContract(
+                contractInfo = contractInfo,
+                OperateType = OperateType,
+                Remark = Remark,
+                SpotContractID = SpotContractID
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    //组装现货合同右侧数据
+    fun resetContraData(respData: List<ContractData>): List<ContractData> {
+        val newList = arrayListOf<ContractData>()
+        respData.forEach {
+            val newRightData = arrayListOf<String>()
+
+            newRightData.add(if (it.contracttype == "1"){
+                it.sellusername
+            }else{
+                it.buyusername
+            } + "\n" + it.qty + it.enumdicname)//'对手方/\n合同量 '
+            newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n品类 '
+            newRightData.add(if (it.biztype == "1"){
+                "套保"
+            }else{
+                "套利"
+            } + "\n" + it.convertfactor)//'业务类型/\n标仓系数 '
+            newRightData.add(ViewEnumUtils.getPriceType(it.pricetype ?: "")  + "\n" + it.goodsname?.isBlankString())//'定价类型/\n点价合约 '
+            newRightData.add(it.price + "\n" + it.pricemove)//'价格/\n升贴水 '
+            newRightData.add(it.amount + "\n" + it.margin)//'金额/\n保证金 '
+            newRightData.add(it.startdate?.isShowTimeString("MM-dd") + "~" + it.enddate?.isShowTimeString("MM-dd") + "\n" + it.deliverystartdate?.isShowTimeString("MM-dd") + "~" + it.deliveryenddate?.isShowTimeString("MM-dd"))//'点价期/\n交收期 '
+            newRightData.add(it.saleuserlogincode?.isBlankString() + "\n" + it.meruserlogincode?.isBlankString())//'业务员/\n跟单员 '
+            newRightData.add(it.tradeuserlogincode?.isBlankString() + "\n" + it.currencyname)//'交易用户/\n结算币种 '
+            val newData = it.copy(rightData = newRightData)
+            newList.add(newData)
+
+        }
+        return newList
+    }
+
 
     /**
      * 查询采购列表头部数据

+ 307 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/contraceui/ContractUI.kt

@@ -0,0 +1,307 @@
+package cn.muchinfo.rma.view.base.procurement.contraceui
+
+import android.annotation.SuppressLint
+import android.view.Gravity
+import android.view.MotionEvent
+import androidx.appcompat.app.AppCompatActivity
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.procurement.ProcurementViewModel
+import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
+import org.jetbrains.anko.*
+
+/**
+ * 未提交
+ */
+class SpotBuyUnSubmitUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ProcurementViewModel
+) : SpotContractAdapter.OnContentScrollListener {
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val contractAdapter by lazy {
+        SpotContractAdapter(activity,"1",viewModel)
+    }
+
+    @SuppressLint("RtlHardcoded")
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryContractTitle(Constant.table_mobile_spotcontract,"1")
+            contractAdapter.setOnContentScrollListener(this@SpotBuyUnSubmitUI)
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.unSubmitTitle.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(250), autoSize(100))
+
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    /**
+                     * 用来同步内容列表的item左右滑动
+                     */
+                    setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
+                        contractAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<SpotContractAdapter.ItemViewHolder> =
+                            contractAdapter.viewHolderCacheList
+                        if (null != viewHolderCacheList) {
+                            val size = viewHolderCacheList.size
+                            for (i in 0 until size) {
+                                viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                    scrollX,
+                                    0
+                                )
+                            }
+                        }
+                    }
+                    relativeLayout {
+                        recyclerView {//头部右侧数据
+                            val linearLayoutManager = LinearLayoutManager(context)
+                            linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                            layoutManager = linearLayoutManager
+                            background = resources.getDrawable(R.color.white)
+                            adapter = topAdapter
+                        }
+                        viewModel.unSubmitTitle.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                setRetryAction {
+                    viewModel.querySpotContract("1")
+                }
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        /**
+                         * 下拉刷新
+                         * contracttype 1-采购, -1-销售
+                         * type  1-全部 2-待点价 3-履约结算
+                         */
+                        viewModel.querySpotContract("1")
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = contractAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<SpotContractAdapter.ItemViewHolder> =
+                                    contractAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                            contractAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+
+
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.unSubmitList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                    }
+                    statusLayout.showSuccess()
+                    contractAdapter.setDatas(it)
+                }
+            }
+        }
+    }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+}
+
+
+
+/**
+ * 已完成
+ */
+class SpotBuyFinishUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: ProcurementViewModel
+) : SpotContractAdapter.OnContentScrollListener {
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val contractAdapter by lazy {
+        SpotContractAdapter(activity,"4",viewModel)
+    }
+
+    @SuppressLint("RtlHardcoded")
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryContractTitle(Constant.table_mobile_spotcontract,"4")
+            contractAdapter.setOnContentScrollListener(this@SpotBuyFinishUI)
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.finishTitle.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(250), autoSize(100))
+
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    /**
+                     * 用来同步内容列表的item左右滑动
+                     */
+                    setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
+                        contractAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<SpotContractAdapter.ItemViewHolder> =
+                            contractAdapter.viewHolderCacheList
+                        if (null != viewHolderCacheList) {
+                            val size = viewHolderCacheList.size
+                            for (i in 0 until size) {
+                                viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                    scrollX,
+                                    0
+                                )
+                            }
+                        }
+                    }
+                    relativeLayout {
+                        recyclerView {//头部右侧数据
+                            val linearLayoutManager = LinearLayoutManager(context)
+                            linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                            layoutManager = linearLayoutManager
+                            background = resources.getDrawable(R.color.white)
+                            adapter = topAdapter
+                        }
+                        viewModel.finishTitle.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                setRetryAction {
+                    viewModel.querySpotContract("4")
+                }
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        /**
+                         * 下拉刷新
+                         */
+                        viewModel.querySpotContract("4")
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = contractAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<SpotContractAdapter.ItemViewHolder> =
+                                    contractAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                            contractAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+
+
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.finishList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                    }
+                    statusLayout.showSuccess()
+                    contractAdapter.setDatas(it)
+                }
+            }
+        }
+    }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+}

+ 351 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/procurement/contraceui/SpotContractAdapter.java

@@ -0,0 +1,351 @@
+package cn.muchinfo.rma.view.base.procurement.contraceui;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.blankj.utilcode.util.ActivityUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cn.muchinfo.rma.R;
+import cn.muchinfo.rma.business.contract.SpotContractInfo;
+import cn.muchinfo.rma.global.GlobalDataCollection;
+import cn.muchinfo.rma.global.ViewEnumUtils;
+import cn.muchinfo.rma.global.data.ContractData;
+import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.base.home.contract.AddContractActivity;
+import cn.muchinfo.rma.view.base.home.contract.ContractDetailsActivity;
+import cn.muchinfo.rma.view.base.home.contract.ContractViewModel;
+import cn.muchinfo.rma.view.base.procurement.ContractDetailActivity;
+import cn.muchinfo.rma.view.base.procurement.ProcurementViewModel;
+import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
+import kotlin.Unit;
+import kotlin.jvm.functions.Function1;
+
+/**
+ * 用于采购和销售的列表adapter
+ */
+public class SpotContractAdapter extends RecyclerView.Adapter<SpotContractAdapter.ItemViewHolder> {
+
+    private Context context;
+    private List<ContractData> datas;
+    private int index = -1;
+    private int position = -1;
+    private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
+    public int offestX = 0;
+    private OnContentScrollListener onContentScrollListener;
+    private ProcurementViewModel viewModel;
+    private String type;//1 未提交 2 待审核 3 履约中 4 已完结
+
+    public interface OnContentScrollListener {
+        void onScroll(MotionEvent event);
+    }
+
+    public void setOnContentScrollListener(OnContentScrollListener onContentScrollListener) {
+        this.onContentScrollListener = onContentScrollListener;
+    }
+
+
+    public SpotContractAdapter(Context context, String type, ProcurementViewModel viewModel) {
+        this.context = context;
+        this.viewModel = viewModel;
+        this.type = type;
+    }
+
+    public void setDatas(List<ContractData> datas) {
+        this.datas = datas;
+        notifyDataSetChanged();
+    }
+
+    private void setPosition(int position) {
+        if (this.position == position) {
+            this.position = -1;
+            notifyItemChanged(index);
+        } else {
+            this.position = position;
+            notifyItemChanged(position);
+        }
+    }
+
+    @NonNull
+    @Override
+    public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+        View view = LayoutInflater.from(context).inflate(R.layout.layout_item_contract, viewGroup, false);
+        return new ItemViewHolder(view);
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
+        this.index = i;
+        ContractData contractData = datas.get(i);
+        itemViewHolder.tvLeftTitle.setText(datas.get(i).getContractno());
+        itemViewHolder.tv_left_bottom_title.setText(ViewEnumUtils.INSTANCE.getContractType(contractData.getContracttype()) + "/" + ViewEnumUtils.INSTANCE.getContractStatus(contractData.getContracctstatus()));
+        //右边滑动部分
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
+        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        itemViewHolder.rvItemRight.setLayoutManager(linearLayoutManager);
+        itemViewHolder.rvItemRight.setHasFixedSize(true);
+        RightScrollAdapter rightScrollAdapter = new RightScrollAdapter(context);
+        rightScrollAdapter.setDatas(datas.get(i).getRightData());
+        itemViewHolder.rvItemRight.setAdapter(rightScrollAdapter);
+        //缓存当前holder
+        if (!mViewHolderList.contains(itemViewHolder)) {
+            mViewHolderList.add(itemViewHolder);
+        }
+        if (i == this.position) {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.rma_list_select_color));
+            itemViewHolder.allView.setVisibility(View.VISIBLE);
+        } else {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.white));
+            itemViewHolder.allView.setVisibility(View.GONE);
+        }
+
+        itemViewHolder.all_click_View.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        itemViewHolder.horItemScrollview.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        if (type.equals("2")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_cancel")){
+                if (contractData.getContracctstatus().equals("1")){
+                    itemViewHolder.contract_undo.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_undo.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_undo.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_undo.setVisibility(View.GONE);
+        }
+        //撤销
+        itemViewHolder.contract_undo.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","3");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("2")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_check")){
+                if (contractData.getContracctstatus().equals("1")){
+                    itemViewHolder.contract_audit.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_audit.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_audit.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_audit.setVisibility(View.GONE);
+        }
+        //审核
+        itemViewHolder.contract_audit.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unsubmit","client_spotcontract_update")){
+                if (contractData.getContracctstatus().equals("1") || contractData.getContracctstatus().equals("0")){
+                    itemViewHolder.contract_modify.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_modify.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_modify.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_modify.setVisibility(View.GONE);
+        }
+        //修改
+        itemViewHolder.contract_modify.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("operationtype","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, AddContractActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("3")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_agreement","client_spotcontract_finish")){
+                itemViewHolder.contract_completion.setVisibility(View.VISIBLE);
+            }else {
+                itemViewHolder.contract_completion.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_completion.setVisibility(View.GONE);
+        }
+        //完结合同
+        itemViewHolder.contract_completion.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","4");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unsubmit","client_spotcontract_recommit")){
+                if (contractData.getContracctstatus().equals("4") || contractData.getContracctstatus().equals("6")){
+                    itemViewHolder.contract_resubmit.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+        }
+        //重新提交
+        itemViewHolder.contract_resubmit.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("operationtype","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, AddContractActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_delete")){
+                itemViewHolder.contract_delete.setVisibility(View.VISIBLE);
+            }else {
+                itemViewHolder.contract_delete.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_delete.setVisibility(View.GONE);
+        }
+        //删除
+        itemViewHolder.contract_delete.setOnClickListener(view -> {
+            viewModel.orderContract(new SpotContractInfo(), "3", "", contractData.getSpotcontractid(), new Function1<Boolean, Unit>() {
+                @Override
+                public Unit invoke(Boolean aBoolean) {
+                    viewModel.querySpotContract("1");
+                    return null;
+                }
+            });
+        });
+        //详情
+        itemViewHolder.contract_details.setOnClickListener(view -> {
+            if (datas.get(i).getContracctstatus().equals("0") || datas.get(i).getContracctstatus().equals("1")){
+                Intent intent = new Intent();
+                intent.putExtra("data", datas.get(i));
+                intent.putExtra("type","1");
+                intent.setClass(context, ContractDetailsActivity.class);
+                context.startActivity(intent);
+            }else {
+                Intent intent = new Intent();
+                intent.putExtra("data", datas.get(i));
+                if (datas.get(i).getContracttype().equals("1")){
+                    intent.putExtra("type","1");
+                }else {
+                    intent.putExtra("type","2");
+                }
+                intent.putExtra("isFrom","2");
+                intent.setClass(context, ContractDetailActivity.class);
+                context.startActivity(intent);
+            }
+        });
+
+        itemViewHolder.horItemScrollview.setEventListener(new CustomHorizontalScrollView.EventListener() {
+            @Override
+            public void onEvent(MotionEvent event) {
+                if (null != onContentScrollListener) onContentScrollListener.onScroll(event);
+            }
+        });
+        //由于viewHolder的缓存,在1级缓存取出来是2个viewholder,并且不会被重新赋值,所以这里需要处理缓存的viewholder的位移
+        itemViewHolder.horItemScrollview.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                if (!itemViewHolder.isLayoutFinish()) {
+                    itemViewHolder.horItemScrollview.scrollTo(offestX, 0);
+                    itemViewHolder.setLayoutFinish(true);
+                }
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return null == datas ? 0 : datas.size();
+    }
+
+    public List<ItemViewHolder> getViewHolderCacheList() {
+        return mViewHolderList;
+    }
+
+    public int getOffestX() {
+        return offestX;
+    }
+
+    public static class ItemViewHolder extends RecyclerView.ViewHolder {
+        LinearLayout roots_view;//根部布局
+        TextView contract_details;//详情
+        TextView contract_undo;//撤销
+        TextView contract_audit;//审核
+        TextView contract_modify;//修改
+        TextView contract_completion;//完结合同
+        TextView contract_resubmit;//重新提交
+        TextView contract_delete;//删除
+        ImageView load_more;//更多
+        LinearLayout allView;//隐藏的底部操作空间
+        LinearLayout all_click_View;//item左侧点击控件
+        TextView tvLeftTitle;//左边销售方字段
+        TextView tv_left_bottom_title;//合同编号
+        RecyclerView rvItemRight;//右方的列表
+        ImageView click_icon;//图标
+        public CustomHorizontalScrollView horItemScrollview;//右方的滑动控件
+        private boolean isLayoutFinish;//自定义字段,用于标记layout
+
+        public boolean isLayoutFinish() {
+            return isLayoutFinish;
+        }
+
+        public void setLayoutFinish(boolean layoutFinish) {
+            isLayoutFinish = layoutFinish;
+        }
+
+        public ItemViewHolder(@NonNull View itemView) {
+            super(itemView);
+            contract_delete = itemView.findViewById(R.id.contract_delete);
+            contract_undo = itemView.findViewById(R.id.contract_undo);
+            click_icon = itemView.findViewById(R.id.click_icon);
+            contract_resubmit = itemView.findViewById(R.id.contract_resubmit);
+            contract_audit = itemView.findViewById(R.id.contract_audit);
+            contract_modify = itemView.findViewById(R.id.contract_modify);
+            contract_completion = itemView.findViewById(R.id.contract_completion);
+            load_more = itemView.findViewById(R.id.load_more);
+            tvLeftTitle = itemView.findViewById(R.id.tv_left_title);
+            rvItemRight = itemView.findViewById(R.id.rv_item_right);
+            horItemScrollview = itemView.findViewById(R.id.hor_item_scrollview);
+            allView = itemView.findViewById(R.id.all_view);
+            tv_left_bottom_title = itemView.findViewById(R.id.tv_left_bottom_title);
+            all_click_View = itemView.findViewById(R.id.all_click_View);
+
+            contract_details = itemView.findViewById(R.id.contract_details);
+            roots_view = itemView.findViewById(R.id.roots_view);
+        }
+    }
+}

+ 143 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/purchasesale/PurchaseSaleFragment.kt

@@ -0,0 +1,143 @@
+package cn.muchinfo.rma.view.base.purchasesale
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.tabSegment
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.hedge.ExecutionUI
+import cn.muchinfo.rma.view.base.home.hedge.HedgePlanViewModel
+import cn.muchinfo.rma.view.base.home.hedge.ToAuditUI
+import cn.muchinfo.rma.view.base.home.hedge.UnSubmitUI
+import cn.muchinfo.rma.view.base.sale.SaleFragment
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 购销计划页面
+ * @property segment QMUITabSegment
+ * @property selectedTabIndex Int
+ * @property viewPager ViewPager
+ * @property unSubmitUI UnSubmitUI
+ * @property executionUI ExecutionUI
+ * @property newPagerAdapter PagerAdapter?
+ * @property newTabsArray ArrayList<String>
+ * @property uiList ArrayList<_FrameLayout>
+ */
+class PurchaseSaleFragment : BaseFragment<HedgePlanViewModel>(){
+
+    companion object {
+        fun newInstance() = PurchaseSaleFragment()
+    }
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    private val unSubmitUI by lazy { UnSubmitUI(this.getAppCompatActivity(), viewModel, "0") }
+
+    private val executionUI by lazy { ExecutionUI(this.getAppCompatActivity(), viewModel, "2") }
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_hedgeplan",threeCode = "client_spots_hedgeplan_new") == true){
+            newTabsArray.add("新增计划")
+            uiList.add(unSubmitUI.root)
+        }
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_hedgeplan",threeCode = "client_spots_hedgeplan_progress") == true){
+            newTabsArray.add("执行中")
+            uiList.add(executionUI.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        initMenuData()
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+
+                    setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(selectedTabIndex)
+            }
+        }.view
+    }
+
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/purchasesale/PurchaseSaleViewModel.kt

@@ -0,0 +1,12 @@
+package cn.muchinfo.rma.view.base.purchasesale
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 购销计划
+ */
+class PurchaseSaleViewModel : BaseViewModel(){
+
+
+
+}

+ 184 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/report/ReportFragment.kt

@@ -0,0 +1,184 @@
+package cn.muchinfo.rma.view.base.report
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.lifecycle.MutableLiveData
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.tabSegment
+import cn.muchinfo.rma.view.base.BaseFragment
+import cn.muchinfo.rma.view.base.home.reportquery.*
+import cn.muchinfo.rma.view.base.purchasesale.PurchaseSaleFragment
+import com.blankj.utilcode.util.ConvertUtils
+import com.qmuiteam.qmui.util.QMUIDisplayHelper
+import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
+import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import org.jetbrains.anko._FrameLayout
+import org.jetbrains.anko.matchParent
+import org.jetbrains.anko.support.v4.UI
+import org.jetbrains.anko.support.v4.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 报表fragment
+ */
+class ReportFragment : BaseFragment<ReportQueryViewModel>(){
+
+    companion object {
+        fun newInstance() = ReportFragment()
+    }
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    /** 财务报表 **/
+    private val financialReportUI by lazy { FinancialReportUI(this.getAppCompatActivity(), viewModel) }
+
+    /** 期货报表 **/
+    private val futureReportUI by lazy { FutureReportUI(this.getAppCompatActivity(), viewModel) }
+
+    /** 敞口报表 **/
+    private val exposureReportUI by lazy { ExposureReportUI(this.getAppCompatActivity(), viewModel) }
+
+    /** 现货报表 **/
+    private val spotReportUI by lazy { SpotReportUI(this.getAppCompatActivity(), viewModel) }
+
+    /** 库存(品类)报表 ***/
+    private val invertoryReportUI by lazy { InvertoryReportUI(this.getAppCompatActivity(), viewModel) }
+
+    /** 现货损益报表 **/
+    private val spotEarningReportUI by lazy { SpotEarningReportUI(this.getAppCompatActivity(),viewModel) }
+
+    /** 库存(仓库)报表 **/
+    private val invertoryWarehouseReportUI by lazy { InvertoryWarehouseReportUI(this.getAppCompatActivity(), viewModel) }
+
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    //计算页面有多少个显示页签
+    private val showIndex : MutableLiveData<Int> = MutableLiveData()
+
+    fun initMenuData(){
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_exposure") == true){
+            newTabsArray.add("敞口报表")
+            uiList.add(exposureReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_futures") == true){
+            newTabsArray.add("期货报表")
+            uiList.add(futureReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_spot") == true){
+            newTabsArray.add("现货报表")
+            uiList.add(spotReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_finance") == true){
+            newTabsArray.add("财务报表")
+            uiList.add(financialReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_wrstandstock") == true){
+            newTabsArray.add("库存(品类)报表")
+            uiList.add(invertoryReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_warehousestock") == true){
+            newTabsArray.add("库存(仓库)报表")
+            uiList.add(invertoryWarehouseReportUI.root)
+        }
+        if (GlobalDataCollection.instance?.getSecondLevelMenu(firstCode = "client_report",secondCode = "client_report_sumprofit") == true){
+            newTabsArray.add("汇总损益报表")
+            uiList.add(spotEarningReportUI.root)
+        }
+        showIndex.postValue(uiList.size)
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
+
+            override fun instantiateItem(container: ViewGroup, position: Int): Any {
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
+                }
+            }
+
+            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 = newTabsArray.size
+
+        }
+
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        return UI {
+            verticalLayout {
+                tabSegment {
+                    segment = this
+                    background = resources.getDrawable(R.color.segtabment_bg_color)
+                    addOnTabSelectedListener(object :
+                        QMUITabSegment.OnTabSelectedListener {
+                        override fun onDoubleTap(index: Int) {}
+                        override fun onTabReselected(index: Int) {}
+                        override fun onTabUnselected(index: Int) {}
+                        override fun onTabSelected(index: Int) {
+                            selectedTabIndex = index
+                        }
+                    })
+
+//                showIndex.bindOptional(context){
+//                    if (it ?: 0 > 5){
+//                        mode = QMUITabSegment.MODE_SCROLLABLE
+//                    }else{
+//                        mode = QMUITabSegment.MODE_FIXED
+//                    }
+//                }
+                    mode = QMUITabSegment.MODE_SCROLLABLE
+                    setIndicator(QMUITabIndicator(QMUIDisplayHelper.dp2px(context, 2), false, true))
+                    setDefaultTextSize(ConvertUtils.sp2px(16f), ConvertUtils.sp2px(16f))
+                }.lparams(matchParent, autoSize(100))
+
+                view {
+                    background = resources.getDrawable(R.color.main_hit_bg_color)
+                }.lparams(matchParent, autoSize(1)) {
+                    marginStart = autoSize(32)
+                    marginEnd = autoSize(32)
+                }
+
+                viewPager {
+                    background = resources.getDrawable(R.color.white)
+                    viewPager = this
+                    adapter = newPagerAdapter
+                }.lparams(matchParent, matchParent)
+
+                segment.setupWithViewPager(viewPager)
+                segment.selectTab(selectedTabIndex)
+            }
+        }.view
+    }
+
+}

+ 12 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/report/ReportViewModel.kt

@@ -0,0 +1,12 @@
+package cn.muchinfo.rma.view.base.report
+
+import cn.muchinfo.rma.view.base.BaseViewModel
+
+/**
+ * 首页报表viewmodel
+ */
+class ReportViewModel : BaseViewModel(){
+
+
+
+}

+ 47 - 22
RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleFragment.kt

@@ -9,11 +9,15 @@ import androidx.recyclerview.widget.RecyclerView
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.lifecycle.getAppCompatActivity
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseFragment
 import cn.muchinfo.rma.view.base.app.Constant
 import cn.muchinfo.rma.view.base.procurement.*
+import cn.muchinfo.rma.view.base.sale.contract.SpotSellFinishUI
+import cn.muchinfo.rma.view.base.sale.contract.SpotSellUnSubmitUI
 import cn.muchinfo.rma.view.eventbus.EventConstent
 import cn.muchinfo.rma.view.eventbus.MessageEvent
 import com.blankj.utilcode.util.ConvertUtils
@@ -45,30 +49,50 @@ class SaleFragment : BaseFragment<SaleViewModel>() {
     private val settlementUI by lazy { SaleSettlementUI(this, viewModel) }
     private val allUI by lazy { SalenewAllUI(this, viewModel) }
 
-    private val tabsArray: List<String> by lazy { arrayListOf("待点价", "履约交收", "全部") }
-//    inflater.inflate(R.layout.fragment_init, container, false)
+    //新增合同
+    private val spotSellUnSubmitUI by lazy { SpotSellUnSubmitUI(this.getAppCompatActivity(),viewModel) }
 
-    private val pagerAdapter: PagerAdapter by lazy {
-        object : PagerAdapter() {
+    //已完成
+    private val spotSellFinishUI by lazy { SpotSellFinishUI(this.getAppCompatActivity(),viewModel) }
 
-            override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
+    //viewpager的适配器
+    private var newPagerAdapter : PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray : ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList : ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initMenuData(){
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_sales",threeCode = "client_spots_sales_point") == true){
+            newTabsArray.add("待点价")
+            uiList.add(priceUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_sales",threeCode = "client_spots_sales_settle") == true){
+            newTabsArray.add("待交收")
+            uiList.add(settlementUI.root)
+        }
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_sales",threeCode = "client_spots_sales_new") == true){
+            newTabsArray.add("新增合同")
+            uiList.add(spotSellUnSubmitUI.root)
+        }
+
+        if (GlobalDataCollection.instance?.getThreeLevelMenu(firstCode = "client_spots",secondCode = "client_spots_sales",threeCode = "client_spots_sales_complete") == true){
+            newTabsArray.add("已完成")
+            uiList.add(spotSellFinishUI.root)
+        }
+        newPagerAdapter = object : PagerAdapter() {
+
+            override fun getPageTitle(position: Int): CharSequence? = newTabsArray[position]
 
             override fun instantiateItem(container: ViewGroup, position: Int): Any {
-                // return container.addView(LayoutInflater.from(context).inflate(R.layout.activity_main, container, false),ViewGroup.LayoutParams(matchParent, matchParent))
-                if (position == 0) {
-                    return priceUI.root.apply {
-                        container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
-                    }
-                } else if (position == 1) {
-                    return settlementUI.root.apply {
-                        container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
-                    }
-                } else if (position == 2) {
-                    return allUI.root.apply {
-                        container.addView(this, ViewGroup.LayoutParams(matchParent, matchParent))
-                    }
+                return uiList.get(position).apply {
+                    container.addView(
+                        this,
+                        ViewGroup.LayoutParams(matchParent, matchParent)
+                    )
                 }
-                return super.instantiateItem(container, position)
             }
 
             override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
@@ -77,9 +101,10 @@ class SaleFragment : BaseFragment<SaleViewModel>() {
 
             override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object`
 
-            override fun getCount(): Int = tabsArray.size
+            override fun getCount(): Int = newTabsArray.size
 
         }
+
     }
 
      //通用的消息更新通知
@@ -103,9 +128,9 @@ class SaleFragment : BaseFragment<SaleViewModel>() {
         savedInstanceState: Bundle?
     ): View? {
         EventBus.getDefault().register(this)
+        initMenuData()
         return UI {
             verticalLayout {
-
                 tabSegment {
                     segment = this
                     background = resources.getDrawable(R.color.segtabment_bg_color)
@@ -132,7 +157,7 @@ class SaleFragment : BaseFragment<SaleViewModel>() {
                 viewPager {
                     background = resources.getDrawable(R.color.white)
                     viewPager = this
-                    adapter = pagerAdapter
+                    adapter = newPagerAdapter
                 }.lparams(matchParent, matchParent)
 
                 segment.setupWithViewPager(viewPager)

+ 157 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/SaleViewModel.kt

@@ -1,16 +1,22 @@
 package cn.muchinfo.rma.view.base.sale
 
 import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.business.contract.SpotContractInfo
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.ViewEnumUtils
 import cn.muchinfo.rma.global.data.ColumnsData
 import cn.muchinfo.rma.global.data.ContractData
 import cn.muchinfo.rma.global.isBlankString
+import cn.muchinfo.rma.global.isShowTimeString
+import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.app.Constant
+import com.blankj.utilcode.util.TimeUtils
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 class SaleViewModel : BaseViewModel(){
@@ -35,6 +41,157 @@ class SaleViewModel : BaseViewModel(){
      */
     val allTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
 
+
+    //未提交头部数据
+    val unSubmitTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    //已完结
+    val finishTitle: MutableLiveData<List<ColumnsData>> = MutableLiveData()
+
+    /**
+     * 客户合同列表未提交数据
+     */
+    val unSubmitList: MutableLiveData<List<ContractData>> = MutableLiveData()
+
+    /**
+     * 客户合同列表已完成数据
+     */
+    val finishList: MutableLiveData<List<ContractData>> = MutableLiveData()
+    /**
+     * 查询采购列表头部数据
+     * @param tableKey String
+     */
+    fun queryContractTitle(tableKey: String, type: String) {
+        val params = mutableMapOf<String, String>().apply {
+            put("tableKey", tableKey)
+            put("tableType", "3")
+        }
+        MyApplication.getInstance()?.commonManager?.queryTableDefine(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isNotEmpty() == true){
+                    val newlist = respData.get(0).columns.toArrayList()
+                    newlist.sortWith(Comparator { t1, t2 ->
+                        t1.autoid?.toInt()?.minus(t2.autoid?.toInt() ?: 0) ?: 0
+                    })
+                    if (type == "1"){
+                        unSubmitTitle.postValue(newlist)
+                    } else if (type == "4"){
+                        finishTitle.postValue(newlist)
+                    }
+                    querySpotContract(type)
+                }
+            }
+        }
+    }
+
+
+
+    /**
+     * 现货合同查询
+     * @param QueryType String 查询类型 1-未提交 2-待审核 3-履约中 4-已完成
+     */
+    fun querySpotContract(QueryType: String) {
+
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+            put(
+                "usertype",
+                GlobalDataCollection.instance?.userAccountData?.usertype?.toString() ?: ""
+            )
+            put("querytype", QueryType)
+        }
+
+        MyApplication.getInstance()?.contractManager?.queryContract(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                when (QueryType) {
+                    "1" -> {
+                        val newList = respData?.toArrayList()
+                        newList?.sortWith(Comparator { t1, t2 ->
+                            (TimeUtils.string2Millis(t1.updatetime) - TimeUtils.string2Millis(t2.updatetime)).toInt()
+                        })
+                        unSubmitList.postValue(resetContraData(newList ?: arrayListOf()))
+                    }
+
+                    "4" -> {
+                        finishList.postValue(resetContraData(respData ?: arrayListOf()))
+                    }
+                }
+            } else {
+                loadingDialogStatus.value =
+                    TaskUiModel.failed(InteractiveException(errorMessage = error?.message ?: ""))
+            }
+        }
+    }
+
+    /**
+     * 合同操作申请
+     * @param contractInfo SpotContractInfo 参数
+     * @param OperateType String 操作类型 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
+     * @param Remark String 备注
+     * @param SpotContractID String  现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)(修改时传入)
+     */
+    fun orderContract(
+        contractInfo: SpotContractInfo = SpotContractInfo(),
+        OperateType: String,
+        Remark: String = "",
+        SpotContractID: String = "",
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ) {
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.contractManager?.orderContract(
+                contractInfo = contractInfo,
+                OperateType = OperateType,
+                Remark = Remark,
+                SpotContractID = SpotContractID
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+    //组装现货合同右侧数据
+    fun resetContraData(respData: List<ContractData>): List<ContractData> {
+        val newList = arrayListOf<ContractData>()
+        respData.forEach {
+            val newRightData = arrayListOf<String>()
+
+            newRightData.add(if (it.contracttype == "1"){
+                it.sellusername
+            }else{
+                it.buyusername
+            } + "\n" + it.qty + it.enumdicname)//'对手方/\n合同量 '
+            newRightData.add(it.deliverygoodsname + "\n" + it.wrstandardname)//'现货品种/\n品类 '
+            newRightData.add(if (it.biztype == "1"){
+                "套保"
+            }else{
+                "套利"
+            } + "\n" + it.convertfactor)//'业务类型/\n标仓系数 '
+            newRightData.add(ViewEnumUtils.getPriceType(it.pricetype ?: "")  + "\n" + it.goodsname?.isBlankString())//'定价类型/\n点价合约 '
+            newRightData.add(it.price + "\n" + it.pricemove)//'价格/\n升贴水 '
+            newRightData.add(it.amount + "\n" + it.margin)//'金额/\n保证金 '
+            newRightData.add(it.startdate?.isShowTimeString("MM-dd") + "~" + it.enddate?.isShowTimeString("MM-dd") + "\n" + it.deliverystartdate?.isShowTimeString("MM-dd") + "~" + it.deliveryenddate?.isShowTimeString("MM-dd"))//'点价期/\n交收期 '
+            newRightData.add(it.saleuserlogincode?.isBlankString() + "\n" + it.meruserlogincode?.isBlankString())//'业务员/\n跟单员 '
+            newRightData.add(it.tradeuserlogincode?.isBlankString() + "\n" + it.currencyname)//'交易用户/\n结算币种 '
+            val newData = it.copy(rightData = newRightData)
+            newList.add(newData)
+
+        }
+        return newList
+    }
+
+
     /**
      * 查询采购列表头部数据
      * @param tableKey String

+ 309 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/contract/ContractUI.kt

@@ -0,0 +1,309 @@
+package cn.muchinfo.rma.view.base.sale.contract
+
+import android.annotation.SuppressLint
+import android.view.Gravity
+import android.view.MotionEvent
+import androidx.appcompat.app.AppCompatActivity
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.base.app.Constant
+import cn.muchinfo.rma.view.base.procurement.ProcurementViewModel
+import cn.muchinfo.rma.view.base.procurement.TopTabAdpater
+import cn.muchinfo.rma.view.base.procurement.contraceui.SpotContractAdapter
+import cn.muchinfo.rma.view.base.sale.SaleViewModel
+import org.jetbrains.anko.*
+
+/**
+ * 未提交
+ */
+class SpotSellUnSubmitUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: SaleViewModel
+) : SpotSellContractAdapter.OnContentScrollListener {
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val contractAdapter by lazy {
+        SpotSellContractAdapter(activity,"1",viewModel)
+    }
+
+    @SuppressLint("RtlHardcoded")
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryContractTitle(Constant.table_mobile_spotcontract,"1")
+            contractAdapter.setOnContentScrollListener(this@SpotSellUnSubmitUI)
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.unSubmitTitle.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(250), autoSize(100))
+
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    /**
+                     * 用来同步内容列表的item左右滑动
+                     */
+                    setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
+                        contractAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<SpotSellContractAdapter.ItemViewHolder> =
+                            contractAdapter.viewHolderCacheList
+                        if (null != viewHolderCacheList) {
+                            val size = viewHolderCacheList.size
+                            for (i in 0 until size) {
+                                viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                    scrollX,
+                                    0
+                                )
+                            }
+                        }
+                    }
+                    relativeLayout {
+                        recyclerView {//头部右侧数据
+                            val linearLayoutManager = LinearLayoutManager(context)
+                            linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                            layoutManager = linearLayoutManager
+                            background = resources.getDrawable(R.color.white)
+                            adapter = topAdapter
+                        }
+                        viewModel.unSubmitTitle.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                setRetryAction {
+                    viewModel.querySpotContract("1")
+                }
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        /**
+                         * 下拉刷新
+                         * contracttype 1-采购, -1-销售
+                         * type  1-全部 2-待点价 3-履约结算
+                         */
+                        viewModel.querySpotContract("1")
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = contractAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<SpotSellContractAdapter.ItemViewHolder> =
+                                    contractAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                            contractAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+
+
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.unSubmitList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                    }
+                    statusLayout.showSuccess()
+                    contractAdapter.setDatas(it)
+                }
+            }
+        }
+    }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+}
+
+
+
+/**
+ * 已完成
+ */
+class SpotSellFinishUI(
+    private val activity: AppCompatActivity,
+    private val viewModel: SaleViewModel
+) : SpotSellContractAdapter.OnContentScrollListener {
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+    lateinit var horScrollview: CustomHorizontalScrollView
+    lateinit var recyclerView: RecyclerView
+
+    val topAdapter by lazy {
+        TopTabAdpater(activity)
+    }
+
+    val contractAdapter by lazy {
+        SpotSellContractAdapter(activity,"4",viewModel)
+    }
+
+    @SuppressLint("RtlHardcoded")
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryContractTitle(Constant.table_mobile_spotcontract,"4")
+            contractAdapter.setOnContentScrollListener(this@SpotSellFinishUI)
+            linearLayout {
+                linearLayout {
+                    gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
+                    textView {//头部右侧数据
+                        viewModel.finishTitle.bindOptional(context) {
+                            text = it?.get(0)?.columntitle?.replace("\\n", "\n") ?: ""
+                        }
+                        textColorStr = "#AAAAAA"
+                        textSizeAuto = 24
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(30)
+                    }
+                }.lparams(autoSize(250), autoSize(100))
+
+                inflateLayout<CustomHorizontalScrollView>(R.layout.scrollview) {
+                    horScrollview = this
+                    /**
+                     * 用来同步内容列表的item左右滑动
+                     */
+                    setOnCustomScrollChangeListener { listener, scrollX, scrollY, oldScrollX, oldScrollY ->
+                        contractAdapter.offestX = scrollX
+                        val viewHolderCacheList: List<SpotSellContractAdapter.ItemViewHolder> =
+                            contractAdapter.viewHolderCacheList
+                        if (null != viewHolderCacheList) {
+                            val size = viewHolderCacheList.size
+                            for (i in 0 until size) {
+                                viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                    scrollX,
+                                    0
+                                )
+                            }
+                        }
+                    }
+                    relativeLayout {
+                        recyclerView {//头部右侧数据
+                            val linearLayoutManager = LinearLayoutManager(context)
+                            linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL
+                            layoutManager = linearLayoutManager
+                            background = resources.getDrawable(R.color.white)
+                            adapter = topAdapter
+                        }
+                        viewModel.finishTitle.bindOptional(context) {
+                            val titleStringList = arrayListOf<String>()
+                            it?.subList(1, it.size)?.forEach { data ->
+                                titleStringList.add(data.columntitle?.replace("\\n", "\n") ?: "")
+                            }
+                            topAdapter.setDatas(titleStringList)
+                        }
+                    }
+                }.lparams(matchParent, matchParent)
+            }.lparams(matchParent, autoSize(100))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+                setRetryAction {
+                    viewModel.querySpotContract("4")
+                }
+//                bindTaskStatus(viewModule.status)
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        /**
+                         * 下拉刷新
+                         */
+                        viewModel.querySpotContract("4")
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = contractAdapter
+                        addOnScrollListener(object : RecyclerView.OnScrollListener() {
+                            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
+                                super.onScrolled(recyclerView, dx, dy)
+                                val viewHolderCacheList: List<SpotSellContractAdapter.ItemViewHolder> =
+                                    contractAdapter.viewHolderCacheList
+                                if (null != viewHolderCacheList) {
+                                    val size = viewHolderCacheList.size
+                                    for (i in 0 until size) {
+                                        viewHolderCacheList[i].horItemScrollview.scrollTo(
+                                            contractAdapter.getOffestX(),
+                                            0
+                                        )
+                                    }
+                                }
+                            }
+                        })
+                    }
+
+
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.finishList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+//                        mHeadHeaderHSView.scrollTo(scrollXView,scrollYView)
+                    }
+                    statusLayout.showSuccess()
+                    contractAdapter.setDatas(it)
+                }
+            }
+        }
+    }
+
+    override fun onScroll(event: MotionEvent?) {
+        //处理单个item滚动时,顶部tab需要联动
+        if (null != horScrollview) horScrollview.onTouchEvent(event)
+    }
+}

+ 351 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/sale/contract/SpotSellContractAdapter.java

@@ -0,0 +1,351 @@
+package cn.muchinfo.rma.view.base.sale.contract;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.blankj.utilcode.util.ActivityUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cn.muchinfo.rma.R;
+import cn.muchinfo.rma.business.contract.SpotContractInfo;
+import cn.muchinfo.rma.global.GlobalDataCollection;
+import cn.muchinfo.rma.global.ViewEnumUtils;
+import cn.muchinfo.rma.global.data.ContractData;
+import cn.muchinfo.rma.view.autoWidget.CustomHorizontalScrollView;
+import cn.muchinfo.rma.view.base.home.contract.AddContractActivity;
+import cn.muchinfo.rma.view.base.home.contract.ContractDetailsActivity;
+import cn.muchinfo.rma.view.base.procurement.ContractDetailActivity;
+import cn.muchinfo.rma.view.base.procurement.ProcurementViewModel;
+import cn.muchinfo.rma.view.base.procurement.RightScrollAdapter;
+import cn.muchinfo.rma.view.base.sale.SaleViewModel;
+import kotlin.Unit;
+import kotlin.jvm.functions.Function1;
+
+/**
+ * 用于采购和销售的列表adapter
+ */
+public class SpotSellContractAdapter extends RecyclerView.Adapter<SpotSellContractAdapter.ItemViewHolder> {
+
+    private Context context;
+    private List<ContractData> datas;
+    private int index = -1;
+    private int position = -1;
+    private List<ItemViewHolder> mViewHolderList = new ArrayList<>();
+    public int offestX = 0;
+    private OnContentScrollListener onContentScrollListener;
+    private SaleViewModel viewModel;
+    private String type;//1 未提交 2 待审核 3 履约中 4 已完结
+
+    public interface OnContentScrollListener {
+        void onScroll(MotionEvent event);
+    }
+
+    public void setOnContentScrollListener(OnContentScrollListener onContentScrollListener) {
+        this.onContentScrollListener = onContentScrollListener;
+    }
+
+
+    public SpotSellContractAdapter(Context context, String type, SaleViewModel viewModel) {
+        this.context = context;
+        this.viewModel = viewModel;
+        this.type = type;
+    }
+
+    public void setDatas(List<ContractData> datas) {
+        this.datas = datas;
+        notifyDataSetChanged();
+    }
+
+    private void setPosition(int position) {
+        if (this.position == position) {
+            this.position = -1;
+            notifyItemChanged(index);
+        } else {
+            this.position = position;
+            notifyItemChanged(position);
+        }
+    }
+
+    @NonNull
+    @Override
+    public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+        View view = LayoutInflater.from(context).inflate(R.layout.layout_item_contract, viewGroup, false);
+        return new ItemViewHolder(view);
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull final ItemViewHolder itemViewHolder, int i) {
+        this.index = i;
+        ContractData contractData = datas.get(i);
+        itemViewHolder.tvLeftTitle.setText(datas.get(i).getContractno());
+        itemViewHolder.tv_left_bottom_title.setText(ViewEnumUtils.INSTANCE.getContractType(contractData.getContracttype()) + "/" + ViewEnumUtils.INSTANCE.getContractStatus(contractData.getContracctstatus()));
+        //右边滑动部分
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
+        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
+        itemViewHolder.rvItemRight.setLayoutManager(linearLayoutManager);
+        itemViewHolder.rvItemRight.setHasFixedSize(true);
+        RightScrollAdapter rightScrollAdapter = new RightScrollAdapter(context);
+        rightScrollAdapter.setDatas(datas.get(i).getRightData());
+        itemViewHolder.rvItemRight.setAdapter(rightScrollAdapter);
+        //缓存当前holder
+        if (!mViewHolderList.contains(itemViewHolder)) {
+            mViewHolderList.add(itemViewHolder);
+        }
+        if (i == this.position) {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.rma_list_select_color));
+            itemViewHolder.allView.setVisibility(View.VISIBLE);
+        } else {
+            itemViewHolder.roots_view.setBackgroundColor(context.getResources().getColor(R.color.white));
+            itemViewHolder.allView.setVisibility(View.GONE);
+        }
+
+        itemViewHolder.all_click_View.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        itemViewHolder.horItemScrollview.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                setPosition(i);
+            }
+        });
+        if (type.equals("2")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_cancel")){
+                if (contractData.getContracctstatus().equals("1")){
+                    itemViewHolder.contract_undo.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_undo.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_undo.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_undo.setVisibility(View.GONE);
+        }
+        //撤销
+        itemViewHolder.contract_undo.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","3");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("2")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_check")){
+                if (contractData.getContracctstatus().equals("1")){
+                    itemViewHolder.contract_audit.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_audit.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_audit.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_audit.setVisibility(View.GONE);
+        }
+        //审核
+        itemViewHolder.contract_audit.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unsubmit","client_spotcontract_update")){
+                if (contractData.getContracctstatus().equals("1") || contractData.getContracctstatus().equals("0")){
+                    itemViewHolder.contract_modify.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_modify.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_modify.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_modify.setVisibility(View.GONE);
+        }
+        //修改
+        itemViewHolder.contract_modify.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("operationtype","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, AddContractActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("3")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_agreement","client_spotcontract_finish")){
+                itemViewHolder.contract_completion.setVisibility(View.VISIBLE);
+            }else {
+                itemViewHolder.contract_completion.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_completion.setVisibility(View.GONE);
+        }
+        //完结合同
+        itemViewHolder.contract_completion.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("type","4");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, ContractDetailsActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unsubmit","client_spotcontract_recommit")){
+                if (contractData.getContracctstatus().equals("4") || contractData.getContracctstatus().equals("6")){
+                    itemViewHolder.contract_resubmit.setVisibility(View.VISIBLE);
+                }else {
+                    itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+                }
+            }else {
+                itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_resubmit.setVisibility(View.GONE);
+        }
+        //重新提交
+        itemViewHolder.contract_resubmit.setOnClickListener(view -> {
+            Intent intent = new Intent();
+            intent.putExtra("operationtype","2");
+            intent.putExtra("data",contractData);
+            intent.setClass(context, AddContractActivity.class);
+            ActivityUtils.startActivity(intent);
+        });
+        if (type.equals("1")){
+            if (GlobalDataCollection.Companion.getInstance().getThreeLevelMenu("client_spotcontract","client_spotcontract_unaduit","client_spotcontract_delete")){
+                itemViewHolder.contract_delete.setVisibility(View.VISIBLE);
+            }else {
+                itemViewHolder.contract_delete.setVisibility(View.GONE);
+            }
+        }else {
+            itemViewHolder.contract_delete.setVisibility(View.GONE);
+        }
+        //删除
+        itemViewHolder.contract_delete.setOnClickListener(view -> {
+            viewModel.orderContract(new SpotContractInfo(), "3", "", contractData.getSpotcontractid(), new Function1<Boolean, Unit>() {
+                @Override
+                public Unit invoke(Boolean aBoolean) {
+                    viewModel.querySpotContract("1");
+                    return null;
+                }
+            });
+        });
+        //详情
+        itemViewHolder.contract_details.setOnClickListener(view -> {
+            if (datas.get(i).getContracctstatus().equals("0") || datas.get(i).getContracctstatus().equals("1")){
+                Intent intent = new Intent();
+                intent.putExtra("data", datas.get(i));
+                intent.putExtra("type","1");
+                intent.setClass(context, ContractDetailsActivity.class);
+                context.startActivity(intent);
+            }else {
+                Intent intent = new Intent();
+                intent.putExtra("data", datas.get(i));
+                if (datas.get(i).getContracttype().equals("1")){
+                    intent.putExtra("type","1");
+                }else {
+                    intent.putExtra("type","2");
+                }
+                intent.putExtra("isFrom","2");
+                intent.setClass(context, ContractDetailActivity.class);
+                context.startActivity(intent);
+            }
+        });
+
+        itemViewHolder.horItemScrollview.setEventListener(new CustomHorizontalScrollView.EventListener() {
+            @Override
+            public void onEvent(MotionEvent event) {
+                if (null != onContentScrollListener) onContentScrollListener.onScroll(event);
+            }
+        });
+        //由于viewHolder的缓存,在1级缓存取出来是2个viewholder,并且不会被重新赋值,所以这里需要处理缓存的viewholder的位移
+        itemViewHolder.horItemScrollview.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                if (!itemViewHolder.isLayoutFinish()) {
+                    itemViewHolder.horItemScrollview.scrollTo(offestX, 0);
+                    itemViewHolder.setLayoutFinish(true);
+                }
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return null == datas ? 0 : datas.size();
+    }
+
+    public List<ItemViewHolder> getViewHolderCacheList() {
+        return mViewHolderList;
+    }
+
+    public int getOffestX() {
+        return offestX;
+    }
+
+    public static class ItemViewHolder extends RecyclerView.ViewHolder {
+        LinearLayout roots_view;//根部布局
+        TextView contract_details;//详情
+        TextView contract_undo;//撤销
+        TextView contract_audit;//审核
+        TextView contract_modify;//修改
+        TextView contract_completion;//完结合同
+        TextView contract_resubmit;//重新提交
+        TextView contract_delete;//删除
+        ImageView load_more;//更多
+        LinearLayout allView;//隐藏的底部操作空间
+        LinearLayout all_click_View;//item左侧点击控件
+        TextView tvLeftTitle;//左边销售方字段
+        TextView tv_left_bottom_title;//合同编号
+        RecyclerView rvItemRight;//右方的列表
+        ImageView click_icon;//图标
+        public CustomHorizontalScrollView horItemScrollview;//右方的滑动控件
+        private boolean isLayoutFinish;//自定义字段,用于标记layout
+
+        public boolean isLayoutFinish() {
+            return isLayoutFinish;
+        }
+
+        public void setLayoutFinish(boolean layoutFinish) {
+            isLayoutFinish = layoutFinish;
+        }
+
+        public ItemViewHolder(@NonNull View itemView) {
+            super(itemView);
+            contract_delete = itemView.findViewById(R.id.contract_delete);
+            contract_undo = itemView.findViewById(R.id.contract_undo);
+            click_icon = itemView.findViewById(R.id.click_icon);
+            contract_resubmit = itemView.findViewById(R.id.contract_resubmit);
+            contract_audit = itemView.findViewById(R.id.contract_audit);
+            contract_modify = itemView.findViewById(R.id.contract_modify);
+            contract_completion = itemView.findViewById(R.id.contract_completion);
+            load_more = itemView.findViewById(R.id.load_more);
+            tvLeftTitle = itemView.findViewById(R.id.tv_left_title);
+            rvItemRight = itemView.findViewById(R.id.rv_item_right);
+            horItemScrollview = itemView.findViewById(R.id.hor_item_scrollview);
+            allView = itemView.findViewById(R.id.all_view);
+            tv_left_bottom_title = itemView.findViewById(R.id.tv_left_bottom_title);
+            all_click_View = itemView.findViewById(R.id.all_click_View);
+
+            contract_details = itemView.findViewById(R.id.contract_details);
+            roots_view = itemView.findViewById(R.id.roots_view);
+        }
+    }
+}

+ 7 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/spot/SpotFragment.kt

@@ -18,6 +18,7 @@ import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
 import cn.muchinfo.rma.view.base.BaseFragment
 import cn.muchinfo.rma.view.base.procurement.ProcurementFragment
+import cn.muchinfo.rma.view.base.purchasesale.PurchaseSaleFragment
 import cn.muchinfo.rma.view.base.sale.SaleFragment
 import com.blankj.utilcode.util.ConvertUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -50,6 +51,10 @@ class SpotFragment : BaseFragment<SpotViewModel>(){
         SaleFragment()
     }
 
+    /** 购销计划 ***/
+    val purchaseSaleFragment by lazy {
+        PurchaseSaleFragment()
+    }
     //viewpager的适配器
     private var newPagerAdapter: FragmentPagerAdapter? = null
 
@@ -66,8 +71,8 @@ class SpotFragment : BaseFragment<SpotViewModel>(){
         newTabsArray.add("销售合同")
         newTabFragment.add(saleFragment)
 
-//        newTabsArray.add("商品掉期")
-//        newTabFragment.add(swapsFragment)
+        newTabsArray.add("购销计划")
+        newTabFragment.add(purchaseSaleFragment)
 
         newPagerAdapter = object : FragmentPagerAdapter(
             getAppCompatActivity().supportFragmentManager,

+ 4 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/yrdzpurchase/YrdzDdjyFragment.kt

@@ -74,8 +74,10 @@ class YrdzDdjyFragment : BaseFragment<YrdzDdjyViewModel>() {
         newTabsArray.add("基差点价")
         newTabFragment.add(basePriceFragment)
 
-        newTabsArray.add("商品掉期")
-        newTabFragment.add(swapsFragment)
+        if (SPUtils.getInstance().getString(Constant.oem) == "tjmd"){
+            newTabsArray.add("商品掉期")
+            newTabFragment.add(swapsFragment)
+        }
 
         newPagerAdapter = object : FragmentPagerAdapter(
             getAppCompatActivity().supportFragmentManager,