Explorar el Código

风险管理6月16日提交代码-liu.bolan-千海金

Liu.bolan hace 4 años
padre
commit
b6f9a4d93f
Se han modificado 43 ficheros con 3386 adiciones y 186 borrados
  1. 6 0
      RMA/app/src/main/AndroidManifest.xml
  2. 88 1
      RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/ContractGoodsManager.kt
  3. 202 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/ContractGoodsAdapter.kt
  4. 344 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/OrderData.java
  5. 368 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/OrderReqData.java
  6. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/future/FutureManager.kt
  7. 39 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/money/MoneyManager.kt
  8. 12 10
      RMA/app/src/main/java/cn/muchinfo/rma/business/money/adapter/MoneyAdapter.kt
  9. 18 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/BaseGlobalData.java
  10. 2 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/MTPEnums.java
  11. 33 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt
  12. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/ContractTradeOrderDetailData.kt
  13. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/PayOrderData.kt
  14. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/QhjContractDetailsData.kt
  15. 20 0
      RMA/app/src/main/java/cn/muchinfo/rma/protobuf/funcode/FunCode.java
  16. 15 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/MainViewModel.kt
  17. 75 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/PayActivity.kt
  18. 44 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/PayViewModel.kt
  19. 18 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/SeaKingMainFragment.kt
  20. 151 28
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/castsurely/AddCastSurelyActivity.kt
  21. 71 34
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/castsurely/MyCastSurelyViewModel.kt
  22. 5 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodViewHolder.kt
  23. 28 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsActivity.kt
  24. 7 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsListActivity.kt
  25. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsViewModel.kt
  26. 0 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/PlatinumTreasureFragment.kt
  27. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/PlatinumTreasureViewModel.kt
  28. 124 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatinumCancellationsActivity.kt
  29. 120 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatnumDealActivty.kt
  30. 121 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatnumMoneyActivity.kt
  31. 67 12
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/CancellationsViewHolder.kt
  32. 24 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/DealViewHolder.kt
  33. 51 18
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/FinancialViewHolder.kt
  34. 13 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/MoneyFlowingVIewHolder.kt
  35. 183 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/NoPayViewHolder.kt
  36. 298 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumBuyOrSellUI.kt
  37. 35 11
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumCancellationsUI.kt
  38. 251 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumDealUI.kt
  39. 26 6
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumMoneyUI.kt
  40. 28 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumPositionUI.kt
  41. 25 5
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeActivity.kt
  42. 442 18
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeViewModel.kt
  43. 15 5
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PositionViewHolder.kt

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

@@ -332,6 +332,12 @@
         <activity android:name=".view.base.login.register.PersonalRegisterActivity"/>
 
         <activity android:name=".view.base.main.pickup.PickAreaActivity"/>
+
+        <activity android:name=".view.base.platinumtreasure.activity.PlatnumDealActivty"/>
+
+        <activity android:name=".view.base.platinumtreasure.activity.PlatinumCancellationsActivity"/>
+
+        <activity android:name=".view.base.platinumtreasure.activity.PlatnumMoneyActivity"/>
     </application>
 
 </manifest>

+ 88 - 1
RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/ContractGoodsManager.kt

@@ -1,16 +1,30 @@
 package cn.muchinfo.rma.business.contractgoods
 
+import cn.muchinfo.rma.business.address.adapter.AddressAdapter
+import cn.muchinfo.rma.business.contractgoods.adapter.ContractGoodsAdapter
+import cn.muchinfo.rma.business.contractgoods.adapter.OrderData
+import cn.muchinfo.rma.business.future.adapter.ChannelOrderReqData
+import cn.muchinfo.rma.business.global.MessageHeadModel
+import cn.muchinfo.rma.global.ErrorMessageUtils
 import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.data.futureOrders.FutureEntrustData
 import cn.muchinfo.rma.netManage.base.ResponseCallback
 import cn.muchinfo.rma.netManage.utils.MyOkHttpUtils
+import cn.muchinfo.rma.netcore.packet.Packet50
+import cn.muchinfo.rma.netcore.socket.Callback
+import cn.muchinfo.rma.protobuf.funcode.FunCode
+import cn.muchinfo.rma.protobuf.protoclasses.MSIM
+import cn.muchinfo.rma.protobuf.protoclasses.TkernelMI1
+import cn.muchinfo.rma.view.MyApplication
+import cn.muchinfo.rma.view.autoWidget.guard
 import cn.muchinfo.rma.view.base.app.BaseResult
 import cn.muchinfo.rma.view.base.app.Constant
 import com.blankj.utilcode.util.SPUtils
 import okhttp3.Call
+import java.io.ByteArrayOutputStream
 import java.lang.Exception
-import java.util.ArrayList
+import java.util.*
 
 /**
  * 合约市场管理类
@@ -19,6 +33,79 @@ class ContractGoodsManager {
 
 
     /**
+     * 交易撤单请求
+     * @param marketid Int
+     * @param goodsid Int
+     * @param accountid Long
+     * @param oldOrderId Long
+     */
+    fun cancelOrderReq(
+        marketid : Int,
+        goodsid : Int,
+        accountid : Long,
+        oldOrderId : Long,
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = ContractGoodsAdapter.getCancelOrderReqInfo(
+            marketid, goodsid, accountid, oldOrderId
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.FID_CancelOrderRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = ContractGoodsAdapter.analysisCancelOrderRsq(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+            }
+        )
+    }
+
+    /**
+     * 交易下单
+     * @param data OrderData
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun orderReq(data: OrderData,callback: (isCompleted: Boolean, err: Error?) -> Unit){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = ContractGoodsAdapter.getChannelOrderReqInfo(
+            data
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.FID_OrderRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = ContractGoodsAdapter.analysisOrderRsq(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+            }
+        )
+    }
+
+
+    /**
      * 查询待付款单据
      * @param params Map<String, String> accountID/资金账户ID startDate/ 开始时间 - 闭区间,格式:yyyy-MM-dd endDate / 结束时间 - 闭区间,格式:yyyy-MM-dd
      * @param responseBack Function3<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] List<FutureDetailsData>?, [@kotlin.ParameterName] Error?, Unit>

+ 202 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/ContractGoodsAdapter.kt

@@ -1,8 +1,210 @@
 package cn.muchinfo.rma.business.contractgoods.adapter
 
+import cn.muchinfo.rma.business.global.MessageHeadModel
+import cn.muchinfo.rma.global.ErrorMessageUtils
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.netcore.packet.Packet50
+import cn.muchinfo.rma.protobuf.funcode.FunCode
+import cn.muchinfo.rma.protobuf.protoclasses.TkernelMI1
+import com.blankj.utilcode.util.TimeUtils
+import java.io.ByteArrayOutputStream
+import java.util.*
+
 /**
  * 合约商品报文装箱解箱
  */
 object ContractGoodsAdapter {
 
+
+//    var builder: Order.CancelOrderReq.Builder = Order.CancelOrderReq.newBuilder()
+//    builder.setHeader(getMessageHead(FunCode.CANCELORDERREQ, cancelOrderData.getAccountID(), goodsId as Int, marketId))
+//    builder.setClientType(CLIENTTYPE)
+//    builder.setAccountID(cancelOrderData.getAccountID())
+//    builder.setOldOrderId(cancelOrderData.getOldOrderId())
+//    builder.setOrderSrc(ORDERSRC)
+//    if (cancelOrderData.getOperateType() !== 0)
+//    {
+//        builder.setOperateType(cancelOrderData.getOperateType())
+//    } else
+//    {
+//        builder.setOperateType(MTPEnums.OPERATETYPE_NORMAL)
+//    }
+//    builder.setClientOrderTime(getCurrentTime())
+//    builder.setClientSerialNo(getUUID())
+//    builder.setOperatorID(GlobalDataCollention.getInstance().getLoginRspData().getUserID())
+    /**
+     * 交易委托撤单请求
+     */
+    fun getCancelOrderReqInfo(
+        marketid : Int,
+        goodsid : Int,
+        accountid : Long,
+        oldOrderId : Long
+    ) : Packet50{
+        val builder = TkernelMI1.CancelOrderReq.newBuilder()
+        val loginInfo = GlobalDataCollection.instance?.loginRsp!!
+
+        builder.clientType = 3
+        builder.accountID = accountid
+        builder.oldOrderId = oldOrderId
+        builder.orderSrc = 1
+        builder.operateType = MTPEnums.OPERATETYPE_NORMAL
+        builder.clientSerialNo = UUID.randomUUID().toString().replace("-", "")
+        builder.clientOrderTime = TimeUtils.getNowString()
+
+        builder.setHeader(
+            MessageHeadModel.getHead(
+                FunCode.FID_CancelOrderReq,
+                loginInfo.userID,
+                GlobalDataCollection.instance?.accountId ?: 0,
+                goodsid,
+                marketid,
+                loginInfo.clientID
+            )
+        )
+
+        val arrayOutputStream = ByteArrayOutputStream();
+        builder.build().writeTo(arrayOutputStream)
+        return Packet50(FunCode.FID_CancelOrderReq, arrayOutputStream.toByteArray())
+    }
+
+    /**
+     * 交易委托撤单的报文解析
+     * @param packet50 Packet50
+     * @return Triple<Boolean, Error?, MSIM.ChannelOrderRsp?>
+     */
+    fun analysisCancelOrderRsq(packet50: Packet50): Triple<Boolean, Error?, TkernelMI1.CancelOrderRsp?> {
+        return try {
+            val loginRsp = TkernelMI1.CancelOrderRsp.parseFrom(packet50.content)
+            if (loginRsp.retCode == 0) {
+                // 操作成功
+                Triple(true, null, loginRsp)
+            } else {
+                // 操作失败
+                Triple(false, Error(ErrorMessageUtils.getErrorString(loginRsp.retCode)), null)
+            }
+        } catch (e: Exception) {
+            // 操作失败
+            Triple(false, Error("装箱失败"), null)
+        }
+    }
+
+    /**
+     * 交易委托的报文装箱(copy 自通用的交易委托)此处适用于千海金下单
+     * @param data ChannelOrderReqData
+     * @return Packet50
+     */
+    fun getChannelOrderReqInfo(data: OrderData): Packet50 {
+        val builder = TkernelMI1.OrderReq.newBuilder()
+        val loginInfo = GlobalDataCollection.instance?.loginRsp!!
+        builder.accountID = data.accountID
+        builder.buyOrSell = data.buyOrSell
+        builder.buildType = data.buildType
+        builder.clientSerialNo = UUID.randomUUID().toString().replace("-", "")
+        builder.clientType = 3
+        if (data.curtQuotePrice != 0.0){
+            builder.curtQuotePrice = data.curtQuotePrice
+        }
+
+        if (data.delistingType != 0){
+            builder.delistingType = data.delistingType
+        }
+
+        if (data.listingSelectType != 0){
+            builder.listingSelectType = data.listingSelectType
+        }
+        builder.marketID = data.marketID
+        builder.goodsID = data.goodsID
+        builder.loginID = loginInfo.loginID
+        builder.receiveInfoID = data.receiveInfoID
+        builder.marketMaxSub = data.marketMaxSub
+        builder.operateType = data.operateType
+        builder.operatorID = loginInfo.userID.toLong()
+        if (data.validTime.isNotEmpty()){
+            builder.validTime = data.validTime
+        }
+        if (data.orderPrice != 0.0){
+            builder.orderPrice = data.orderPrice
+        }
+
+        if (data.couponTypeID != 0L){
+            builder.couponTypeID = data.couponTypeID
+        }
+
+        if (data.usedQty != 0){
+            builder.usedQty = data.usedQty
+        }
+        if (data.relatedID != 0L){
+            builder.relatedID = data.relatedID
+        }
+        builder.clientOrderTime = TimeUtils.getNowString()
+
+        builder.orderQty = data.orderQty
+        if (data.optionType != 0){
+            builder.optionType = data.optionType
+        }
+        if (data.orderSrc != 0){
+            builder.orderSrc = data.orderSrc
+        }
+        if (data.premium != 0.0){
+            builder.premium = data.premium
+        }
+        builder.priceMode = data.priceMode
+
+        if (data.slPrice != 0.0){
+            builder.slPrice = data.slPrice
+        }
+        if (data.spPrice != 0.0){
+            builder.spPrice = data.spPrice
+        }
+        builder.timevalidType = data.timevalidType
+        if (data.triggerPrice != 0.0){
+            builder.triggerPrice = data.triggerPrice
+        }
+        builder.triggerType = data.triggerType
+        builder.validType = data.validType
+        if (data.triggerOperator != 0){
+            builder.triggerOperator = data.triggerOperator
+        }
+        // FIXME: - time???
+//        builder.serviceTime =
+
+
+        builder.setHeader(
+            MessageHeadModel.getHead(
+                FunCode.FID_OrderReq,
+                loginInfo.userID,
+                GlobalDataCollection.instance?.accountId ?: 0,
+                data.goodsID,
+                data.marketID,
+                loginInfo.clientID
+            )
+        )
+
+        val arrayOutputStream = ByteArrayOutputStream();
+        builder.build().writeTo(arrayOutputStream)
+        return Packet50(FunCode.FID_OrderReq, arrayOutputStream.toByteArray())
+    }
+
+    /**
+     * 交易委托的报文解析
+     * @param packet50 Packet50
+     * @return Triple<Boolean, Error?, MSIM.ChannelOrderRsp?>
+     */
+    fun analysisOrderRsq(packet50: Packet50): Triple<Boolean, Error?, TkernelMI1.OrderRsp?> {
+        return try {
+            val loginRsp = TkernelMI1.OrderRsp.parseFrom(packet50.content)
+            if (loginRsp.retCode == 0) {
+                // 操作成功
+                Triple(true, null, loginRsp)
+            } else {
+                // 操作失败
+                Triple(false, Error(ErrorMessageUtils.getErrorString(loginRsp.retCode)), null)
+            }
+        } catch (e: Exception) {
+            // 操作失败
+            Triple(false, Error("装箱失败"), null)
+        }
+    }
 }

+ 344 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/OrderData.java

@@ -0,0 +1,344 @@
+package cn.muchinfo.rma.business.contractgoods.adapter;
+
+/**
+ * optional uint64 LoginID = 5; // 登陆账号
+ * optional uint64 AccountID = 6; // 交易账号
+ * optional uint32 GoodsID = 7; // 商品ID
+ * optional uint32 MarketID = 8; // 市场ID
+ * optional int32 ValidType = 9; // 校验类型
+ * optional uint32 OperateType = 10; // 操作类型:
+ * optional uint32 OrderSrc = 11; // 单据来源
+ * optional uint64 OperatorID = 12; // 操作员账号ID
+ * optional double OrderPrice = 13; // 委托价格
+ * optional double MarketMaxSub = 14; // 市价允许最大偏差(做市)
+ * optional uint64 OrderQty = 15; // 委托数量
+ * optional uint32 BuyOrSell = 16; // 买卖方向
+ * optional uint32 BuildType = 17; // 下单类型
+ * optional double CurtQuotePrice = 18; // 保留,计算冻结金额使用
+ * optional double SpPrice = 19; // 止盈价格
+ * optional double SlPrice = 20; // 止损价格
+ * optional uint32 PriceMode = 21; // 取价方式
+ * optional uint32 TimevalidType = 22; // \
+ * optional uint32 TriggerType = 23; // 预埋单触发类型
+ * optional double TriggerPrice = 24; // 预埋单触发价格
+ * optional uint32 ListingSelectType = 25; // 挂牌点选类型
+ * optional uint32 DelistingType = 26; // 摘牌类型
+ * optional uint64 RelatedID = 27; // 关联单号
+ * optional uint32 OptionType = 28; // 期权类型(1:认购(看涨)2:认沽(看跌))
+ * optional double Premium = 29; // 权利金
+ * optional uint32 TriggerOperator = 30; // 触发条件-1:
+ * optional string ServiceTime = 31; // 服务端时间
+ */
+public class OrderData {
+    private String clientOrderTime = "";
+    private long loginID = 0;
+    private long accountID = 0;
+    private int goodsID = 0;
+    private int marketID = 0;
+    private int validType = 0;
+    private int operateType = 0;
+    private int orderSrc = 0;
+    private long operatorID = 0;
+    private double orderPrice = 0;
+    private double marketMaxSub = 0;
+    private long orderQty = 0;
+    private int buyOrSell = 0;
+    private int buildType = 0;
+    private double curtQuotePrice = 0;
+    private double spPrice = 0;
+    private double slPrice = 0;
+    private int priceMode = 0;
+    private int timevalidType = 0;
+    private int triggerType = 1;
+    private double triggerPrice = 0;
+    private int listingSelectType = 0;
+    private int delistingType = 0;
+    private long relatedID = 0;
+    private int optionType = 0;
+    private double premium = 0;
+    private int triggerOperator = 0; // 触发条件-1:
+    private String serviceTime = ""; // 服务端时间
+    private long couponTypeID = 0;//优惠券类型ID(买方)
+    private int usedQty = 0;//使用数量
+    private String validTime = "";//指定有效日期
+    private long receiveInfoID = 0;//收货地址ID
+    private int OrderFlag = 1;//委托标识 - 1:按量 2:按金额
+    private double OrderAmount = 0;//委托金额 OrderFlag=2必填
+
+    public int getOrderFlag() {
+        return OrderFlag;
+    }
+
+    public void setOrderFlag(int orderFlag) {
+        OrderFlag = orderFlag;
+    }
+
+    public double getOrderAmount() {
+        return OrderAmount;
+    }
+
+    public void setOrderAmount(double orderAmount) {
+        OrderAmount = orderAmount;
+    }
+
+    public long getReceiveInfoID() {
+        return receiveInfoID;
+    }
+
+    public void setReceiveInfoID(long receiveInfoID) {
+        this.receiveInfoID = receiveInfoID;
+    }
+
+    public long getCouponTypeID() {
+        return couponTypeID;
+    }
+
+    public void setCouponTypeID(long couponTypeID) {
+        this.couponTypeID = couponTypeID;
+    }
+
+    public int getUsedQty() {
+        return usedQty;
+    }
+
+    public void setUsedQty(int usedQty) {
+        this.usedQty = usedQty;
+    }
+
+    public String getValidTime() {
+        return validTime;
+    }
+
+    public void setValidTime(String validTime) {
+        this.validTime = validTime;
+    }
+
+    public long getLoginID() {
+        return loginID;
+    }
+
+    public void setLoginID(long loginID) {
+        this.loginID = loginID;
+    }
+
+    public long getAccountID() {
+        return accountID;
+    }
+
+    public void setAccountID(long accountID) {
+        this.accountID = accountID;
+    }
+
+    public int getGoodsID() {
+        return goodsID;
+    }
+
+    public void setGoodsID(int goodsID) {
+        this.goodsID = goodsID;
+    }
+
+    public int getMarketID() {
+        return marketID;
+    }
+
+    public void setMarketID(int marketID) {
+        this.marketID = marketID;
+    }
+
+    public int getValidType() {
+        return validType;
+    }
+
+    public void setValidType(int validType) {
+        this.validType = validType;
+    }
+
+    public int getOperateType() {
+        return operateType;
+    }
+
+    public void setOperateType(int operateType) {
+        this.operateType = operateType;
+    }
+
+    public int getOrderSrc() {
+        return orderSrc;
+    }
+
+    public void setOrderSrc(int orderSrc) {
+        this.orderSrc = orderSrc;
+    }
+
+    public long getOperatorID() {
+        return operatorID;
+    }
+
+    public void setOperatorID(long operatorID) {
+        this.operatorID = operatorID;
+    }
+
+    public double getOrderPrice() {
+        return orderPrice;
+    }
+
+    public void setOrderPrice(double orderPrice) {
+        this.orderPrice = orderPrice;
+    }
+
+    public double getMarketMaxSub() {
+        return marketMaxSub;
+    }
+
+    public void setMarketMaxSub(double marketMaxSub) {
+        this.marketMaxSub = marketMaxSub;
+    }
+
+    public long getOrderQty() {
+        return orderQty;
+    }
+
+    public void setOrderQty(long orderQty) {
+        this.orderQty = orderQty;
+    }
+
+    public int getBuyOrSell() {
+        return buyOrSell;
+    }
+
+    public void setBuyOrSell(int buyOrSell) {
+        this.buyOrSell = buyOrSell;
+    }
+
+    public int getBuildType() {
+        return buildType;
+    }
+
+    public void setBuildType(int buildType) {
+        this.buildType = buildType;
+    }
+
+    public double getCurtQuotePrice() {
+        return curtQuotePrice;
+    }
+
+    public void setCurtQuotePrice(double curtQuotePrice) {
+        this.curtQuotePrice = curtQuotePrice;
+    }
+
+    public double getSpPrice() {
+        return spPrice;
+    }
+
+    public void setSpPrice(double spPrice) {
+        this.spPrice = spPrice;
+    }
+
+    public double getSlPrice() {
+        return slPrice;
+    }
+
+    public void setSlPrice(double slPrice) {
+        this.slPrice = slPrice;
+    }
+
+    public int getPriceMode() {
+        return priceMode;
+    }
+
+    public void setPriceMode(int priceMode) {
+        this.priceMode = priceMode;
+    }
+
+    public int getTimevalidType() {
+        return timevalidType;
+    }
+
+    public void setTimevalidType(int timevalidType) {
+        this.timevalidType = timevalidType;
+    }
+
+    public int getTriggerType() {
+        return triggerType;
+    }
+
+    public void setTriggerType(int triggerType) {
+        this.triggerType = triggerType;
+    }
+
+    public double getTriggerPrice() {
+        return triggerPrice;
+    }
+
+    public void setTriggerPrice(double triggerPrice) {
+        this.triggerPrice = triggerPrice;
+    }
+
+    public int getListingSelectType() {
+        return listingSelectType;
+    }
+
+    public void setListingSelectType(int listingSelectType) {
+        this.listingSelectType = listingSelectType;
+    }
+
+    public int getDelistingType() {
+        return delistingType;
+    }
+
+    public void setDelistingType(int delistingType) {
+        this.delistingType = delistingType;
+    }
+
+    public long getRelatedID() {
+        return relatedID;
+    }
+
+    public void setRelatedID(long relatedID) {
+        this.relatedID = relatedID;
+    }
+
+    public int getOptionType() {
+        return optionType;
+    }
+
+    public void setOptionType(int optionType) {
+        this.optionType = optionType;
+    }
+
+    public double getPremium() {
+        return premium;
+    }
+
+    public void setPremium(double premium) {
+        this.premium = premium;
+    }
+
+    public String getClientOrderTime() {
+        return clientOrderTime;
+    }
+
+    /**
+     * 可以不用传,调用的方法里面已经处理了。
+     *
+     * @param clientOrderTime
+     */
+    public void setClientOrderTime(String clientOrderTime) {
+        this.clientOrderTime = clientOrderTime;
+    }
+
+    public int getTriggerOperator() {
+        return triggerOperator;
+    }
+
+    public void setTriggerOperator(int triggerOperator) {
+        this.triggerOperator = triggerOperator;
+    }
+
+    public String getServiceTime() {
+        return serviceTime;
+    }
+
+    public void setServiceTime(String serviceTime) {
+        this.serviceTime = serviceTime;
+    }
+}

+ 368 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/contractgoods/adapter/OrderReqData.java

@@ -0,0 +1,368 @@
+package cn.muchinfo.rma.business.contractgoods.adapter;
+
+/**
+ * 千海金交易
+ */
+public class OrderReqData {
+
+    private long AccountID;//交易账号
+    private int BuyOrSell;//买卖方向
+    private int BuildType;//下单类型
+    private int OperateType;//操作类型:
+    private int OrderSrc;//单据来源
+    private String ClientOrderTime;
+    private String ClientSerialNo;
+    private int ClientType;
+    private int CloseType;
+    private int GoodsID;
+    private long LoginID;
+    private int MarketID;
+    private long OperatorID;//操作员账号ID
+    private double OrderPrice;//委托价格
+    private int HedgeFlag;
+    private long OrderQty;//委托数量
+    private int PriceMode;//取价方式
+    private long RelatedID;//关联单号
+    private String ServiceTime;// string 服务端时间
+    private int ValidType;
+    private String Validtime;//// string 指定有效日期
+    private int TimeValidType;//时间有效类型
+    private long CloseTodayQty;
+    private String Ip;
+    private double MarketMaxSub;//市价允许最大偏差(做市)
+    private double CurtQuotePrice;//保留,计算冻结金额使用
+    private double SpPrice;//止盈价格
+    private double SlPrice;//止损价格
+    private int TriggerType;//预埋单触发类型
+    private double TriggerPrice;//预埋单触发价格
+    private int ListingSelectType;//挂牌点选类型
+    private int DelistingType;//摘牌类型
+    private int OptionType;//期权类型(1:认购(看涨) 2:认沽(看跌))
+    private double Premium;//权利金
+    private int TriggerOperator;//触发条件(1: 大于等于 2:小于等于)
+    private Long CouponTypeID;//// uint64 优惠券类型ID(买方)
+    private int UsedQty;//使用数量
+    private String ReceiveInfoID;//// uint64 收货地址ID
+    private int OrderFlag;//委托标识 - 1:按量 2:按金额
+    private double OrderAmount;//委托金额 OrderFlag=2必填
+
+    public long getAccountID() {
+        return AccountID;
+    }
+
+    public void setAccountID(long accountID) {
+        AccountID = accountID;
+    }
+
+    public int getBuyOrSell() {
+        return BuyOrSell;
+    }
+
+    public void setBuyOrSell(int buyOrSell) {
+        BuyOrSell = buyOrSell;
+    }
+
+    public int getBuildType() {
+        return BuildType;
+    }
+
+    public void setBuildType(int buildType) {
+        BuildType = buildType;
+    }
+
+    public int getOperateType() {
+        return OperateType;
+    }
+
+    public void setOperateType(int operateType) {
+        OperateType = operateType;
+    }
+
+    public int getOrderSrc() {
+        return OrderSrc;
+    }
+
+    public void setOrderSrc(int orderSrc) {
+        OrderSrc = orderSrc;
+    }
+
+    public String getClientOrderTime() {
+        return ClientOrderTime;
+    }
+
+    public void setClientOrderTime(String clientOrderTime) {
+        ClientOrderTime = clientOrderTime;
+    }
+
+    public String getClientSerialNo() {
+        return ClientSerialNo;
+    }
+
+    public void setClientSerialNo(String clientSerialNo) {
+        ClientSerialNo = clientSerialNo;
+    }
+
+    public int getClientType() {
+        return ClientType;
+    }
+
+    public void setClientType(int clientType) {
+        ClientType = clientType;
+    }
+
+    public int getCloseType() {
+        return CloseType;
+    }
+
+    public void setCloseType(int closeType) {
+        CloseType = closeType;
+    }
+
+    public int getGoodsID() {
+        return GoodsID;
+    }
+
+    public void setGoodsID(int goodsID) {
+        GoodsID = goodsID;
+    }
+
+    public long getLoginID() {
+        return LoginID;
+    }
+
+    public void setLoginID(long loginID) {
+        LoginID = loginID;
+    }
+
+    public int getMarketID() {
+        return MarketID;
+    }
+
+    public void setMarketID(int marketID) {
+        MarketID = marketID;
+    }
+
+    public long getOperatorID() {
+        return OperatorID;
+    }
+
+    public void setOperatorID(long operatorID) {
+        OperatorID = operatorID;
+    }
+
+    public double getOrderPrice() {
+        return OrderPrice;
+    }
+
+    public void setOrderPrice(double orderPrice) {
+        OrderPrice = orderPrice;
+    }
+
+    public int getHedgeFlag() {
+        return HedgeFlag;
+    }
+
+    public void setHedgeFlag(int hedgeFlag) {
+        HedgeFlag = hedgeFlag;
+    }
+
+    public long getOrderQty() {
+        return OrderQty;
+    }
+
+    public void setOrderQty(long orderQty) {
+        OrderQty = orderQty;
+    }
+
+    public int getPriceMode() {
+        return PriceMode;
+    }
+
+    public void setPriceMode(int priceMode) {
+        PriceMode = priceMode;
+    }
+
+    public long getRelatedID() {
+        return RelatedID;
+    }
+
+    public void setRelatedID(long relatedID) {
+        RelatedID = relatedID;
+    }
+
+    public String getServiceTime() {
+        return ServiceTime;
+    }
+
+    public void setServiceTime(String serviceTime) {
+        ServiceTime = serviceTime;
+    }
+
+    public int getValidType() {
+        return ValidType;
+    }
+
+    public void setValidType(int validType) {
+        ValidType = validType;
+    }
+
+    public String getValidtime() {
+        return Validtime;
+    }
+
+    public void setValidtime(String validtime) {
+        Validtime = validtime;
+    }
+
+    public int getTimeValidType() {
+        return TimeValidType;
+    }
+
+    public void setTimeValidType(int timeValidType) {
+        TimeValidType = timeValidType;
+    }
+
+    public long getCloseTodayQty() {
+        return CloseTodayQty;
+    }
+
+    public void setCloseTodayQty(long closeTodayQty) {
+        CloseTodayQty = closeTodayQty;
+    }
+
+    public String getIp() {
+        return Ip;
+    }
+
+    public void setIp(String ip) {
+        Ip = ip;
+    }
+
+    public double getMarketMaxSub() {
+        return MarketMaxSub;
+    }
+
+    public void setMarketMaxSub(double marketMaxSub) {
+        MarketMaxSub = marketMaxSub;
+    }
+
+    public double getCurtQuotePrice() {
+        return CurtQuotePrice;
+    }
+
+    public void setCurtQuotePrice(double curtQuotePrice) {
+        CurtQuotePrice = curtQuotePrice;
+    }
+
+    public double getSpPrice() {
+        return SpPrice;
+    }
+
+    public void setSpPrice(double spPrice) {
+        SpPrice = spPrice;
+    }
+
+    public double getSlPrice() {
+        return SlPrice;
+    }
+
+    public void setSlPrice(double slPrice) {
+        SlPrice = slPrice;
+    }
+
+    public int getTriggerType() {
+        return TriggerType;
+    }
+
+    public void setTriggerType(int triggerType) {
+        TriggerType = triggerType;
+    }
+
+    public double getTriggerPrice() {
+        return TriggerPrice;
+    }
+
+    public void setTriggerPrice(double triggerPrice) {
+        TriggerPrice = triggerPrice;
+    }
+
+    public int getListingSelectType() {
+        return ListingSelectType;
+    }
+
+    public void setListingSelectType(int listingSelectType) {
+        ListingSelectType = listingSelectType;
+    }
+
+    public int getDelistingType() {
+        return DelistingType;
+    }
+
+    public void setDelistingType(int delistingType) {
+        DelistingType = delistingType;
+    }
+
+    public int getOptionType() {
+        return OptionType;
+    }
+
+    public void setOptionType(int optionType) {
+        OptionType = optionType;
+    }
+
+    public double getPremium() {
+        return Premium;
+    }
+
+    public void setPremium(double premium) {
+        Premium = premium;
+    }
+
+    public int getTriggerOperator() {
+        return TriggerOperator;
+    }
+
+    public void setTriggerOperator(int triggerOperator) {
+        TriggerOperator = triggerOperator;
+    }
+
+    public Long getCouponTypeID() {
+        return CouponTypeID;
+    }
+
+    public void setCouponTypeID(Long couponTypeID) {
+        CouponTypeID = couponTypeID;
+    }
+
+    public int getUsedQty() {
+        return UsedQty;
+    }
+
+    public void setUsedQty(int usedQty) {
+        UsedQty = usedQty;
+    }
+
+    public String getReceiveInfoID() {
+        return ReceiveInfoID;
+    }
+
+    public void setReceiveInfoID(String receiveInfoID) {
+        ReceiveInfoID = receiveInfoID;
+    }
+
+    public int getOrderFlag() {
+        return OrderFlag;
+    }
+
+    public void setOrderFlag(int orderFlag) {
+        OrderFlag = orderFlag;
+    }
+
+    public double getOrderAmount() {
+        return OrderAmount;
+    }
+
+    public void setOrderAmount(double orderAmount) {
+        OrderAmount = orderAmount;
+    }
+}

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/future/FutureManager.kt

@@ -59,6 +59,8 @@ class FutureManager {
             type = "1",
             callback = object : ResponseCallback<BaseResult<List<GoodsInfo>>>() {
                 override fun onResponse(response: BaseResult<List<GoodsInfo>>?, id: Int) {
+                    //每次请求都把之前的数据清掉,不然会出现不存在的商品
+                    DataBase.getInstance().goodsInfoDao().clearAllData()
                     // 存储直接入库,需要的时候,再查询,检查方法的运行时间,10ms可以接受
                     DataBase.getInstance().goodsInfoDao().insertAll(response?.data)
 //                    Builder.getDatabase<AppDatabase>().goodsInfoDao.insertAll()

+ 39 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/money/MoneyManager.kt

@@ -3,6 +3,7 @@ package cn.muchinfo.rma.business.money
 import cn.muchinfo.rma.business.address.adapter.AddressAdapter
 import cn.muchinfo.rma.business.money.adapter.MoneyAdapter
 import cn.muchinfo.rma.global.data.*
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.netManage.base.ResponseCallback
 import cn.muchinfo.rma.netManage.utils.MyOkHttpUtils
 import cn.muchinfo.rma.netcore.packet.Packet50
@@ -22,6 +23,44 @@ import java.lang.Exception
 class MoneyManager {
 
     /**
+     * 余额支付请求
+     * @param accountid Long
+     * @param tradeID Long
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
+     */
+    fun balancePaymentReq(
+        tradeID : Long,
+        goodsInfo: GoodsInfo,
+        accountid : Long,
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = MoneyAdapter.getBalancePaymentReqInfo(
+             tradeID,goodsInfo,accountid
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.QhjRegularlyStrategyRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = MoneyAdapter.analysisQhjRegularlyStrategyRsq(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+            }
+        )
+    }
+
+    /**
      *
      * @param regularlyStrategyID Long 定投策略ID
      * @param goodsID Long 定投商品ID

+ 12 - 10
RMA/app/src/main/java/cn/muchinfo/rma/business/money/adapter/MoneyAdapter.kt

@@ -3,6 +3,7 @@ package cn.muchinfo.rma.business.money.adapter
 import cn.muchinfo.rma.business.global.MessageHeadModel
 import cn.muchinfo.rma.global.ErrorMessageUtils
 import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.netcore.packet.Packet50
 import cn.muchinfo.rma.protobuf.funcode.FunCode
 import cn.muchinfo.rma.protobuf.protoclasses.BankMI1
@@ -12,6 +13,7 @@ import cn.muchinfo.rma.protobuf.protoclasses.TkernelMI1
 import com.google.common.math.IntMath
 import java.io.ByteArrayOutputStream
 import java.lang.Exception
+import java.util.*
 
 object MoneyAdapter {
 
@@ -39,9 +41,9 @@ object MoneyAdapter {
      * @param ClientTicket String
      */
     fun getBalancePaymentReqInfo(
-        TradeID : Long,
-        AccountID : Long,
-        ClientTicket : String
+        tradeID : Long,
+        goodsInfo: GoodsInfo,
+        accountID : Long
     ) : Packet50{
         val builder = TkernelMI1.BalancePaymentReq.newBuilder()
         val loginInfo = GlobalDataCollection.instance?.loginRsp!!
@@ -50,15 +52,15 @@ object MoneyAdapter {
             MessageHeadModel.getHead(
                 FunCode.FID_BalancePaymentReq,
                 loginInfo.userID,
-                0,
-                0,
-                18
+                accountID,
+                goodsInfo.goodsid,
+                goodsInfo.marketid
             )
         )
 
-        builder.tradeID = TradeID
-        builder.accountID = AccountID
-        builder.clientTicket = ClientTicket
+        builder.tradeID = tradeID
+        builder.accountID = accountID
+        builder.clientTicket = UUID.randomUUID().toString().replace("-", "")
         val arrayOutputStream = ByteArrayOutputStream();
         builder.build().writeTo(arrayOutputStream)
         return Packet50(FunCode.FID_BalancePaymentReq, arrayOutputStream.toByteArray())
@@ -228,7 +230,7 @@ object MoneyAdapter {
             MessageHeadModel.getHead(
                 FunCode.QhjRegularlyStrategyReq,
                 loginInfo.userID,
-                0,
+                GlobalDataCollection.instance?.accountId ?: 0,
                 0,
                 18
             )

+ 18 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/BaseGlobalData.java

@@ -8,6 +8,7 @@ import cn.muchinfo.rma.global.data.AccountData;
 import cn.muchinfo.rma.global.data.ClientMenuData;
 import cn.muchinfo.rma.global.data.ErmcpRoleFuncMenuData;
 import cn.muchinfo.rma.global.data.FutureDetailsData;
+import cn.muchinfo.rma.global.data.GoodsExInfoData;
 import cn.muchinfo.rma.global.data.GoodsInfoAndQuotes;
 import cn.muchinfo.rma.global.data.UserAccountData;
 import cn.muchinfo.rma.global.data.account.LoginQueryData;
@@ -95,6 +96,23 @@ public class BaseGlobalData {
 
     private ArrayList<String> goodsIdList;//自选的商品信息
 
+    /**
+     * 交易商品的扩展信息
+     */
+    private ArrayList<GoodsExInfoData> goodsExInfoDataArrayList;
+
+
+    public ArrayList<GoodsExInfoData> getGoodsExInfoDataArrayList() {
+        if (goodsExInfoDataArrayList == null){
+            goodsExInfoDataArrayList = new ArrayList<>();
+        }
+        return goodsExInfoDataArrayList;
+    }
+
+    public void setGoodsExInfoDataArrayList(ArrayList<GoodsExInfoData> goodsExInfoDataArrayList) {
+        this.goodsExInfoDataArrayList = goodsExInfoDataArrayList;
+    }
+
     public ArrayList<String> getGoodsIdList() {
         return goodsIdList;
     }

+ 2 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/MTPEnums.java

@@ -273,6 +273,8 @@ public class MTPEnums {
     public static final int ORDEROPERATETYPE_PREPOSORDER_ORDER = 19;
     /// 预埋单撤单
     public static final int ORDEROPERATETYPE_PREPOSORDER_CANCEL = 20;
+    /// 融资买入
+    public static final int OPERATETYPE_FINANC = 23;
     /**
      * 委托来源
      */

+ 33 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/StringUtils.kt

@@ -296,4 +296,37 @@ fun String.takeorderstatus() : String{
     return str
 }
 
+/**
+ * 待支付列表状态
+ * @receiver String
+ * @return String
+ */
+fun String.payflag() : String{
+    if (this.isNullOrEmpty()){
+        return "--"
+    }
+    var str = ""
+    when {
+        this == "1" -> {
+            str = "未支付"
+        }
+        this == "2" -> {
+            str = "已支付"
+        }
+        this == "3" -> {
+            str = "已过期"
+        }
+        this == "4" -> {
+            str = "已撤销"
+        }
+        this == "5" -> {
+            str = "结算过期"
+        }
+        this == "6" -> {
+            str = "预售终止"
+        }
+    }
+    return str
+}
+
 

+ 3 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/ContractTradeOrderDetailData.kt

@@ -74,6 +74,7 @@ data class ContractTradeOrderDetailData(
     val updatetime: String?  ="",//更新时间
     val uuid : String? = "",//发起端唯一id
     val validtime : String? = "",//有效期限
+    var isClick : Int = 0,//是否点击展开
     val validtype : String? = "",//有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效
     val volumetype : String? =""//当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量 1:最小量(暂时不支持) 2:全部量
 ) : Parcelable{
@@ -145,6 +146,7 @@ data class ContractTradeOrderDetailData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readInt(),
         parcel.readString(),
         parcel.readString()
     ) {
@@ -218,6 +220,7 @@ data class ContractTradeOrderDetailData(
         parcel.writeString(updatetime)
         parcel.writeString(uuid)
         parcel.writeString(validtime)
+        parcel.writeInt(isClick)
         parcel.writeString(validtype)
         parcel.writeString(volumetype)
     }

+ 4 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/PayOrderData.kt

@@ -27,6 +27,7 @@ data class PayOrderData(
     val tradedate : String? = "",//交易日(yyyyMMdd)
     val tradeid : String? = "",//成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
     val tradeprice : String? = "",//成交价格
+    var isClick : Int = 0,//是否点击展开
     val tradeqty : String? = ""//成交数量
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
@@ -50,6 +51,7 @@ data class PayOrderData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readInt(),
         parcel.readString()
     ) {
     }
@@ -75,6 +77,7 @@ data class PayOrderData(
         parcel.writeString(tradedate)
         parcel.writeString(tradeid)
         parcel.writeString(tradeprice)
+        parcel.writeInt(isClick)
         parcel.writeString(tradeqty)
     }
 
@@ -92,4 +95,5 @@ data class PayOrderData(
         }
     }
 
+
 }

+ 3 - 0
RMA/app/src/main/java/cn/muchinfo/rma/global/data/QhjContractDetailsData.kt

@@ -30,6 +30,7 @@ data class QhjContractDetailsData(
     val amount : String? = "",
     val amounttype : String? = "",
     val logid : String? = "",
+    var isClick : Int = 0,//是否点击展开
     val updatetime : String? = ""
 
 ) : Parcelable{
@@ -56,6 +57,7 @@ data class QhjContractDetailsData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readInt(),
         parcel.readString()
     ) {
     }
@@ -83,6 +85,7 @@ data class QhjContractDetailsData(
         parcel.writeString(amount)
         parcel.writeString(amounttype)
         parcel.writeString(logid)
+        parcel.writeInt(isClick)
         parcel.writeString(updatetime)
     }
 

+ 20 - 0
RMA/app/src/main/java/cn/muchinfo/rma/protobuf/funcode/FunCode.java

@@ -271,4 +271,24 @@ public class FunCode {
      * 撤单应答
      */
     public static final int CANCELORDERRSP = 196612;
+
+    /**
+     * 交易委托下单请求 千海金
+     */
+    public static final int FID_OrderReq = 196609;
+
+    /**
+     * 交易委托下单应答 千海金
+     */
+    public static final int FID_OrderRsp = 196610;
+
+    /**
+     * 交易委托撤单请求
+     */
+    public static final int FID_CancelOrderReq = 196611;
+
+    /**
+     * 交易委托撤单应答
+     */
+    public static final int FID_CancelOrderRsp = 196612;
 }

+ 15 - 1
RMA/app/src/main/java/cn/muchinfo/rma/view/MainViewModel.kt

@@ -11,6 +11,7 @@ import cn.muchinfo.rma.view.autoWidget.guard
 import cn.muchinfo.rma.view.autoWidget.toArrayList
 import cn.muchinfo.rma.view.base.BaseViewModel
 import cn.muchinfo.rma.view.base.app.Constant
+import com.blankj.utilcode.util.LogUtils
 import com.blankj.utilcode.util.SPUtils
 import kotlinx.coroutines.*
 import mtp.polymer.com.autowidget.utils.TaskUiModel
@@ -40,10 +41,10 @@ class MainViewModel : BaseViewModel() {
             }
             MyApplication.getInstance()?.initializeManager?.getTaAccounts(params = params) { isSuccess, respData, error ->
                 isInitiaDataSuccess.postValue(isSuccess)
+                LogUtils.eTag("accountid",respData)
                 if (isSuccess) {
                     GlobalDataCollection.instance?.accountDataList = respData
                     getUserAccount()//请求成功就继续请求用户账号信息
-
                 } else {
                     loadingDialogStatus.postValue(TaskUiModel.idel())
                 }
@@ -57,6 +58,7 @@ class MainViewModel : BaseViewModel() {
         }
 
         queryUserFavoriteGoodses()
+        queryGoodsEx()
 //
 //        //如果获取资金账户信息出错,则中断请求
 //        if (!canContinue) {
@@ -83,6 +85,18 @@ class MainViewModel : BaseViewModel() {
 
     }
 
+    /**
+     * 查询请求商品扩展信息
+     */
+    fun queryGoodsEx(){
+        val params = mutableMapOf<String, String>()
+        MyApplication.getInstance()?.moneyManager?.queryGoodsEx(params){isSuccess, respData, error ->
+            if (isSuccess){
+                GlobalDataCollection.instance?.goodsExInfoDataArrayList = respData?.toArrayList()
+            }
+        }
+    }
+
 
     /**
      * 查询我的自选

+ 75 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/PayActivity.kt

@@ -3,8 +3,13 @@ package cn.muchinfo.rma.view.base.main
 import android.graphics.Typeface
 import android.os.Bundle
 import android.view.Gravity
+import android.view.View
+import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.PayOrderData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
 import cn.muchinfo.rma.view.autoWidget.textColorInt
@@ -13,7 +18,12 @@ import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import com.blankj.utilcode.util.BarUtils
+import com.blankj.utilcode.util.TimeUtils
+import com.blankj.utilcode.util.ToastUtils
 import com.qmuiteam.qmui.util.QMUIStatusBarHelper
+import mtp.polymer.com.autowidget.dialog.SelectData
+import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
 
 /**
@@ -21,10 +31,18 @@ import org.jetbrains.anko.*
  */
 class PayActivity : BaseActivity<PayViewModel>(){
 
+    private val dialog by lazy { createLoadingDialog(hintStr = "请求中...") }
+
+    val tradepaydata by lazy { intent.getParcelableExtra<PayOrderData>("tradepaydata") as PayOrderData }
+
+    //选择的支付方式 1 余额支付 2 支付宝支付 3 微信支付
+    val selectPayType : MutableLiveData<SelectData> = MutableLiveData()
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         QMUIStatusBarHelper.translucent(this)
         verticalLayout {
+            dialog.bindTaskStatus(context, viewModel.loadingDialogStatus)
             background = resources.getDrawable(R.color.main_hit_bg_color)
             verticalLayout {
                 backgroundResource = R.mipmap.qhj_pay_bg
@@ -86,7 +104,7 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 }
 
                 textView {
-                    text = "¥590"
+                    text = tradepaydata.payamount
                     textSizeAuto = 55
                     textColorInt = R.color.rma_red_color
                 }.lparams(wrapContent, wrapContent){
@@ -101,6 +119,9 @@ class PayActivity : BaseActivity<PayViewModel>(){
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
+                onThrottleFirstClick {
+                    selectPayType.postValue(SelectData(id = "1",value = ""))
+                }
                 imageView {
                     imageResource = R.mipmap.qhj_balance_icon
                 }.lparams(autoSize(48), autoSize(48)){
@@ -126,12 +147,26 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 emptyView()
 
                 textView {
+                    visibility = View.GONE
                     text = "余额不足"
                     textSizeAuto = 31
                     textColorInt = R.color.hint_text_color
                 }.lparams(wrapContent, wrapContent){
                     marginEnd = autoSize(35)
                 }
+
+                imageView {
+                    selectPayType.bindOptional(context){
+                        if (it?.id == "1"){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
+                    }
+                    imageResource = R.mipmap.qhj_pay_select
+                }.lparams(autoSize(48), autoSize(48)){
+                    marginEnd = autoSize(36)
+                }
             }.lparams(matchParent, autoSize(144))
 
             itemView()
@@ -139,6 +174,9 @@ class PayActivity : BaseActivity<PayViewModel>(){
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
+                onThrottleFirstClick {
+                    selectPayType.postValue(SelectData(id = "3",value = ""))
+                }
                 imageView {
                     imageResource = R.mipmap.wechat_pay_icon
                 }.lparams(autoSize(48), autoSize(48)){
@@ -157,6 +195,13 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 emptyView()
 
                 imageView {
+                    selectPayType.bindOptional(context){
+                        if (it?.id == "3"){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
+                    }
                     imageResource = R.mipmap.qhj_pay_select
                 }.lparams(autoSize(48), autoSize(48)){
                     marginEnd = autoSize(36)
@@ -168,6 +213,9 @@ class PayActivity : BaseActivity<PayViewModel>(){
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
+                onThrottleFirstClick {
+                    selectPayType.postValue(SelectData(id = "2",value = ""))
+                }
                 imageView {
                     imageResource = R.mipmap.alipay_icon
                 }.lparams(autoSize(48), autoSize(48)){
@@ -186,6 +234,13 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 emptyView()
 
                 imageView {
+                    selectPayType.bindOptional(context){
+                        if (it?.id == "2"){
+                            visibility = View.VISIBLE
+                        }else{
+                            visibility = View.GONE
+                        }
+                    }
                     imageResource = R.mipmap.qhj_pay_select
                 }.lparams(autoSize(48), autoSize(48)){
                     marginEnd = autoSize(36)
@@ -203,7 +258,17 @@ class PayActivity : BaseActivity<PayViewModel>(){
 
                 textView {
                     onThrottleFirstClick {
-
+                        if (selectPayType.value?.id.isNullOrEmpty()){
+                            ToastUtils.showLong("请选择支付方式")
+                            return@onThrottleFirstClick
+                        }
+                        if (selectPayType.value?.id == "1"){
+                            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(tradepaydata.goodsid?.toInt() ?: 0)
+                            viewModel.balancePaymentReq(accountid = GlobalDataCollection.instance?.accountId ?: 0,tradeID = tradepaydata.tradeid?.toLong() ?: 0,goodsInfo = goodsInfo){
+                                ToastUtils.showLong("支付成功")
+                                finish()
+                            }
+                        }
                     }
                     gravity = Gravity.CENTER
                     backgroundResource = R.mipmap.rma_submit_bg
@@ -220,13 +285,20 @@ class PayActivity : BaseActivity<PayViewModel>(){
         }
     }
 
+    /**
+     * paytype 1 成交支付 2 尾款支付 3 保证金支付 4 充值
+     * msgType 9 支付宝 10 微信
+     */
     fun update(){
         val params = mutableMapOf<String, Any>()
         params["accoundId"] = GlobalDataCollection.instance?.accountId ?: 0
         params["accountName"] = GlobalDataCollection.instance?.userAccountData?.accountname ?: ""
-        params["marketId"] = 70201
+        params["marketId"] = 69201
         params["orderNo"] = "2011613819351030007"
         params["payType"] = 4
+        params["orderDate"] = TimeUtils.getNowString()
+        params["totalAmout"] = 450
+        params["msgType"] = "9"
     }
 
 

+ 44 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/PayViewModel.kt

@@ -1,8 +1,52 @@
 package cn.muchinfo.rma.view.base.main
 
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
+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
 
 //支付页面的viewmodel
 class PayViewModel : BaseViewModel(){
 
+    /**
+     * 数据初始化状态控制
+     */
+    val loadingDialogStatus: MutableLiveData<TaskUiModel> = MutableLiveData()
+
+    /**
+     * 余额支付请求
+     */
+    fun balancePaymentReq(
+        accountid : Long,
+        tradeID : Long,
+        goodsInfo: GoodsInfo,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.moneyManager?.balancePaymentReq(
+                accountid = accountid,
+                tradeID = tradeID,
+                goodsInfo = goodsInfo
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
 }

+ 18 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/SeaKingMainFragment.kt

@@ -17,6 +17,9 @@ import cn.muchinfo.rma.view.base.main.castsurely.MyCastSurelyActivity
 import cn.muchinfo.rma.view.base.main.pickup.PickUpGoodsSearchActivity
 import cn.muchinfo.rma.view.base.main.promotioncode.MyPromotionCodeActivity
 import cn.muchinfo.rma.view.base.main.withdrawmanagement.WithDrawManagementActivity
+import cn.muchinfo.rma.view.base.platinumtreasure.activity.PlatinumCancellationsActivity
+import cn.muchinfo.rma.view.base.platinumtreasure.activity.PlatnumDealActivty
+import cn.muchinfo.rma.view.base.platinumtreasure.activity.PlatnumMoneyActivity
 import com.blankj.utilcode.util.ActivityUtils
 
 import com.qmuiteam.qmui.kotlin.matchParent
@@ -234,6 +237,11 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>(){
 
                             //交易撤单
                             verticalLayout {
+                                onThrottleFirstClick {
+                                    val intent = Intent()
+                                    intent.setClass(context,PlatinumCancellationsActivity::class.java)
+                                    ActivityUtils.startActivity(intent)
+                                }
                                 gravity = Gravity.CENTER_HORIZONTAL
                                 imageView {
                                     imageResource = R.mipmap.qhj_trading_cancellations
@@ -253,6 +261,11 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>(){
 
                             //成交记录
                             verticalLayout {
+                                onThrottleFirstClick {
+                                    val intent = Intent()
+                                    intent.setClass(context,PlatnumDealActivty::class.java)
+                                    ActivityUtils.startActivity(intent)
+                                }
                                 gravity = Gravity.CENTER_HORIZONTAL
                                 imageView {
                                     imageResource = R.mipmap.qhj_deal_the_record
@@ -271,6 +284,11 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>(){
 
                             //资金流水
                             verticalLayout {
+                                onThrottleFirstClick {
+                                    val intent = Intent()
+                                    intent.setClass(context,PlatnumMoneyActivity::class.java)
+                                    ActivityUtils.startActivity(intent)
+                                }
                                 gravity = Gravity.CENTER_HORIZONTAL
                                 imageView {
                                     imageResource = R.mipmap.qhj_money_flowing_water

+ 151 - 28
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/castsurely/AddCastSurelyActivity.kt

@@ -7,6 +7,7 @@ import android.view.inputmethod.EditorInfo
 import android.widget.EditText
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.global.database.DataBase
 import cn.muchinfo.rma.lifecycle.bindOptional
@@ -17,12 +18,18 @@ import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
+import com.blankj.utilcode.util.LogUtils
 import com.blankj.utilcode.util.ToastUtils
 import mtp.polymer.com.autowidget.dialog.SelectData
 import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
 import mtp.polymer.com.autowidget.dialog.creatGoodsInfoBottomSheetDialog
 import mtp.polymer.com.autowidget.dialog.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.TaskUiModel
 import mtp.polymer.com.autowidget.utils.bindTaskStatus
+import org.greenrobot.eventbus.EventBus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
 import org.jetbrains.anko.*
 
 /**
@@ -30,7 +37,7 @@ import org.jetbrains.anko.*
  */
 class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
 
-    //输入的金额
+    //输入的金额或者克数
     lateinit var amount_input: EditText
 
     private var options1Items: List<JsonBean> = java.util.ArrayList<JsonBean>()
@@ -39,33 +46,78 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
     var opt1tx: String? = null
     var opt2tx: String? = null
 
+    /** 当前页面的goodsid **/
+    val goodsId by lazy {
+        intent.getStringExtra("goodsId")
+    }
+
+    val outGoodsCode by lazy {
+        intent.getStringExtra("outGoodsCode")
+    }
+
     //选择的交易类型 金额或者数量
-    val selectPayType : MutableLiveData<SelectData> = MutableLiveData()
+    val selectPayType: MutableLiveData<SelectData> = MutableLiveData()
+
+    /** 用于订阅行情的唯一标识 */
+    val thisTag by lazy {
+        "platinumtradeorder"
+    }
 
-    /**
-     * selectTime选择的定投时间策略 id = 1 是周 ID= 2 是月
-     */
-    val selectTime : MutableLiveData<SelectData> = MutableLiveData()
 
     /**
-     * 选择的商品信息
+     * selectTime选择的定投时间策略 id = 1 是周 ID= 2 是月
      */
-    val selectGoodsInfoData : MutableLiveData<GoodsInfo> = MutableLiveData()
+    val selectTime: MutableLiveData<SelectData> = MutableLiveData()
 
     //  1是新增 2是修改
     val type by lazy { intent.getStringExtra("type") }
 
+    //行情推送通知
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
+        val goodsids = quoteMessageEvent.goodsid
+        //如果推送的goodsid包含当前页面的goodsid,则进行页面刷新
+        if (goodsids.contains(viewModel.goodsInfoData.value?.goodsid)) {
+            LogUtils.eTag("dasjhdkjagfkask", "行情推送" + viewModel.goodsInfoData.value?.goodsid)
+            val goodsInfo = DataBase.getInstance().goodsInfoDao()
+                .getGoodsInfo(viewModel.goodsInfoData.value?.goodsid ?: 0)
+            val quote =
+                GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find { goodsInfo?.outgoodscode == it.outgoodscode }?.quoteDayData
+            if (quote != null) {
+                viewModel.quoteDayData.postValue(quote)
+            }
+        }
+    }
 
-    fun initData(){
+    fun initData() {
         viewModel.initCastSureData()
-        selectPayType.postValue(SelectData(id = "1",value = "按克数定投"))
+        viewModel.goodsInfoData.postValue(
+            DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId?.toInt() ?: 0)
+        )//获取商品详情
+        selectPayType.postValue(SelectData(id = "1", value = "按克数定投"))
+        viewModel.queryGoodsEx(goodsId ?: "")
+        viewModel.queryQuoteDay(
+            tag = thisTag,
+            goodsCodes = outGoodsCode ?: "",
+            isShowLoading = false
+        )
+    }
+
+    override fun onDestroy() {
+        super.onDestroy()
+        viewModel.removeSubscriptQuote(thisTag)
+        EventBus.getDefault().unregister(this)
     }
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        EventBus.getDefault().register(this)
         verticalLayout {
             initData()
-            createLoadingDialog(hintStr = "").bindTaskStatus(context, viewModel.loadingDialogStatus)
+            createLoadingDialog(hintStr = "请求中...").bindTaskStatus(
+                context,
+                viewModel.loadingDialogStatus
+            )
             background = resources.getDrawable(R.color.rma_item_bg)
             topBar {
                 commonLeftButton()
@@ -79,19 +131,24 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                     val selectGoodsInfoList = arrayListOf<GoodsInfo>()
                     val goodsInfoList = DataBase.getInstance().goodsInfoDao().all
                     goodsInfoList.forEach {
-                        if (it.marketid == 69201){
+                        if (it.marketid == 69201) {
                             selectGoodsInfoList.add(it)
                         }
                     }
-                    creatGoodsInfoBottomSheetDialog("请选择的商品",selectGoodsInfoList){
-                        selectGoodsInfoData.postValue(this)
+                    creatGoodsInfoBottomSheetDialog("请选择的商品", selectGoodsInfoList) {
+                        viewModel.goodsInfoData.postValue(this)
                         viewModel.queryGoodsEx(this.goodsid.toString())
+                        viewModel.queryQuoteDay(
+                            tag = thisTag,
+                            goodsCodes = this.outgoodscode ?: "",
+                            isShowLoading = true
+                        )
                     }
                 }
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
-                    selectGoodsInfoData.bindOptional(context){
+                    viewModel.goodsInfoData.bindOptional(context) {
                         text = it?.goodsname
                     }
                     text = "请选择商品"
@@ -108,13 +165,15 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                 background = resources.getDrawable(R.color.white)
                 textView {
                     onThrottleFirstClick {
-                        val selectDataList = arrayListOf(SelectData(id = "1",value = "按克数定投"),
-                            SelectData(id = "2",value = "按金额定投"))
+                        val selectDataList = arrayListOf(
+                            SelectData(id = "1", value = "按克数定投"),
+                            SelectData(id = "2", value = "按金额定投")
+                        )
                         creatBottomSheetDialog("请选择方式", selectDataList) {
                             selectPayType.postValue(this)
                         }
                     }
-                    selectPayType.bindOptional(context){
+                    selectPayType.bindOptional(context) {
                         text = it?.value
                     }
                     textSizeAuto = 32
@@ -126,10 +185,13 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
 
                 imageView {
                     onThrottleFirstClick {
-                        val selectDataList = arrayListOf(SelectData(id = "1",value = "按克数定投"),
-                            SelectData(id = "2",value = "按金额定投"))
+                        val selectDataList = arrayListOf(
+                            SelectData(id = "1", value = "按克数定投"),
+                            SelectData(id = "2", value = "按金额定投")
+                        )
                         creatBottomSheetDialog("请选择方式", selectDataList) {
                             selectPayType.postValue(this)
+                            viewModel.goodsexinfo.postValue(viewModel.goodsexinfo.value)
                         }
                     }
                     imageResource = R.mipmap.qhj_trade_numberamout_select
@@ -149,13 +211,24 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                         gravity = Gravity.CENTER_VERTICAL
                         editText {
                             gravity = Gravity.CENTER_VERTICAL
-                            isEnabled = false
                             amount_input = this
-                            hint = "请输入定投金额"
-//                            hint = "请输入定投克数"
+                            selectPayType.bindOptional(context) {
+                                if (it?.id == "1") {//按克数定投
+                                    hint = "请输入定投克数"
+                                } else if (it?.id == "2") {//按金额定投
+                                    hint = "请输入定投金额"
+                                }
+                            }
                             background = null
                             inputType = EditorInfo.TYPE_CLASS_NUMBER
-                            setDecimalInputType()
+                            viewModel.goodsInfoData.bindOptional(context) {
+                                if (selectPayType.value?.id == "1") {
+                                    setDecimalInputType(decimals = it?.decimalplace ?: 2)
+                                } else {
+                                    setDecimalInputType()
+                                }
+                            }
+
                             hintColorStr = "#CCCCCC"
                             textSizeAuto = 31
                             textColorStr = "#333333"
@@ -167,7 +240,13 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                     linearLayout {
                         gravity = Gravity.CENTER_VERTICAL
                         textView {
-                            text = "500元起购,10元递增"
+                            viewModel.goodsexinfo.bindOptional(context) {
+                                if (selectPayType.value?.id == "1") {
+                                    text = it?.regularlybuyminqty + "克起购"
+                                } else {
+                                    text = it?.regularlybuyminamount + "元起购"
+                                }
+                            }
                             textSizeAuto = 29
                             textColorInt = R.color.rma_gray_color
                         }.lparams(wrapContent, wrapContent) {
@@ -197,8 +276,13 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                                     options2Items.get(options1).get(options2)
                                 else
                                     ""
-                            selectTime.postValue(SelectData(id = opt1tx ?: "",value = opt2tx ?: ""))
-                            ToastUtils.showLong( opt1tx + "----" +  opt2tx)
+                            selectTime.postValue(
+                                SelectData(
+                                    id = opt1tx ?: "",
+                                    value = opt2tx ?: ""
+                                )
+                            )
+                            ToastUtils.showLong(opt1tx + "----" + opt2tx)
                         })
                         .setTitleText("定投策略选择")
                         .setDividerColor(Color.BLACK)
@@ -225,6 +309,11 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                 }
 
                 textView {
+                    selectTime.bindOptional(context){
+                        text = if (it?.id == "1"){
+                            "每周一次,每周"
+                        }else {"每月一次,每月"} + it?.value + "扣款"
+                    }
                     text = "请选择定投频率"
                     textSizeAuto = 34
                     textColorInt = R.color.rma_gray_color
@@ -248,7 +337,13 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
                     onThrottleFirstClick {
-
+                        if (check().not()){
+                            return@onThrottleFirstClick
+                        }
+                        viewModel.requestQhjRegularlyStrategyReq(goodsID = viewModel.goodsInfoData.value?.goodsid?.toLong() ?: 0,regularlyCycle = 1,regularlyCycleValue = 2,regularlyMode = selectPayType.value?.id?.toInt() ?: 0,
+                            regularlyModeValue = amount_input.text.toString().toDouble(),operateType = 1){
+                            viewModel.loadingDialogStatus.postValue(TaskUiModel.success(msg = "新增定投成功"))
+                        }
                     }
                     gravity = Gravity.CENTER
                     backgroundResource = R.mipmap.rma_submit_bg
@@ -267,5 +362,33 @@ class AddCastSurelyActivity : BaseActivity<MyCastSurelyViewModel>() {
 
     }
 
+    fun check(): Boolean {
+
+        if (amount_input.text.toString().isNullOrEmpty()) {
+            if (selectPayType.value?.id == "1") {//判断克数
+                ToastUtils.showLong("请输入定投克数")
+                return false
+            }else {
+                ToastUtils.showLong("请输入定投金额")
+                return false
+            }
+        }
+
+        if (selectPayType.value?.id == "1"){
+            if (amount_input.text.toString().toDouble() < viewModel.goodsexinfo.value?.regularlybuyminqty?.toDouble() ?: 0.0){
+                ToastUtils.showLong("定投克数应大于" + viewModel.goodsexinfo.value?.regularlybuyminqty + "克")
+                return false
+            }
+        }
+
+        if (selectPayType.value?.id == "2"){
+            if (amount_input.text.toString().toDouble() < viewModel.goodsexinfo.value?.regularlybuyminamount?.toDouble() ?: 0.0){
+                ToastUtils.showLong("定投克数应大于" + viewModel.goodsexinfo.value?.regularlybuyminamount + "元")
+                return false
+            }
+        }
+        return true
+    }
+
 
 }

+ 71 - 34
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/castsurely/MyCastSurelyViewModel.kt

@@ -2,13 +2,12 @@ package cn.muchinfo.rma.view.base.main.castsurely
 
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
-import cn.muchinfo.rma.global.data.GoodsExInfoData
-import cn.muchinfo.rma.global.data.RSTriggerLogData
-import cn.muchinfo.rma.global.data.RStrategyData
-import cn.muchinfo.rma.global.data.UserCollectConfigData
+import cn.muchinfo.rma.global.data.*
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
+import com.blankj.utilcode.util.LogUtils
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import mtp.polymer.com.autowidget.utils.TaskUiModel
@@ -33,6 +32,14 @@ class MyCastSurelyViewModel : BaseViewModel(){
     val castSurelyLogDataList : MutableLiveData<List<RSTriggerLogData>> = MutableLiveData()
 
     /**
+     * 交易页面的当前商品的盘面信息
+     */
+    val quoteDayData: MutableLiveData<QuoteDayData> = MutableLiveData()
+
+    /** 当前页面的商品信息 **/
+    val goodsInfoData: MutableLiveData<GoodsInfo> = MutableLiveData()
+
+    /**
      * 选择的商品的关联商品表
      */
     val goodsexinfo : MutableLiveData<GoodsExInfoData> = MutableLiveData()
@@ -41,13 +48,15 @@ class MyCastSurelyViewModel : BaseViewModel(){
 
     val secondSelectData : MutableLiveData<List<List<String>>> = MutableLiveData()//定投选择的月对应天,周对应周几
 
+
+
     //初始化定投周期选择数据集
     fun initCastSureData(){
         val jsonBean1 = JsonBean()//月的数据组装
         val c1List  = arrayListOf<JsonBean.CityBean>()//月的子数据
         val jsonBean2 = JsonBean()//周的数据组装
         val c2List  = arrayListOf<JsonBean.CityBean>()//周的子数据
-        val jsonBean1SonString = arrayListOf("周一","周二","周三","周四","周五")
+        val jsonBean1SonString = arrayListOf("周一","周二","周三","周四","周五","周六","周日")
         val jsonBean2SonString = arrayListOf("1号","2号","3号","4号","5号","6号","7号","8号","9号","10号","11号","12号","13号","14号","15号","16号","17号","18号","19号","20号","21号","22号","23号","24号","25号","26号","27号","28号")
         jsonBean1.autoId = "1"
         jsonBean1.name = "每周一次"
@@ -121,48 +130,76 @@ class MyCastSurelyViewModel : BaseViewModel(){
     }
 
     /**
-     * 定投策略请求
+     * 请求盘面信息
+     * @param first Int
+     * @param last Int
+     * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
      */
-    fun qhjRegularlyStrategyReq(
-        regularlyStrategyID : Long = 0,
-        goodsID : Long,
-        regularlyCycle : Int,
-        regularlyCycleValue : Int,
-        regularlyMode : Int,
-        regularlyModeValue : Double,
-        remark : String = "",
-        operateType : Int,
-        isSuccess: (isCompleted: Boolean) -> Unit
-    ){
-        loadingDialogStatus.value = TaskUiModel.inFlight()
-        GlobalScope.launch {
-            MyApplication.getInstance()?.moneyManager?.requestQhjRegularlyStrategyReq(
-                regularlyStrategyID = regularlyStrategyID,
-                goodsID = goodsID,
-                regularlyCycle = regularlyCycle,
-                regularlyCycleValue = regularlyCycleValue ,
-                regularlyMode = regularlyMode,
-                regularlyModeValue = regularlyModeValue,
-                remark = remark,
-                operateType = operateType
-            ) { isCompleted, err ->
-                if (isCompleted) {
-                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
-                    isSuccess(true)
-                } else {
+    fun queryQuoteDay(
+        tag: String,
+        goodsCodes: String,
+        isShowLoading: Boolean
+    ) {
+        if (isShowLoading) {
+            loadingDialogStatus.postValue(TaskUiModel.inFlight())
+        }
+
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsCodes", goodsCodes)
+        }
+        MyApplication.getInstance()?.futureManager?.queryQuoteDay(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.isEmpty()?.not() == true) {
+                    quoteDayData.postValue(respData[0])
+                }
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功"))
+                }
+
+            } else {
+                if (isShowLoading) {
                     loadingDialogStatus.postValue(
                         TaskUiModel.failed(
                             InteractiveException(
-                                errorMessage = err?.message!!
+                                errorMessage = "数据请求失败"
                             )
                         )
                     )
                 }
             }
         }
+        addSubscriptQuote(tag = tag, goodsCodes = setOf(goodsCodes))
     }
 
     /**
+     * 订阅行情
+     * @param tag String
+     * @param goodsInfoList List<GoodsInfo>
+     */
+    fun addSubscriptQuote(tag: String, goodsCodes: Set<String>) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
+                tag = tag, goodsCodeSet = goodsCodes
+            ) { isCompleted, err ->
+                LogUtils.eTag("订阅行情", goodsCodes)
+            }
+        }
+    }
+
+    /**
+     * 取消订阅
+     * @param tag String
+     */
+    fun removeSubscriptQuote(tag: String) {
+        GlobalScope.launch {
+            MyApplication.getInstance()?.quoteManager?.removeSubscriptQuote(
+                tag = tag
+            )
+        }
+    }
+
+
+    /**
      * 查询商品扩展表
      */
     fun queryGoodsEx(goodsid : String){

+ 5 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodViewHolder.kt

@@ -40,9 +40,9 @@ class PickUpGoodViewHolder(private val activity : AppCompatActivity,private val
                 verticalLayout {
                     textView {
                         data.bindOptional(context){
-
+                            text = it?.pickupgoodsname
                         }
-                        text = "5g 黄金豆"
+
                         textSizeAuto = 36
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -50,7 +50,9 @@ class PickUpGoodViewHolder(private val activity : AppCompatActivity,private val
                     }
 
                     textView {
-                        text = "1:1 兑换"
+                        data.bindOptional(context){
+                            text = "1:" + it?.pickupgoodsagreeunit + "  兑换"
+                        }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){

+ 28 - 3
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsActivity.kt

@@ -6,7 +6,11 @@ import android.text.TextUtils
 import android.view.Gravity
 import android.view.inputmethod.EditorInfo
 import android.widget.EditText
+import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.global.data.PickGoodsData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
@@ -14,6 +18,7 @@ import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.main.addressmanagement.AddressSelectActivity
 import cn.muchinfo.rma.view.base.main.addressmanagement.StoresAddressListActivity
 import com.blankj.utilcode.util.ActivityUtils
+import mtp.polymer.com.autowidget.dialog.SelectData
 import org.jetbrains.anko.*
 
 /**
@@ -21,12 +26,29 @@ import org.jetbrains.anko.*
  */
 class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
 
+    //用于提货的商品
+    val data by lazy { intent.getParcelableExtra<ContractTradeOrderDetailData>("data") as ContractTradeOrderDetailData }
+
     //输入的提现数量
     lateinit var number_input : EditText
 
+    //选择的提货方式 ID = 1 是邮寄  ID = 2 是自提
+    val selectPickUpType : MutableLiveData<SelectData> = MutableLiveData()
+
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+        super.onActivityResult(requestCode, resultCode, data)
+        if (requestCode == 1000 && resultCode == 1001){
+            val pickGoodsData = data?.getParcelableExtra<PickGoodsData>("goodsdata") as PickGoodsData
+            viewModel.pickGoodsData.postValue(pickGoodsData)
+        }
+    }
+
+
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            selectPickUpType.postValue(SelectData(id = "1",value = "邮寄"))
             background = resources.getDrawable(R.color.rma_item_bg)
             topBar {
                 commonLeftButton()
@@ -48,7 +70,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
 
                 linearLayout {
                     textView {
-                        text = "黄金"
+                        text = data.goodsname
                         textSizeAuto = 41
                         textColorInt = R.color.qhj_pick_color
                     }.lparams(wrapContent, wrapContent){
@@ -58,7 +80,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     emptyView()
 
                     textView {
-                        text = "5g"
+                        text = data.enableqty
                         textSizeAuto = 41
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -112,7 +134,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 verticalLayout {
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        text = "提现金额"
+                        text = "商品数量"
                         textSizeAuto = 31
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
@@ -138,6 +160,9 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
 
                     linearLayout {
                         textView {
+                            viewModel.pickGoodsData.bindOptional(context){
+                                val qry = data.enableqty?.toDouble()?.div(it?.pickupgoodsagreeunit?.toInt() ?: 1)?.times(100.0)?.toInt()?.div(100)
+                            }
                             text = "可提货数量 7 ,需要35g黄金"
                             textSizeAuto = 31
                             textColorInt = R.color.rma_color_ccc

+ 7 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsListActivity.kt

@@ -1,5 +1,6 @@
 package cn.muchinfo.rma.view.base.main.pickup
 
+import android.content.Intent
 import android.os.Bundle
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.PickGoodsData
@@ -80,6 +81,12 @@ class PickUpGoodsListActivity : BaseActivity<PickUpGoodsViewModel>(){
                     pickUpGoodViewAdapter.setNewData(it)
                 }
             }
+            pickUpGoodViewAdapter.setOnItemClickListener { adapter, view, position ->
+                val intent = Intent()
+                intent.putExtra("goodsdata",viewModel.pickUpGoodsDataList.value?.get(position))
+                setResult(1001, intent)
+                finish()
+            }
         }
     }
 

+ 4 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsViewModel.kt

@@ -38,6 +38,10 @@ class PickUpGoodsViewModel : BaseViewModel(){
     val pickAreaDataList : MutableLiveData<List<PickAreaData>> = MutableLiveData()
 
     /**
+     * 选择的提货商品
+     */
+    val pickGoodsData : MutableLiveData<PickGoodsData> = MutableLiveData()
+    /**
      * 查询提货单请求
      */
     fun queryPickArea(){

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

@@ -60,7 +60,6 @@ class PlatinumTreasureFragment : BaseFragment<PlatinumTreasureViewModel>() , Pla
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
-
             /** 行情推送过来的goodsid **/
             quoteMessageEvent.goodsid.forEach { goodid ->
                 //找到相应商品信息

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

@@ -25,7 +25,7 @@ class PlatinumTreasureViewModel : BaseViewModel(){
         val list = arrayListOf<GoodsInfo>()
         val allList = DataBase.getInstance().goodsInfoDao().all
         allList.forEach {
-            if (it.marketid == 69201){
+            if (it.trademode == 69 && it.goodsstatus == 3){
                 list.add(it)
             }
         }

+ 124 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatinumCancellationsActivity.kt

@@ -0,0 +1,124 @@
+package cn.muchinfo.rma.view.base.platinumtreasure.activity
+
+import android.os.Bundle
+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.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.*
+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.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 撤单单独activity
+ */
+class PlatinumCancellationsActivity : BaseActivity<PlatinumTradeViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //可撤UI
+    private val canRemoveUI by lazy {
+        CanRemoveUI(this, viewModel)
+    }
+
+    //全部UI
+    private val allUI by lazy { AllUI(this, viewModel) }
+
+    //viewpager的适配器
+    private var newPagerAdapter: PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList: ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initDataTitle() {
+        newTabsArray.add("可撤")
+        uiList.add(canRemoveUI.root)
+        newTabsArray.add("全部")
+        uiList.add(allUI.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 onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            initDataTitle()
+
+            background = resources.getDrawable(R.color.rma_item_bg)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "交易撤单"
+                }
+            }
+
+            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(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)
+        }
+    }
+
+}

+ 120 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatnumDealActivty.kt

@@ -0,0 +1,120 @@
+package cn.muchinfo.rma.view.base.platinumtreasure.activity
+
+import android.os.Bundle
+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.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.NoPayUI
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.PlatinumTradeViewModel
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.PlatnumDealedUI
+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.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+class PlatnumDealActivty : BaseActivity<PlatinumTradeViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待付款
+    private val noPayUI by lazy { NoPayUI(this, viewModel) }
+
+    //已成交
+    private val platnumDealedUI by lazy { PlatnumDealedUI(this, viewModel) }
+
+    //viewpager的适配器
+    private var newPagerAdapter: PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList: ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initDataTitle() {
+        newTabsArray.add("待付款")
+        uiList.add(noPayUI.root)
+        newTabsArray.add("已成交")
+        uiList.add(platnumDealedUI.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 onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            initDataTitle()
+
+            background = resources.getDrawable(R.color.rma_item_bg)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "成交记录"
+                }
+            }
+
+            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(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)
+        }
+    }
+
+}

+ 121 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/activity/PlatnumMoneyActivity.kt

@@ -0,0 +1,121 @@
+package cn.muchinfo.rma.view.base.platinumtreasure.activity
+
+import android.os.Bundle
+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.view.autoWidget.*
+import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.base.platinumtreasure.trade.*
+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.viewPager
+import org.jetbrains.anko.verticalLayout
+import org.jetbrains.anko.view
+
+/**
+ * 单独的资金流水页面
+ */
+class PlatnumMoneyActivity : BaseActivity<PlatinumTradeViewModel>(){
+
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //资金信息
+    private val moneyInfoUI by lazy { MoneyInfoUI(this, viewModel) }
+
+    //资金流水
+    private val moneyFlowingUI by lazy { MoneyFlowingUI(this, viewModel) }
+
+    //viewpager的适配器
+    private var newPagerAdapter: PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList: ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initDataTitle() {
+        newTabsArray.add("资金信息")
+        uiList.add(moneyInfoUI.root)
+        newTabsArray.add("资金流水")
+        uiList.add(moneyFlowingUI.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 onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        verticalLayout {
+            initDataTitle()
+
+            background = resources.getDrawable(R.color.rma_item_bg)
+            topBar {
+                commonLeftButton()
+                commonTitle {
+                    text = "资金信息"
+                }
+            }
+
+            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(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)
+        }
+    }
+
+}

+ 67 - 12
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/CancellationsViewHolder.kt

@@ -1,17 +1,30 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
 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.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.global.isShowTimeString
+import cn.muchinfo.rma.global.toShowTime
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
 import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import com.blankj.utilcode.util.AppUtils
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import mtp.polymer.com.autowidget.dialog.createCustomDialog
+import mtp.polymer.com.autowidget.dialog.createWarningDialog
 import org.jetbrains.anko.*
 
 //撤单viewholder
-class CancellationsViewHolder(private val activity: AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<String>(activity){
+class CancellationsViewHolder(private val activity: AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<ContractTradeOrderDetailData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
@@ -20,16 +33,20 @@ class CancellationsViewHolder(private val activity: AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.LEFT
                     textView {
-                        text = "黄金"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = it?.goodsname
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
                         marginStart = autoSize(36)
                     }
                     textView {
-                        text = "17:01:11"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = it?.ordertime?.toShowTime("HH:mm:ss")
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         marginStart = autoSize(36)
@@ -40,8 +57,10 @@ class CancellationsViewHolder(private val activity: AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.CENTER
                     textView {
-                        text = "2131"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.orderprice,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent)
                 }.lparams(0, autoSize(149),1f)
@@ -50,19 +69,31 @@ class CancellationsViewHolder(private val activity: AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.CENTER
                     textView {
-                        text = "2g"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(it?.goodsid?.toInt() ?: 0)
+                            text = NumberUtils.roundNum(it?.orderqty,goodsInfo.decimalplace)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent)
                 }.lparams(0, autoSize(149),1f)
 
 
                 linearLayout {
+
+                    emptyView()
+
                     verticalLayout {
                         gravity = Gravity.CENTER_HORIZONTAL
                         textView {
-                            text = "买入"
-                            textSizeAuto = 36
+                            data.bindOptional(context){
+                                if (it?.buyorsell == "0"){
+                                    text = "买入"
+                                }else if (it?.buyorsell == "1"){
+                                    text = "卖出"
+                                }
+                            }
+                            textSizeAuto = 31
                             textColorInt = R.color.rma_red_color
                         }.lparams(wrapContent, wrapContent){
                             topMargin = autoSize(25)
@@ -70,12 +101,36 @@ class CancellationsViewHolder(private val activity: AppCompatActivity,private va
 
                         textView {
                             text = "已报"
-                            textSizeAuto = 36
+                            textSizeAuto = 31
                             textColorInt = R.color.rma_black_33
                         }.lparams(wrapContent, wrapContent)
                     }.lparams(autoSize(115), autoSize(149))
 
                     textView {
+                        onThrottleFirstClick {
+                            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data.value?.goodsid?.toInt() ?: 0)
+                            activity.createWarningDialog {
+                                setTitle("温馨提示")
+                                setMessage("确定要撤销此单吗?")
+                                addAction("取消") { dialog, _ ->
+                                    dialog.dismiss()
+                                }
+                                addAction("确定") { dialog, _ ->
+                                    viewModel.cancelOrder(marketid = goodsInfo.marketid,goodsid = goodsInfo.goodsid,accountid = GlobalDataCollection.instance?.accountId ?: 0,oldOrderId = data.value?.orderid?.toLong() ?: 0){
+                                        viewModel.queryContractTradeOrderDetail()
+                                    }
+                                    dialog.dismiss()
+                                }
+                            }.show()
+
+                        }
+                        data.bindOptional(context){
+                            if (it?.orderstatus == "3"){
+                                visibility = View.VISIBLE
+                            }else{
+                                visibility = View.GONE
+                            }
+                        }
                         gravity = Gravity.CENTER
                         backgroundResource = R.drawable.qhj_tradeprice_bg
                         text = "撤"

+ 24 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/DealViewHolder.kt

@@ -3,9 +3,13 @@ package cn.muchinfo.rma.view.base.platinumtreasure.trade
 import android.view.Gravity
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.ContractTradeDetailData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
 
@@ -15,7 +19,7 @@ import org.jetbrains.anko.*
  * @property viewModel PlatinumTradeViewModel
  * @constructor
  */
-class DealViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<String>(activity){
+class DealViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<ContractTradeDetailData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
@@ -24,7 +28,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 gravity = Gravity.LEFT
                 //商品
                 textView {
-                    text = "黄金"
+                    data.bindOptional(context){
+                        text = it?.goodsname
+                    }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -34,7 +40,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
 
                 //时间
                 textView {
-                    text = " 15:20:11"
+                    data.bindOptional(context){
+                        text = it?.tradetime
+                    }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -46,7 +54,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 gravity = Gravity.RIGHT
                 //价格
                 textView {
-                    text = "3231.00"
+                    data.bindOptional(context){
+                        text = NumberUtils.roundNum(it?.tradeprice,2)
+                    }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -55,7 +65,10 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
 
                 //数量
                 textView {
-                    text = "10g"
+                    data.bindOptional(context){
+                             val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(it?.goodsid?.toInt() ?: 0)
+                             text = NumberUtils.roundNum(it?.tradeqty?.toDouble()?.div(goodsInfo.decimalplace ?: 2).toString(),0)
+                        }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -68,7 +81,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 gravity = Gravity.RIGHT
                 //金额
                 textView {
-                    text = "52。00"
+                    data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.tradeamount,2)
+                        }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -81,7 +96,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 gravity = Gravity.RIGHT
                 //类型
                 textView {
-                    text = "买入"
+                    data.bindOptional(context){
+                        text = if (it?.buyorsell == "0"){"买入"}else{"卖出"}
+                    }
                     textColorInt = R.color.rma_red_color
                     textSizeAuto = 36
                 }.lparams(wrapContent, wrapContent){

+ 51 - 18
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/FinancialViewHolder.kt

@@ -5,10 +5,15 @@ import android.view.Gravity
 import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.QhjContractDetailsData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.global.toShowTime
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
 import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
 import cn.muchinfo.rma.view.base.home.spotmarket.SpotMarketDetailsActivity
@@ -23,11 +28,14 @@ import org.jetbrains.anko.*
  * @property itemSize IntArray
  * @constructor
  */
-class FinancialViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<String>(activity){
+class FinancialViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<QhjContractDetailsData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
         verticalLayout {
+            onThrottleFirstClick {
+                viewModel.setOnFinancingItemClick(data.value?.scfcontractid ?: "")
+            }
             linearLayout {
                 linearLayout {
                     imageView {
@@ -39,18 +47,22 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
                     verticalLayout {
                         gravity = Gravity.LEFT
                         textView {
-                            text = "黄金"
+                            data.bindOptional(context){
+                                text = it?.goodsname
+                            }
                             textColorInt = R.color.rma_black_33
-                            textSizeAuto = 36
+                            textSizeAuto = 31
                         }.lparams(wrapContent, wrapContent){
                             topMargin = autoSize(25)
                             marginStart = autoSize(7)
                         }
 
                         textView {
-                            text = "2021-05-19 11:00:23"
+                            data.bindOptional(context){
+                                text = it?.contractconfirmtime//?.toShowTime()
+                            }
                             textColorInt = R.color.rma_black_33
-                            textSizeAuto = 29
+                            textSizeAuto = 24
                         }.lparams(wrapContent, wrapContent){
                             marginStart = autoSize(7)
                         }
@@ -61,16 +73,21 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
                 verticalLayout {
                     gravity = Gravity.RIGHT
                     textView {
-                        text = "20g"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(it?.goodsid?.toInt() ?: 0)
+                            text = NumberUtils.roundNum(it?.wrqty?.toDouble()?.div(goodsInfo.decimalplace ?: 2).toString(),0)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
                     }
 
                     textView {
-                        text = "362.00"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.tradeprice,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
 
@@ -80,16 +97,20 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
                 verticalLayout {
                     gravity = Gravity.RIGHT
                     textView {
-                        text = "1312.00"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.lenderamount,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
                     }
 
                     textView {
-                        text = "3214.43"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.payamount,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
 
@@ -100,8 +121,10 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
                 verticalLayout {
                     gravity = Gravity.RIGHT
                     textView {
-                        text = "1312.00"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.remainamount,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
@@ -109,8 +132,10 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
                     }
 
                     textView {
-                        text = "3214.43"
-                        textSizeAuto = 36
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.totalinterest,2)
+                        }
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         marginEnd = autoSize(30)
@@ -123,13 +148,21 @@ class FinancialViewHolder(private val activity : AppCompatActivity,private val v
 
             // 控制区
             linearLayout {
-                visibility = View.GONE
+                data.bindOptional(context){
+                    if (it?.isClick == 1){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
+                }
                 gravity = Gravity.CENTER_VERTICAL
 
                 emptyView()
 
                 textView {
+                    data.bindOptional(context){
 
+                    }
                     onThrottleFirstClick {
 
                     }

+ 13 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/MoneyFlowingVIewHolder.kt

@@ -3,9 +3,12 @@ package cn.muchinfo.rma.view.base.platinumtreasure.trade
 import android.view.Gravity
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.AmountLogData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.textColorInt
 import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
@@ -17,7 +20,7 @@ import org.jetbrains.anko.*
  * @property itemSize IntArray
  * @constructor
  */
-class MoneyFlowingVIewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<String>(activity){
+class MoneyFlowingVIewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<AmountLogData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
@@ -26,7 +29,9 @@ class MoneyFlowingVIewHolder(private val activity : AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.LEFT
                     textView {
-                        text = "19:00:00"
+                        data.bindOptional(context){
+                            text = it?.createtime
+                        }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -38,7 +43,9 @@ class MoneyFlowingVIewHolder(private val activity : AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.CENTER
                     textView {
-                        text = "买入"
+                        data.bindOptional(context){
+                            text = it?.OPERATETYPENAME
+                        }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -49,7 +56,9 @@ class MoneyFlowingVIewHolder(private val activity : AppCompatActivity,private va
                 verticalLayout {
                     gravity = Gravity.RIGHT
                     textView {
-                        text = "90000"
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.amount,2)
+                        }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){

+ 183 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/NoPayViewHolder.kt

@@ -0,0 +1,183 @@
+package cn.muchinfo.rma.view.base.platinumtreasure.trade
+
+import android.content.Intent
+import android.view.Gravity
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.PayOrderData
+import cn.muchinfo.rma.global.database.DataBase
+import cn.muchinfo.rma.global.isShowTimeString
+import cn.muchinfo.rma.global.payflag
+import cn.muchinfo.rma.global.toShowTime
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.autoSize
+import cn.muchinfo.rma.view.autoWidget.onThrottleFirstClick
+import cn.muchinfo.rma.view.autoWidget.textColorInt
+import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
+import cn.muchinfo.rma.view.base.future.trade.itemView
+import cn.muchinfo.rma.view.base.home.contract.emptyView
+import cn.muchinfo.rma.view.base.home.spotmarket.SpotMarketDetailsActivity
+import cn.muchinfo.rma.view.base.main.PayActivity
+import cn.muchinfo.rma.view.base.main.pickup.PickUpGoodsActivity
+import com.blankj.utilcode.util.ActivityUtils
+import mtp.polymer.com.autowidget.adapter.BaseViewHolder
+import org.jetbrains.anko.*
+
+/**
+ * 待付款单的viewholder
+ * @property activity AppCompatActivity
+ * @property viewModel PlatinumTradeViewModel
+ * @constructor
+ */
+class NoPayViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<PayOrderData>(activity){
+    override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
+
+    override fun _FrameLayout.createContentView() {
+        verticalLayout {
+            onThrottleFirstClick {
+                viewModel.setOnPayItemClick(data.value?.tradeid ?: "")
+            }
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.LEFT
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.goodsname
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                        marginStart = autoSize(36)
+                    }
+
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.createtime//?.toShowTime()
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.tradeprice,2)
+                        }
+
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+
+                    textView {
+                         data.bindOptional(context){
+                             val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(it?.goodsid?.toInt() ?: 0)
+                             text = NumberUtils.roundNum(it?.tradeqty?.toDouble()?.div(goodsInfo.decimalplace ?: 2).toString(),0)
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        data.bindOptional(context){
+                            text = NumberUtils.roundNum(it?.payamount,2)
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(30)
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        data.bindOptional(context){
+                            if (it?.operatetype == "1"){
+                                text = "正常下单"
+                            }else if (it?.operatetype == "16"){
+                                text = "融资买入"
+                            }
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                        marginEnd = autoSize(36)
+                    }
+
+                    textView {
+                        data.bindOptional(context){
+                            text = it?.payflag?.payflag()
+                        }
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent){
+                        marginEnd = autoSize(36)
+                    }
+                }.lparams(0, autoSize(96),2f)
+            }.lparams(matchParent, autoSize(96))
+
+            itemView()
+
+            // 控制区
+            linearLayout {
+                data.bindOptional(context){
+                    if (it?.isClick == 1){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
+                }
+                gravity = Gravity.CENTER_VERTICAL
+
+                emptyView()
+
+                textView {
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("tradepaydata",data.value)
+                        intent.setClass(context,PayActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    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(24)
+                }
+
+                textView {
+
+                    onThrottleFirstClick {
+
+                    }
+                    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(24)
+                }
+
+            }.lparams(matchParent, autoSize(72))
+        }.lparams(matchParent, wrapContent)
+    }
+
+}

+ 298 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumBuyOrSellUI.kt

@@ -1,10 +1,16 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.graphics.Color
 import android.view.Gravity
 import android.view.View
+import android.widget.TextView
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
 import cn.muchinfo.rma.global.database.AppDatabase
 import cn.muchinfo.rma.global.database.DataBase
 import cn.muchinfo.rma.global.isBlankString
@@ -16,10 +22,17 @@ import cn.muchinfo.rma.view.autoWidget.view.MangeNumberEditText2
 import cn.muchinfo.rma.view.base.app.FutureConstent
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import cn.muchinfo.rma.view.base.main.castsurely.AddCastSurelyActivity
 import cn.muchinfo.rma.view.base.main.castsurely.MyCastSurelyViewHolder
+import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.LogUtils
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
-import mtp.polymer.com.autowidget.dialog.SelectData
-import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
+import mtp.polymer.com.autowidget.dialog.*
+import mtp.polymer.com.autowidget.utils.TaskUiModel
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
 import org.jetbrains.anko.*
 
 /**
@@ -39,7 +52,7 @@ class PlatinumBuyOrSellUI(
     private val type: String
 ) {
 
-    //选择的交易类型 金额或者数量
+    //选择的交易类型 金额或者数量 1 是数量 2 是金额
     val selectPayType : MutableLiveData<SelectData> = MutableLiveData()
 
     // 下拉刷新
@@ -52,6 +65,12 @@ class PlatinumBuyOrSellUI(
     //输入的数量或者金额
     lateinit var trade_number_or_amount: MangeNumberEditText2
 
+    //销售价
+    lateinit var sell_price : TextView
+
+    //回购价
+    lateinit var buy_price : TextView
+
     /**
      * 交易下持仓
      */
@@ -68,17 +87,37 @@ class PlatinumBuyOrSellUI(
         viewModel.goodsInfoData.postValue(DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId.toInt()))//获取商品详情
         viewModel.queryQuoteDay(tag = thisTag,goodsCodes = outGoodsCode,isShowLoading = isShowLoading)//请求盘面
         viewModel.queryContractTradePosition()
+        viewModel.queryGoodsEx(goodsid = goodsId)
     }
 
+    //行情推送通知
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onQuoteMessageEvent(quoteMessageEvent: QuoteMessageEvent) {
+        val goodsids = quoteMessageEvent.goodsid
+        //如果推送的goodsid包含当前页面的goodsid,则进行页面刷新
+        if (goodsids.contains(goodsId?.toInt())){
+            LogUtils.eTag("dasjhdkjagfkask","行情推送" + goodsId)
+            val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId?.toInt() ?: 0)
+            val quote = GlobalDataCollection.instance?.goodsInfoAndQuotesList?.find { goodsInfo?.outgoodscode == it.outgoodscode }?.quoteDayData
+            if (quote != null){
+                viewModel.quoteDayData.postValue(quote)
+            }
+        }
+    }
+
+
     val root = _FrameLayout(activity).apply {
 
         verticalLayout {
+            activity.createLoadingDialog(hintStr = "请求中...").bindTaskStatus(context, viewModel.loadingDialogStatus)
             initData(goodsId = goodsId,outGoodsCode = outGoodsCode,isShowLoading = false)
             background = resources.getDrawable(R.color.main_hit_bg_color)
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 onThrottleFirstClick {
-
+                    activity.creatGoodsInfoBottomSheetDialog("请选择商品",viewModel.getGoodsInfoList()){
+                        initData(goodsId = this.goodsid.toString(),outGoodsCode = this.outgoodscode,isShowLoading = false)
+                    }
                 }
                 gravity = Gravity.CENTER_VERTICAL
                 textView {
@@ -128,6 +167,33 @@ class PlatinumBuyOrSellUI(
                             setOnTextChangeListener { view, value ->
 
                             }
+                            //拿到商品信息后对输入框进行初始化
+                            viewModel.goodsInfoData.bindOptional(context) {data ->
+//                                val goodsExData = GlobalDataCollection.instance?.goodsExInfoDataArrayList?.find { it.goodsid == data?.goodsid.toString()}
+//                                if (goodsExData?.goodsid?.isNotEmpty() == true){
+//
+//                                }
+                                setDecimal(data?.decimalplace ?: 2)
+                                val limitRangeMin = if (data?.decimalplace == 0) {
+                                    1.0
+                                } else {
+                                    Math.pow(10.0, -data?.decimalplace?.toDouble()!!)
+                                }//限价范围最小值
+                                val limitRangeMax =
+                                    1000000000 - limitRangeMin // 限价范围最大值
+                                setMax(limitRangeMax)
+                                setMin(limitRangeMin)
+                                setStep(Math.pow(10.0, -data.decimalplace.toDouble()))
+                            }
+
+                            //行情变化后根据不同的价格类型分别对赋值
+                            viewModel.quoteDayData.bindOptional(context) {
+                                if (type == "1"){
+                                    setText(NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.ask.toString()),2))
+                                }else{
+                                    setText(NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.bid.toString()),2))
+                                }
+                            }
                         }.lparams(matchParent, autoSize(88)) {
                             marginStart = autoSize(30)
                             marginEnd = autoSize(18)
@@ -143,6 +209,7 @@ class PlatinumBuyOrSellUI(
                                 SelectData(id = "2",value = "金额"))
                             activity.creatBottomSheetDialog("请选择方式", selectDataList) {
                                 selectPayType.postValue(this)
+                                viewModel.goodsInfoData.postValue(viewModel.goodsInfoData.value)
                             }
                         }
                         textView {
@@ -167,6 +234,22 @@ class PlatinumBuyOrSellUI(
                             setOnTextChangeListener { view, value ->
 
                             }
+
+                            //拿到商品信息后对输入框进行初始化
+                            viewModel.goodsInfoData.bindOptional(context) {data ->
+                                val goodsExData = GlobalDataCollection.instance?.goodsExInfoDataArrayList?.find { it.goodsid == data?.goodsid.toString()}
+                                if (goodsExData?.goodsid?.isNotEmpty() == true){
+                                    if (selectPayType.value?.id == "1"){//按数量
+                                        setMin(goodsExData.regularlybuyminqty?.toDouble() ?: 0.0)
+                                        setStep(goodsExData.regularlybuyminqty?.toDouble() ?: 0.01)
+                                        setText(goodsExData.regularlybuyminqty)
+                                    }else{//按金额
+                                        setMin(goodsExData.regularlybuyminamount?.toDouble() ?: 0.0)
+                                        setStep(goodsExData.regularlybuyminamount?.toDouble() ?: 0.01)
+                                        setText(goodsExData.regularlybuyminamount)
+                                    }
+                                }
+                            }
                         }.lparams(matchParent, autoSize(88)) {
                             marginStart = autoSize(8)
                             marginEnd = autoSize(18)
@@ -195,6 +278,7 @@ class PlatinumBuyOrSellUI(
                             emptyView()
 
                             textView {
+                                sell_price = this
                                 viewModel.quoteDayData.bindOptional(context){
                                     text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.ask.toString()),2)//卖一
                                 }
@@ -218,6 +302,7 @@ class PlatinumBuyOrSellUI(
                             emptyView()
 
                             textView {
+                                buy_price = this
                                 viewModel.quoteDayData.bindOptional(context){
                                     text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.bid.toString()),2)//买一
                                 }
@@ -243,6 +328,9 @@ class PlatinumBuyOrSellUI(
                         visibility = View.GONE
                     }
                     textView {
+                        onThrottleFirstClick {
+                            creatOrderDetailsDialog(type = "1",orderPrice = trade_price_edittext.text.toString(),goodsInfo = viewModel.goodsInfoData.value ?: GoodsInfo(),selectPayType = selectPayType.value?.id ?: "1")
+                        }
                         gravity = Gravity.CENTER
                         text = "买入"
                         textSizeAuto = 36
@@ -254,6 +342,19 @@ class PlatinumBuyOrSellUI(
                     }
 
                     verticalLayout {
+                        viewModel.goodsExData.bindOptional(context){
+                            if (it?.canfinance == "0"){
+                                visibility = View.GONE
+                            }else if(it?.canfinance == "1"){
+                                val userinfo = GlobalDataCollection.instance?.loginQueryData?.userInfo?.userinfotype
+                                if (userinfo == 2){
+                                    visibility = View.VISIBLE
+                                }else{
+                                    visibility = View.GONE
+                                }
+                            }
+                        }
+                        visibility = View.GONE
                         backgroundDrawable = createRoundRectDrawable("#FF9536", 15)
                         gravity = Gravity.CENTER_HORIZONTAL
                         textView {
@@ -274,6 +375,21 @@ class PlatinumBuyOrSellUI(
                     }
 
                     textView {
+                        onThrottleFirstClick {
+                            val intent = Intent()
+                            intent.putExtra("goodsId",goodsId)
+                            intent.putExtra("outGoodsCode",outGoodsCode)
+                            intent.setClass(context,AddCastSurelyActivity::class.java)
+                            ActivityUtils.startActivity(intent)
+                        }
+                        viewModel.goodsExData.bindOptional(context){
+                            if (it?.canregularlybuy == "0"){
+                                visibility = View.GONE
+                            }else if(it?.canregularlybuy == "1"){
+                                visibility = View.VISIBLE
+                            }
+                        }
+                        visibility = View.GONE
                         gravity = Gravity.CENTER
                         text = "定投"
                         textSizeAuto = 36
@@ -402,4 +518,182 @@ class PlatinumBuyOrSellUI(
 
     }
 
+    /**
+     * 订单详情弹出提示
+     * type : 1 买 2 卖 3 融资买
+     * orderPrice 价格
+     * goodsName 商品名称
+     * selectPayType 1 按数量 2 按金额
+     */
+
+    fun creatOrderDetailsDialog(type: String, orderPrice: String, goodsInfo : GoodsInfo, selectPayType : String) {
+        activity.createCustomDialog(cancelable = false) { dialog ->
+            backgroundColor = Color.parseColor("#5f000000")
+
+            verticalLayout {
+                backgroundDrawable = createRoundRectDrawable("#ffffff", 24)
+
+                linearLayout {
+                    gravity = Gravity.CENTER
+                    textView {
+                        text = "订单详情"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(100))
+                itemView()
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        emptyView()
+                        textView {
+                            text = "账户:"
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 28
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 2f)
+                    linearLayout {
+                        textView {
+                            text = GlobalDataCollection.instance?.accountId.toString()
+                            textSizeAuto = 28
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 5f)
+                }.lparams(matchParent, autoSize(90))
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        emptyView()
+                        textView {
+                            text = "类型:"
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 28
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 2f)
+                    linearLayout {
+                        textView {
+                            if (type == "1") {
+                                text = "买入"
+                            } else if (type == "2") {
+                                text = "融资买入"
+                            } else if (type == "3") {
+                                text = "卖出"
+                            }
+                            textSizeAuto = 28
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 5f)
+                }.lparams(matchParent, autoSize(90))
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        emptyView()
+                        textView {
+                            text = "名称代码:"
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 28
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 2f)
+                    linearLayout {
+                        textView {
+                            text = goodsInfo.goodsname
+                            textSizeAuto = 28
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 5f)
+                }.lparams(matchParent, autoSize(90))
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        emptyView()
+                        textView {
+                            text = "价格:"
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 28
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 2f)
+                    linearLayout {
+                        textView {
+                            text = orderPrice
+                            textSizeAuto = 28
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 5f)
+                }.lparams(matchParent, autoSize(90))
+
+                linearLayout {
+                    gravity = Gravity.CENTER_VERTICAL
+                    linearLayout {
+                        emptyView()
+                        textView {
+                            if (selectPayType == "1"){
+                                text = "数量:"
+                            }else{
+                                text = "金额:"
+                            }
+                            textColorInt = R.color.rma_black_33
+                            textSizeAuto = 28
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 2f)
+                    linearLayout {
+                        textView {
+                            text = trade_number_or_amount.text.toString()
+                            textSizeAuto = 28
+                            textColorInt = R.color.rma_black_33
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, wrapContent, 5f)
+                }.lparams(matchParent, autoSize(90))
+
+                itemView()
+
+                linearLayout {
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        onThrottleFirstClick {
+                            dialog.dismiss()
+                        }
+                        textView {
+                            text = "取消"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_hint_title_text_color
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, autoSize(100), 1f)
+
+                    linearLayout {
+                        gravity = Gravity.CENTER
+                        onThrottleFirstClick {
+                            var orderQtyOrAmount = 0.0
+                            if (selectPayType == "1"){//数量
+                                orderQtyOrAmount = trade_number_or_amount.text.toString().toDouble().times(Math.pow(10.0,goodsInfo.decimalplace.toDouble()))
+                            }else{
+                                orderQtyOrAmount = trade_number_or_amount.text.toString().toDouble()
+                            }
+                            viewModel.commit(goodsInfo = goodsInfo,type = type,orderPrice = orderPrice,orderQtyOrAmount = orderQtyOrAmount.toString(),selectPayType = selectPayType){
+                                viewModel.loadingDialogStatus.postValue(TaskUiModel.success(msg = "下单成功"))
+                            }
+//                            commitDealData(
+//                                buyOrSell = buyOrSell,
+//                                isClose = isClose,
+//                                orderPrice = orderPrice
+//                            )
+                            dialog.dismiss()
+                        }
+                        textView {
+                            text = "确定"
+                            textSizeAuto = 31
+                            textColorInt = R.color.rma_yellow_text_color
+                        }.lparams(wrapContent, wrapContent)
+                    }.lparams(0, autoSize(100), 1f)
+                }.lparams(matchParent, autoSize(100))
+            }.lparams(matchParent, wrapContent) {
+                topMargin = autoSize(450)
+                marginStart = autoSize(100)
+                marginEnd = autoSize(100)
+            }
+        }.show()
+    }
+
 }

+ 35 - 11
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumCancellationsUI.kt

@@ -3,9 +3,12 @@ package cn.muchinfo.rma.view.base.platinumtreasure.trade
 import android.view.Gravity
 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.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import com.blankj.utilcode.util.ConvertUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -127,7 +130,7 @@ class PlatinumCancellationsUI(
  * @constructor
  */
 class CanRemoveUI(
-    private val activity: PlatinumTradeActivity,
+    private val activity: AppCompatActivity,
     private val viewModel: PlatinumTradeViewModel
 ) {
 
@@ -139,7 +142,7 @@ class CanRemoveUI(
     /**
      * 交易下持仓
      */
-    private val cancelltionAdapter: BaseAdapter<String, CancellationsViewHolder> =
+    private val cancelltionAdapter: BaseAdapter<ContractTradeOrderDetailData, CancellationsViewHolder> =
         BaseAdapter { _, _ ->
             CancellationsViewHolder(
                 activity,
@@ -150,6 +153,7 @@ class CanRemoveUI(
     val root = _FrameLayout(activity).apply {
 
         verticalLayout {
+            viewModel.queryContractTradeOrderDetail()
             frameLayout {
                 verticalLayout {
                     //可撤标题头
@@ -218,14 +222,14 @@ class CanRemoveUI(
                         statusLayout = this
 //                bindTaskStatus(viewModule.status)
                         setRetryAction {
-
+                            viewModel.queryContractTradeOrderDetail()
                         }
                         swipeToLoadLayout {
                             swipeToLayout = this
                             setEnableRefresh(true)
                             setEnableLoadMore(false)
                             setOnRefreshListener {
-
+                                viewModel.queryContractTradeOrderDetail()
                             }
                             setEnableScrollContentWhenLoaded(false)
                             setEnableLoadMoreWhenContentNotFull(false)
@@ -240,7 +244,17 @@ class CanRemoveUI(
                         emptyView(hint = resources.getString(R.string.now_no_data))
                     }).lparams(matchParent, matchParent)
 
-                    cancelltionAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+                    viewModel.tradeOrderDetailDatalist.bindOptional(context) {
+                        if (it?.isEmpty() == true || it?.size == 0) {
+                            statusLayout.showEmpty()
+                        } else {
+                            if (swipeToLayout.getIsRefreshing()) {
+                                swipeToLayout.finishRefresh()
+                            }
+                            statusLayout.showSuccess()
+                            cancelltionAdapter.setNewData(it)
+                        }
+                    }
                 }
 
 
@@ -280,7 +294,7 @@ class CanRemoveUI(
  * @constructor
  */
 class AllUI(
-    private val activity: PlatinumTradeActivity,
+    private val activity: AppCompatActivity,
     private val viewModel: PlatinumTradeViewModel
 ) {
     private lateinit var swipeToLayout: SwipeToLoadLayout
@@ -289,7 +303,7 @@ class AllUI(
     /**
      * 交易下持仓
      */
-    private val cancelltionAdapter: BaseAdapter<String, CancellationsViewHolder> =
+    private val cancelltionAdapter: BaseAdapter<ContractTradeOrderDetailData, CancellationsViewHolder> =
         BaseAdapter { _, _ ->
             CancellationsViewHolder(
                 activity,
@@ -301,7 +315,7 @@ class AllUI(
 
         verticalLayout {
 
-
+            viewModel.queryContractTradeOrderDetailNoType()
             frameLayout {
                 verticalLayout {
                     //可撤标题头
@@ -370,14 +384,14 @@ class AllUI(
                         statusLayout = this
 //                bindTaskStatus(viewModule.status)
                         setRetryAction {
-
+                            viewModel.queryContractTradeOrderDetailNoType()
                         }
                         swipeToLoadLayout {
                             swipeToLayout = this
                             setEnableRefresh(true)
                             setEnableLoadMore(false)
                             setOnRefreshListener {
-
+                                viewModel.queryContractTradeOrderDetailNoType()
                             }
                             setEnableScrollContentWhenLoaded(false)
                             setEnableLoadMoreWhenContentNotFull(false)
@@ -392,7 +406,17 @@ class AllUI(
                         emptyView(hint = resources.getString(R.string.now_no_data))
                     }).lparams(matchParent, matchParent)
 
-                    cancelltionAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+                    viewModel.tradeOrderAllDetailDatalist.bindOptional(context) {
+                        if (it?.isEmpty() == true || it?.size == 0) {
+                            statusLayout.showEmpty()
+                        } else {
+                            if (swipeToLayout.getIsRefreshing()) {
+                                swipeToLayout.finishRefresh()
+                            }
+                            statusLayout.showSuccess()
+                            cancelltionAdapter.setNewData(it)
+                        }
+                    }
                 }
 
 

+ 251 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumDealUI.kt

@@ -1,10 +1,23 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
 import android.view.Gravity
+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.data.ContractTradeDetailData
+import cn.muchinfo.rma.global.data.PayOrderData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
+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.*
+import org.jetbrains.anko.support.v4.viewPager
 
 /**
  * 千海金交易-成交单列表页UI
@@ -14,6 +27,95 @@ import org.jetbrains.anko.*
  * @constructor
  */
 class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val viewModel: PlatinumTradeViewModel){
+    lateinit var segment: QMUITabSegment
+    var selectedTabIndex: Int = 0
+    private lateinit var viewPager: ViewPager
+
+    //待付款
+    private val noPayUI by lazy { NoPayUI(activity, viewModel) }
+
+    //已成交
+    private val platnumDealedUI by lazy { PlatnumDealedUI(activity, viewModel) }
+
+    //viewpager的适配器
+    private var newPagerAdapter: PagerAdapter? = null
+
+    //tabSegment标题
+    private val newTabsArray: ArrayList<String> = arrayListOf()
+
+    //暂存的页面组
+    private val uiList: ArrayList<_FrameLayout> = arrayListOf()
+
+    fun initDataTitle() {
+        newTabsArray.add("待付款")
+        uiList.add(noPayUI.root)
+        newTabsArray.add("已成交")
+        uiList.add(platnumDealedUI.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
+
+        }
+    }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            initDataTitle()
+
+            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(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)
+        }
+    }
+
+
+}
+
+class PlatnumDealedUI(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel){
 
     // 下拉刷新
     private lateinit var swipeToLayout: SwipeToLoadLayout
@@ -22,7 +124,7 @@ class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val vie
     /**
      * 成交单
      */
-    private val dealAdapter: BaseAdapter<String, DealViewHolder> =
+    private val dealAdapter: BaseAdapter<ContractTradeDetailData, DealViewHolder> =
         BaseAdapter { _, _ ->
             DealViewHolder(
                 activity,
@@ -32,6 +134,7 @@ class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val vie
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+            viewModel.queryContractTradeDetail()
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.LEFT
@@ -90,6 +193,7 @@ class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val vie
                         textSizeAuto = 31
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(36)
                         marginEnd = autoSize(36)
                     }
                 }.lparams(0, autoSize(96),2f)
@@ -99,14 +203,14 @@ class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val vie
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)
                 setRetryAction {
-
+                    viewModel.queryContractTradeDetail()
                 }
                 swipeToLoadLayout {
                     swipeToLayout = this
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryContractTradeDetail()
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -121,8 +225,151 @@ class PlatinumDealUI(private val activity: PlatinumTradeActivity,private val vie
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            dealAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+            viewModel.contractTradeDetailDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    dealAdapter.setNewData(it)
+                }
+            }
+        }
+    }
+
+}
+
+class NoPayUI(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel){
+    // 下拉刷新
+    private lateinit var swipeToLayout: SwipeToLoadLayout
+    private lateinit var statusLayout: StatusLayout
+
+    /**
+     * 成交单
+     */
+    private val payAdapter: BaseAdapter<PayOrderData, NoPayViewHolder> =
+        BaseAdapter { _, _ ->
+            NoPayViewHolder(
+                activity,
+                viewModel
+            )
+        }
+
+    val root = _FrameLayout(activity).apply {
+        verticalLayout {
+            viewModel.queryPayOrder()
+            linearLayout {
+                verticalLayout {
+                    gravity = Gravity.LEFT
+                    textView {
+                        text = "商品"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                        marginStart = autoSize(36)
+                    }
+
+                    textView {
+                        text = "时间"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+                        marginStart = autoSize(36)
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        text = "价格"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+
+                    textView {
+                        text = "数量"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        text = "金额"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(30)
+                    }
+                }.lparams(0, autoSize(96),2f)
+
+                verticalLayout {
+                    gravity = Gravity.RIGHT
+                    textView {
+                        text = "类型"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+                        topMargin = autoSize(10)
+                    }
+
+                    textView {
+                        text = "状态"
+                        textSizeAuto = 31
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(wrapContent, wrapContent){
+
+                    }
+                }.lparams(0, autoSize(96),2f)
+            }.lparams(matchParent, autoSize(96))
+
+            statusLayout(contentBlock = {
+                statusLayout = this
+//                bindTaskStatus(viewModule.status)
+                setRetryAction {
+                    viewModel.queryPayOrder()
+                }
+                swipeToLoadLayout {
+                    swipeToLayout = this
+                    setEnableRefresh(true)
+                    setEnableLoadMore(false)
+                    setOnRefreshListener {
+                        viewModel.queryPayOrder()
+                    }
+                    setEnableScrollContentWhenLoaded(false)
+                    setEnableLoadMoreWhenContentNotFull(false)
+
+                    // 未提交列表
+                    recyclerView {
+                        background = resources.getDrawable(R.color.white)
+                        adapter = payAdapter
+                    }.lparams(matchParent, matchParent)
+                }
+            }, emptyBlock = {
+                emptyView(hint = resources.getString(R.string.now_no_data))
+            }).lparams(matchParent, matchParent)
+
+            viewModel.payOrderDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    payAdapter.setNewData(it)
+                }
+            }
         }
     }
 
+
 }

+ 26 - 6
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumMoneyUI.kt

@@ -3,9 +3,12 @@ package cn.muchinfo.rma.view.base.platinumtreasure.trade
 import android.view.Gravity
 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.data.AmountLogData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import com.blankj.utilcode.util.ConvertUtils
@@ -118,7 +121,7 @@ class PlatinumMoneyUI(private val activity: PlatinumTradeActivity,private val vi
  * @property root _FrameLayout
  * @constructor
  */
-class MoneyInfoUI(private val activity: PlatinumTradeActivity,private val viewModel: PlatinumTradeViewModel){
+class MoneyInfoUI(private val activity: AppCompatActivity,private val viewModel: PlatinumTradeViewModel){
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
@@ -134,6 +137,9 @@ class MoneyInfoUI(private val activity: PlatinumTradeActivity,private val viewMo
                 }
 
                 textView {
+                    viewModel.usedAccountData.bindOptional(context){
+
+                    }
                     text = "RMB"
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
@@ -155,6 +161,9 @@ class MoneyInfoUI(private val activity: PlatinumTradeActivity,private val viewMo
                 }
 
                 textView {
+                    viewModel.usedAccountData.bindOptional(context){
+
+                    }
                     text = "280000.00"
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
@@ -280,7 +289,7 @@ class MoneyInfoUI(private val activity: PlatinumTradeActivity,private val viewMo
  * @property root _FrameLayout
  * @constructor
  */
-class MoneyFlowingUI(private val activity: PlatinumTradeActivity,private val viewModel: PlatinumTradeViewModel){
+class MoneyFlowingUI(private val activity: AppCompatActivity,private val viewModel: PlatinumTradeViewModel){
 
 
     // 下拉刷新
@@ -290,7 +299,7 @@ class MoneyFlowingUI(private val activity: PlatinumTradeActivity,private val vie
     /**
      * 交易下持仓
      */
-    private val moneyFlowingAdapter: BaseAdapter<String, MoneyFlowingVIewHolder> =
+    private val moneyFlowingAdapter: BaseAdapter<AmountLogData, MoneyFlowingVIewHolder> =
         BaseAdapter { _, _ ->
             MoneyFlowingVIewHolder(
                 activity,
@@ -300,6 +309,7 @@ class MoneyFlowingUI(private val activity: PlatinumTradeActivity,private val vie
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+            viewModel.queryAmountLog()
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.LEFT
@@ -341,14 +351,14 @@ class MoneyFlowingUI(private val activity: PlatinumTradeActivity,private val vie
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)
                 setRetryAction {
-
+                    viewModel.queryAmountLog()
                 }
                 swipeToLoadLayout {
                     swipeToLayout = this
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryAmountLog()
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -363,7 +373,17 @@ class MoneyFlowingUI(private val activity: PlatinumTradeActivity,private val vie
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            moneyFlowingAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+            viewModel.costList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    moneyFlowingAdapter.setNewData(it)
+                }
+            }
         }
     }
 

+ 28 - 7
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumPositionUI.kt

@@ -7,6 +7,8 @@ import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.global.data.QhjContractDetailsData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import com.blankj.utilcode.util.ConvertUtils
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -132,7 +134,7 @@ class PositionUI(private val activity: PlatinumTradeActivity,private val viewMod
 
     val root = _FrameLayout(activity).apply {
         verticalLayout {
-
+            viewModel.queryContractTradePosition()
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 textView {
@@ -196,7 +198,7 @@ class PositionUI(private val activity: PlatinumTradeActivity,private val viewMod
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryContractTradePosition()
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -210,8 +212,17 @@ class PositionUI(private val activity: PlatinumTradeActivity,private val viewMod
             }, emptyBlock = {
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
-
-//            positionAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+            viewModel.buyOrSellTradePositionDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    positionAdapter.setNewData(it)
+                }
+            }
         }
     }
 }
@@ -227,7 +238,7 @@ class FinancingUI(private val activity: PlatinumTradeActivity,private val viewMo
     /**
      * 持仓汇总
      */
-    private val financingAdapter: BaseAdapter<String, FinancialViewHolder> =
+    private val financingAdapter: BaseAdapter<QhjContractDetailsData, FinancialViewHolder> =
         BaseAdapter { _, _ ->
             FinancialViewHolder(
                 activity,
@@ -236,9 +247,9 @@ class FinancingUI(private val activity: PlatinumTradeActivity,private val viewMo
         }
 
 
-
     val root = _FrameLayout(activity).apply {
         verticalLayout {
+            viewModel.queryContract()
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.LEFT
@@ -342,7 +353,17 @@ class FinancingUI(private val activity: PlatinumTradeActivity,private val viewMo
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            financingAdapter.setNewData(arrayListOf("1", "2", "3", "4"))
+            viewModel.qhjContractDetailsData.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    financingAdapter.setNewData(it)
+                }
+            }
         }
     }
 }

+ 25 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeActivity.kt

@@ -4,6 +4,7 @@ import android.os.Bundle
 import android.view.Gravity
 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
@@ -11,11 +12,11 @@ import cn.muchinfo.rma.global.GlobalDataCollection
 import cn.muchinfo.rma.global.database.AppDatabase
 import cn.muchinfo.rma.global.database.DataBase
 import cn.muchinfo.rma.global.room.Builder
-import cn.muchinfo.rma.view.autoWidget.autoSize
-import cn.muchinfo.rma.view.autoWidget.tabSegment
-import cn.muchinfo.rma.view.autoWidget.textColorInt
-import cn.muchinfo.rma.view.autoWidget.textSizeAuto
+import cn.muchinfo.rma.lifecycle.bindOptional
+import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
+import cn.muchinfo.rma.view.eventbus.EventConstent
+import cn.muchinfo.rma.view.eventbus.MessageEvent
 import cn.muchinfo.rma.view.eventbus.QuoteMessageEvent
 import com.blankj.utilcode.util.ConvertUtils
 import com.blankj.utilcode.util.LogUtils
@@ -23,6 +24,7 @@ import com.qmuiteam.qmui.util.QMUIDisplayHelper
 import com.qmuiteam.qmui.util.QMUIStatusBarHelper
 import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
 import com.qmuiteam.qmui.widget.tab.QMUITabSegment
+import mtp.polymer.com.autowidget.dialog.creatSelectAccountDialog
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
 import org.greenrobot.eventbus.ThreadMode
@@ -145,6 +147,14 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
         }
     }
 
+    //通用的消息更新通知
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onMessageEvent(messageEvent : MessageEvent) {
+        if (messageEvent.messageType == EventConstent.USERACCOUNTCHANGE){//接到通知更新当前的资金账号
+            viewModel.initAccountData()
+        }
+    }
+
     override fun onDestroy() {
         super.onDestroy()
         viewModel.removeSubscriptQuote(thisTag)
@@ -156,6 +166,7 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
         QMUIStatusBarHelper.translucent(this)
         EventBus.getDefault().register(this)
         verticalLayout {
+            viewModel.initAccountData()
             initDataView()
             linearLayout {
                 background = resources.getDrawable(R.color.main_title_bg_color)
@@ -170,6 +181,13 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
 
                     verticalLayout {
                         gravity = Gravity.CENTER_HORIZONTAL
+                        /** 资金账户选择 **/
+                        onThrottleFirstClick {
+                            (context as AppCompatActivity).creatSelectAccountDialog {
+                                EventBus.getDefault()
+                                    .post(MessageEvent(EventConstent.USERACCOUNTCHANGE))
+                            }.show()
+                        }
                         textView {
                             text = "交易"
                             textColorInt = R.color.white
@@ -180,7 +198,9 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
 
                         linearLayout {
                             textView {
-                                text = "周星星(200000001)"
+                                viewModel.usedAccountData.bindOptional(context){
+                                    text = it?.accountname + "(" + it?.accountid + ")"
+                                }
                                 textSizeAuto = 29
                                 textColorInt = R.color.qhj_title_hint_color
                             }.lparams(wrapContent, wrapContent)

+ 442 - 18
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeViewModel.kt

@@ -1,14 +1,17 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
 import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.business.contractgoods.adapter.OrderData
 import cn.muchinfo.rma.global.GlobalDataCollection
-import cn.muchinfo.rma.global.data.ContractTradeOrderDetailData
-import cn.muchinfo.rma.global.data.QuoteDayData
+import cn.muchinfo.rma.global.MTPEnums
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.global.data.account.loginQeruy.GoodsInfo
+import cn.muchinfo.rma.global.database.DataBase
 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.base.BaseViewModel
+import com.blankj.utilcode.util.LogUtils
 import com.blankj.utilcode.util.TimeUtils
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
@@ -17,7 +20,7 @@ import mtp.polymer.com.autowidget.utils.TaskUiModel
 /**
  * 千海金交易页面的viewmodel
  */
-class PlatinumTradeViewModel : BaseViewModel(){
+class PlatinumTradeViewModel : BaseViewModel() {
 
 
     /**
@@ -33,16 +36,304 @@ class PlatinumTradeViewModel : BaseViewModel(){
      */
     val quoteDayData: MutableLiveData<QuoteDayData> = MutableLiveData()
 
-
     /**
      * 买卖页面的持仓汇总单据
      */
-    val buyOrSellTradePositionDataList : MutableLiveData<List<ContractTradeOrderDetailData>> = MutableLiveData()
+    val buyOrSellTradePositionDataList: MutableLiveData<List<ContractTradeOrderDetailData>> =
+        MutableLiveData()
+
+    /**
+     * 当前交易商品的扩展信息
+     */
+    val goodsExData: MutableLiveData<GoodsExInfoData> = MutableLiveData()
+
+    /**
+     * 委托单列表
+     */
+    val tradeOrderDetailDatalist: MutableLiveData<List<ContractTradeOrderDetailData>> =
+        MutableLiveData()
+
+    /**
+     * 委托单全部列表
+     */
+    val tradeOrderAllDetailDatalist: MutableLiveData<List<ContractTradeOrderDetailData>> =
+        MutableLiveData()
+
+    /**
+     * 使用的当前的资金账户信息
+     */
+    val usedAccountData: MutableLiveData<AccountData> = MutableLiveData()
+
+    /**
+     * 融资明细列表数据
+     */
+    val qhjContractDetailsData : MutableLiveData<List<QhjContractDetailsData>> = MutableLiveData()
+
+    /**
+     * 待付款单
+     */
+    val payOrderDataList : MutableLiveData<List<PayOrderData>> = MutableLiveData()
+
+    /**
+     * 成交单数据列表
+     */
+    val contractTradeDetailDataList : MutableLiveData<List<ContractTradeDetailData>> = MutableLiveData()
+
+    /**
+     * 资金流水数据
+     */
+    val costList : MutableLiveData<List<AmountLogData>> = MutableLiveData()
+
+    /**
+     * 查询资金流水
+     */
+    fun queryAmountLog(){
+        val params = mutableMapOf<String, String>()
+        params["accountID"] = GlobalDataCollection.instance?.accountId.toString()
+        MyApplication.getInstance()?.futureManager?.queryAmountLog(params) { isSuccess, respData, _ ->
+            if (isSuccess) {
+                costList.value = respData
+            }
+        }
+    }
+
+    /**
+     * 成交单查询
+     */
+    fun queryContractTradeDetail(){
+        val params = mutableMapOf<String,String>().apply {
+            put("accountID",GlobalDataCollection.instance?.accountId?.toString() ?: "0")
+        }
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractTradeDetail(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                queryContractHisTradeDetail(respData ?: arrayListOf())
+            }
+        }
+    }
+
+    /**
+     * 历史成交单查询
+     * @param list List<ContractTradeDetailData>
+     */
+    fun queryContractHisTradeDetail(list : List<ContractTradeDetailData>){
+        val params = mutableMapOf<String,String>().apply {
+            put("accountID",GlobalDataCollection.instance?.accountId?.toString() ?: "0")
+        }
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractTradeDetail(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                val newList = arrayListOf<ContractTradeDetailData>()
+                newList.addAll(list)
+                newList.addAll(respData ?: arrayListOf())
+                contractTradeDetailDataList.postValue(newList)
+            }
+        }
+    }
+
+    /**
+     * 查询待付款单
+     */
+    fun queryPayOrder(){
+        val params = mutableMapOf<String,String>().apply {
+            put("accountid",GlobalDataCollection.instance?.accountId?.toString() ?: "0")
+            put("payflag","1")
+        }
+        MyApplication.getInstance()?.contractGoodsManager?.queryPayOrder(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                payOrderDataList.postValue(respData)
+            }
+        }
+    }
+
+    /**
+     * 支付页汇总单viewhodler内的item点击事件
+     * @param deliverygoodsid String
+     */
+    fun setOnPaypositionItemClick(orderid : String){
+        val oldList = buyOrSellTradePositionDataList.value
+        val newDataList = arrayListOf<ContractTradeOrderDetailData>()
+        oldList?.forEach {
+            if (orderid == it.orderid){
+                if (it.isClick == 0){
+                    newDataList.add(it.copy(isClick = 1))
+                }else{
+                    newDataList.add(it.copy(isClick = 0))
+                }
+            }else{
+                newDataList.add(it.copy(isClick = 0))
+            }
+        }
+        buyOrSellTradePositionDataList.postValue(newDataList)
+    }
+
+    /**
+     * 待支付viewhodler内的item点击事件
+     * @param deliverygoodsid String
+     */
+    fun setOnPayItemClick(tradeid : String){
+        val oldList = payOrderDataList.value
+        val newDataList = arrayListOf<PayOrderData>()
+        oldList?.forEach {
+            if (tradeid == it.tradeid){
+                if (it.isClick == 0){
+                    newDataList.add(it.copy(isClick = 1))
+                }else{
+                    newDataList.add(it.copy(isClick = 0))
+                }
+            }else{
+                newDataList.add(it.copy(isClick = 0))
+            }
+        }
+        payOrderDataList.postValue(newDataList)
+    }
+
+
+    /**
+     * 待支付viewhodler内的item点击事件
+     * @param deliverygoodsid String
+     */
+    fun setOnFinancingItemClick(scfcontractid : String){
+        val oldList = qhjContractDetailsData.value
+        val newDataList = arrayListOf<QhjContractDetailsData>()
+        oldList?.forEach {
+            if (scfcontractid == it.scfcontractid){
+                if (it.isClick == 0){
+                    newDataList.add(it.copy(isClick = 1))
+                }else{
+                    newDataList.add(it.copy(isClick = 0))
+                }
+            }else{
+                newDataList.add(it.copy(isClick = 0))
+            }
+        }
+        qhjContractDetailsData.postValue(newDataList)
+    }
+
+    /**
+     * 查询融资明细列表
+     */
+    fun queryContract(){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid",GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+        MyApplication.getInstance()?.contractGoodsManager?.queryContract(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                qhjContractDetailsData.postValue(respData)
+            }
+        }
+    }
+
+
+    /**
+     * 查询当前委托单
+     */
+    fun queryContractTradeOrderDetailNoType() {
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountId.toString())
+        }
+
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractTradeOrderDetail(params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                queryContractHisTradeOrderDetail(respData ?: arrayListOf())
+            }
+        }
+    }
+
+    /**
+     * 查询历史委托单
+     */
+    fun queryContractHisTradeOrderDetail(list: List<ContractTradeOrderDetailData>) {
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountId.toString())
+        }
+
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractHisTradeOrderDetail(params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                val newList = arrayListOf<ContractTradeOrderDetailData>()
+                newList.addAll(list)
+                newList.addAll(respData ?: arrayListOf())
+                tradeOrderAllDetailDatalist.postValue(newList)
+            }
+        }
+    }
+
+    /**
+     * 查询当前委托单
+     */
+    fun queryContractTradeOrderDetail() {
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountId.toString())
+            put("orderstatus", "3")
+        }
+
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractTradeOrderDetail(params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                tradeOrderDetailDatalist.postValue(respData)
+            }
+        }
+    }
+
+    /**
+     * 获取可供选择的商品列表
+     * @return List<GoodsInfo>
+     */
+    fun getGoodsInfoList(): List<GoodsInfo> {
+        val list = arrayListOf<GoodsInfo>()
+        val allList = DataBase.getInstance().goodsInfoDao().all
+        allList.forEach {
+            if (it.marketid == 69201) {
+                list.add(it)
+            }
+        }
+        return list
+    }
+
+    /**
+     * 交易下单
+     */
+    fun orderReq(data: OrderData, isSuccess: (isCompleted: Boolean) -> Unit) {
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.contractGoodsManager?.orderReq(
+                data = data
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 获取当前交易商品的扩展信息
+     * @param goodsid String
+     */
+    fun queryGoodsEx(goodsid: String) {
+        val params = mutableMapOf<String, String>().apply {
+            put("goodsid", goodsid)
+        }
+        MyApplication.getInstance()?.moneyManager?.queryGoodsEx(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                if (respData?.size ?: 0 > 0) {
+                    goodsExData.postValue(respData?.get(0))
+                }
+            }
+        }
+    }
 
     /**
      * 买卖页面查询持仓汇总单
      */
-    fun queryContractTradePosition(){
+    fun queryContractTradePosition() {
 
         val params = mutableMapOf<String, String>().apply {
             put("accountID", GlobalDataCollection.instance?.accountData?.accountid.toString())
@@ -62,11 +353,11 @@ class PlatinumTradeViewModel : BaseViewModel(){
      * @param callback Function2<[@kotlin.ParameterName] Boolean, [@kotlin.ParameterName] Error?, Unit>
      */
     fun queryQuoteDay(
-        tag : String,
+        tag: String,
         goodsCodes: String,
-        isShowLoading : Boolean
+        isShowLoading: Boolean
     ) {
-        if (isShowLoading){
+        if (isShowLoading) {
             loadingDialogStatus.postValue(TaskUiModel.inFlight())
         }
 
@@ -78,17 +369,23 @@ class PlatinumTradeViewModel : BaseViewModel(){
                 if (respData?.isEmpty()?.not() == true) {
                     quoteDayData.postValue(respData[0])
                 }
-                if (isShowLoading){
+                if (isShowLoading) {
                     loadingDialogStatus.postValue(TaskUiModel.success(msg = "数据请求成功"))
                 }
 
             } else {
-                if (isShowLoading){
-                    loadingDialogStatus.postValue(TaskUiModel.failed(InteractiveException(errorMessage = "数据请求失败")))
+                if (isShowLoading) {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = "数据请求失败"
+                            )
+                        )
+                    )
                 }
             }
         }
-        addSubscriptQuote(tag = tag,goodsCodes = setOf(goodsCodes))
+        addSubscriptQuote(tag = tag, goodsCodes = setOf(goodsCodes))
     }
 
 
@@ -97,12 +394,12 @@ class PlatinumTradeViewModel : BaseViewModel(){
      * @param tag String
      * @param goodsInfoList List<GoodsInfo>
      */
-    fun addSubscriptQuote(tag : String,goodsCodes: Set<String>){
+    fun addSubscriptQuote(tag: String, goodsCodes: Set<String>) {
         GlobalScope.launch {
             MyApplication.getInstance()?.quoteManager?.addSubscriptQuote(
-                tag = tag,goodsCodeSet = goodsCodes
-            ){isCompleted, err ->
-
+                tag = tag, goodsCodeSet = goodsCodes
+            ) { isCompleted, err ->
+                LogUtils.eTag("订阅行情", goodsCodes)
             }
         }
     }
@@ -111,7 +408,7 @@ class PlatinumTradeViewModel : BaseViewModel(){
      * 取消订阅
      * @param tag String
      */
-    fun removeSubscriptQuote(tag : String){
+    fun removeSubscriptQuote(tag: String) {
         GlobalScope.launch {
             MyApplication.getInstance()?.quoteManager?.removeSubscriptQuote(
                 tag = tag
@@ -119,4 +416,131 @@ class PlatinumTradeViewModel : BaseViewModel(){
         }
     }
 
+    /**
+     * 更新交易下单的account
+     */
+    fun initAccountData() {
+        val accountDataList = GlobalDataCollection.instance?.accountDataList
+        if (accountDataList.isNullOrEmpty().not()) {
+            usedAccountData.postValue(GlobalDataCollection.instance?.accountData)
+        }
+    }
+
+    /**
+     * 交易撤单请求
+     * @param marketid Int
+     * @param goodsid Int
+     * @param accountid Long
+     * @param oldOrderId Long
+     * @param isSuccess Function1<[@kotlin.ParameterName] Boolean, Unit>
+     */
+    fun cancelOrder(
+        marketid: Int,
+        goodsid: Int,
+        accountid: Long,
+        oldOrderId: Long,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ) {
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.contractGoodsManager?.cancelOrderReq(
+                marketid = marketid,
+                goodsid = goodsid,
+                accountid = accountid,
+                oldOrderId = oldOrderId
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
+
+    /**
+     *  type : 1 买 2 卖 3 融资买
+     *  selectPayType 1 按数量 2 按金额
+     * 千海金下单
+     */
+    fun commit(
+        goodsInfo: GoodsInfo,
+        isListed: Boolean = false,
+        orderPrice: String,
+        orderQtyOrAmount: String,
+        selectPayType: String,
+        type: String,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ) {
+
+        val orderData = OrderData()
+        orderData.accountID = GlobalDataCollection.instance?.accountId?.toLong() ?: 0
+        orderData.buildType = MTPEnums.BUILDTYPE_OPEN// 建仓
+        if (type == "1" || type == "3") {
+            orderData.buyOrSell = MTPEnums.DIRECTION_BUY// 买入
+        } else {
+            orderData.buyOrSell = MTPEnums.DIRECTION_SALE// 买入
+        }
+
+        orderData.goodsID = goodsInfo.goodsid
+        orderData.marketID = goodsInfo.marketid
+        if (type == "3") {
+            orderData.operateType = MTPEnums.OPERATETYPE_FINANC// 操作类型
+        } else {
+            orderData.operateType = MTPEnums.OPERATETYPE_NORMAL// 操作类型
+        }
+        orderData.orderPrice = orderPrice.toDouble()//价格
+        orderData.orderFlag = selectPayType.toInt()
+        if (selectPayType == "1") {
+            orderData.orderQty = orderQtyOrAmount.toDouble().toLong()//数量 测试先写乘100
+        } else {
+            orderData.orderAmount = orderQtyOrAmount.toDouble()
+        }
+
+        orderData.orderSrc = MTPEnums.ORDERSRC_CLIENT// 来自客户端
+        orderData.priceMode = MTPEnums.PRICEMODE_LIMIT//
+        orderData.timevalidType = MTPEnums.TC_IOC
+        orderData.validType = MTPEnums.VALIDTYPE_DR
+        orderData.delistingType = MTPEnums.DELISTINGTYPE_SELECTED
+
+        orderData.triggerType = 1
+        orderData.listingSelectType = MTPEnums.LISTINGSELECTTYPE_DELISTING// 摘牌
+
+        orderData.optionType = MTPEnums.OPTION_TYPE_C
+
+
+        orderData.triggerOperator = 1
+//        if (depostrade_orderid.getVisibility() == View.VISIBLE && depostrade_orderid.getText() != null && !Utils.isEmpty(depostrade_orderid.getText().toString())) {
+//            orderData.relatedID = java.lang.Long.parseLong(depostrade_orderid.getText().toString())
+//        }
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.contractGoodsManager?.orderReq(
+                data = orderData
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+
+    }
+
 }

+ 15 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PositionViewHolder.kt

@@ -29,6 +29,9 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
     override fun _FrameLayout.createContentView() {
         verticalLayout {
+            onThrottleFirstClick {
+                viewModel.setOnPaypositionItemClick(data.value?.orderid ?: "")
+            }
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.CENTER
@@ -120,7 +123,13 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
             // 控制区
             linearLayout {
-                visibility = View.VISIBLE
+               data.bindOptional(context){
+                   if (it?.isClick == 1){
+                       visibility = View.VISIBLE
+                   }else{
+                       visibility = View.GONE
+                   }
+               }
                 gravity = Gravity.CENTER_VERTICAL
 
                 emptyView()
@@ -156,6 +165,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
                 textView {
                     onThrottleFirstClick {
                         val intent = Intent()
+                        intent.putExtra("data",data.value)
                         intent.setClass(context,PickUpGoodsActivity::class.java)
                         ActivityUtils.startActivity(intent)
                     }
@@ -170,10 +180,10 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
                 textView {
                     onThrottleFirstClick {
-                        val intent = Intent()
-                        intent.putExtra("data",data.value)
-                        intent.setClass(context, SpotMarketDetailsActivity::class.java)
-                        ActivityUtils.startActivity(intent)
+//                        val intent = Intent()
+//                        intent.putExtra("data",data.value)
+//                        intent.setClass(context, SpotMarketDetailsActivity::class.java)
+//                        ActivityUtils.startActivity(intent)
                     }
                     backgroundResource = R.drawable.rma_item_click_bg
                     gravity = Gravity.CENTER