Forráskód Böngészése

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

Liu.bolan 4 éve
szülő
commit
b8f1fb9fd1
37 módosított fájl, 1130 hozzáadás és 240 törlés
  1. 55 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/address/AddressManager.kt
  2. 88 0
      RMA/app/src/main/java/cn/muchinfo/rma/business/address/adapter/AddressAdapter.kt
  3. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/business/money/MoneyManager.kt
  4. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/business/money/adapter/MoneyAdapter.kt
  5. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/BankAccountSignData.kt
  6. 4 0
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/GoodsPickupData.kt
  7. 26 1
      RMA/app/src/main/java/cn/muchinfo/rma/global/data/PickAreaData.kt
  8. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/MyApplication.kt
  9. 3 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/PayActivity.kt
  10. 12 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/SeaKingMainFragment.kt
  11. 26 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/SeaKingMainViewModel.kt
  12. 30 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/AddressSelectActivity.kt
  13. 14 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/AddressSelectViewHolder.kt
  14. 21 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/MyAddressViewModel.kt
  15. 30 4
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/StoresAddressListActivity.kt
  16. 11 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/StoresAddressViewHolder.kt
  17. 186 20
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsActivity.kt
  18. 9 11
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsDetailsActivity.kt
  19. 2 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsSearchActivity.kt
  20. 15 7
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsViewHolder.kt
  21. 95 3
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsViewModel.kt
  22. 31 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/AddWithDrawActivity.kt
  23. 143 67
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/WithDrawManagementActivity.kt
  24. 68 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/WithDrawManagementViewModel.kt
  25. 5 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/PlatinumTreasureFragment.kt
  26. 0 2
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/adapter/PlatnumTreasureAdapter.java
  27. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/CancellationsViewHolder.kt
  28. 16 9
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/DealViewHolder.kt
  29. 16 10
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/NoPayViewHolder.kt
  30. 125 63
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumBuyOrSellUI.kt
  31. 1 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumCancellationsUI.kt
  32. 9 8
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumDealUI.kt
  33. 1 1
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumPositionUI.kt
  34. 25 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeActivity.kt
  35. 43 0
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PlatinumTradeViewModel.kt
  36. 8 8
      RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/trade/PositionViewHolder.kt
  37. BIN
      RMA/app/src/main/res/mipmap-xhdpi/qhj_no_card.png

+ 55 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/address/AddressManager.kt

@@ -20,6 +20,61 @@ import java.lang.Exception
 class AddressManager {
 
     /**
+     * 商品提货申请请求
+     * @param AccountID Long交易账号
+     * @param GoodsID Int 商品ID
+     * @param PickupGoodsID Int 提货商品ID
+     * @param PickupGoodsQty Int 提货商品手数
+     * @param TakeMode Int 提货方式 - 2:自提 3:配送
+     * @param StoreUserID Int 门店用户ID(自提必填)
+     * @param ReciverName String 提货人姓名
+     * @param CountryID Int 国家
+     * @param CityID Int 市
+     * @param DistrictID Int 地区
+     * @param Provinceid Int 省
+     */
+    fun goodsPickupApplyReq(
+        AccountID : Long,
+        GoodsID : Int,
+        Marketid : Int,
+        PickupGoodsID : Int,
+        PickupGoodsQty : Long,
+        TakeMode : Int,
+        StoreUserID : Int = 0,
+        ReciverName : String = "",
+        CountryID : Int = 0,
+        CityID : Int = 0,
+        DistrictID : Int = 0,
+        Provinceid : Int = 0,
+        callback: (isCompleted: Boolean, err: Error?) -> Unit
+    ){
+        val tradeSocketManager = MyApplication.getInstance()?.tradeSocketManager.guard {
+            callback(false, Error("交易链路未初始化"))
+            return
+        }
+
+        val reqPacket = AddressAdapter.getGoodsPickupApplyReqInfo(
+            AccountID, GoodsID, Marketid, PickupGoodsID, PickupGoodsQty, TakeMode, StoreUserID, ReciverName, CountryID, CityID, DistrictID, Provinceid
+        )
+
+        tradeSocketManager.send(
+            reqPacket,
+            FunCode.FID_GoodsPickupApplyRsp,
+            object : Callback<Packet50> {
+                override fun onSuccess(rsp: Packet50?) {
+                    val rst = AddressAdapter.analysisGoodsPickupApplyRsp(rsp!!)
+                    callback(rst.first, rst.second)
+                }
+
+                override fun onFail(err: Error?) {
+                    // 发送数据失败
+                    callback(false, err)
+                }
+            }
+        )
+    }
+
+    /**
      * 提货单操作请求
      * @param operatetype Int
      * @param takeorderid Long

+ 88 - 0
RMA/app/src/main/java/cn/muchinfo/rma/business/address/adapter/AddressAdapter.kt

@@ -8,13 +8,101 @@ import cn.muchinfo.rma.protobuf.funcode.FunCode
 import cn.muchinfo.rma.protobuf.protoclasses.ErmcpMI1
 import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI1
 import cn.muchinfo.rma.protobuf.protoclasses.ManageServiceMI3
+import cn.muchinfo.rma.protobuf.protoclasses.TkernelMI1
 import com.blankj.utilcode.util.TimeUtils
+import com.google.common.math.IntMath
 import java.io.ByteArrayOutputStream
 import java.lang.Exception
 import java.util.*
 
 object AddressAdapter {
 
+    /**
+     * 商品提货申请请求
+     * @param AccountID Long交易账号
+     * @param GoodsID Int 商品ID
+     * @param PickupGoodsID Int 提货商品ID
+     * @param PickupGoodsQty Int 提货商品手数
+     * @param TakeMode Int 提货方式 - 2:自提 3:配送
+     * @param StoreUserID Int 门店用户ID(自提必填)
+     * @param ReciverName String 提货人姓名
+     * @param CountryID Int 国家
+     * @param CityID Int 市
+     * @param DistrictID Int 地区
+     * @param Provinceid Int 省
+     */
+    fun getGoodsPickupApplyReqInfo(
+        AccountID : Long,
+        GoodsID : Int,
+        Marketid : Int,
+        PickupGoodsID : Int,
+        PickupGoodsQty : Long,
+        TakeMode : Int,
+        StoreUserID : Int = 0,
+        ReciverName : String = "",
+        CountryID : Int = 0,
+        CityID : Int = 0,
+        DistrictID : Int = 0,
+        Provinceid : Int = 0
+    ) : Packet50{
+        val builder = TkernelMI1.GoodsPickupApplyReq.newBuilder()
+        val loginInfo = GlobalDataCollection.instance?.loginRsp!!
+
+        // FIXME: - 250000000005
+        builder.setHeader(
+            MessageHeadModel.getHead(
+                FunCode.FID_GoodsPickupApplyReq,
+                loginInfo.userID,
+                AccountID,
+                GoodsID,
+                Marketid
+            )
+        )
+
+        builder.accountID = AccountID
+        builder.goodsID = GoodsID
+        builder.pickupGoodsID = PickupGoodsID
+        builder.pickupGoodsQty = PickupGoodsQty
+        builder.takeMode = TakeMode
+        if (TakeMode == 2){//自提
+            builder.storeUserID = StoreUserID
+        }else if (TakeMode == 3){//配送
+            builder.reciverName = ReciverName
+            builder.countryID = CountryID
+            builder.provinceid = Provinceid
+            builder.cityID = CityID
+            builder.districtID = DistrictID
+        }
+        val arrayOutputStream = ByteArrayOutputStream();
+        builder.build().writeTo(arrayOutputStream)
+        return Packet50(FunCode.FID_GoodsPickupApplyReq, arrayOutputStream.toByteArray())
+    }
+
+
+    /**
+     * 商品提货申请响应
+     * @param packet50 Packet50
+     * @return Triple<Boolean, Error?, ErmcpMI1.SpotContractOperateRsp?>
+     */
+    fun analysisGoodsPickupApplyRsp(packet50: Packet50): Triple<Boolean, Error?, TkernelMI1.GoodsPickupApplyRsp?> {
+        return try {
+            val resultRsp = TkernelMI1.GoodsPickupApplyRsp.parseFrom(packet50.content)
+            if (resultRsp.retCode == 0) {
+                // 操作成功
+                Triple(true, null, resultRsp)
+            }else if (resultRsp.retCode == -1){
+                // 操作失败
+                Triple(false, Error(resultRsp.retDesc), null)
+            } else {
+                // 操作失败
+                Triple(false, Error(ErrorMessageUtils.getErrorString(resultRsp.retCode)), null)
+            }
+        } catch (e: Exception) {
+            // 操作失败
+            Triple(false, Error("装箱失败"), null)
+        }
+    }
+
     /** 新增修改收货地址请求
      * optional MessageHead Header = 1; // MessageHead
     optional uint64 ClientSerialID = 2; // uint64 客户端唯一ID

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

@@ -45,10 +45,10 @@ class MoneyManager {
 
         tradeSocketManager.send(
             reqPacket,
-            FunCode.QhjRegularlyStrategyRsp,
+            FunCode.FID_BalancePaymentRsp,
             object : Callback<Packet50> {
                 override fun onSuccess(rsp: Packet50?) {
-                    val rst = MoneyAdapter.analysisQhjRegularlyStrategyRsq(rsp!!)
+                    val rst = MoneyAdapter.analysisBalancePaymentRsq(rsp!!)
                     callback(rst.first, rst.second)
                 }
 

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

@@ -68,7 +68,7 @@ object MoneyAdapter {
 
 
     /**
-     * 撤销支付请求报文解析
+     * 余额支付请求报文解析
      * @param packet50 Packet50
      * @return Triple<Boolean, Error?, ErmcpMI1.SpotContractOperateRsp?>
      */

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

@@ -21,6 +21,7 @@ data class BankAccountSignData(
     val bankchildaccount : String? = "",//银行子账号(签约成功后,很多银行会返回对应的这个虚拟账号)
     val bankcity : String? = "",//开户行城市
     val bankid : String? = "",//签约银行ID
+    val bankname : String? = "",//签约银行名称
     val bankprovince : String? = "",//开户行省份
     val branchbankid : String? = "",//签约银行支行号
     val branchbankname : String? = "",//签约银行支行名称
@@ -66,6 +67,7 @@ data class BankAccountSignData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readString(),
         parcel.readString()
     ) {
     }
@@ -85,6 +87,7 @@ data class BankAccountSignData(
         parcel.writeString(bankchildaccount)
         parcel.writeString(bankcity)
         parcel.writeString(bankid)
+        parcel.writeString(bankname)
         parcel.writeString(bankprovince)
         parcel.writeString(branchbankid)
         parcel.writeString(branchbankname)

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

@@ -53,6 +53,7 @@ data class GoodsPickupData(
     val tradedate : String? = "",//交易日(yyyyMMdd)
     val updatetime : String? = "",//更新时间
     val userid : String? = "",//用户ID
+    var isClick : Int = 0,//是否点击展开
     val username : String? = ""//用户名称
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
@@ -105,6 +106,7 @@ data class GoodsPickupData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readInt(),
         parcel.readString()
     ) {
     }
@@ -159,6 +161,7 @@ data class GoodsPickupData(
         parcel.writeString(tradedate)
         parcel.writeString(updatetime)
         parcel.writeString(userid)
+        parcel.writeInt(isClick)
         parcel.writeString(username)
     }
 
@@ -176,4 +179,5 @@ data class GoodsPickupData(
         }
     }
 
+
 }

+ 26 - 1
RMA/app/src/main/java/cn/muchinfo/rma/global/data/PickAreaData.kt

@@ -5,10 +5,18 @@ import android.os.Parcelable
 
 //提货门店
 data class PickAreaData(
+    val cityid : String? = "",//市
+    val cityname : String? = "",//城市名称
+    val countryid : String? = "",//国家
+    val countryname : String? = "",//国家名称
+    val districtid : String? = "",//地区
+    val districtname : String? = "",//地区名称
+    val provinceid : String? = "",//省
+    val provincename : String? = "",//省名称
     val fromuserid : String? = "",//所属机构(组织机构)( OrgType = 1时为自己, = 2\3时取上级机构的所属机构)
     val fromusername : String? = "",//所属机构名称
     val suborgtype : String? = "",//子机构类型(千海金) - 0:机构 1:代理 2:门店
-    val userid : String? = "",//机构用户ID 其他做市关系,都设置为 1
+    val userid : String? = "0",//机构用户ID 其他做市关系,都设置为 1
     val username : String? = ""//机构用户名称(门店门称)
 ) : Parcelable{
     constructor(parcel: Parcel) : this(
@@ -16,11 +24,27 @@ data class PickAreaData(
         parcel.readString(),
         parcel.readString(),
         parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
+        parcel.readString(),
         parcel.readString()
     ) {
     }
 
     override fun writeToParcel(parcel: Parcel, flags: Int) {
+        parcel.writeString(cityid)
+        parcel.writeString(cityname)
+        parcel.writeString(countryid)
+        parcel.writeString(countryname)
+        parcel.writeString(districtid)
+        parcel.writeString(districtname)
+        parcel.writeString(provinceid)
+        parcel.writeString(provincename)
         parcel.writeString(fromuserid)
         parcel.writeString(fromusername)
         parcel.writeString(suborgtype)
@@ -42,4 +66,5 @@ data class PickAreaData(
         }
     }
 
+
 }

+ 5 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/MyApplication.kt

@@ -8,6 +8,7 @@ import android.os.Looper
 import cn.muchinfo.rma.BuildConfig
 import cn.muchinfo.rma.business.account.AccountManager
 import cn.muchinfo.rma.business.address.AddressManager
+import cn.muchinfo.rma.business.bank.BankManager
 import cn.muchinfo.rma.business.chart.ChartManager
 import cn.muchinfo.rma.business.commodity.CommodityManager
 import cn.muchinfo.rma.business.common.CommonManager
@@ -137,6 +138,9 @@ class MyApplication : BaseApplication() {
     /** 合约市场管理类 **/
     var contractGoodsManager : ContractGoodsManager? = null
 
+    /** 银行相关管理类 **/
+    var bankManager : BankManager? = null
+
     companion object {
         private var instance: MyApplication? = null
 
@@ -257,6 +261,7 @@ class MyApplication : BaseApplication() {
         addressManager = AddressManager()
         moneyManager = MoneyManager()
         contractGoodsManager = ContractGoodsManager()
+        bankManager = BankManager()
     }
 
     /**

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

@@ -156,6 +156,7 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 }
 
                 imageView {
+                    visibility = View.GONE
                     selectPayType.bindOptional(context){
                         if (it?.id == "1"){
                             visibility = View.VISIBLE
@@ -195,6 +196,7 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 emptyView()
 
                 imageView {
+                    visibility = View.GONE
                     selectPayType.bindOptional(context){
                         if (it?.id == "3"){
                             visibility = View.VISIBLE
@@ -234,6 +236,7 @@ class PayActivity : BaseActivity<PayViewModel>(){
                 emptyView()
 
                 imageView {
+                    visibility = View.GONE
                     selectPayType.bindOptional(context){
                         if (it?.id == "2"){
                             visibility = View.VISIBLE

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

@@ -7,6 +7,8 @@ import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.BankAccountSignData
+import cn.muchinfo.rma.global.data.UserCollectConfigData
 import cn.muchinfo.rma.view.autoWidget.*
 
 import cn.muchinfo.rma.view.base.BaseFragment
@@ -31,6 +33,11 @@ import org.jetbrains.anko.support.v4.UI
  */
 class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>(){
 
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryUserCollectConfig()
+    }
+
     override fun onCreateView(
         inflater: LayoutInflater,
         container: ViewGroup?,
@@ -386,6 +393,11 @@ class SeaKingMainFragment : BaseFragment<SeaKingMainViewModel>(){
                         linearLayout {
                             onThrottleFirstClick {
                                 val intent = Intent()
+                                if (viewModel.userCollectConfigData.value?.bankid.isNullOrEmpty()){
+                                    intent.putExtra("data", BankAccountSignData())
+                                }else{
+                                    intent.putExtra("data", viewModel.userCollectConfigData.value)
+                                }
                                 intent.setClass(context,WithDrawManagementActivity::class.java)
                                 ActivityUtils.startActivity(intent)
                             }

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

@@ -1,5 +1,10 @@
 package cn.muchinfo.rma.view.base.main
 
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BankAccountSignData
+import cn.muchinfo.rma.global.data.UserCollectConfigData
+import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 
 /**
@@ -7,5 +12,26 @@ import cn.muchinfo.rma.view.base.BaseViewModel
  */
 class SeaKingMainViewModel : BaseViewModel(){
 
+    /**
+     * 提现账户设置信息
+     */
+    val userCollectConfigData : MutableLiveData<BankAccountSignData> = MutableLiveData()
+
+    /**
+     * 查询提现账户设置信息
+     */
+    fun queryUserCollectConfig(){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid",GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+
+        MyApplication.getInstance()?.bankManager?.queryBankAccountSign(params = params){isSuccess, respData, error ->
+            if (isSuccess){
+                if (respData?.size ?: 0 > 0){
+                    userCollectConfigData.postValue(respData?.get(0))
+                }
+            }
+        }
+    }
 
 }

+ 30 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/AddressSelectActivity.kt

@@ -1,7 +1,10 @@
 package cn.muchinfo.rma.view.base.main.addressmanagement
 
+import android.content.Intent
 import android.os.Bundle
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.UserReceiveInfoData
+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.main.pickup.PickUpGoodViewHolder
@@ -9,6 +12,12 @@ import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import org.jetbrains.anko.matchParent
 import org.jetbrains.anko.verticalLayout
 
+/**
+ * 提货地址选择
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property pickUpGoodViewAdapter BaseAdapter<String, AddressSelectViewHolder>
+ */
 class AddressSelectActivity : BaseActivity<MyAddressViewModel>(){
 
     // 下拉刷新
@@ -18,7 +27,7 @@ class AddressSelectActivity : BaseActivity<MyAddressViewModel>(){
     /**
      * 商品
      */
-    private val pickUpGoodViewAdapter: BaseAdapter<String, AddressSelectViewHolder> =
+    private val pickUpGoodViewAdapter: BaseAdapter<UserReceiveInfoData, AddressSelectViewHolder> =
         BaseAdapter { _, _ ->
             AddressSelectViewHolder(
                 this,
@@ -29,6 +38,7 @@ class AddressSelectActivity : BaseActivity<MyAddressViewModel>(){
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.queryUserReceiveInfo()
             background = resources.getDrawable(R.color.rma_item_bg)
             topBar {
                 commonLeftButton()
@@ -41,14 +51,14 @@ class AddressSelectActivity : BaseActivity<MyAddressViewModel>(){
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)
                 setRetryAction {
-
+                    viewModel.queryUserReceiveInfo()
                 }
                 swipeToLoadLayout {
                     swipeToLayout = this
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryUserReceiveInfo()
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -63,7 +73,23 @@ class AddressSelectActivity : BaseActivity<MyAddressViewModel>(){
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            pickUpGoodViewAdapter.setNewData(arrayListOf("1","2","3","4"))
+            viewModel.userReceiveInfoDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    pickUpGoodViewAdapter.setNewData(it)
+                }
+            }
+            pickUpGoodViewAdapter.setOnItemClickListener { adapter, view, position ->
+                val intent = Intent()
+                intent.putExtra("maildata",viewModel.userReceiveInfoDataList.value?.get(position))
+                setResult(2001, intent)
+                finish()
+            }
         }
     }
 

+ 14 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/AddressSelectViewHolder.kt

@@ -1,8 +1,11 @@
 package cn.muchinfo.rma.view.base.main.addressmanagement
 
 import android.text.TextUtils
+import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.UserReceiveInfoData
+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
@@ -16,7 +19,7 @@ import org.jetbrains.anko.*
  * @property viewModel MyAddressViewModel
  * @constructor
  */
-class AddressSelectViewHolder(private val activity : AppCompatActivity,private val viewModel: MyAddressViewModel) : BaseViewHolder<String>(activity){
+class AddressSelectViewHolder(private val activity : AppCompatActivity,private val viewModel: MyAddressViewModel) : BaseViewHolder<UserReceiveInfoData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
@@ -32,12 +35,16 @@ class AddressSelectViewHolder(private val activity : AppCompatActivity,private v
                 verticalLayout {
                     linearLayout {
                         textView {
-                            text = "周星星"
+                            data.bindOptional(context){
+                                text = it?.receivername
+                            }
                             textSizeAuto = 32
                             textColorInt = R.color.rma_black_33
                         }.lparams(wrapContent, wrapContent)
                         textView {
-                            text = "132312412412"
+                            data.bindOptional(context){
+                                text = it?.phonenum
+                            }
                             textSizeAuto = 32
                             textColorInt = R.color.rma_black_33
                         }.lparams(wrapContent, wrapContent){
@@ -48,7 +55,9 @@ class AddressSelectViewHolder(private val activity : AppCompatActivity,private v
                     }
 
                     textView {
-                        text = "asdjafjakljfklajsdklajdklajsdklasda"
+                        data.bindOptional(context){
+                            text = it?.provincename + it?.cityname + it?.districtname + it?.address
+                        }
                         textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                         maxLines = 1
@@ -60,6 +69,7 @@ class AddressSelectViewHolder(private val activity : AppCompatActivity,private v
                 }
 
                 imageView {
+                    visibility = View.GONE
                     imageResource = R.drawable.ic_check_number
                 }.lparams(autoSize(40), autoSize(40)){
                     marginEnd = autoSize(36)

+ 21 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/MyAddressViewModel.kt

@@ -2,6 +2,7 @@ package cn.muchinfo.rma.view.base.main.addressmanagement
 
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.PickAreaData
 import cn.muchinfo.rma.global.data.UserReceiveInfoData
 import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
@@ -25,6 +26,26 @@ class MyAddressViewModel : BaseViewModel(){
      */
     val userReceiveInfoDataList : MutableLiveData<List<UserReceiveInfoData>> = MutableLiveData()
 
+    /**
+     * 门店地址
+     */
+    val pickAreaDataList : MutableLiveData<List<PickAreaData>> = MutableLiveData()
+
+
+    /**
+     * 查询收货地址
+     */
+    fun queryPickArea(){
+        val params = mutableMapOf<String, String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+        MyApplication.getInstance()?.addressManager?.queryPickArea(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                pickAreaDataList.postValue(respData)
+            }
+        }
+    }
+
 
     /**
      * 查询收货地址

+ 30 - 4
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/addressmanagement/StoresAddressListActivity.kt

@@ -1,13 +1,22 @@
 package cn.muchinfo.rma.view.base.main.addressmanagement
 
+import android.content.Intent
 import android.os.Bundle
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.PickAreaData
+import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
 import mtp.polymer.com.autowidget.adapter.BaseAdapter
 import org.jetbrains.anko.matchParent
 import org.jetbrains.anko.verticalLayout
 
+/**
+ * 提货门店选择
+ * @property swipeToLayout SwipeToLoadLayout
+ * @property statusLayout StatusLayout
+ * @property stroresAddressAdapter BaseAdapter<String, StoresAddressViewHolder>
+ */
 class StoresAddressListActivity : BaseActivity<MyAddressViewModel>(){
 
     // 下拉刷新
@@ -17,7 +26,7 @@ class StoresAddressListActivity : BaseActivity<MyAddressViewModel>(){
     /**
      * 商品
      */
-    private val stroresAddressAdapter: BaseAdapter<String, StoresAddressViewHolder> =
+    private val stroresAddressAdapter: BaseAdapter<PickAreaData, StoresAddressViewHolder> =
         BaseAdapter { _, _ ->
             StoresAddressViewHolder(
                 this,
@@ -28,6 +37,7 @@ class StoresAddressListActivity : BaseActivity<MyAddressViewModel>(){
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.queryPickArea()
             background = resources.getDrawable(R.color.rma_item_bg)
             topBar {
                 commonLeftButton()
@@ -40,14 +50,14 @@ class StoresAddressListActivity : BaseActivity<MyAddressViewModel>(){
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)
                 setRetryAction {
-
+                    viewModel.queryPickArea()
                 }
                 swipeToLoadLayout {
                     swipeToLayout = this
                     setEnableRefresh(true)
                     setEnableLoadMore(false)
                     setOnRefreshListener {
-
+                        viewModel.queryPickArea()
                     }
                     setEnableScrollContentWhenLoaded(false)
                     setEnableLoadMoreWhenContentNotFull(false)
@@ -62,7 +72,23 @@ class StoresAddressListActivity : BaseActivity<MyAddressViewModel>(){
                 emptyView(hint = resources.getString(R.string.now_no_data))
             }).lparams(matchParent, matchParent)
 
-            stroresAddressAdapter.setNewData(arrayListOf("1","2","3","4"))
+            viewModel.pickAreaDataList.bindOptional(context) {
+                if (it?.isEmpty() == true || it?.size == 0) {
+                    statusLayout.showEmpty()
+                } else {
+                    if (swipeToLayout.getIsRefreshing()) {
+                        swipeToLayout.finishRefresh()
+                    }
+                    statusLayout.showSuccess()
+                    stroresAddressAdapter.setNewData(it)
+                }
+            }
+            stroresAddressAdapter.setOnItemClickListener { adapter, view, position ->
+                val intent = Intent()
+                intent.putExtra("storedata",viewModel.pickAreaDataList.value?.get(position))
+                setResult(2002, intent)
+                finish()
+            }
         }
     }
 

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

@@ -1,8 +1,11 @@
 package cn.muchinfo.rma.view.base.main.addressmanagement
 
 import android.text.TextUtils
+import android.view.View
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.PickAreaData
+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
@@ -10,7 +13,7 @@ import cn.muchinfo.rma.view.base.future.trade.itemView
 import mtp.polymer.com.autowidget.adapter.BaseViewHolder
 import org.jetbrains.anko.*
 
-class StoresAddressViewHolder(private val activity : AppCompatActivity, private val viewModel: MyAddressViewModel) : BaseViewHolder<String>(activity){
+class StoresAddressViewHolder(private val activity : AppCompatActivity, private val viewModel: MyAddressViewModel) : BaseViewHolder<PickAreaData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
     override fun _FrameLayout.createContentView() {
@@ -26,6 +29,9 @@ class StoresAddressViewHolder(private val activity : AppCompatActivity, private
                 verticalLayout {
                     linearLayout {
                         textView {
+                            data.bindOptional(context){
+                                text = it?.username
+                            }
                             text = "周星星"
                             textSizeAuto = 32
                             textColorInt = R.color.rma_black_33
@@ -36,7 +42,9 @@ class StoresAddressViewHolder(private val activity : AppCompatActivity, private
                     }
 
                     textView {
-                        text = "asdjafjakljfklajsdklajdklajsdklasda"
+                        data.bindOptional(context){
+                            text = it?.provincename + it?.cityid + it?.districtname + "--"
+                        }
                         textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                         maxLines = 1
@@ -48,6 +56,7 @@ class StoresAddressViewHolder(private val activity : AppCompatActivity, private
                 }
 
                 imageView {
+                    visibility = View.GONE
                     imageResource = R.drawable.ic_check_number
                 }.lparams(autoSize(40), autoSize(40)){
                     marginEnd = autoSize(36)

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

@@ -4,21 +4,33 @@ import android.content.Intent
 import android.os.Bundle
 import android.text.TextUtils
 import android.view.Gravity
+import android.view.View
 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.MTPEnums
 import cn.muchinfo.rma.global.data.ContractTradeOrderDetailData
+import cn.muchinfo.rma.global.data.PickAreaData
 import cn.muchinfo.rma.global.data.PickGoodsData
+import cn.muchinfo.rma.global.data.UserReceiveInfoData
+import cn.muchinfo.rma.global.database.DataBase
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
+import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
 import cn.muchinfo.rma.view.base.BaseActivity
 import cn.muchinfo.rma.view.base.future.trade.itemView
 import cn.muchinfo.rma.view.base.home.contract.emptyView
+import cn.muchinfo.rma.view.base.home.contract.verticalEmptyView
 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 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.createLoadingDialog
+import mtp.polymer.com.autowidget.utils.bindTaskStatus
 import org.jetbrains.anko.*
 
 /**
@@ -35,20 +47,34 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
     //选择的提货方式 ID = 1 是邮寄  ID = 2 是自提
     val selectPickUpType : MutableLiveData<SelectData> = MutableLiveData()
 
+    //最大的可提货数量
+    val canPickUpMaxNumber : MutableLiveData<Int> = 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)
+        }else if (requestCode == 2000){
+            //resultCode 2001 门店地址 2002 邮寄地址
+            if (resultCode == 2001){
+                val mailData = data?.getParcelableExtra<UserReceiveInfoData>("maildata") as UserReceiveInfoData
+                viewModel.selectMailAddress.postValue(mailData)
+            }else if (resultCode == 2002){
+                val storeData = data?.getParcelableExtra<PickAreaData>("storedata") as PickAreaData
+                viewModel.selectStoreAddress.postValue(storeData)
+            }
         }
     }
 
-
-
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
-            selectPickUpType.postValue(SelectData(id = "1",value = "邮寄"))
+            createLoadingDialog(hintStr = "请求中...").bindTaskStatus(
+                context,
+                viewModel.loadingDialogStatus
+            )
+            selectPickUpType.postValue(SelectData(id = "2",value = "自提"))
             background = resources.getDrawable(R.color.rma_item_bg)
             topBar {
                 commonLeftButton()
@@ -80,7 +106,8 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     emptyView()
 
                     textView {
-                        text = data.enableqty
+                        val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data.goodsid?.toInt() ?: 0)
+                        text = NumberUtils.roundNum(data.enableqty?.toDouble()?.div(Math.pow(10.0,goodsInfo.qtydecimalplace.toDouble())).toString(),0) + "g"
                         textSizeAuto = 41
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -97,7 +124,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
 
             linearLayout {
                 gravity = Gravity.CENTER_VERTICAL
-
+                background = resources.getDrawable(R.color.white)
                 onThrottleFirstClick {
                     val intent = Intent()
                     intent.setClass(context,PickUpGoodsListActivity::class.java)
@@ -112,7 +139,10 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }
 
                 textView {
-                    text = "5g金豆"
+                    viewModel.pickGoodsData.bindOptional(context){
+                        text = it?.pickupgoodsname
+                    }
+                    text = "请选择提货商品"
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -131,6 +161,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
             itemView()
 
             linearLayout {
+                background = resources.getDrawable(R.color.white)
                 verticalLayout {
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
@@ -145,7 +176,7 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 verticalLayout {
                     editText {
                         gravity = Gravity.CENTER_VERTICAL
-                        isEnabled = false
+//                        isEnabled = false
                         number_input = this
                         hint = "请填写提现商品数量"
                         background = null
@@ -161,9 +192,12 @@ 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)
+                                val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(data?.goodsid?.toInt() ?: 0)
+                                val qry = data.enableqty?.toDouble()?.div(Math.pow(10.0,goodsInfo.qtydecimalplace?.toDouble()))?.div(it?.pickupgoodsagreeunit?.toInt() ?: 1)?.times(100.0)?.toInt()?.div(100)
+                                canPickUpMaxNumber.postValue(qry)
+                                text = "可提货数量" + qry + ",需要" + qry?.times(it?.pickupgoodsagreeunit?.toInt() ?: 1) + "g" + data.goodsname
                             }
-                            text = "可提货数量 7 ,需要35g黄金"
+                            text = "可提货数量 -- ,需要--" + data.goodsname
                             textSizeAuto = 31
                             textColorInt = R.color.rma_color_ccc
                         }.lparams(wrapContent, wrapContent){
@@ -189,7 +223,23 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
             itemView()
 
             linearLayout {
+                background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
+                onThrottleFirstClick {
+                    val selectDataList = arrayListOf(
+                        SelectData(
+                            id = "1",
+                            value = "邮寄"
+                        ),
+                        SelectData(
+                            id = "2",
+                            value = "自提"
+                        )
+                    )
+                    creatBottomSheetDialog("请选择提货类型", selectDataList) {
+                        selectPickUpType.postValue(this)
+                    }
+                }
                 textView {
                     text = "提货方式"
                     textSizeAuto = 36
@@ -199,7 +249,9 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }
 
                 textView {
-                    text = "自提"
+                    selectPickUpType.bindOptional(context){
+                        text = it?.value
+                    }
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -218,11 +270,18 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
             itemView()
 
             linearLayout {
+                selectPickUpType.bindOptional(context){
+                    if (it?.id == "1"){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
+                }
+                background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
                 onThrottleFirstClick {
                     val intent = Intent()
-                    intent.setClass(context,AddressSelectActivity::class.java)
-//                    intent.setClass(context,StoresAddressListActivity::class.java)
+                    intent.setClass(context,StoresAddressListActivity::class.java)
                     startActivityForResult(intent,2000)
                 }
                 textView {
@@ -234,7 +293,10 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }
 
                 textView {
-                    text = "科技园店"
+                    viewModel.selectStoreAddress.bindOptional(context){
+                        text = it?.username
+                    }
+                    text = "请选择自提门店"
                     textSizeAuto = 36
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
@@ -250,7 +312,20 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }
             }.lparams(matchParent, autoSize(150))
 
-            linearLayout {
+            verticalLayout {
+                selectPickUpType.bindOptional(context){
+                    if (it?.id == "2"){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
+                }
+                background = resources.getDrawable(R.color.white)
+                onThrottleFirstClick {
+                    val intent = Intent()
+                    intent.setClass(context,AddressSelectActivity::class.java)
+                    startActivityForResult(intent,2000)
+                }
                 linearLayout {
                     textView {
                         text = "收货信息"
@@ -261,7 +336,10 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     }
 
                     textView {
-                        text = "周星星"
+                        viewModel.selectMailAddress.bindOptional(context){
+                            text = it?.receivername
+                        }
+                        text = "请选择收货地址"
                         textSizeAuto = 36
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -269,7 +347,9 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     }
 
                     textView {
-                        text = "13147060145"
+                        viewModel.selectMailAddress.bindOptional(context){
+                            text = it?.phonenum
+                        }
                         textSizeAuto = 36
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
@@ -283,22 +363,108 @@ class PickUpGoodsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     }.lparams(autoSize(36), autoSize(36)){
                         marginEnd = autoSize(36)
                     }
-                }.lparams(matchParent, wrapContent){
+                }.lparams(matchParent, autoSize(100)){
                     topMargin = autoSize(50)
                 }
 
                 textView {
-                    text = "中国广东省深圳市南山区科技园金融基地2栋10楼"
+                    viewModel.selectMailAddress.bindOptional(context){
+                        text = it?.provincename + it?.cityname + it?.districtname + it?.address
+                    }
                     textSizeAuto = 31
                     textColorInt = R.color.rma_gray_color
-                    maxLines = 1
                     ellipsize = TextUtils.TruncateAt.END
                 }.lparams(wrapContent, wrapContent){
                     marginStart = autoSize(240)
                     marginEnd = autoSize(36)
                 }
-            }.lparams(matchParent, autoSize(200))
+
+
+
+            }.lparams(matchParent, wrapContent)
+            verticalEmptyView()
+
+            linearLayout {
+                background = resources.getDrawable(R.color.white)
+                gravity = Gravity.CENTER_VERTICAL
+                textView {
+                    onThrottleFirstClick {
+//                        params["countryid"] = 0
+//                        params["provinceid"] = mData.value?.get(0)?.autoid?.toInt()!!
+//                        params["cityid"] = mData.value?.get(1)?.autoid?.toInt()!!
+//                        params["districtid"] = mData.value?.get(2)?.autoid?.toInt()!!
+                        if (check().not()){
+                            return@onThrottleFirstClick
+                        }
+
+                        viewModel.goodsPickupApplyReq(
+                            AccountID = GlobalDataCollection.instance?.accountId ?: 0,
+                            GoodsID = data.goodsid?.toInt() ?: 0,
+                            Marketid = data.marketid?.toInt() ?: 0,
+                            PickupGoodsID = viewModel.pickGoodsData.value?.pickupgoodsid?.toInt() ?: 0,
+                            PickupGoodsQty = number_input.text.toString().toLong(),
+                            TakeMode = if (selectPickUpType.value?.id  == "1"){3}else{2},
+                            StoreUserID = viewModel.selectStoreAddress.value?.userid?.toInt() ?: 0,
+                            ReciverName = viewModel.selectMailAddress.value?.receivername ?: "",
+                            Provinceid = viewModel.selectMailAddress?.value?.provinceid?.toInt() ?: 0,
+                            CityID = viewModel.selectMailAddress?.value?.cityid?.toInt() ?: 0,
+                            DistrictID = viewModel.selectMailAddress.value?.districtid?.toInt() ?: 0
+                        ){
+                            ToastUtils.showLong("提货申请成功")
+                            finish()
+                        }
+                    }
+                    gravity = Gravity.CENTER
+                    backgroundResource = R.mipmap.rma_submit_bg
+                    text = "确定"
+                    textSizeAuto = 38
+                    textColorInt = R.color.white
+                }.lparams(matchParent, autoSize(119)) {
+                    marginStart = autoSize(59)
+                    marginEnd = autoSize(59)
+                }
+
+            }.lparams(matchParent, autoSize(144)) {
+                gravity = Gravity.BOTTOM
+            }
+        }
+    }
+
+    fun check() : Boolean{
+
+        if (viewModel.pickGoodsData.value?.pickupgoodsid.isNullOrEmpty()){
+            ToastUtils.showLong("请选择提货商品")
+            return false
+        }
+
+        if (number_input.text.toString().isNullOrEmpty()){
+            ToastUtils.showLong("请输入提货数量")
+            return false
+        }
+
+        if (number_input.text.toString() == "0"){
+            ToastUtils.showLong("提货数量不能为0")
+            return false
         }
+
+        if (number_input.text.toString().toInt() > canPickUpMaxNumber.value ?: 0){
+            ToastUtils.showLong("提货数量不能大于" + canPickUpMaxNumber.value)
+            return false
+        }
+
+        if (selectPickUpType.value?.id == "1"){//邮寄
+            if (viewModel.selectMailAddress.value?.autoid.isNullOrEmpty()){
+                ToastUtils.showLong("请选择邮寄地址")
+                return false
+            }
+        }else{
+            if (viewModel.selectStoreAddress.value?.userid.isNullOrEmpty()){
+                ToastUtils.showLong("请选择自提门店")
+                return false
+            }
+        }
+
+        return true
     }
 
 }

+ 9 - 11
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/pickup/PickUpGoodsDetailsActivity.kt

@@ -6,6 +6,7 @@ import android.view.Gravity
 import android.view.View
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.GoodsPickupData
+import cn.muchinfo.rma.global.isBlankString
 import cn.muchinfo.rma.global.takeorderstatus
 import cn.muchinfo.rma.view.autoWidget.*
 import cn.muchinfo.rma.view.base.BaseActivity
@@ -45,10 +46,10 @@ class PickUpGoodsDetailsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     linearLayout {
                         gravity = Gravity.CENTER_VERTICAL
                         textView {
-                            if (data.takeorderstatus == "4" || data.takeorderstatus == "5" || data.takeorderstatus == "6"){
-                                text = "邮寄"
-                            }else{
+                            if (data?.takemode == "2" ){
                                 text = "自提"
+                            }else if (data?.takemode == "3"){
+                                text = "邮寄"
                             }
 
                             textSizeAuto = 43
@@ -142,9 +143,9 @@ class PickUpGoodsDetailsActivity : BaseActivity<PickUpGoodsViewModel>(){
                 linearLayout {
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
-                        if (data.takeorderstatus == "2" || data.takeorderstatus == "3"){
+                        if (data.takemode == "2"){
                             text = "提货地址"
-                        } else if (data.takeorderstatus == "4" || data.takeorderstatus == "5" || data.takeorderstatus == "6"){
+                        } else if (data.takemode == "3"){
                             text = "收货信息"
                         }
                         textSizeAuto = 32
@@ -207,6 +208,7 @@ class PickUpGoodsDetailsActivity : BaseActivity<PickUpGoodsViewModel>(){
             }.lparams(matchParent, wrapContent)
 
             verticalLayout {
+                background = resources.getDrawable(R.color.white)
                 linearLayout {
                     gravity = Gravity.CENTER_VERTICAL
                     textView {
@@ -256,11 +258,7 @@ class PickUpGoodsDetailsActivity : BaseActivity<PickUpGoodsViewModel>(){
                     }
 
                     textView {
-                        if (data.takemode == "2"){//2 自提 3配送
-                            text = data.audittime
-                        }else{
-                            text = data.audittime
-                        }
+                        text = data.audittime?.isBlankString()
                         textSizeAuto = 34
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent)
@@ -285,7 +283,7 @@ class PickUpGoodsDetailsActivity : BaseActivity<PickUpGoodsViewModel>(){
                         if (data.takemode == "3"){//2 自提 3配送
                             text = data.expresscompany + "  " + data.expressnum
                         }else{
-                            text = "2021-05-18 17:13:28" //  TODO 取货时间缺少
+                            text = "--" //  TODO 取货时间缺少
                         }
                         textSizeAuto = 34
                         textColorInt = R.color.rma_black_33

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

@@ -58,7 +58,7 @@ class PickUpGoodsSearchActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }.lparams(0, autoSize(84),2f)
 
                 verticalLayout {
-                    gravity = Gravity.RIGHT
+                    gravity = Gravity.RIGHT or Gravity.CENTER_VERTICAL
                     textView {
                         text = "数量"
                         textSizeAuto = 31
@@ -67,7 +67,7 @@ class PickUpGoodsSearchActivity : BaseActivity<PickUpGoodsViewModel>(){
                 }.lparams(0, autoSize(84),1f)
 
                 verticalLayout {
-                    gravity = Gravity.RIGHT
+                    gravity = Gravity.RIGHT or Gravity.CENTER_VERTICAL
                     textView {
                         text = "状态"
                         textSizeAuto = 31

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

@@ -25,6 +25,9 @@ class PickUpGoodsViewHolder(private val activity : AppCompatActivity,private val
 
     override fun _FrameLayout.createContentView() {
         verticalLayout {
+            onThrottleFirstClick {
+                viewModel.setOnPickUpGoodsItemClick(data.value?.takeorderid ?: "")
+            }
             linearLayout {
                 verticalLayout {
                     gravity = Gravity.LEFT
@@ -33,7 +36,7 @@ class PickUpGoodsViewHolder(private val activity : AppCompatActivity,private val
                         data.bindOptional(context){
                             text = it?.goodsname
                         }
-                        textSizeAuto = 36
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
@@ -69,7 +72,7 @@ class PickUpGoodsViewHolder(private val activity : AppCompatActivity,private val
                         data.bindOptional(context){
                             text = it?.takeorderstatus?.takeorderstatus()
                         }
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(25)
@@ -78,15 +81,13 @@ class PickUpGoodsViewHolder(private val activity : AppCompatActivity,private val
 
                     textView {
                         data.bindOptional(context){
-                            if (it?.takeorderstatus == "2" || it?.takeorderstatus == "3"){
+                            if (it?.takemode == "2" ){
                                 text = "自提"
-                            }else if (it?.takeorderstatus == "4" || it?.takeorderstatus == "5" || it?.takeorderstatus == "6"){
+                            }else if (it?.takemode == "3"){
                                 text = "邮寄"
-                            }else{
-                                visibility = View.GONE
                             }
                         }
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         marginEnd = autoSize(36)
@@ -98,6 +99,13 @@ class PickUpGoodsViewHolder(private val activity : AppCompatActivity,private val
 
             // 控制区
             linearLayout {
+                data.bindOptional(context){
+                    if (it?.isClick == 0){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
+                }
                 gravity = Gravity.CENTER_VERTICAL
                 emptyView()
 

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

@@ -2,9 +2,7 @@ package cn.muchinfo.rma.view.base.main.pickup
 
 import androidx.lifecycle.MutableLiveData
 import cn.muchinfo.rma.global.GlobalDataCollection
-import cn.muchinfo.rma.global.data.GoodsPickupData
-import cn.muchinfo.rma.global.data.PickAreaData
-import cn.muchinfo.rma.global.data.PickGoodsData
+import cn.muchinfo.rma.global.data.*
 import cn.muchinfo.rma.netManage.base.InteractiveException
 import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
@@ -41,6 +39,39 @@ class PickUpGoodsViewModel : BaseViewModel(){
      * 选择的提货商品
      */
     val pickGoodsData : MutableLiveData<PickGoodsData> = MutableLiveData()
+
+    /**
+     * 邮寄时选择的邮寄地址
+     */
+    val selectMailAddress : MutableLiveData<UserReceiveInfoData> = MutableLiveData()
+
+    /**
+     * 自提时选择的门店地址
+     */
+    val selectStoreAddress : MutableLiveData<PickAreaData> = MutableLiveData()
+
+
+    /**
+     * 持仓页汇总单viewhodler内的item点击事件
+     * @param deliverygoodsid String
+     */
+    fun setOnPickUpGoodsItemClick(takeorderid : String){
+        val oldList = pickUpDataList.value
+        val newDataList = arrayListOf<GoodsPickupData>()
+        oldList?.forEach {
+            if (takeorderid == it.takeorderid){
+                if (it.isClick == 0){
+                    newDataList.add(it.copy(isClick = 1))
+                }else{
+                    newDataList.add(it.copy(isClick = 0))
+                }
+            }else{
+                newDataList.add(it.copy(isClick = 0))
+            }
+        }
+        pickUpDataList.postValue(newDataList)
+    }
+
     /**
      * 查询提货单请求
      */
@@ -113,6 +144,67 @@ class PickUpGoodsViewModel : BaseViewModel(){
         }
     }
 
+    /**
+     * 商品提货申请请求
+     * @param AccountID Long交易账号
+     * @param GoodsID Int 商品ID
+     * @param PickupGoodsID Int 提货商品ID
+     * @param PickupGoodsQty Int 提货商品手数
+     * @param TakeMode Int 提货方式 - 2:自提 3:配送
+     * @param StoreUserID Int 门店用户ID(自提必填)
+     * @param ReciverName String 提货人姓名
+     * @param CountryID Int 国家
+     * @param CityID Int 市
+     * @param DistrictID Int 地区
+     * @param Provinceid Int 省
+     */
+    fun goodsPickupApplyReq(
+        AccountID : Long,
+        GoodsID : Int,
+        Marketid : Int,
+        PickupGoodsID : Int,
+        PickupGoodsQty : Long,
+        TakeMode : Int,
+        StoreUserID : Int = 0,
+        ReciverName : String = "",
+        CountryID : Int = 0,
+        CityID : Int = 0,
+        DistrictID : Int = 0,
+        Provinceid : Int = 0,
+        isSuccess: (isCompleted: Boolean) -> Unit
+    ){
+        loadingDialogStatus.value = TaskUiModel.inFlight()
+        GlobalScope.launch {
+            MyApplication.getInstance()?.addressManager?.goodsPickupApplyReq(
+                AccountID = AccountID,
+                GoodsID = GoodsID,
+                Marketid = Marketid,
+                PickupGoodsID = PickupGoodsID,
+                PickupGoodsQty = PickupGoodsQty,
+                TakeMode = TakeMode,
+                StoreUserID = StoreUserID,
+                ReciverName = ReciverName,
+                CountryID = CountryID,
+                CityID = CityID,
+                DistrictID = DistrictID,
+                Provinceid = Provinceid
+            ) { isCompleted, err ->
+                if (isCompleted) {
+                    loadingDialogStatus.postValue(TaskUiModel.success(msg = "请求成功"))
+                    isSuccess(true)
+                } else {
+                    loadingDialogStatus.postValue(
+                        TaskUiModel.failed(
+                            InteractiveException(
+                                errorMessage = err?.message!!
+                            )
+                        )
+                    )
+                }
+            }
+        }
+    }
+
 
 
 }

+ 31 - 10
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/AddWithDrawActivity.kt

@@ -4,11 +4,15 @@ import android.os.Bundle
 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.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.*
 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.ToastUtils
+import mtp.polymer.com.autowidget.dialog.SelectData
 import org.jetbrains.anko.*
 
 /**
@@ -21,6 +25,11 @@ class AddWithDrawActivity : BaseActivity<WithDrawManagementViewModel>(){
      */
     private val type by lazy { intent.getStringExtra("type") }
 
+    /**
+     * 选择的开户银行
+     */
+    val selectBnak : MutableLiveData<SelectData> = MutableLiveData()
+
     //开户姓名
     lateinit var bank_card_account_name : EditText
 
@@ -36,6 +45,8 @@ class AddWithDrawActivity : BaseActivity<WithDrawManagementViewModel>(){
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.queryCusBankSignBank()
+            viewModel.queryBankInfo()
             background = resources.getDrawable(R.color.rma_item_bg)
             //页面标题
             topBar {
@@ -52,6 +63,9 @@ class AddWithDrawActivity : BaseActivity<WithDrawManagementViewModel>(){
             linearLayout {
                 background = resources.getDrawable(R.color.white)
                 gravity = Gravity.CENTER_VERTICAL
+                onThrottleFirstClick {
+
+                }
                 textView {
                     text = "开户银行"
                     textSizeAuto = 36
@@ -60,19 +74,26 @@ class AddWithDrawActivity : BaseActivity<WithDrawManagementViewModel>(){
                     marginStart = autoSize(36)
                 }
 
-                editText {
-                    isEnabled = false
-                    bank_name = this
-                    hint = "请填写开户银行"
-                    background = null
-                    inputType = EditorInfo.TYPE_CLASS_TEXT
-                    setDecimalInputType()
-                    hintColorStr = "#CCCCCC"
+
+                textView {
+                    selectBnak.bindOptional(context) {
+                        text = it?.value
+                        textColorInt = R.color.rma_black_33
+                    }
+                    text = "请选择开户银行"
                     textSizeAuto = 31
-                    textColorStr = "#333333"
-                }.lparams(matchParent, autoSize(148)) {
+                    textColorInt = R.color.rma_hint_text_color_ccc
+                }.lparams(wrapContent, wrapContent) {
                     marginStart = autoSize(80)
                 }
+
+                emptyView()
+
+                imageView {
+                    imageResource = R.mipmap.rma_more
+                }.lparams(autoSize(36), autoSize(36)) {
+                    marginEnd = autoSize(25)
+                }
             }.lparams(matchParent, autoSize(148))
 
             itemView()

+ 143 - 67
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/WithDrawManagementActivity.kt

@@ -3,7 +3,12 @@ package cn.muchinfo.rma.view.base.main.withdrawmanagement
 import android.content.Intent
 import android.os.Bundle
 import android.view.Gravity
+import android.view.View
 import cn.muchinfo.rma.R
+import cn.muchinfo.rma.global.data.BankAccountSignData
+import cn.muchinfo.rma.global.data.CusBankSignBankData
+import cn.muchinfo.rma.global.data.UserCollectConfigData
+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
@@ -18,9 +23,18 @@ import org.jetbrains.anko.*
  */
 class WithDrawManagementActivity : BaseActivity<WithDrawManagementViewModel>() {
 
+    //传来的账户设置信息
+    val data by lazy { intent.getParcelableExtra<BankAccountSignData>("data") as BankAccountSignData }
+
+    override fun onResume() {
+        super.onResume()
+        viewModel.queryUserCollectConfig()
+    }
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         verticalLayout {
+            viewModel.userCollectConfigData.postValue(data)
             background = resources.getDrawable(R.color.rma_item_bg)
             //页面标题
             topBar {
@@ -38,10 +52,6 @@ class WithDrawManagementActivity : BaseActivity<WithDrawManagementViewModel>() {
                         SelectData(
                             id = "2",
                             value = "删除"
-                        ),
-                        SelectData(
-                            id = "3",
-                            value = "取消"
                         )
                     )
                     creatBottomSheetNoTitleDialog(selectDataList) {
@@ -52,90 +62,156 @@ class WithDrawManagementActivity : BaseActivity<WithDrawManagementViewModel>() {
                             ActivityUtils.startActivity(intent)
                         }else if (this.id == "2"){
                             ToastUtils.showLong("删除")
-                        }else if (this.id == "3"){
-                            ToastUtils.showLong("取消")
                         }
                     }
                 }
             }
 
-            linearLayout {
+            /**
+             * 无提现账户信息时空
+             */
+            verticalLayout {
                 background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
-                textView {
-                    text = "开户银行"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_gray_color
-                }.lparams(autoSize(220), wrapContent){
-                    marginStart = autoSize(36)
+                viewModel.userCollectConfigData.bindOptional(context){
+                    if (it?.bankid.isNullOrEmpty()){
+                        visibility = View.VISIBLE
+                    }else{
+                        visibility = View.GONE
+                    }
                 }
 
-                textView {
-                    text = "光大银行"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_black_33
-                }.lparams(wrapContent, wrapContent)
-            }.lparams(matchParent, autoSize(148))
 
-            itemView()
+                gravity = Gravity.CENTER_HORIZONTAL
+                imageView {
+                    imageResource = R.mipmap.qhj_no_card
+                }.lparams(autoSize(168), autoSize(168)){
+                    topMargin = autoSize(300)
+                }
 
-            linearLayout {
-                background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
                 textView {
-                    text = "银行卡号"
-                    textSizeAuto = 36
+                    text = "您还未添加提现账户"
+                    textSizeAuto = 31
                     textColorInt = R.color.rma_gray_color
-                }.lparams(autoSize(220), wrapContent){
-                    marginStart = autoSize(36)
+                }.lparams(wrapContent, wrapContent){
+                    topMargin = autoSize(20)
                 }
 
                 textView {
-                    text = "6225 6320 4578 6953"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_black_33
-                }.lparams(wrapContent, wrapContent)
-            }.lparams(matchParent, autoSize(148))
+                    onThrottleFirstClick {
+                        val intent = Intent()
+                        intent.putExtra("type","1")
+                        intent.setClass(context,AddWithDrawActivity::class.java)
+                        ActivityUtils.startActivity(intent)
+                    }
+                    backgroundDrawable = createRoundRectDrawable("#CDE6FC", 45)
+                    gravity = Gravity.CENTER
+                    text = "添加提现账户"
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_blue_color
+                }.lparams(autoSize(288), autoSize(84)){
+                    topMargin = autoSize(30)
+                }
+            }.lparams(matchParent, matchParent)
+
+            /**
+             * 只是展示提现账户信息
+             */
+            verticalLayout {
+                viewModel.userCollectConfigData.bindOptional(context){
+                    if (it?.bankid.isNullOrEmpty()){
+                        visibility = View.GONE
+                    }else{
+                        visibility = View.VISIBLE
+                    }
+                }
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "开户银行"
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(autoSize(220), wrapContent){
+                        marginStart = autoSize(36)
+                    }
 
-            itemView()
+                    textView {
+                        viewModel.userCollectConfigData.bindOptional(context){
+                             text = it?.bankname
+                        }
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(148))
+
+                itemView()
+
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "银行卡号"
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(autoSize(220), wrapContent){
+                        marginStart = autoSize(36)
+                    }
 
-            linearLayout {
-                background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
-                textView {
-                    text = "姓名"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_gray_color
-                }.lparams(autoSize(220), wrapContent){
-                    marginStart = autoSize(36)
-                }
+                    textView {
+                        viewModel.userCollectConfigData.bindOptional(context){
+                             text = it?.bankaccountno
+                        }
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(148))
+
+                itemView()
+
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "姓名"
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(autoSize(220), wrapContent){
+                        marginStart = autoSize(36)
+                    }
 
-                textView {
-                    text = "周星驰"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_black_33
-                }.lparams(wrapContent, wrapContent)
-            }.lparams(matchParent, autoSize(148))
+                    textView {
+                         viewModel.userCollectConfigData.bindOptional(context){
+                             text = it?.accountname
+                        }
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(148))
+
+                itemView()
+
+                linearLayout {
+                    background = resources.getDrawable(R.color.white)
+                    gravity = Gravity.CENTER_VERTICAL
+                    textView {
+                        text = "支行名称"
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_gray_color
+                    }.lparams(autoSize(220), wrapContent){
+                        marginStart = autoSize(36)
+                    }
 
-            itemView()
+                    textView {
+                        viewModel.userCollectConfigData.bindOptional(context){
+                             text = it?.branchbankname
+                        }
+                        textSizeAuto = 36
+                        textColorInt = R.color.rma_black_33
+                    }.lparams(wrapContent, wrapContent)
+                }.lparams(matchParent, autoSize(148))
 
-            linearLayout {
-                background = resources.getDrawable(R.color.white)
-                gravity = Gravity.CENTER_VERTICAL
-                textView {
-                    text = "支行名称"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_gray_color
-                }.lparams(autoSize(220), wrapContent){
-                    marginStart = autoSize(36)
-                }
+            }.lparams(matchParent, matchParent)
 
-                textView {
-                    text = "深圳支行"
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_black_33
-                }.lparams(wrapContent, wrapContent)
-            }.lparams(matchParent, autoSize(148))
 
         }
     }

+ 68 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/main/withdrawmanagement/WithDrawManagementViewModel.kt

@@ -1,5 +1,12 @@
 package cn.muchinfo.rma.view.base.main.withdrawmanagement
 
+import androidx.lifecycle.MutableLiveData
+import cn.muchinfo.rma.global.GlobalDataCollection
+import cn.muchinfo.rma.global.data.BankAccountSignData
+import cn.muchinfo.rma.global.data.BankInfoData
+import cn.muchinfo.rma.global.data.CusBankSignBankData
+import cn.muchinfo.rma.global.data.UserCollectConfigData
+import cn.muchinfo.rma.view.MyApplication
 import cn.muchinfo.rma.view.base.BaseViewModel
 
 /**
@@ -7,6 +14,67 @@ import cn.muchinfo.rma.view.base.BaseViewModel
  */
 class WithDrawManagementViewModel : BaseViewModel(){
 
+    /**
+     * 提现账户设置信息
+     */
+    val userCollectConfigData : MutableLiveData<BankAccountSignData> = MutableLiveData()
+
+    /**
+     * 托管银行信息
+     */
+    val cusBankSignBankDataList : MutableLiveData<List<CusBankSignBankData>> = MutableLiveData()
+
+    /**
+     * 开户行信息
+     */
+    val bankInfoDataList : MutableLiveData<List<BankInfoData>> = MutableLiveData()
+
+    /**
+     * 查询开户行信息
+     */
+    fun queryBankInfo(){
+        val params = mutableMapOf<String,String>()
+
+        MyApplication.getInstance()?.bankManager?.queryBankInfo(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                bankInfoDataList.postValue(respData)
+            }
+        }
+    }
+
+    /**
+     * 查询托管银行信息
+     */
+    fun queryCusBankSignBank(){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+
+        MyApplication.getInstance()?.bankManager?.queryCusBankSignBank(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                cusBankSignBankDataList.postValue(respData)
+            }
+        }
+    }
+
+    /**
+     * 查询提现账户设置信息
+     */
+    fun queryUserCollectConfig(){
+        val params = mutableMapOf<String,String>().apply {
+            put("userid", GlobalDataCollection.instance?.loginRsp?.userID.toString())
+        }
+
+        MyApplication.getInstance()?.bankManager?.queryBankAccountSign(params = params){ isSuccess, respData, error ->
+            if (isSuccess){
+                if (respData?.size ?: 0 > 0){
+                    userCollectConfigData.postValue(respData?.get(0))
+                }
+            }
+        }
+    }
+
+
 
 
 }

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

@@ -235,6 +235,11 @@ class PlatinumTreasureFragment : BaseFragment<PlatinumTreasureViewModel>() , Pla
                 }).lparams(matchParent, matchParent)
 
                 viewModel.demoList.bindOptional(context) {
+                    if (it?.size ?: 0 > 10){
+                        lastShow = 10
+                    }else{
+                        lastShow = it?.size ?: 0
+                    }
                     if (it?.isEmpty() == true || it?.size == 0) {
                         statusLayout.showEmpty()
                     } else {

+ 0 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/platinumtreasure/adapter/PlatnumTreasureAdapter.java

@@ -157,8 +157,6 @@ public class PlatnumTreasureAdapter extends RecyclerView.Adapter<PlatnumTreasure
                 riseFallData.setValue("--");
                 riseFallData.setColorType("1");
             }
-
-
         }
 
 

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

@@ -71,7 +71,7 @@ class CancellationsViewHolder(private val activity: AppCompatActivity,private va
                     textView {
                         data.bindOptional(context){
                             val goodsInfo = DataBase.getInstance().goodsInfoDao().getGoodsInfo(it?.goodsid?.toInt() ?: 0)
-                            text = NumberUtils.roundNum(it?.orderqty,goodsInfo.decimalplace)
+                            text = NumberUtils.roundNum(it?.orderqty?.toDouble()?.div(Math.pow(10.0, goodsInfo.qtydecimalplace.toDouble()))?.toString(),0)
                         }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33

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

@@ -1,10 +1,14 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
+import android.os.Build
 import android.view.Gravity
+import android.widget.TextView
+import androidx.annotation.RequiresApi
 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.global.toShowTime
 import cn.muchinfo.rma.lifecycle.bindOptional
 import cn.muchinfo.rma.view.autoWidget.autoSize
 import cn.muchinfo.rma.view.autoWidget.textColorInt
@@ -22,6 +26,7 @@ import org.jetbrains.anko.*
 class DealViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<ContractTradeDetailData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
+    @RequiresApi(Build.VERSION_CODES.O)
     override fun _FrameLayout.createContentView() {
         linearLayout {
             verticalLayout {
@@ -31,7 +36,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                     data.bindOptional(context){
                         text = it?.goodsname
                     }
-                    textSizeAuto = 36
+                    textSizeAuto = 31
+                    setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM)
+                    maxLines = 2
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
                     topMargin = autoSize(25)
@@ -41,9 +48,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 //时间
                 textView {
                     data.bindOptional(context){
-                        text = it?.tradetime
+                        text = it?.tradetime?.toShowTime()
                     }
-                    textSizeAuto = 36
+                    textSizeAuto = 21
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
                     marginStart = autoSize(35)
@@ -57,7 +64,7 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                     data.bindOptional(context){
                         text = NumberUtils.roundNum(it?.tradeprice,2)
                     }
-                    textSizeAuto = 36
+                    textSizeAuto = 31
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
                     topMargin = autoSize(25)
@@ -67,9 +74,9 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                 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)
+                             text = NumberUtils.roundNum(it?.tradeqty?.toDouble()?.div(Math.pow(10.0,goodsInfo.qtydecimalplace.toDouble())).toString(),0)
                         }
-                    textSizeAuto = 36
+                    textSizeAuto = 31
                     textColorInt = R.color.rma_black_33
                 }.lparams(wrapContent, wrapContent){
 
@@ -84,8 +91,8 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                     data.bindOptional(context){
                             text = NumberUtils.roundNum(it?.tradeamount,2)
                         }
-                    textSizeAuto = 36
-                    textColorInt = R.color.rma_black_33
+                    textSizeAuto = 31
+                    textColorInt = R.color.rma_red_color
                 }.lparams(wrapContent, wrapContent){
                     topMargin = autoSize(50)
                 }
@@ -100,7 +107,7 @@ class DealViewHolder(private val activity : AppCompatActivity,private val viewMo
                         text = if (it?.buyorsell == "0"){"买入"}else{"卖出"}
                     }
                     textColorInt = R.color.rma_red_color
-                    textSizeAuto = 36
+                    textSizeAuto = 31
                 }.lparams(wrapContent, wrapContent){
                     topMargin = autoSize(50)
                     marginEnd = autoSize(30)

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

@@ -1,8 +1,11 @@
 package cn.muchinfo.rma.view.base.platinumtreasure.trade
 
 import android.content.Intent
+import android.os.Build
 import android.view.Gravity
 import android.view.View
+import android.widget.TextView
+import androidx.annotation.RequiresApi
 import androidx.appcompat.app.AppCompatActivity
 import cn.muchinfo.rma.R
 import cn.muchinfo.rma.global.data.PayOrderData
@@ -34,6 +37,7 @@ import org.jetbrains.anko.*
 class NoPayViewHolder(private val activity : AppCompatActivity,private val viewModel: PlatinumTradeViewModel) : BaseViewHolder<PayOrderData>(activity){
     override val itemSize: IntArray = intArrayOf(matchParent, wrapContent)
 
+    @RequiresApi(Build.VERSION_CODES.O)
     override fun _FrameLayout.createContentView() {
         verticalLayout {
             onThrottleFirstClick {
@@ -47,6 +51,8 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
                             text = it?.goodsname
                         }
                         textSizeAuto = 31
+                        setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM)
+                        maxLines = 2
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -55,14 +61,14 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
 
                     textView {
                         data.bindOptional(context){
-                            text = it?.createtime//?.toShowTime()
+                            text = it?.createtime?.isShowTimeString("HH:mm:ss")
                         }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         marginStart = autoSize(36)
                     }
-                }.lparams(0, autoSize(96),2f)
+                }.lparams(0, autoSize(140),2f)
 
                 verticalLayout {
                     gravity = Gravity.RIGHT
@@ -74,20 +80,20 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
-                        topMargin = autoSize(10)
+                        topMargin = autoSize(20)
                     }
 
                     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)
+                             text = NumberUtils.roundNum(it?.tradeqty?.toDouble()?.div(Math.pow(10.0,goodsInfo.qtydecimalplace?.toDouble())).toString(),0)
                         }
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
 
                     }
-                }.lparams(0, autoSize(96),2f)
+                }.lparams(0, autoSize(140),2f)
 
                 verticalLayout {
                     gravity = Gravity.RIGHT
@@ -96,11 +102,11 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
                             text = NumberUtils.roundNum(it?.payamount,2)
                         }
                         textSizeAuto = 31
-                        textColorInt = R.color.rma_black_33
+                        textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(30)
                     }
-                }.lparams(0, autoSize(96),2f)
+                }.lparams(0, autoSize(140),2f)
 
                 verticalLayout {
                     gravity = Gravity.RIGHT
@@ -115,7 +121,7 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
                         textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
-                        topMargin = autoSize(10)
+                        topMargin = autoSize(20)
                         marginEnd = autoSize(36)
                     }
 
@@ -128,8 +134,8 @@ class NoPayViewHolder(private val activity : AppCompatActivity,private val viewM
                     }.lparams(wrapContent, wrapContent){
                         marginEnd = autoSize(36)
                     }
-                }.lparams(0, autoSize(96),2f)
-            }.lparams(matchParent, autoSize(96))
+                }.lparams(0, autoSize(140),2f)
+            }.lparams(matchParent, autoSize(140))
 
             itemView()
 

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

@@ -46,14 +46,14 @@ import org.jetbrains.anko.*
 class PlatinumBuyOrSellUI(
     private val activity: PlatinumTradeActivity,
     private val viewModel: PlatinumTradeViewModel,
-    private val goodsId : String,
-    private val outGoodsCode : String,
-    private val thisTag : String,
+    private val goodsId: String,
+    private val outGoodsCode: String,
+    private val thisTag: String,
     private val type: String
 ) {
 
     //选择的交易类型 金额或者数量 1 是数量 2 是金额
-    val selectPayType : MutableLiveData<SelectData> = MutableLiveData()
+    val selectPayType: MutableLiveData<SelectData> = MutableLiveData()
 
     // 下拉刷新
     private lateinit var swipeToLayout: SwipeToLoadLayout
@@ -66,10 +66,10 @@ class PlatinumBuyOrSellUI(
     lateinit var trade_number_or_amount: MangeNumberEditText2
 
     //销售价
-    lateinit var sell_price : TextView
+    lateinit var sell_price: TextView
 
     //回购价
-    lateinit var buy_price : TextView
+    lateinit var buy_price: TextView
 
     /**
      * 交易下持仓
@@ -82,10 +82,21 @@ class PlatinumBuyOrSellUI(
             )
         }
 
-    fun initData(goodsId: String, outGoodsCode: String = "",buyOrSell: Int = -1,isShowLoading : Boolean = true){
-        selectPayType.postValue(SelectData(id = "1",value = "数量"))
-        viewModel.goodsInfoData.postValue(DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId.toInt()))//获取商品详情
-        viewModel.queryQuoteDay(tag = thisTag,goodsCodes = outGoodsCode,isShowLoading = isShowLoading)//请求盘面
+    fun initData(
+        goodsId: String,
+        outGoodsCode: String = "",
+        buyOrSell: Int = -1,
+        isShowLoading: Boolean = true
+    ) {
+        selectPayType.postValue(SelectData(id = "1", value = "数量"))
+        viewModel.goodsInfoData.postValue(
+            DataBase.getInstance().goodsInfoDao().getGoodsInfo(goodsId.toInt())
+        )//获取商品详情
+        viewModel.queryQuoteDay(
+            tag = thisTag,
+            goodsCodes = outGoodsCode,
+            isShowLoading = isShowLoading
+        )//请求盘面
         viewModel.queryContractTradePosition()
         viewModel.queryGoodsEx(goodsid = goodsId)
     }
@@ -95,11 +106,13 @@ class PlatinumBuyOrSellUI(
     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){
+        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)
             }
         }
@@ -109,14 +122,22 @@ class PlatinumBuyOrSellUI(
     val root = _FrameLayout(activity).apply {
 
         verticalLayout {
-            activity.createLoadingDialog(hintStr = "请求中...").bindTaskStatus(context, viewModel.loadingDialogStatus)
-            initData(goodsId = goodsId,outGoodsCode = outGoodsCode,isShowLoading = false)
+            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)
+                    activity.creatGoodsInfoBottomSheetDialog(
+                        "请选择商品",
+                        viewModel.getGoodsInfoList()
+                    ) {
+                        initData(
+                            goodsId = this.goodsid.toString(),
+                            outGoodsCode = this.outgoodscode,
+                            isShowLoading = false
+                        )
                     }
                 }
                 gravity = Gravity.CENTER_VERTICAL
@@ -129,7 +150,7 @@ class PlatinumBuyOrSellUI(
                 }
 
                 textView {
-                    viewModel.goodsInfoData.bindOptional(context){
+                    viewModel.goodsInfoData.bindOptional(context) {
                         text = it?.goodsname?.isBlankString()
                     }
                     textColorInt = R.color.rma_black_33
@@ -168,7 +189,7 @@ class PlatinumBuyOrSellUI(
 
                             }
                             //拿到商品信息后对输入框进行初始化
-                            viewModel.goodsInfoData.bindOptional(context) {data ->
+                            viewModel.goodsInfoData.bindOptional(context) { data ->
 //                                val goodsExData = GlobalDataCollection.instance?.goodsExInfoDataArrayList?.find { it.goodsid == data?.goodsid.toString()}
 //                                if (goodsExData?.goodsid?.isNotEmpty() == true){
 //
@@ -188,10 +209,22 @@ class PlatinumBuyOrSellUI(
 
                             //行情变化后根据不同的价格类型分别对赋值
                             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))
+                                if (trade_price_edittext.text.toString().isNullOrEmpty()) {
+                                    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)) {
@@ -205,15 +238,17 @@ class PlatinumBuyOrSellUI(
                     linearLayout {
                         gravity = Gravity.CENTER_VERTICAL
                         onThrottleFirstClick {
-                            val selectDataList = arrayListOf(SelectData(id = "1",value = "数量"),
-                                SelectData(id = "2",value = "金额"))
+                            val selectDataList = arrayListOf(
+                                SelectData(id = "1", value = "数量"),
+                                SelectData(id = "2", value = "金额")
+                            )
                             activity.creatBottomSheetDialog("请选择方式", selectDataList) {
                                 selectPayType.postValue(this)
                                 viewModel.goodsInfoData.postValue(viewModel.goodsInfoData.value)
                             }
                         }
                         textView {
-                            selectPayType.bindOptional(context){
+                            selectPayType.bindOptional(context) {
                                 text = it?.value
                             }
                             textSizeAuto = 36
@@ -236,16 +271,19 @@ class PlatinumBuyOrSellUI(
                             }
 
                             //拿到商品信息后对输入框进行初始化
-                            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"){//按数量
+                            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{//按金额
+                                    } else {//按金额
                                         setMin(goodsExData.regularlybuyminamount?.toDouble() ?: 0.0)
-                                        setStep(goodsExData.regularlybuyminamount?.toDouble() ?: 0.01)
+                                        setStep(
+                                            goodsExData.regularlybuyminamount?.toDouble() ?: 0.01
+                                        )
                                         setText(goodsExData.regularlybuyminamount)
                                     }
                                 }
@@ -279,8 +317,11 @@ class PlatinumBuyOrSellUI(
 
                             textView {
                                 sell_price = this
-                                viewModel.quoteDayData.bindOptional(context){
-                                    text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.ask.toString()),2)//卖一
+                                viewModel.quoteDayData.bindOptional(context) {
+                                    text = NumberUtils.roundNum(
+                                        NumberUtils.doubleDistortion(it?.ask.toString()),
+                                        2
+                                    )//卖一
                                 }
                                 textSizeAuto = 41
                                 textColorInt = R.color.rma_red_color
@@ -303,8 +344,11 @@ class PlatinumBuyOrSellUI(
 
                             textView {
                                 buy_price = this
-                                viewModel.quoteDayData.bindOptional(context){
-                                    text = NumberUtils.roundNum(NumberUtils.doubleDistortion(it?.bid.toString()),2)//买一
+                                viewModel.quoteDayData.bindOptional(context) {
+                                    text = NumberUtils.roundNum(
+                                        NumberUtils.doubleDistortion(it?.bid.toString()),
+                                        2
+                                    )//买一
                                 }
                                 textSizeAuto = 41
                                 textColorInt = R.color.rma_red_color
@@ -329,7 +373,12 @@ class PlatinumBuyOrSellUI(
                     }
                     textView {
                         onThrottleFirstClick {
-                            creatOrderDetailsDialog(type = "1",orderPrice = trade_price_edittext.text.toString(),goodsInfo = viewModel.goodsInfoData.value ?: GoodsInfo(),selectPayType = selectPayType.value?.id ?: "1")
+                            creatOrderDetailsDialog(
+                                type = "1",
+                                orderPrice = trade_price_edittext.text.toString(),
+                                goodsInfo = viewModel.goodsInfoData.value ?: GoodsInfo(),
+                                selectPayType = selectPayType.value?.id ?: "1"
+                            )
                         }
                         gravity = Gravity.CENTER
                         text = "买入"
@@ -342,14 +391,15 @@ class PlatinumBuyOrSellUI(
                     }
 
                     verticalLayout {
-                        viewModel.goodsExData.bindOptional(context){
-                            if (it?.canfinance == "0"){
+                        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){
+                            } else if (it?.canfinance == "1") {
+                                val userinfo =
+                                    GlobalDataCollection.instance?.loginQueryData?.userInfo?.userinfotype
+                                if (userinfo == 2) {
                                     visibility = View.VISIBLE
-                                }else{
+                                } else {
                                     visibility = View.GONE
                                 }
                             }
@@ -377,15 +427,15 @@ class PlatinumBuyOrSellUI(
                     textView {
                         onThrottleFirstClick {
                             val intent = Intent()
-                            intent.putExtra("goodsId",goodsId)
-                            intent.putExtra("outGoodsCode",outGoodsCode)
-                            intent.setClass(context,AddCastSurelyActivity::class.java)
+                            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"){
+                        viewModel.goodsExData.bindOptional(context) {
+                            if (it?.canregularlybuy == "0") {
                                 visibility = View.GONE
-                            }else if(it?.canregularlybuy == "1"){
+                            } else if (it?.canregularlybuy == "1") {
                                 visibility = View.VISIBLE
                             }
                         }
@@ -444,11 +494,11 @@ class PlatinumBuyOrSellUI(
                         text = "持有"
                         textSizeAuto = 30
                         textColorInt = R.color.rma_hint_title_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         topMargin = autoSize(10)
                     }
                     textView {
-                        text ="可用"
+                        text = "可用"
                         textSizeAuto = 30
                         textColorInt = R.color.rma_hint_title_text_color
                     }.lparams(wrapContent, wrapContent)
@@ -461,15 +511,15 @@ class PlatinumBuyOrSellUI(
                         text = "成本"
                         textSizeAuto = 30
                         textColorInt = R.color.rma_hint_title_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         topMargin = autoSize(10)
                         marginEnd = autoSize(30)
                     }
                     textView {
-                        text ="现价"
+                        text = "现价"
                         textSizeAuto = 30
                         textColorInt = R.color.rma_hint_title_text_color
-                    }.lparams(wrapContent, wrapContent){
+                    }.lparams(wrapContent, wrapContent) {
                         marginEnd = autoSize(30)
                     }
                 }.lparams(0, autoSize(100), 1f)
@@ -526,7 +576,12 @@ class PlatinumBuyOrSellUI(
      * selectPayType 1 按数量 2 按金额
      */
 
-    fun creatOrderDetailsDialog(type: String, orderPrice: String, goodsInfo : GoodsInfo, selectPayType : String) {
+    fun creatOrderDetailsDialog(
+        type: String,
+        orderPrice: String,
+        goodsInfo: GoodsInfo,
+        selectPayType: String
+    ) {
         activity.createCustomDialog(cancelable = false) { dialog ->
             backgroundColor = Color.parseColor("#5f000000")
 
@@ -629,9 +684,9 @@ class PlatinumBuyOrSellUI(
                     linearLayout {
                         emptyView()
                         textView {
-                            if (selectPayType == "1"){
+                            if (selectPayType == "1") {
                                 text = "数量:"
-                            }else{
+                            } else {
                                 text = "金额:"
                             }
                             textColorInt = R.color.rma_black_33
@@ -666,12 +721,19 @@ class PlatinumBuyOrSellUI(
                         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{
+                            if (selectPayType == "1") {//数量
+                                orderQtyOrAmount = trade_number_or_amount.text.toString().toDouble()
+                                    .times(Math.pow(10.0, goodsInfo.qtydecimalplace.toDouble()))
+                            } else {
                                 orderQtyOrAmount = trade_number_or_amount.text.toString().toDouble()
                             }
-                            viewModel.commit(goodsInfo = goodsInfo,type = type,orderPrice = orderPrice,orderQtyOrAmount = orderQtyOrAmount.toString(),selectPayType = selectPayType){
+                            viewModel.commit(
+                                goodsInfo = goodsInfo,
+                                type = type,
+                                orderPrice = orderPrice,
+                                orderQtyOrAmount = orderQtyOrAmount.toString(),
+                                selectPayType = selectPayType
+                            ) {
                                 viewModel.loadingDialogStatus.postValue(TaskUiModel.success(msg = "下单成功"))
                             }
 //                            commitDealData(

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

@@ -79,6 +79,7 @@ class PlatinumCancellationsUI(
         }
     }
 
+
     val root = _FrameLayout(activity).apply {
 
         verticalLayout {

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

@@ -265,7 +265,7 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
                     gravity = Gravity.LEFT
                     textView {
                         text = "商品"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -274,7 +274,7 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
 
                     textView {
                         text = "时间"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
                         marginStart = autoSize(36)
@@ -285,7 +285,7 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
                     gravity = Gravity.RIGHT
                     textView {
                         text = "价格"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -293,7 +293,7 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
 
                     textView {
                         text = "数量"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
 
@@ -304,7 +304,7 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
                     gravity = Gravity.RIGHT
                     textView {
                         text = "金额"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(30)
@@ -315,18 +315,19 @@ class NoPayUI(private val activity : AppCompatActivity,private val viewModel: Pl
                     gravity = Gravity.RIGHT
                     textView {
                         text = "类型"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
+                        marginEnd = autoSize(36)
                     }
 
                     textView {
                         text = "状态"
-                        textSizeAuto = 31
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_gray_color
                     }.lparams(wrapContent, wrapContent){
-
+                        marginEnd = autoSize(36)
                     }
                 }.lparams(0, autoSize(96),2f)
             }.lparams(matchParent, autoSize(96))

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

@@ -191,7 +191,7 @@ class PositionUI(private val activity: PlatinumTradeActivity,private val viewMod
                 statusLayout = this
 //                bindTaskStatus(viewModule.status)
                 setRetryAction {
-
+                    viewModel.queryContractTradePosition()
                 }
                 swipeToLoadLayout {
                     swipeToLayout = this

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

@@ -5,6 +5,7 @@ import android.view.Gravity
 import android.view.View
 import android.view.ViewGroup
 import androidx.appcompat.app.AppCompatActivity
+import androidx.lifecycle.MutableLiveData
 import androidx.viewpager.widget.PagerAdapter
 import androidx.viewpager.widget.ViewPager
 import cn.muchinfo.rma.R
@@ -56,6 +57,11 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
     var selectedTabIndex: Int = 0
     private lateinit var viewPager: ViewPager
 
+    /**
+     * 用livedata监测当前页面
+     */
+    val selectIndex : MutableLiveData<Int> = MutableLiveData()
+
     //交易买入UI
     private val platinumBuyUI by lazy {
         PlatinumBuyOrSellUI(this,viewModel,goodsId ?: "",outGoodsCode ?: "",thisTag,"1")
@@ -166,6 +172,24 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
         QMUIStatusBarHelper.translucent(this)
         EventBus.getDefault().register(this)
         verticalLayout {
+            selectIndex.bindOptional(context){
+                if (it == 0){//买入
+                    viewModel.queryContractTradePosition()
+                }else if (it == 1){//卖出
+                    viewModel.queryContractTradePosition()
+                }else if (it == 2){//可撤
+                    viewModel.queryContractTradeOrderDetail()
+                    viewModel.queryContractTradeOrderDetailNoType()
+                }else if (it == 3){//持仓
+                    viewModel.queryContractTradePosition()
+                    viewModel.queryContract()
+                }else if (it == 4){//成交
+                    viewModel.queryContractTradeDetail()
+                    viewModel.queryPayOrder()
+                }else if (it == 5){//资金
+
+                }
+            }
             viewModel.initAccountData()
             initDataView()
             linearLayout {
@@ -237,6 +261,7 @@ class PlatinumTradeActivity : BaseActivity<PlatinumTradeViewModel>(){
                     override fun onTabUnselected(index: Int) {}
                     override fun onTabSelected(index: Int) {
                         selectedTabIndex = index
+                        selectIndex.postValue(index)
                     }
                 })
                 mode = QMUITabSegment.MODE_FIXED

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

@@ -43,6 +43,12 @@ class PlatinumTradeViewModel : BaseViewModel() {
         MutableLiveData()
 
     /**
+     * 持仓页面的持仓单
+     */
+    val positionUiTradePositionDataList: MutableLiveData<List<ContractTradeOrderDetailData>> =
+        MutableLiveData()
+
+    /**
      * 当前交易商品的扩展信息
      */
     val goodsExData: MutableLiveData<GoodsExInfoData> = MutableLiveData()
@@ -144,6 +150,28 @@ class PlatinumTradeViewModel : BaseViewModel() {
         }
     }
 
+
+    /**
+     * 持仓页汇总单viewhodler内的item点击事件
+     * @param deliverygoodsid String
+     */
+    fun setOnPositionUipositionItemClick(orderid : String){
+        val oldList = positionUiTradePositionDataList.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))
+            }
+        }
+        positionUiTradePositionDataList.postValue(newDataList)
+    }
+
     /**
      * 支付页汇总单viewhodler内的item点击事件
      * @param deliverygoodsid String
@@ -345,6 +373,21 @@ class PlatinumTradeViewModel : BaseViewModel() {
         }
     }
 
+    /**
+     * 买卖页面查询持仓汇总单
+     */
+    fun queryPositionUIContractTradePosition() {
+
+        val params = mutableMapOf<String, String>().apply {
+            put("accountID", GlobalDataCollection.instance?.accountData?.accountid.toString())
+        }
+        MyApplication.getInstance()?.contractGoodsManager?.queryContractTradePosition(params = params) { isSuccess, respData, error ->
+            if (isSuccess) {
+                positionUiTradePositionDataList.postValue(respData)
+            }
+        }
+    }
+
 
     /**
      * 请求盘面信息

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

@@ -40,7 +40,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
                         data.bindOptional(context){
                             text = it?.goodsname
                         }
-                        textSizeAuto = 36
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(15)
@@ -55,7 +55,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
                         }
                         text = "16081.25"
-                        textSizeAuto = 36
+                        textSizeAuto = 29
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -65,7 +65,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
                     gravity = Gravity.CENTER
                     textView {
                         text = "10"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(15)
@@ -73,7 +73,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
                     textView {
                         text = "16.25%"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -83,7 +83,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
                     gravity = Gravity.RIGHT
                     textView {
                         text = "10g"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(15)
@@ -91,7 +91,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
                     textView {
                         text = "10g"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)
@@ -101,7 +101,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
                     gravity = Gravity.RIGHT
                     textView {
                         text = "360"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_black_33
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(15)
@@ -110,7 +110,7 @@ class PositionViewHolder(private val activity : AppCompatActivity,private val vi
 
                     textView {
                         text = "360"
-                        textSizeAuto = 36
+                        textSizeAuto = 31
                         textColorInt = R.color.rma_red_color
                     }.lparams(wrapContent, wrapContent){
                         topMargin = autoSize(10)

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