diff --git a/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt b/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt index 2468001..e574f74 100644 --- a/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt +++ b/app/src/main/java/com/yingmao/clash/fragment/recharge/RechargeFragment.kt @@ -9,6 +9,7 @@ import android.util.Log import android.view.View import android.widget.FrameLayout import android.widget.ImageView +import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.RelativeLayout import android.widget.Switch @@ -547,62 +548,136 @@ class RechargeFragment : BaseFragment() { } private fun orderPayment(data: Trade) { - val jhPay = data.payType?.get(0)?.payChannel - val kjPay = data.payType?.get(2)?.payChannel - activity?.let { - MaterialDialog(it).show { - this.cancelable(true) - cornerRadius(res = R.dimen.dp_10) - customView( - R.layout.backup_payment_dialog, - scrollable = false, - noVerticalPadding = true, - horizontalPadding = false - ) - if (jhPay != null) { - findViewById(R.id.JUhePay).text = jhPay - } - if (kjPay != null) { - findViewById(R.id.KJPay).text = kjPay - } - getCustomView().findViewById(R.id.ivAlipay).setOnClickListener { - val payModel = data.payType?.get(0)?.payModel - val payType = data.payType?.get(0)?.payType - val payParam = data.payType?.get(0)?.payParam - if (payModel != null && payType != null && payParam != null) { - viewModel.orderPayment(data, payModel, payType, payParam) - } else { - viewModel.orderPayment(data, 10, 1, "ip@影猫充值") - } - } - getCustomView().findViewById(R.id.ivWechatPay) - .setOnClickListener { - val payModel = data.payType?.get(1)?.payModel - val payType = data.payType?.get(1)?.payType - val payParam = data.payType?.get(1)?.payParam - if (payModel != null && payType != null && payParam != null) { - viewModel.orderPayment(data, payModel, payType, payParam) - } else { - viewModel.orderPayment(data, 10, 2, "ip@影猫充值") - } + if(data.payType!=null){ + activity?.let { + MaterialDialog(it).show { + this.cancelable(true) + cornerRadius(res = R.dimen.dp_10) + customView( + R.layout.backup_payment_dialog, + scrollable = false, + noVerticalPadding = true, + horizontalPadding = false + ) + for (index in data.payType!!){ + if(index.payModel==10){ + findViewById(R.id.llAggregatePayment).visibility=View.VISIBLE + val JUhePay=findViewById(R.id.JUhePay) + JUhePay.visibility=View.VISIBLE + JUhePay.text = index.payChannel + if(index.payType==1){ + val ivAlipay =findViewById(R.id.ivAlipay) + ivAlipay.visibility=View.VISIBLE + ivAlipay.setOnClickListener { + val payModel = index.payModel + val payType =index.payType + val payParam = index.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 10, 1, "ip@影猫充值") + } + } + }else if(index.payType==2){ + val ivWechatPay= findViewById(R.id.ivWechatPay) + ivWechatPay.visibility=View.VISIBLE + ivWechatPay.setOnClickListener { + val payModel = index.payModel + val payType =index.payType + val payParam =index.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 10, 2, "ip@影猫充值") + } - } - getCustomView().findViewById(R.id.ivQuickPayment) - .setOnClickListener { - val payModel = data.payType?.get(2)?.payModel - val payType = data.payType?.get(2)?.payType - val payParam = data.payType?.get(2)?.payParam - if (payModel != null && payType != null && payParam != null) { - viewModel.orderPayment(data, payModel, payType, payParam) - } else { - viewModel.orderPayment(data, 11, 1, "ip@影猫充值") + } + } + }else if(index.payModel==11){ + findViewById(R.id.llQuickPayment).visibility=View.VISIBLE + val KJPay=findViewById(R.id.KJPay) + KJPay.visibility=View.VISIBLE + KJPay.text = index.payChannel + if(index.payType==1){ + val ivQuickPayment=findViewById(R.id.ivQuickPayment) + ivQuickPayment.visibility=View.VISIBLE + ivQuickPayment.setOnClickListener { + val payModel =index.payModel + val payType =index.payType + val payParam =index.payParam + if (payModel != null && payType != null && payParam != null) { + viewModel.orderPayment(data, payModel, payType, payParam) + } else { + viewModel.orderPayment(data, 11, 1, "ip@影猫充值") + } + } + } } } - getCustomView().findViewById(R.id.ivBack).setOnClickListener { - dismiss() + getCustomView().findViewById(R.id.ivBack).setOnClickListener { + dismiss() + } } } } + + + + +// activity?.let { +// MaterialDialog(it).show { +// this.cancelable(true) +// cornerRadius(res = R.dimen.dp_10) +// customView( +// R.layout.backup_payment_dialog, +// scrollable = false, +// noVerticalPadding = true, +// horizontalPadding = false +// ) +// if (jhPay != null) { +// findViewById(R.id.JUhePay).text = jhPay +// } +// if (kjPay != null) { +// findViewById(R.id.KJPay).text = kjPay +// } +// getCustomView().findViewById(R.id.ivAlipay).setOnClickListener { +// val payModel = data.payType?.get(0)?.payModel +// val payType = data.payType?.get(0)?.payType +// val payParam = data.payType?.get(0)?.payParam +// if (payModel != null && payType != null && payParam != null) { +// viewModel.orderPayment(data, payModel, payType, payParam) +// } else { +// viewModel.orderPayment(data, 10, 1, "ip@影猫充值") +// } +// } +// getCustomView().findViewById(R.id.ivWechatPay) +// .setOnClickListener { +// val payModel = data.payType?.get(1)?.payModel +// val payType = data.payType?.get(1)?.payType +// val payParam = data.payType?.get(1)?.payParam +// if (payModel != null && payType != null && payParam != null) { +// viewModel.orderPayment(data, payModel, payType, payParam) +// } else { +// viewModel.orderPayment(data, 10, 2, "ip@影猫充值") +// } +// +// } +// getCustomView().findViewById(R.id.ivQuickPayment) +// .setOnClickListener { +// val payModel = data.payType?.get(2)?.payModel +// val payType = data.payType?.get(2)?.payType +// val payParam = data.payType?.get(2)?.payParam +// if (payModel != null && payType != null && payParam != null) { +// viewModel.orderPayment(data, payModel, payType, payParam) +// } else { +// viewModel.orderPayment(data, 11, 1, "ip@影猫充值") +// } +// } +// getCustomView().findViewById(R.id.ivBack).setOnClickListener { +// dismiss() +// } +// } +// } } // private fun goWebViewStartPayClient(rsp: BaseRsp, isPayWeb: Boolean) { diff --git a/app/src/main/res/layout/backup_payment_dialog.xml b/app/src/main/res/layout/backup_payment_dialog.xml index 0c5970b..050265e 100644 --- a/app/src/main/res/layout/backup_payment_dialog.xml +++ b/app/src/main/res/layout/backup_payment_dialog.xml @@ -24,12 +24,15 @@ android:layout_marginStart="30dp" android:layout_marginEnd="30dp" android:layout_marginTop="20dp" + android:layout_marginBottom="20dp" + android:visibility="gone" > + app:srcCompat="@drawable/alipay" + android:visibility="gone" + /> @@ -69,8 +75,8 @@ android:background="@drawable/payment_options_bg" android:layout_marginStart="30dp" android:layout_marginEnd="30dp" - android:layout_marginTop="20dp" android:layout_marginBottom="20dp" + android:visibility="gone" >