app/src/main/java/com/kuanzhai/user/dialog/PayDialog.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/kuanzhai/user/network/entity/OrderData.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/com/kuanzhai/user/ui/trip/OrderDetailActivity.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/dialog_pay.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/com/kuanzhai/user/dialog/PayDialog.kt
@@ -46,6 +46,9 @@ private val isCancel by lazy { arguments?.getBoolean("isCancel",false)?:false } private val isCompany by lazy { arguments?.getBoolean("isCompany",false)?:false } private var coupon = "" private val orderId by lazy { @@ -67,6 +70,13 @@ // tv_origin_money.text = String.format(if (isCancel) "%.2f元" else "¥%.2f",money) tv_origin_money.text = String.format("¥%.2f",money) tv_money.text = String.format(if (isCancel) "%.2f元" else "¥%.2f",money) if (isCompany){//企业公费 rb_ali.gone() line1.gone() rb_wx.gone() line2.gone() rb_balance.text = "企业授信额度" } group_coupon.visibility = if (isCancel||isLogistics) { //取消支付没有优惠券,补差价没有优惠券 View.GONE } else { @@ -83,7 +93,7 @@ } tv_action.text = "立即支付%.2f元".format(payMoney) rb_balance.text = String.format("充值余额(%.2f可用)",balance) rb_balance.text = String.format("${if (isCompany) "企业授信额度" else "充值余额"}(%.2f可用)",balance) View.VISIBLE } // if (isLogistics){ //物流订单没有优惠券 @@ -93,7 +103,7 @@ rb_offline.gone() tv_action.setOnClickListener { if (payWay == 3&&!isCancel&&balance<payMoney) myToast("余额不足,请选择其他支付方式") myToast(if (isCompany) "额度不足,请申请企业额度" else "余额不足,请选择其他支付方式") else callback?.onOk(payWay,if (coupon.isEmpty()) 0 else coupon.toInt(),discountType) } app/src/main/java/com/kuanzhai/user/network/entity/OrderData.kt
@@ -79,6 +79,7 @@ val peopleNumber: Int = 0, val rideType: Int = 0, //乘车类型(1=独享,2=一口价,3=拼车) val spellSuccess: Int = 0, //拼车'0未成功,1成功' val payWay: Int = 0, //1自费 2企业支付 val seatNumber: String = "", val fareTypeNote1: String = "", val fareTypeNote2: String = "", app/src/main/java/com/kuanzhai/user/ui/trip/OrderDetailActivity.kt
@@ -66,7 +66,7 @@ callPhone(order?.driverPhone) } tv_action.setOnClickListener { if (order?.state == 7||order?.state == 12){ if (order?.state == 7||order?.state == 12&&mPayDialog.arguments!=null){ mPayDialog.show(supportFragmentManager,"pay") }else if (order?.state == 8){ HttpManager.orderEvaluate(id,score,type,checkList.joinToString (","){ it }).request(this){_,_-> @@ -377,7 +377,9 @@ private fun queryBalance(){ HttpManager.queryBalance(id,type).request(this){_,data-> data?.let { mPayDialog.arguments = bundleOf("isCancel" to (order?.state == 12),"balance" to it.optDouble("balance"), mPayDialog.arguments = bundleOf("isCancel" to (order?.state == 12), "balance" to if (order?.payWay == 2) it.optDouble("companyLimit") else it.optDouble("balance"), "isCompany" to (order?.payWay == 2), "discount" to it.optDouble("discountAmount"), "coupon" to it.optString("objectId"), "discountType" to it.optInt("type"), "money" to payMoney,"id" to id,"type" to type) } @@ -415,37 +417,24 @@ * @param way 1=微信,2=支付宝,3=余额 */ private fun pay(way:Int,couponId:Int,couponType: Int){ // if (way == 1){ //微信支付,跳转微信小程序 // val api = WXAPIFactory.createWXAPI(this, Const.WX_APP_ID) // val req = WXLaunchMiniProgram.Req() // req.userName = "gh_a6c22560b6be" // 填小程序原始id // val content = if (order!!.state == 12)"{\"cancleId\":${order!!.cancelId}}" // else if (couponId!=0) "{\"couponId\":${couponId}}" // else "" // req.path = "/pages/appPay/appPay?orderId=${id}&orderType=${type}&type=${if (order!!.state == 12) 2 else 1}" + // "&userType=1&uid=${SPUtils.instance().getInt(Const.User.USER_ID)}&content=${content}" // req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE// 可选打开 开发版,体验版和正式版 // isGotoWx = true // api.sendReq(req) // }else{ if (order!!.state == 12) HttpManager.cancleOrderTaxi(id,way,order!!.cancelId,type).request(this){_,data-> if (way == 3) onPaySuccess() else if (way == 2) PayUtil.aliPay(this,data!!.orderInfo) else PayUtil.weChatPay(data!!) } else HttpManager.payTaxiOrder(id,way,type,if (couponId == 0) null else couponId,if (couponType == 0) null else couponType).request(this){_,data-> if (way == 3) onPaySuccess() else if (way == 2) PayUtil.aliPay(this,data!!.orderInfo) else PayUtil.weChatPay(data!!) } // } if (order!!.state == 12) HttpManager.cancleOrderTaxi(id,if (order?.payWay == 2) 4 else way,order!!.cancelId,type).request(this){_,data-> if (way == 3) onPaySuccess() else if (way == 2) PayUtil.aliPay(this,data!!.orderInfo) else PayUtil.weChatPay(data!!) } else HttpManager.payTaxiOrder(id,if (order?.payWay == 2) 4 else way,type,if (couponId == 0) null else couponId,if (couponType == 0) null else couponType).request(this){_,data-> if (way == 3) onPaySuccess() else if (way == 2) PayUtil.aliPay(this,data!!.orderInfo) else PayUtil.weChatPay(data!!) } } /** app/src/main/res/layout/dialog_pay.xml
@@ -105,7 +105,9 @@ android:drawableEnd="@drawable/selector_radio" android:text="支付宝" /> <View style="@style/style_form_divider_line" /> <View android:id="@+id/line1" style="@style/style_form_divider_line" /> <RadioButton android:id="@+id/rb_wx" @@ -115,7 +117,8 @@ android:drawableEnd="@drawable/selector_radio" android:text="微信支付" /> <View style="@style/style_form_divider_line" /> <View style="@style/style_form_divider_line" android:id="@+id/line2" /> <RadioButton android:id="@+id/rb_balance"