lmw
2023-06-16 03972ad1d3ce6ffe0be0395c0a4d5dcb4474031f
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!!)
            }
    }
    /**