|
|
@@ -1,8 +1,11 @@
|
|
|
package cn.muchinfo.rma.view.base.main.withdrawmanagement
|
|
|
|
|
|
+import android.Manifest
|
|
|
+import android.app.Activity
|
|
|
import android.content.Intent
|
|
|
import android.net.Uri
|
|
|
import android.os.Bundle
|
|
|
+import android.provider.MediaStore
|
|
|
import android.view.Gravity
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
@@ -10,6 +13,7 @@ import android.view.inputmethod.EditorInfo
|
|
|
import android.widget.EditText
|
|
|
import android.widget.LinearLayout
|
|
|
import android.widget.TextView
|
|
|
+import androidx.core.content.FileProvider
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.viewpager.widget.PagerAdapter
|
|
|
import androidx.viewpager.widget.ViewPager
|
|
|
@@ -22,6 +26,7 @@ import cn.muchinfo.rma.netManage.base.InteractiveException
|
|
|
import cn.muchinfo.rma.netManage.utils.UpLoadUtils
|
|
|
import cn.muchinfo.rma.view.autoWidget.*
|
|
|
import cn.muchinfo.rma.view.autoWidget.photopicter.PhotoUtils
|
|
|
+import cn.muchinfo.rma.view.autoWidget.photopicter.utils.ImageCaptureManager
|
|
|
import cn.muchinfo.rma.view.autoWidget.utils.NumberUtils
|
|
|
import cn.muchinfo.rma.view.base.BaseActivity
|
|
|
import cn.muchinfo.rma.view.base.app.Constant
|
|
|
@@ -37,8 +42,10 @@ import com.cuieney.sdk.rxpay.RxPay
|
|
|
import com.qmuiteam.qmui.util.QMUIDisplayHelper
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator
|
|
|
import com.qmuiteam.qmui.widget.tab.QMUITabSegment
|
|
|
+import com.tbruyelle.rxpermissions2.RxPermissions
|
|
|
import com.zhy.http.okhttp.callback.StringCallback
|
|
|
import mtp.polymer.com.autowidget.dialog.SelectData
|
|
|
+import mtp.polymer.com.autowidget.dialog.creatBottomSheetDialog
|
|
|
import mtp.polymer.com.autowidget.dialog.creatBottomSheetNoTitleDialog
|
|
|
import mtp.polymer.com.autowidget.dialog.createLoadingDialog
|
|
|
import mtp.polymer.com.autowidget.utils.TaskUiModel
|
|
|
@@ -50,25 +57,27 @@ import org.json.JSONArray
|
|
|
import org.json.JSONException
|
|
|
import org.json.JSONObject
|
|
|
import java.io.File
|
|
|
-import kotlin.math.sin
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 充值提现
|
|
|
*/
|
|
|
-class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
+class WithdrawalActivity : BaseActivity<WithdrawalViewModel>() {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
|
|
|
|
- val selectindex by lazy { intent.getIntExtra("selectindex",0) }
|
|
|
+
|
|
|
+ val selectindex by lazy { intent.getIntExtra("selectindex", 0) }
|
|
|
+
|
|
|
+ val imageCaptureManager by lazy { ImageCaptureManager(this) }
|
|
|
|
|
|
//充值UI
|
|
|
- private val moneyInUI by lazy { MoneyInUI(this,viewModel) }
|
|
|
+ private val moneyInUI by lazy { MoneyInUI(this, viewModel, imageCaptureManager) }
|
|
|
|
|
|
//提现UI
|
|
|
- private val moneyOutUI by lazy { MoneyOutUI(this,viewModel) }
|
|
|
+ private val moneyOutUI by lazy { MoneyOutUI(this, viewModel) }
|
|
|
|
|
|
//viewpager的适配器
|
|
|
private var newPagerAdapter: PagerAdapter? = null
|
|
|
@@ -82,7 +91,7 @@ class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
/**
|
|
|
* 用livedata监测当前页面
|
|
|
*/
|
|
|
- val selectIndex1 : MutableLiveData<Int> = MutableLiveData()
|
|
|
+ val selectIndex1: MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
|
|
|
override fun onResume() {
|
|
|
@@ -119,6 +128,15 @@ class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data)
|
|
|
+ if (requestCode == 102 && resultCode == Activity.RESULT_OK) {
|
|
|
+ imageCaptureManager.galleryAddPic()
|
|
|
+ moneyInUI.moneyInOutlineUI.imagePhotoString.postValue(imageCaptureManager.currentPhotoPath)
|
|
|
+ LogUtils.eTag("dasdasdsadasdad", imageCaptureManager.currentPhotoPath)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
@@ -137,7 +155,7 @@ class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
}
|
|
|
commonMenuButton(R.mipmap.qhj_dian_dian) {
|
|
|
val intent = Intent()
|
|
|
- intent.setClass(context,WithDrawLogActivity::class.java)
|
|
|
+ intent.setClass(context, WithDrawLogActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
|
}
|
|
|
}
|
|
|
@@ -171,7 +189,7 @@ class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
|
|
|
segment.setupWithViewPager(viewPager)
|
|
|
segment.selectTab(selectedTabIndex)
|
|
|
- selectIndex1.bindOptional(context){
|
|
|
+ selectIndex1.bindOptional(context) {
|
|
|
segment.selectTab(it ?: 0)
|
|
|
}
|
|
|
|
|
|
@@ -186,16 +204,21 @@ class WithdrawalActivity : BaseActivity<WithdrawalViewModel>(){
|
|
|
* @property root _FrameLayout
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class MoneyInUI(private val activity: WithdrawalActivity,private val viewModel: WithdrawalViewModel){
|
|
|
+class MoneyInUI(
|
|
|
+ private val activity: WithdrawalActivity,
|
|
|
+ private val viewModel: WithdrawalViewModel,
|
|
|
+ private val imageCaptureManager: ImageCaptureManager
|
|
|
+) {
|
|
|
|
|
|
lateinit var segment: QMUITabSegment
|
|
|
var selectedTabIndex: Int = 0
|
|
|
private lateinit var viewPager: ViewPager
|
|
|
+
|
|
|
//线上充值
|
|
|
private val moneyInOnlineUI by lazy { MoneyInOnlineUI(activity, viewModel) }
|
|
|
|
|
|
//线下充值
|
|
|
- private val moneyInOutlineUI by lazy { MoneyInOutlineUI(activity, viewModel) }
|
|
|
+ val moneyInOutlineUI by lazy { MoneyInOutlineUI(activity, viewModel, imageCaptureManager) }
|
|
|
|
|
|
//viewpager的适配器
|
|
|
private var newPagerAdapter: PagerAdapter? = null
|
|
|
@@ -282,11 +305,14 @@ class MoneyInUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
* @property root _FrameLayout
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel: WithdrawalViewModel){
|
|
|
+class MoneyOutUI(
|
|
|
+ private val activity: WithdrawalActivity,
|
|
|
+ private val viewModel: WithdrawalViewModel
|
|
|
+) {
|
|
|
|
|
|
- lateinit var amount_input : EditText
|
|
|
+ lateinit var amount_input: EditText
|
|
|
|
|
|
- var canUseBanlance : Double = 0.0
|
|
|
+ var canUseBanlance: Double = 0.0
|
|
|
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
@@ -297,7 +323,7 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "提现金额"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(200))
|
|
|
@@ -319,15 +345,18 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
|
|
|
linearLayout {
|
|
|
textView {
|
|
|
- viewModel.usedAccountData.bindOptional(context){
|
|
|
- val freezeAmount = it?.freezemargin?.plus(it.otherfreezemargin)?.plus(it.freezecharge)?.plus(it.outamountfreeze)//冻结金额
|
|
|
+ viewModel.usedAccountData.bindOptional(context) {
|
|
|
+ val freezeAmount = it?.freezemargin?.plus(it.otherfreezemargin)
|
|
|
+ ?.plus(it.freezecharge)?.plus(it.outamountfreeze)//冻结金额
|
|
|
val balance = it?.currentbalance?.minus(freezeAmount ?: 0.0)//
|
|
|
canUseBanlance = balance ?: 0.0
|
|
|
- text = "可提现金额 " + NumberUtils.roundNum(NumberUtils.doubleDistortion(balance?.toString()),2)
|
|
|
+ text = "可提现金额 " + NumberUtils.roundNum(
|
|
|
+ NumberUtils.doubleDistortion(balance?.toString()), 2
|
|
|
+ )
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -340,10 +369,10 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "全部"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_blue_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginEnd = autoSize(36)
|
|
|
}
|
|
|
- }.lparams(matchParent, wrapContent){
|
|
|
+ }.lparams(matchParent, wrapContent) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -360,13 +389,13 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "开户银行"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(150))
|
|
|
|
|
|
textView {
|
|
|
- viewModel.userCollectConfigData.bindOptional(context){
|
|
|
+ viewModel.userCollectConfigData.bindOptional(context) {
|
|
|
text = it?.bankname
|
|
|
}
|
|
|
textSizeAuto = 36
|
|
|
@@ -384,13 +413,13 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "银行卡号"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(150))
|
|
|
|
|
|
textView {
|
|
|
- viewModel.userCollectConfigData.bindOptional(context){
|
|
|
+ viewModel.userCollectConfigData.bindOptional(context) {
|
|
|
text = it?.bankaccountno
|
|
|
}
|
|
|
textSizeAuto = 36
|
|
|
@@ -408,13 +437,13 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "姓名"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(150))
|
|
|
|
|
|
textView {
|
|
|
- viewModel.userCollectConfigData.bindOptional(context){
|
|
|
+ viewModel.userCollectConfigData.bindOptional(context) {
|
|
|
text = it?.bankaccountname
|
|
|
}
|
|
|
|
|
|
@@ -433,13 +462,13 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
text = "支行名称"
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.rma_color_ccc
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(autoSize(250), autoSize(150))
|
|
|
|
|
|
textView {
|
|
|
- viewModel.userCollectConfigData.bindOptional(context){
|
|
|
+ viewModel.userCollectConfigData.bindOptional(context) {
|
|
|
text = it?.branchbankname
|
|
|
}
|
|
|
textSizeAuto = 31
|
|
|
@@ -454,8 +483,11 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
textView {
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.text_hint_color_two
|
|
|
- text = "提现时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue("013")
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ text =
|
|
|
+ "提现时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "013"
|
|
|
+ )
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
@@ -465,11 +497,11 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (amount_input.text.toString().isNullOrEmpty()){
|
|
|
+ if (amount_input.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入提现金额")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0."){
|
|
|
+ if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0.") {
|
|
|
ToastUtils.showLong("提现金额不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
@@ -482,7 +514,7 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
BankAccoutNum = singingInfo?.bankaccountno2 ?: "",
|
|
|
Amount = amount_input.text.toString().toDouble(),
|
|
|
extend_info = getJSONExtendInfo() ?: ""
|
|
|
- ){
|
|
|
+ ) {
|
|
|
amount_input.setText("")
|
|
|
}
|
|
|
}
|
|
|
@@ -501,6 +533,7 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 组装扩展信息
|
|
|
*
|
|
|
@@ -516,7 +549,6 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 充值-线上充值
|
|
|
* @property activity WithdrawalActivity
|
|
|
@@ -524,16 +556,19 @@ class MoneyOutUI(private val activity: WithdrawalActivity,private val viewModel:
|
|
|
* @property root _FrameLayout
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewModel: WithdrawalViewModel){
|
|
|
+class MoneyInOnlineUI(
|
|
|
+ private val activity: WithdrawalActivity,
|
|
|
+ private val viewModel: WithdrawalViewModel
|
|
|
+) {
|
|
|
|
|
|
//填写的充值金额
|
|
|
- lateinit var amount_input : EditText
|
|
|
+ lateinit var amount_input: EditText
|
|
|
|
|
|
//选择的充值渠道
|
|
|
- private val pay_type : MutableLiveData<SelectData> = MutableLiveData()
|
|
|
+ private val pay_type: MutableLiveData<SelectData> = MutableLiveData()
|
|
|
|
|
|
- fun initData(){
|
|
|
- pay_type.postValue(SelectData(id = "9",value = "支付宝"))
|
|
|
+ fun initData() {
|
|
|
+ pay_type.postValue(SelectData(id = "9", value = "支付宝"))
|
|
|
}
|
|
|
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
@@ -544,7 +579,7 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
text = "充值金额"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
|
|
|
@@ -572,10 +607,13 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
|
|
|
onThrottleFirstClick {
|
|
|
- val selectDataList = arrayListOf(SelectData(id = "9",value = "支付宝")/*,
|
|
|
- SelectData(id = "10",value = "微信")*/)
|
|
|
+ val selectDataList = arrayListOf(
|
|
|
+ SelectData(id = "9", value = "支付宝")/*,
|
|
|
+ SelectData(id = "10",value = "微信")*/
|
|
|
+ )
|
|
|
|
|
|
- activity.creatBottomSheetNoTitleDialog(selectDataList
|
|
|
+ activity.creatBottomSheetNoTitleDialog(
|
|
|
+ selectDataList
|
|
|
) {
|
|
|
pay_type.postValue(this)
|
|
|
}
|
|
|
@@ -585,18 +623,18 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
text = "充值渠道"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
|
|
|
textView {
|
|
|
- pay_type.bindOptional(context){
|
|
|
+ pay_type.bindOptional(context) {
|
|
|
text = it?.value
|
|
|
}
|
|
|
text = "请选择充值渠道"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_black_33
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(50)
|
|
|
}
|
|
|
|
|
|
@@ -614,19 +652,22 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
textView {
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.text_hint_color_two
|
|
|
- text = "充值时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue("013")
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ text =
|
|
|
+ "充值时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "013"
|
|
|
+ )
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
|
|
|
- viewModel.payInfoRequest.bindOptional(context){
|
|
|
- LogUtils.eTag("asdhasgfjahsdha",it)
|
|
|
+ viewModel.payInfoRequest.bindOptional(context) {
|
|
|
+ LogUtils.eTag("asdhasgfjahsdha", it)
|
|
|
RxPay(activity)
|
|
|
.requestAlipay(it ?: "")
|
|
|
.subscribe {
|
|
|
val intent = Intent()
|
|
|
- intent.putExtra("type","2")
|
|
|
+ intent.putExtra("type", "2")
|
|
|
intent.setClass(context, PaySuccessActivity::class.java)
|
|
|
ActivityUtils.startActivity(intent)
|
|
|
amount_input.setText("")
|
|
|
@@ -638,15 +679,19 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (amount_input.text.toString().isNullOrEmpty()){
|
|
|
+ if (amount_input.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入充值金额")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0."){
|
|
|
+ if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0.") {
|
|
|
ToastUtils.showLong("充值金额不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- viewModel.getPayInfo(totalAmount = amount_input.text.toString(),payType = "4",msgType = "9")
|
|
|
+ viewModel.getPayInfo(
|
|
|
+ totalAmount = amount_input.text.toString(),
|
|
|
+ payType = "4",
|
|
|
+ msgType = "9"
|
|
|
+ )
|
|
|
}
|
|
|
gravity = Gravity.CENTER
|
|
|
backgroundResource = R.mipmap.rma_submit_bg
|
|
|
@@ -675,21 +720,28 @@ class MoneyInOnlineUI(private val activity: WithdrawalActivity,private val viewM
|
|
|
* @property root _FrameLayout
|
|
|
* @constructor
|
|
|
*/
|
|
|
-class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val viewModel: WithdrawalViewModel){
|
|
|
+class MoneyInOutlineUI(
|
|
|
+ private val activity: WithdrawalActivity,
|
|
|
+ private val viewModel: WithdrawalViewModel,
|
|
|
+ private val imageCaptureManager: ImageCaptureManager
|
|
|
+) {
|
|
|
|
|
|
private var uploadFile: String = ""//上传成功后服务给的图片地址
|
|
|
- private val imageString: MutableLiveData<String> =
|
|
|
+ val imageString: MutableLiveData<String> =
|
|
|
MutableLiveData<String>().apply { value = "" }//文件地址
|
|
|
|
|
|
+ val imagePhotoString: MutableLiveData<String> =
|
|
|
+ MutableLiveData<String>().apply { value = "" }//拍照后的文件地址
|
|
|
+
|
|
|
//填写的充值金额
|
|
|
- lateinit var amount_input : EditText
|
|
|
+ lateinit var amount_input: EditText
|
|
|
|
|
|
lateinit var viewPager: ViewPager
|
|
|
|
|
|
/**
|
|
|
* 选择的银行卡
|
|
|
*/
|
|
|
- val selectCardType : MutableLiveData<Int> = MutableLiveData()
|
|
|
+ val selectCardType: MutableLiveData<Int> = MutableLiveData()
|
|
|
|
|
|
val root = _FrameLayout(activity).apply {
|
|
|
verticalLayout {
|
|
|
@@ -701,29 +753,41 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
clipChildren = false
|
|
|
gravity = Gravity.CENTER
|
|
|
viewPager {
|
|
|
- backgroundDrawable = createRoundRectDrawable("#ffffff",25)
|
|
|
+ backgroundDrawable = createRoundRectDrawable("#ffffff", 25)
|
|
|
clipChildren = false
|
|
|
viewPager = this
|
|
|
- val dataList = arrayListOf(R.mipmap.qhj_withdraw_bg3,R.mipmap.qhj_withdraw_bg1,R.mipmap.qhj_withdraw_bg2)
|
|
|
- viewModel.userCollectConfigDataList.bindOptional(context){
|
|
|
+ val dataList = arrayListOf(
|
|
|
+ R.mipmap.qhj_withdraw_bg3,
|
|
|
+ R.mipmap.qhj_withdraw_bg1,
|
|
|
+ R.mipmap.qhj_withdraw_bg2
|
|
|
+ )
|
|
|
+ viewModel.userCollectConfigDataList.bindOptional(context) {
|
|
|
val baseVPAdapter: CardViewAdapter<UserCollectConfigData> =
|
|
|
- object : CardViewAdapter<UserCollectConfigData>(activity, R.layout.item_card_view, it) {
|
|
|
+ object : CardViewAdapter<UserCollectConfigData>(
|
|
|
+ activity,
|
|
|
+ R.layout.item_card_view,
|
|
|
+ it
|
|
|
+ ) {
|
|
|
override fun bindView(view: View, data: UserCollectConfigData?) {
|
|
|
val linearLayout =
|
|
|
view.findViewById<LinearLayout>(R.id.image_bg)
|
|
|
- val account_name = view.findViewById<TextView>(R.id.account_name)//名字
|
|
|
- val card_number = view.findViewById<TextView>(R.id.card_number)//卡号
|
|
|
- val card_name = view.findViewById<TextView>(R.id.card_name)//银行名称
|
|
|
+ val account_name =
|
|
|
+ view.findViewById<TextView>(R.id.account_name)//名字
|
|
|
+ val card_number =
|
|
|
+ view.findViewById<TextView>(R.id.card_number)//卡号
|
|
|
+ val card_name =
|
|
|
+ view.findViewById<TextView>(R.id.card_name)//银行名称
|
|
|
linearLayout.setBackgroundResource(R.mipmap.qhj_withdraw_bg3)
|
|
|
account_name.setText(data?.collectaccountname)
|
|
|
card_number.text = data?.collectaccountno
|
|
|
- card_name.text = data?.collectbankname + data?.collectbranchbankname
|
|
|
+ card_name.text =
|
|
|
+ data?.collectbankname + data?.collectbranchbankname
|
|
|
}
|
|
|
}
|
|
|
adapter = baseVPAdapter
|
|
|
|
|
|
}
|
|
|
- viewPager.setOnPageChangeListener(object : ViewPager.OnPageChangeListener{
|
|
|
+ viewPager.setOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
|
|
override fun onPageScrollStateChanged(state: Int) {
|
|
|
|
|
|
}
|
|
|
@@ -743,13 +807,13 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
|
|
|
})
|
|
|
setOffscreenPageLimit(15)
|
|
|
- setPageTransformer(false, ScaleTransformerCardView(activity))
|
|
|
+ setPageTransformer(false, ScaleTransformerCardView(activity))
|
|
|
|
|
|
- }.lparams(matchParent, autoSize(260)){
|
|
|
+ }.lparams(matchParent, autoSize(260)) {
|
|
|
marginStart = autoSize(65)
|
|
|
marginEnd = autoSize(65)
|
|
|
}
|
|
|
- }.lparams(matchParent, autoSize(270)){
|
|
|
+ }.lparams(matchParent, autoSize(270)) {
|
|
|
topMargin = autoSize(25)
|
|
|
}
|
|
|
|
|
|
@@ -761,7 +825,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
text = "充值金额"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
|
|
|
@@ -781,7 +845,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
marginStart = autoSize(50)
|
|
|
}
|
|
|
|
|
|
- }.lparams(matchParent, autoSize(150)){
|
|
|
+ }.lparams(matchParent, autoSize(150)) {
|
|
|
topMargin = autoSize(20)
|
|
|
}
|
|
|
|
|
|
@@ -794,7 +858,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
text = "凭证"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
|
|
|
@@ -802,7 +866,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
text = "请上传银行充值流水截图"
|
|
|
textSizeAuto = 36
|
|
|
textColorInt = R.color.rma_gray_color
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(80)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(132))
|
|
|
@@ -819,58 +883,132 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
}
|
|
|
visibility = View.VISIBLE
|
|
|
onThrottleFirstClick {
|
|
|
- PhotoUtils().showPicker(activity) {
|
|
|
- it.firstOrNull()?.let {
|
|
|
- viewModel.loadingDialogStatus.value =
|
|
|
- TaskUiModel.inFlight()
|
|
|
- UpLoadUtils(activity).uploadPicture(
|
|
|
- File(it),
|
|
|
- object : StringCallback() {
|
|
|
- override fun onError(
|
|
|
- call: Call,
|
|
|
- e: Exception,
|
|
|
- id: Int
|
|
|
- ) {
|
|
|
- LogUtils.e("hidahdashdsdasd", e.message)
|
|
|
- viewModel.loadingDialogStatus.value =
|
|
|
- TaskUiModel.failed(
|
|
|
- InteractiveException(
|
|
|
- errorMessage = e.message ?: ""
|
|
|
- )
|
|
|
- )
|
|
|
+ if (imageString.value.isNullOrEmpty().not()){
|
|
|
+ return@onThrottleFirstClick
|
|
|
+ }
|
|
|
+
|
|
|
+ val selectDataList = arrayListOf(
|
|
|
+ SelectData(id = "1", value = "拍照"),
|
|
|
+ SelectData(id = "2", value = "相册")
|
|
|
+ )
|
|
|
+ activity.creatBottomSheetDialog("请选择上传", selectDataList) {
|
|
|
+ if (this.id == "1"){
|
|
|
+ RxPermissions(activity).request(Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.CAMERA)
|
|
|
+ .subscribe { granted ->
|
|
|
+ if (granted) {//打开相机拍照
|
|
|
+ val intent = imageCaptureManager.dispatchTakePictureIntent()
|
|
|
+ ActivityUtils.startActivityForResult(activity, intent, 102)
|
|
|
}
|
|
|
+ }
|
|
|
+ }else if (this.id == "2"){
|
|
|
+ PhotoUtils().showPicker(activity) {
|
|
|
+ it.firstOrNull()?.let {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.inFlight()
|
|
|
+ UpLoadUtils(activity).uploadPicture(
|
|
|
+ File(it),
|
|
|
+ object : StringCallback() {
|
|
|
+ override fun onError(
|
|
|
+ call: Call,
|
|
|
+ e: Exception,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ LogUtils.e("hidahdashdsdasd", e.message)
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.failed(
|
|
|
+ InteractiveException(
|
|
|
+ errorMessage = e.message ?: ""
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
|
|
|
- override fun onResponse(
|
|
|
- response: String,
|
|
|
- id: Int
|
|
|
- ) {
|
|
|
- /*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
- try {
|
|
|
- viewModel.loadingDialogStatus.value =
|
|
|
- TaskUiModel.success("上传成功")
|
|
|
- val jsonArray = JSONArray(response)
|
|
|
- LogUtils.eTag(
|
|
|
- "图片",
|
|
|
- JSON.toJSONString(jsonArray)
|
|
|
- )
|
|
|
- for (i in 0 until jsonArray.length()) {
|
|
|
- uploadFile =
|
|
|
- (jsonArray.get(i) as JSONObject).getString(
|
|
|
- "filePath"
|
|
|
+ override fun onResponse(
|
|
|
+ response: String,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ /*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
+ try {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.success("上传成功")
|
|
|
+ val jsonArray = JSONArray(response)
|
|
|
+ LogUtils.eTag(
|
|
|
+ "图片",
|
|
|
+ JSON.toJSONString(jsonArray)
|
|
|
)
|
|
|
- imageString.value = it
|
|
|
- LogUtils.e("hidahdashd", uploadFile)
|
|
|
+ for (i in 0 until jsonArray.length()) {
|
|
|
+ uploadFile =
|
|
|
+ (jsonArray.get(i) as JSONObject).getString(
|
|
|
+ "filePath"
|
|
|
+ )
|
|
|
+ imageString.value = it
|
|
|
+ LogUtils.e("hidahdashd", uploadFile)
|
|
|
+ }
|
|
|
+ } catch (e: JSONException) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- } catch (e: JSONException) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
+ },
|
|
|
+ 10000.0,
|
|
|
+ SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ imagePhotoString.bindOptional(context) {
|
|
|
+ if (it.isNullOrEmpty().not()) {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.inFlight()
|
|
|
+ UpLoadUtils(activity).uploadPicture(
|
|
|
+ File(it),
|
|
|
+ object : StringCallback() {
|
|
|
+ override fun onError(
|
|
|
+ call: Call,
|
|
|
+ e: Exception,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ LogUtils.e("hidahdashdsdasd", e.message)
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.failed(
|
|
|
+ InteractiveException(
|
|
|
+ errorMessage = e.message ?: ""
|
|
|
+ )
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResponse(
|
|
|
+ response: String,
|
|
|
+ id: Int
|
|
|
+ ) {
|
|
|
+ /*[{"originalName":"tem.jpg","fileName":"201907161657044712.jpg","fileSize":"0KB","fileType":"image/jpeg","filePath":"./uploadFile/20190716/201907161657044712.jpg","submitName":null}]*/
|
|
|
+ try {
|
|
|
+ viewModel.loadingDialogStatus.value =
|
|
|
+ TaskUiModel.success("上传成功")
|
|
|
+ val jsonArray = JSONArray(response)
|
|
|
+ LogUtils.eTag(
|
|
|
+ "图片",
|
|
|
+ JSON.toJSONString(jsonArray)
|
|
|
+ )
|
|
|
+ for (i in 0 until jsonArray.length()) {
|
|
|
+ uploadFile =
|
|
|
+ (jsonArray.get(i) as JSONObject).getString(
|
|
|
+ "filePath"
|
|
|
+ )
|
|
|
+ imageString.value = it
|
|
|
+ LogUtils.e("hidahdashd", uploadFile)
|
|
|
+ }
|
|
|
+ } catch (e: JSONException) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
- },
|
|
|
- 10000.0,
|
|
|
- SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
- )
|
|
|
- }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 10000.0,
|
|
|
+ SPUtils.getInstance().getString(Constant.uploadUrl)
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
background = resources.getDrawable(R.color.rma_color_ccc)
|
|
|
@@ -878,7 +1016,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
imageView {
|
|
|
imageResource = R.mipmap.qhj_picture
|
|
|
}.lparams(autoSize(96), autoSize(96))
|
|
|
- }.lparams(autoSize(288), autoSize(288)){
|
|
|
+ }.lparams(autoSize(288), autoSize(288)) {
|
|
|
marginStart = autoSize(250)
|
|
|
}
|
|
|
|
|
|
@@ -902,7 +1040,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
arrayListOf(path)
|
|
|
)
|
|
|
}
|
|
|
- }.lparams(autoSize(288), autoSize(288)){
|
|
|
+ }.lparams(autoSize(288), autoSize(288)) {
|
|
|
marginStart = autoSize(250)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(300))
|
|
|
@@ -914,8 +1052,11 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
textView {
|
|
|
textSizeAuto = 31
|
|
|
textColorInt = R.color.text_hint_color_two
|
|
|
- text = "充值时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue("013")
|
|
|
- }.lparams(wrapContent, wrapContent){
|
|
|
+ text =
|
|
|
+ "充值时间" + GlobalDataCollection.instance?.getSystemParamsValue("012") + "~" + GlobalDataCollection.instance?.getSystemParamsValue(
|
|
|
+ "013"
|
|
|
+ )
|
|
|
+ }.lparams(wrapContent, wrapContent) {
|
|
|
marginStart = autoSize(36)
|
|
|
}
|
|
|
}.lparams(matchParent, autoSize(100))
|
|
|
@@ -925,19 +1066,19 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
gravity = Gravity.CENTER_VERTICAL
|
|
|
textView {
|
|
|
onThrottleFirstClick {
|
|
|
- if (amount_input.text.toString().isNullOrEmpty()){
|
|
|
+ if (amount_input.text.toString().isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请输入充值金额")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0."){
|
|
|
+ if (amount_input.text.toString() == "0" || amount_input.text.toString() == "0.0" || amount_input.text.toString() == "0.00" || amount_input.text.toString() == "0.") {
|
|
|
ToastUtils.showLong("充值金额不能为零")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (uploadFile.isNullOrEmpty()){
|
|
|
+ if (uploadFile.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请上传充值凭证")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
- if (viewModel.userCollectConfigData.value?.accountcode.isNullOrEmpty()){
|
|
|
+ if (viewModel.userCollectConfigData.value?.accountcode.isNullOrEmpty()) {
|
|
|
ToastUtils.showLong("请先添加提现账户信息")
|
|
|
return@onThrottleFirstClick
|
|
|
}
|
|
|
@@ -950,7 +1091,7 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
BankAccoutNum = singingInfo?.bankaccountno2 ?: "",
|
|
|
Amount = amount_input.text.toString().toDouble(),
|
|
|
extend_info = getJSONExtendInfo(uploadFile) ?: ""
|
|
|
- ){
|
|
|
+ ) {
|
|
|
amount_input.setText("")
|
|
|
uploadFile = ""
|
|
|
imageString.postValue("")
|
|
|
@@ -980,10 +1121,10 @@ class MoneyInOutlineUI(private val activity: WithdrawalActivity,private val view
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- fun getJSONExtendInfo(url : String): String? {
|
|
|
+ fun getJSONExtendInfo(url: String): String? {
|
|
|
val json = JSONObject()
|
|
|
json.put("sex", MTPEnums.SEX_FEMALE)
|
|
|
- json.put("certificate_photo_url",url)
|
|
|
+ json.put("certificate_photo_url", url)
|
|
|
return json.toString()
|
|
|
}
|
|
|
|