| | |
| | | import com.dayu.general.databinding.ActivityNewCardGeBinding |
| | | import com.dayu.general.net.ApiManager |
| | | import com.dayu.general.net.BaseResponse |
| | | import com.dayu.general.tool.BaseCommon.Companion.protocol |
| | | import com.dayu.general.tool.CardCommon.Companion.USER_CARD_TYPE_1 |
| | | import com.dayu.general.tool.CardOperationType |
| | | import com.dayu.general.tool.NfcReadHelper |
| | |
| | | private var paymentMethod: String = "现金" |
| | | |
| | | // 支付方式ID |
| | | private var paymentId: Long = 0 |
| | | private var paymentId: String = "" |
| | | |
| | | // 支付方式列表 |
| | | private var paymentMethodList: List<PaymentMethod> = listOf() |
| | |
| | | private fun getPaymentMethods() { |
| | | ApiManager.getInstance().requestGetLoading( |
| | | this, |
| | | "sell/paymentmethod/get", |
| | | PaymentMethodResponse::class.java, |
| | | "terminal/paymentmethod/get", |
| | | Array<PaymentMethod>::class.java, |
| | | null, |
| | | object : SubscriberListener<BaseResponse<PaymentMethodResponse>>() { |
| | | override fun onNext(response: BaseResponse<PaymentMethodResponse>) { |
| | | object : SubscriberListener<BaseResponse<Array<PaymentMethod>>>() { |
| | | override fun onNext(response: BaseResponse<Array<PaymentMethod>>) { |
| | | if (response.success) { |
| | | // 获取支付方式列表 |
| | | val paymentMethods = response.content?.obj ?: listOf() |
| | | // 获取支付方式列表,现在content直接是PaymentMethod数组 |
| | | val paymentMethods = response.content?.toList() ?: listOf() |
| | | if (paymentMethods.isNotEmpty()) { |
| | | paymentMethodList = paymentMethods |
| | | // 更新支付方式显示 |
| | |
| | | params["amount"] = rechargeAmount // 充值金额(元) |
| | | params["paymentId"] = paymentId // 支付方式ID |
| | | params["remarks"] = remark // 备注 |
| | | params["protocol"] = "p206V1_0_1" // 协议 |
| | | params["protocol"] = protocol // 协议 |
| | | params["operator"] = BaseApplication.userId // 操作人ID |
| | | |
| | | // 执行卡片激活API请求 |
| | |
| | | clientId = clientId, |
| | | cardFee = cardFee, |
| | | remark = binding.newCardRemark.text.toString(), |
| | | paymentMethod = paymentId.toInt(), |
| | | paymentMethod = paymentId.toLongOrNull()?.toInt() ?: 0, |
| | | isReported = true, |
| | | isCardWritten = false, // 初始设置为false,写卡成功后再更新为true |
| | | operatorId = orderId, |