Zhou.xiaoning 3 år sedan
förälder
incheckning
c62195fef7

+ 1 - 1
RMA/app/build.gradle

@@ -69,7 +69,7 @@ android {
         xhcp {
             // 解释同app1
             applicationId "cn.muchinfo.xhcp"
-            resValue "string","app_name","新会陈皮"
+            resValue "string","app_name","廣陈优品"
             manifestPlaceholders = [app_icon : "@mipmap/ic_launcher_rma"]
         }
     }

+ 3 - 1
RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/WarehouseManager.kt

@@ -528,6 +528,7 @@ class WarehouseManager {
         HasWr: Int = 0,//是否有仓单-0:没有仓单 1:有仓单
         IsFinancing : Int = 0,//是否融资购买(买摘牌时有效)-0:否 1:是
         ProductDetailID : Long = 0,//金融机构产品组合ID(融资购买时有效)
+        MarketID: Int = 17201, // 原代码写死,需要按需求传入
         callback: (isCompleted: Boolean, err: Error?) -> Unit
     ) {
         val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
@@ -535,7 +536,8 @@ class WarehouseManager {
             return
         }
         val reqPacket = WarehouseAdapter.getHdWRDealOrderReqInfo(
-            RelatedWRTradeOrderID, WRTransferUserID, OrderQty, BuyOrSell, ApplyID, LadingBillId, SubNum, WRFactorTypeId, DeliveryMonth, HasWr,IsFinancing,ProductDetailID
+            RelatedWRTradeOrderID, WRTransferUserID, OrderQty, BuyOrSell, ApplyID, LadingBillId,
+            SubNum, WRFactorTypeId, DeliveryMonth, HasWr,IsFinancing,ProductDetailID, MarketID
         )
 
         tradeSocketManager.send(

+ 3 - 2
RMA/app/src/main/java/cn/muchinfo/rma/business/warehouse/adapter/WarehouseAdapter.kt

@@ -220,7 +220,8 @@ object WarehouseAdapter {
         DeliveryMonth : String = "",//交收月
         HasWr : Int = 0,//是否有仓单-0:没有仓单 1:有仓单
         IsFinancing : Int = 0,//是否融资购买(买摘牌时有效)-0:否 1:是
-        ProductDetailID : Long = 0//金融机构产品组合ID(融资购买时有效)
+        ProductDetailID : Long = 0,//金融机构产品组合ID(融资购买时有效)
+        MarketID: Int = 0 // 原代码写死,需要按需求传入
     ) : Packet50{
         val builder = WarehouseTradeMI1.HdWRDealOrderReq.newBuilder()
         val loginInfo = GlobalDataCollection.instance?.loginRsp!!
@@ -231,7 +232,7 @@ object WarehouseAdapter {
                 loginInfo.userID,
                 GlobalDataCollection.instance?.accountId ?: 0,
                 0,
-                17201
+                MarketID
             )
         )
         builder.tradeDate = cn.muchinfo.rma.global.utils.TimeUtils.getNowTime("yyyyMMdd")

+ 1 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/autoWidget/dialog/Dialog.kt

@@ -244,7 +244,7 @@ fun AppCompatActivity.creatGoodsInfoBottomSheetDialog(
 }
 
 /**
- * 专门用于千海金商品下拉选择的dialog
+ * 专门用于千海金资金账户下拉选择的dialog
  * @receiver AppCompatActivity
  * @param titleStr 头部内容
  * @param selectList List<AccountData> 选择的实体列表

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

@@ -41,7 +41,7 @@ object Constant {
 //    const val baseurl = "http://218.17.158.45:21001/cfg?key=test_139"// 邓工139外网环境 2100000003/123456
 //    const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 邓工 新会陈皮
 //    const val baseurl = "http://192.168.31.139:8080/cfg?key=test_139" // 麦顿
-    const val baseurl = "http://192.168.31.176/cfg?key=test_176" // 邓工 新会陈皮 176外网
+    const val baseurl = "http://218.17.158.45:15203/cfg?key=test_176" // 邓工 新会陈皮 176外网
 
     /**
      * 用sp存储基础url的key

+ 8 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/future/trade/GoodsTradeActivity.kt

@@ -1438,6 +1438,14 @@ fun _LinearLayout.itemView() {
     }.lparams(matchParent, autoSize(1))
 }
 
+fun _LinearLayout.itemView(top: Int) {
+    view {
+        background = resources.getDrawable(R.color.rma_hint_line_color_eee)
+    }.lparams(matchParent, autoSize(1)) {
+        topMargin = autoSize(top)
+    }
+}
+
 fun _LinearLayout.itemPaddingView() {
     view {
         background = resources.getDrawable(R.color.rma_hint_line_color_eee)

+ 9 - 185
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpHomeFragment.kt

@@ -73,17 +73,8 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
     var selectedTabIndex: Int = 0
     private lateinit var viewPager: ViewPager
 
-    lateinit var noticeViewFlipper : ViewFlipper
-
     lateinit var dataRecyclerview : RecyclerView
 
-    private val xhcpAnnouncementUI: XhcpAnnouncementUI by lazy {
-        XhcpAnnouncementUI(
-            this,
-            viewModel
-        )
-    }//公告
-    private val informationUI: XhcpInformationUI by lazy { XhcpInformationUI(this, viewModel) }//咨讯
 
     val thisTag by lazy {
         "XhcpHomeFragment"
@@ -95,73 +86,6 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
     //tabSegment标题
     private val tabsArray: ArrayList<String> = arrayListOf()
 
-    //暂存的页面组
-    private val uiMessageList: ArrayList<_FrameLayout> = arrayListOf()
-
-    fun initMessageMenuData() {
-
-        tabsArray.add("新闻资讯")
-        uiMessageList.add(informationUI.root)
-        tabsArray.add("通知公告")
-        uiMessageList.add(xhcpAnnouncementUI.root)
-
-        pagerAdapter = object : PagerAdapter() {
-
-            override fun getPageTitle(position: Int): CharSequence? = tabsArray[position]
-
-            override fun instantiateItem(container: ViewGroup, position: Int): Any {
-                return uiMessageList[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 = tabsArray.size
-        }
-    }
-
-    @SuppressLint("RtlHardcoded")
-    private fun initViewFlipper(notice: List<NoticeData>) {
-        for (i in 0 until notice.size) {
-            val view = TextView(context)
-            val params = FrameLayout.LayoutParams(
-                ViewGroup.LayoutParams.WRAP_CONTENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT
-            )
-            params.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL
-            view.layoutParams = params
-            view.text = notice[i].title
-            view.maxLines = 1
-            view.ellipsize = TextUtils.TruncateAt.END
-            view.setTextColor(context?.resources?.getColor(R.color.rma_black_33)!!)
-            view.textSize = 12f
-            view.setOnClickListener {
-                val intent = Intent()
-                intent.putExtra("data", notice[i])
-                intent.setClass(context!!, MessageDetailsActivity::class.java)
-                ActivityUtils.startActivity(intent)
-            }
-            noticeViewFlipper.addView(view)
-        }
-        //是否自动开始滚动
-        noticeViewFlipper.isAutoStart = true
-        //滚动时间
-        noticeViewFlipper.flipInterval = 3000
-        //开始滚动
-        noticeViewFlipper.startFlipping()
-        //出入动画
-        noticeViewFlipper.setOutAnimation(context, R.anim.slide_out_right)
-        noticeViewFlipper.setInAnimation(context, R.anim.slide_in_left)
-    }
-
 
     override fun onCreateView(
         inflater: LayoutInflater,
@@ -169,7 +93,6 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
         savedInstanceState: Bundle?
     ): View? {
         return UI {
-            initMessageMenuData()
             viewModel.getBanner()
             viewModel.setDataList(thisTag){ _, _ ->
                 GlobalScope.launch(Dispatchers.Main) {
@@ -180,11 +103,11 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
             verticalLayout {
                 // 标题栏
                 linearLayout {
-                    background = resources.getDrawable(R.color.main_title_bg_color)
+                    background = resources.getDrawable(R.color.rma_red_color)
                     verticalLayout {
                         gravity = Gravity.CENTER
                         textView {
-                            text = "新会陈皮"
+                            text = "廣陈优品"
                             textColorInt = R.color.white
                             textSizeAuto = 36
                         }.lparams(wrapContent, wrapContent) {
@@ -224,10 +147,9 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
                             }
                         })
                         verticalLayout {
-                            background = resources.getDrawable(R.color.white)
+                            background = resources.getDrawable(R.color.white, null)
                             // banner
                             inflateLayout<BGABanner>(R.layout.banner) {
-                                // TODO 目前没有banner
                                 viewModel.bannerList.bindOptional(context) {
                                     setData(
                                         R.layout.item_fresco,
@@ -262,116 +184,18 @@ class XhcpHomeFragment : BaseFragment<XhcpHomeViewModel>(){
                                     }
                                 })
 
-                            }.lparams(matchParent, autoSize(400))
-
-                            itemView()
-
-//                            view {
-//                                background = resources.getDrawable(R.color.rma_hint_line_color_eee)
-//                            }.lparams(matchParent, autoSize(20))
+                            }.lparams(matchParent, autoSize(420))
 
-                            // 推广图片
-                            viewModel.imageList.bindOptional(context) {
-                                it?.forEachIndexed { index, bannerData ->
-                                    imageView {
-                                        if (bannerData.imagepath != null && bannerData.imagepath.isNotEmpty()) {
-                                            showImage(SPUtils.getInstance().getString(Constant.uploadUrl).replace("/upload","") + bannerData.imagepath.substring(1))
-                                        }
-                                    }.lparams(autoSize(360), autoSize(260))
-                                }
+                            // 固定广告图片
+                            imageView {
+                                imageResource = R.mipmap.xhcp_home_ad_
+                            }.lparams(matchParent, wrapContent) {
+                                topMargin = autoSize(5)
                             }
-
-                            itemView()
-
-                            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(18f)
-                                )
-
-                            }.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 = pagerAdapter
-                            }.lparams(matchParent, autoSize(1000))
-
-                            segment.setupWithViewPager(viewPager)
-                            segment.selectTab(selectedTabIndex)
                         }
                     }.lparams(matchParent, matchParent)
                 }
             }
         }.view
     }
-}
-
-/**
- * 咨讯
- */
-class XhcpInformationUI(private val baseFragment: Fragment, private val viewModule: XhcpHomeViewModel) {
-    private lateinit var swipeToLayout: SwipeToLoadLayout
-    private lateinit var statusLayout: StatusLayout
-
-    lateinit var recyclerView: RecyclerView
-
-    private val informationAdapter: BaseAdapter<SiteColumnDetailData, XhcpInformationViewHolder> =
-        BaseAdapter { _, _ -> XhcpInformationViewHolder(baseFragment, viewModule) }
-    val root = _FrameLayout(baseFragment.context!!).apply {
-        verticalLayout {
-            viewModule.querySiteColumnDetail()
-
-            backgroundColor = Color.WHITE
-            statusLayout(contentBlock = {
-                statusLayout = this
-//                bindTaskStatus(viewModule.status)
-                swipeToLoadLayout {
-                    swipeToLayout = this
-                    setEnableRefresh(false)
-                    setEnableLoadMore(false)
-                    setEnableScrollContentWhenLoaded(false)
-                    setEnableLoadMoreWhenContentNotFull(false)
-                    recyclerView {
-                        background = resources.getDrawable(R.color.white)
-                        adapter = informationAdapter
-                        isNestedScrollingEnabled = false
-                    }.lparams(matchParent, matchParent) {
-                        marginStart = autoSize(32)
-                        marginEnd = autoSize(20)
-                    }
-                }
-            }, emptyBlock = {
-                emptyView(hint = resources.getString(R.string.now_no_data))
-            }).lparams(matchParent, matchParent)
-            viewModule.SiteColumnDetailList.bindOptional(context) {
-                informationAdapter.setNewData(it)
-            }
-        }
-    }
 }

+ 64 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpNewGoodsViewModel.kt

@@ -3,13 +3,23 @@ package cn.muchinfo.rma.view.base.home.xhcp
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.global.data.OrderQuoteData
 import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 
 class XhcpNewGoodsViewModel: BaseViewModel() {
 
     /**
+     * 加载状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    /**
      * 新品发布信息-未开始
      */
     val wrPreSaleInfoNotStartedList: MutableLiveData<List<WrPreSaleInfoData>> = MutableLiveData()
@@ -56,4 +66,58 @@ class XhcpNewGoodsViewModel: BaseViewModel() {
             }
         }
     }
+
+    /**
+     * 持仓单摘牌请求
+     */
+    fun HdWRDealOrderReq(
+        RelatedWRTradeOrderID: Long = 0,//关联委托单号(摘牌委托关联挂牌委托单ID)
+        WRTransferUserID: Int = 0,//仓单受让用户
+        OrderQty: Long = 0,//委托数量
+        BuyOrSell: Int = 0,//买卖方向
+        ApplyID: Long = 0,//申请ID
+        LadingBillId: Long = 0,//提单id(wrholdlb的LadingBillId字段),卖的时候填写
+        SubNum: Long = 0,//提单子单号(wrholdlb的SubNum字段),卖的时候填写
+        WRFactorTypeId: Long = 0,//仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写
+        DeliveryMonth: String = "",//交收月
+        HasWr: Int = 0,//是否有仓单-0:没有仓单 1:有仓单
+        IsFinancing : Int = 0,//是否融资购买(买摘牌时有效)-0:否 1:是
+        ProductDetailID : Long = 0,//金融机构产品组合ID(融资购买时有效)
+        MarketID: Int = 0,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.warehouseManager?.HdWRDealOrderReq(
+                LadingBillId = LadingBillId,
+                RelatedWRTradeOrderID = RelatedWRTradeOrderID,
+                WRTransferUserID = WRTransferUserID,
+                OrderQty = OrderQty,
+                IsFinancing = IsFinancing,
+                ProductDetailID = ProductDetailID,
+                DeliveryMonth = DeliveryMonth,
+                SubNum = SubNum,
+                WRFactorTypeId = WRFactorTypeId,
+                BuyOrSell = BuyOrSell,
+                HasWr = HasWr,
+                ApplyID = ApplyID,
+                MarketID = MarketID
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+//                    querySellDataList(pricetype = pricetype,type = type,data = data)
+//                    queryBuyDataList(pricetype = pricetype,type = type,data = data)
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
 }

+ 6 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpPreSaleActivity.kt

@@ -9,20 +9,23 @@ import cn.muchinfo.rma.global.data.WrPreSaleInfoData
 import cn.muchinfo.rma.global.toShowTime
 import cn.muchinfo.rma.global.toShowTime3
 import cn.muchinfo.rma.global.toTimeData
+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.BaseViewModel
 import cn.muchinfo.rma.view.base.app.Constant
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import cn.muchinfo.rma.view.base.tjmd.WarehouseScreeningDialog
 import com.blankj.utilcode.util.SPUtils
+import com.qmuiteam.qmui.kotlin.onClick
 import org.jetbrains.anko.*
 
 /**
  * 新品发售商品详情(抢购中)
  * @property data WrPreSaleInfoData
  */
-class XhcpPreSaleActivity: BaseActivity<BaseViewModel>() {
+class XhcpPreSaleActivity: BaseActivity<XhcpNewGoodsViewModel>() {
     private val data by lazy {
         intent.getParcelableExtra<WrPreSaleInfoData>("data") as WrPreSaleInfoData
     }
@@ -173,6 +176,8 @@ class XhcpPreSaleActivity: BaseActivity<BaseViewModel>() {
                                 createRoundRectDrawable("#2794FF", 10)
                         }.lparams(autoSize(320), autoSize(100)) {
                             gravity = Gravity.CENTER
+                        }.onClick {
+                            getAppCompatActivity().XhcpHdWRDealScreeningDialog(viewModel, getAppCompatActivity(), data).show()
                         }
                     }.lparams(matchParent, autoSize(200))
 

+ 270 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/home/xhcp/XhcpScreeningDialog.kt

@@ -0,0 +1,270 @@
+package cn.muchinfo.rma.view.base.home.xhcp
+
+import android.annotation.SuppressLint
+import android.app.Dialog
+import android.graphics.Color
+import android.view.Gravity
+import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.global.data.AccountData
+import cn.muchinfo.rma.global.data.WrPreSaleInfoData
+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.autoWidget.view.MangeNumberEditText2
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.ToastUtils
+import com.qmuiteam.qmui.kotlin.onClick
+import mtp.polymer.com.autowidget.dialog.CustomDialogFragment
+import mtp.polymer.com.autowidget.dialog.createCustomDialog
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
+import org.jetbrains.anko.*
+
+@SuppressLint("SetTextI18n")
+fun AppCompatActivity.XhcpHdWRDealScreeningDialog(
+    viewModel: XhcpNewGoodsViewModel,
+    activity: AppCompatActivity,
+    data: WrPreSaleInfoData
+): CustomDialogFragment {
+    return createCustomDialog(cancelable = false) { dialog ->
+        var loadingDialog: Dialog? = null
+        // 认购数量
+        lateinit var qtyNumberEditText: MangeNumberEditText2
+
+        //选择的资金账号
+        val selectAccountData: MutableLiveData<AccountData> = MutableLiveData()
+
+        // 需要的履约保证金
+        val buyMarginValue: MutableLiveData<Double> = MutableLiveData()
+        // 计算需要的履约保证金
+        val unitPrice: Double = data.unitprice?.toDouble() ?: 0.0
+        buyMarginValue.postValue(unitPrice.times(data.baseqty?.toDouble() ?: 0.0))
+
+        // 选择当前资金账户
+        selectAccountData.postValue(GlobalDataCollection.instance?.accountData)
+
+        backgroundColor = Color.parseColor("#5f000000")
+        relativeLayout {
+            loadingDialog = createLoadingDialog(hintStr = "请求中")
+            loadingDialog?.bindTaskStatus(context, viewModel.loadingDialogStatus)
+
+            verticalLayout {
+                background = resources.getDrawable(R.color.white, null)
+
+                // 资金账户
+                linearLayout {
+                    textView {
+                        selectAccountData.bindOptional(context) {
+                            text = it?.accountname + "(" + it?.accountid.toString() + ")"
+                        }
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                        gravity = Gravity.CENTER
+                    }.lparams(matchParent, wrapContent, 1F)
+
+                    emptyView()
+
+                    imageView {
+                        imageResource = R.mipmap.rma_more
+                    }.lparams(autoSize(36), autoSize(36)) {
+                        rightMargin = autoSize(20)
+                    }
+                }.lparams(matchParent, wrapContent) {
+                    topMargin = autoSize(20)
+                }
+
+                // 发行方
+                linearLayout {
+                    textView {
+                        textSizeAuto = 32
+                        textColorInt = R.color.text_hint_color_two
+                        text = "发行方"
+                    }.lparams(autoSize(100), wrapContent) {
+                        leftMargin = autoSize(30)
+                    }
+                    textView {
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                        text = data.username
+                    }.lparams(autoSize(0), wrapContent, 1F) {
+                        leftMargin = autoSize(10)
+                    }
+                }.lparams(matchParent, wrapContent) {
+                    topMargin = autoSize(20)
+                }
+
+                // 发行价格 & 最大认购数量
+                linearLayout {
+                    linearLayout {
+                        textView {
+                            textColorInt = R.color.text_hint_color_two
+                            textSizeAuto = 32
+                            text = "发行价格"
+                        }.lparams(autoSize(0), wrapContent, 1F)
+                        textView {
+                            textColorInt = R.color.rma_item_yellow_color
+                            textSizeAuto = 36
+                            text = data.unitprice
+                            gravity = Gravity.RIGHT
+                        }.lparams(autoSize(0), wrapContent, 1F)
+                    }.lparams(matchParent, wrapContent, 1F) {
+                        topMargin = autoSize(10)
+                        leftMargin = autoSize(30)
+                        rightMargin = autoSize(30)
+                    }
+                    linearLayout {
+                        textView {
+                            textColorInt = R.color.text_hint_color_two
+                            textSizeAuto = 32
+                            text = "最大认购数量"
+                        }.lparams(autoSize(0), wrapContent, 1F)
+                        textView {
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 36
+                            text = data.maxbuyqty + " " + data.enumdicname
+                            gravity = Gravity.RIGHT
+                        }.lparams(autoSize(0), wrapContent, 1F)
+                    }.lparams(matchParent, wrapContent, 1F) {
+                        topMargin = autoSize(10)
+                        leftMargin = autoSize(30)
+                        rightMargin = autoSize(20)
+                    }
+                }
+
+                itemView(10)
+
+                // 认购数量
+                linearLayout {
+                    textView {
+                        textSizeAuto = 32
+                        textColorInt = R.color.text_hint_color_two
+                        text = "认购数量(" + data.baseqty + data.enumdicname + "起)"
+                    }.lparams(autoSize(300), wrapContent) {
+                        leftMargin = autoSize(30)
+                        topMargin = autoSize(5)
+                    }
+                    numberEditText {
+                        qtyNumberEditText = this
+                        text = data.baseqty
+                        max = data.maxbuyqty?.toDouble() ?: 0.0
+                        min = data.baseqty?.toDouble() ?: 0.0
+                        step = data.baseqty?.toDouble() ?: 0.0
+                        setOnTextChangeListener { view, value ->
+                            if (value.isNullOrEmpty().not()) {
+                                // 计算需要的履约保证金
+                                val unitPrice: Double = data.unitprice?.toDouble() ?: 0.0
+                                buyMarginValue.postValue(unitPrice.times(value.toDouble()))
+                            }
+                        }
+                    }.lparams(0, autoSize(72), 1f) {
+                        marginStart = autoSize(100)
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(matchParent, autoSize(100)) {
+                    topMargin = autoSize(30)
+                }
+
+                itemView(10)
+
+                // 履约保证金
+                linearLayout {
+                    textView {
+                        textSizeAuto = 32
+                        textColorInt = R.color.text_hint_color_two
+                        text = "履约保证金"
+                    }.lparams(autoSize(300), wrapContent) {
+                        leftMargin = autoSize(30)
+                        topMargin = autoSize(5)
+                    }
+                    verticalLayout {
+                        textView {
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 36
+                            buyMarginValue.bindOptional(context) {
+                                text = NumberUtils.roundNum(it ?: 0.0, 2)
+                            }
+                            gravity = Gravity.RIGHT
+                        }.lparams(wrapContent, wrapContent)
+                        textView {
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 36
+                            selectAccountData.bindOptional(context) {
+                                if (it != null) {
+                                    text = "可用资金: " + NumberUtils.roundNum(it.canUserAmount ?: 0.0, 2)
+                                } else {
+                                    text = "可用资金: --"
+                                }
+                            }
+                            gravity = Gravity.RIGHT
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(autoSize(0), wrapContent, 1F)
+                }.lparams(matchParent, autoSize(100)) {
+                    topMargin = autoSize(30)
+                }
+
+                itemView(10)
+
+                // 交互区
+                linearLayout {
+                    button {
+                        gravity = Gravity.CENTER
+                        text = "取消"
+                        textSizeAuto = 36
+                        textColorInt = R.color.white
+                        backgroundDrawable =
+                            createRoundRectDrawable("#505050", 10)
+                    }.lparams(autoSize(0), autoSize(100), 1F) {
+                        leftMargin = autoSize(30)
+                        rightMargin = autoSize(15)
+                        topMargin = autoSize(30)
+                    }.onClick {
+                        dialog.dismiss()
+                    }
+                    button {
+                        gravity = Gravity.CENTER
+                        text = "认购"
+                        textSizeAuto = 36
+                        textColorInt = R.color.white
+                        backgroundDrawable =
+                            createRoundRectDrawable("#2794FF", 10)
+                    }.lparams(autoSize(0), autoSize(100), 1F) {
+                        leftMargin = autoSize(15)
+                        rightMargin = autoSize(30)
+                        topMargin = autoSize(30)
+                    }.onClick {
+                        // 摘牌数量不能为0
+                        if (qtyNumberEditText.text.isNullOrEmpty() || qtyNumberEditText.text == "0") {
+                            ToastUtils.showLong("认购数量不能为0")
+                            return@onClick
+                        }
+                        val qty = qtyNumberEditText.text.toLong()
+
+                        // 市场
+                        val marketID = GlobalDataCollection.instance?.getMaketidByTrademode(MTPEnums.TRADEMODE_CDYS) ?: 0
+
+                        viewModel.HdWRDealOrderReq(
+                            RelatedWRTradeOrderID = data.sellwrtradeorderid?.toLong() ?: 0,
+                            WRTransferUserID = GlobalDataCollection.instance?.userAccountData?.userid?.toInt() ?: 0,
+                            WRFactorTypeId = data.wrfactortypeid?.toLong() ?: 0,
+                            OrderQty = qty,
+                            BuyOrSell = 0, // 买方向
+                            HasWr = 1,
+                            MarketID = marketID,
+                            ApplyID = data.presaleapplyid?.toLong() ?: 0
+                        ) {
+                            dialog.dismiss()
+                        }
+                    }
+                }.lparams(matchParent, autoSize(200))
+
+            }.lparams(matchParent, autoSize(700)) {
+                gravity = Gravity.BOTTOM
+            }
+        }.lparams(matchParent, matchParent)
+    }
+}