package com.igo.user.ui.trip
|
|
import android.annotation.SuppressLint
|
import android.app.Activity
|
import android.graphics.Typeface
|
import android.util.Log
|
import android.view.View
|
import android.widget.CheckBox
|
import android.widget.TextView
|
import androidx.core.os.bundleOf
|
import cn.sinata.xldutils.callPhone
|
import cn.sinata.xldutils.gone
|
import cn.sinata.xldutils.hide
|
import cn.sinata.xldutils.invisible
|
import cn.sinata.xldutils.toBrowser
|
import cn.sinata.xldutils.utils.SPUtils
|
import cn.sinata.xldutils.utils.SpanBuilder
|
import cn.sinata.xldutils.utils.myToast
|
import cn.sinata.xldutils.utils.optDouble
|
import cn.sinata.xldutils.utils.optInt
|
import cn.sinata.xldutils.utils.showAllowingStateLoss
|
import cn.sinata.xldutils.visible
|
import com.facebook.drawee.view.SimpleDraweeView
|
import com.igo.user.IGoApplication
|
import com.igo.user.R
|
import com.igo.user.dialog.ChooseCardDialog
|
import com.igo.user.dialog.PayDialog
|
import com.igo.user.dialog.ShareDialog
|
import com.igo.user.dialog.SpecialSuggestDialog
|
import com.igo.user.dialog.TipDialog
|
import com.igo.user.interfaces.OrderStateChangeListener
|
import com.igo.user.interfaces.StringCallback
|
import com.igo.user.network.Apis
|
import com.igo.user.network.HttpManager
|
import com.igo.user.network.entity.Order
|
import com.igo.user.network.entity.TrippingInfo
|
import com.igo.user.network.request
|
import com.igo.user.ui.TransparentStatusBarActivity
|
import com.igo.user.ui.crosscity.PayCrossActivity
|
import com.igo.user.ui.crosscity.ShuttleBusActivity
|
import com.igo.user.utils.Const
|
import com.igo.user.utils.IGoShareUtils
|
import com.igo.user.utils.pay.PayListener
|
import com.igo.user.utils.pay.PayUtil
|
import com.igo.user.utils.showMoney
|
import com.igo.user.views.CenterFlowLayout
|
import com.igo.user.views.RatingBar
|
import com.share.utils.ShareUtils
|
import com.umeng.socialize.UMShareListener
|
import com.umeng.socialize.bean.SHARE_MEDIA
|
import org.jetbrains.anko.find
|
import org.jetbrains.anko.sdk27.coroutines.onClick
|
import org.jetbrains.anko.startActivity
|
|
class OrderDetailActivity : TransparentStatusBarActivity(), OrderStateChangeListener, PayListener,
|
UMShareListener {
|
override fun setContentView() = R.layout.activity_order_detail
|
|
private val id by lazy {
|
intent.getIntExtra("id", 0)
|
}
|
private val type by lazy {
|
intent.getIntExtra("type", 0)
|
}
|
private val doPay by lazy { intent.getBooleanExtra("doPay", false) }
|
|
private var order: Order? = null
|
private var payMoney = 0.0//支付费用
|
private var isGotoWx = false //是否跳转到微信小程序支付 true:回来时需要查询是否支付成功
|
|
private var score = 0
|
|
private val iv_call by lazy { find<View>(R.id.iv_call) }
|
private val tv_title1 by lazy { find<TextView>(R.id.tv_title1) }
|
private val tv_detail by lazy { find<TextView>(R.id.tv_detail) }
|
private val tv_pay_offline by lazy { find<TextView>(R.id.tv_pay_offline) }
|
private val rating by lazy { find<RatingBar>(R.id.rating) }
|
private val iv_header_home by lazy { find<SimpleDraweeView>(R.id.iv_header_home) }
|
private val tv_start by lazy { find<TextView>(R.id.tv_start) }
|
private val tv_end by lazy { find<TextView>(R.id.tv_end) }
|
private val tv_time by lazy { find<TextView>(R.id.tv_time) }
|
private val tv_name by lazy { find<TextView>(R.id.tv_name) }
|
private val tv_car by lazy { find<TextView>(R.id.tv_car) }
|
private val tv_car_info by lazy { find<TextView>(R.id.tv_car_info) }
|
private val tv_score by lazy { find<TextView>(R.id.tv_score) }
|
private val tv_count by lazy { find<TextView>(R.id.tv_count) }
|
private val tv_passenger_num by lazy { find<TextView>(R.id.tv_passenger_num) }
|
private val tv_remark by lazy { find<TextView>(R.id.tv_remark) }
|
private val tv_tip by lazy { find<TextView>(R.id.tv_tip) }
|
private val tv_title by lazy { find<TextView>(R.id.tv_title) }
|
private val tv_money by lazy { find<TextView>(R.id.tv_money) }
|
private val tv_frozen by lazy { find<TextView>(R.id.tv_frozen) }
|
private val tv_action by lazy { find<TextView>(R.id.tv_action) }
|
private val cl_evaluate by lazy { find<View>(R.id.cl_evaluate) }
|
private val fl_label by lazy { find<CenterFlowLayout>(R.id.fl_label) }
|
private val tv_confirm_fee by lazy { find<View>(R.id.tv_confirm_fee) }
|
|
|
private val cl_driver by lazy { find<View>(R.id.cl_driver) }
|
|
|
private var isCancel = false
|
private var balance = -1.0
|
private var coupon = 0
|
private var redTotal = 0.0
|
private var deductionAmount = 0.0
|
|
private val app by lazy {
|
application as IGoApplication
|
}
|
|
//订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)加个15作为改派成功
|
override fun initClick() {
|
iv_call.setOnClickListener {
|
callPhone(order?.driverPhone)
|
}
|
tv_action.setOnClickListener {
|
if ((balance >= 0 && order?.state == 7) || order?.state == 12) {
|
val payDialog = PayDialog()
|
payDialog.arguments = bundleOf(
|
"isCancel" to (order?.state == 12),
|
"balance" to balance,
|
"coupon" to coupon,
|
"money" to payMoney,
|
"id" to id,
|
"type" to type,
|
"isFrozen" to (order?.isDispute == 1),
|
"discount" to order?.discountMoney,
|
"redTotal" to redTotal,
|
"deductionAmount" to deductionAmount
|
)
|
payDialog.setCallback(object : PayDialog.Callback {
|
override fun onOk(way: Int, couponId: Int, useRed: Boolean) {
|
if (way == 2) {
|
val dialog = ChooseCardDialog()
|
dialog.setCallback(object : StringCallback {
|
override fun onRlt(rlt: String) {
|
pay(way, couponId, rlt, useRed)
|
}
|
})
|
dialog.show(supportFragmentManager, "card")
|
} else
|
pay(way, couponId, null, useRed)
|
payDialog.dismiss()
|
}
|
|
override fun onClose() {
|
}
|
})
|
payDialog.show(supportFragmentManager, "pay")
|
} else if (order?.state == 8) {
|
HttpManager.orderEvaluate(id, score, type, checkList.joinToString(",") { it })
|
.request(this) { _, _ ->
|
setResult(Activity.RESULT_OK)
|
myToast(getString(R.string.评价成功))
|
tv_action.gone()
|
tv_title1.text = getString(R.string.评价详情)
|
getData()
|
getRedMoney()
|
}
|
}
|
}
|
rating.setOnRatingChangeListener {
|
if (!rating.clickable)
|
return@setOnRatingChangeListener
|
tv_action.visible()
|
if (it.toInt() != score)
|
inputLabel(it.toInt())
|
score = it.toInt()
|
}
|
iv_header_home.setOnClickListener {
|
if (order != null)
|
startActivity<DriverDetailActivity>("id" to order!!.driverId)
|
}
|
tv_detail.onClick {
|
startActivity<PriceDetailActivity>("order" to order)
|
}
|
tv_pay_offline.onClick {
|
// val tipDialog = TipDialog()
|
// tipDialog.arguments = bundleOf("msg" to "是否确认已线下支付费用?","ok" to "确认","cancle" to "取消")
|
// tipDialog.setCallback(object :TipDialog.OnClickCallback{
|
// override fun onOk() {
|
// HttpManager.completeOrder(id,type).request(this@OrderDetailActivity){_,_->
|
// onPaySuccess()
|
// }
|
// }
|
//
|
// override fun onCancel() {
|
// }
|
// })
|
// tipDialog.show(supportFragmentManager,"offline")
|
}
|
}
|
|
override fun initView() {
|
titleBar.addRightButton(
|
getString(R.string.投诉司机),
|
onClickListener = View.OnClickListener {
|
order?.driverId?.let {
|
startActivity<ComplainActivity>("id" to it)
|
}
|
})
|
showDialog()
|
getData()
|
PayUtil.addPayListener(this)
|
app.addTripStateListener(this)
|
}
|
|
private fun getData() {
|
HttpManager.queryOrderInfo(id, type).request(this) { _, data ->
|
order = data
|
data?.run {
|
tv_start.text = startAddress
|
tv_end.text = endAddress
|
tv_time.text = travelTime
|
iv_header_home.setImageURI(driverAvatar)
|
tv_name.text = driverName
|
tv_car.text = licensePlate
|
tv_car_info.text = "$brand·$carColor"
|
tv_score.text = String.format("%.1f", score)
|
tv_count.text = getString(R.string.单数, orderNum)
|
if (type == Const.OrderType.TYPE_CROSS_CITY) {
|
tv_passenger_num.visible()
|
tv_passenger_num.text =
|
String.format("%d人乘车:%s号座位", peopleNumber, seatNumber)
|
.replace(",", "号,")
|
tv_remark.visibility = if (!remark.isNullOrEmpty()) View.VISIBLE else View.GONE
|
tv_remark.text = remark
|
}
|
|
if (type == Const.OrderType.TYPE_SAME_CITY) {
|
tv_remark.visible()
|
tv_remark.text = if (remark.isNullOrEmpty()) "——" else remark
|
}
|
|
setStateUI()
|
if (state == 10 || state == 12)
|
tv_tip.text = getString(R.string.乘客在司机到达上车点后取消了行程)
|
else if (tipMoney == 0.0) {
|
tv_tip.invisible()
|
} else {
|
tv_tip.typeface = Typeface.DEFAULT_BOLD
|
val content = getString(R.string.tips_is, tipMoney)
|
tv_tip.text = SpanBuilder(content).color(
|
this@OrderDetailActivity,
|
6,
|
content.length,
|
R.color.colorPrimary
|
).build()
|
}
|
if (order!!.isFree == "2") {//首单免费订单
|
tv_title.visible()
|
tv_money.visible()
|
tv_title.text = "此次行程免费,无需支付"
|
tv_money.text = order!!.orderMoney.showMoney(this@OrderDetailActivity)
|
}
|
if (order!!.isFrozen == 2) {
|
tv_frozen.visible()
|
val language = SPUtils.instance().getString("language", "en")
|
val ic = when (language) {
|
"en" -> R.mipmap.yidongjie_e
|
"ch" -> R.mipmap.yidongjie
|
else -> R.mipmap.yidongjie_f
|
}
|
tv_frozen.setCompoundDrawablesRelativeWithIntrinsicBounds(0, ic, 0, 0)
|
}
|
}
|
}
|
}
|
|
/**
|
* 评价成功以后需要查询是否可以获得分享红包
|
*/
|
private var hasGetRed = false //防止多次触发红包获取
|
|
@SuppressLint("StringFormatMatches")
|
private fun getRedMoney() {
|
HttpManager.queryRedMoney(id, type).request(this) { _, data ->
|
data?.let {
|
val money = it.optDouble("amount")
|
if (money > 0) {
|
val tipDialog = TipDialog()
|
tipDialog.arguments = bundleOf(
|
"msg" to String.format(
|
getString(
|
R.string.分享APP给好友可以获得红包,
|
money.showMoney(this)
|
)
|
),
|
"ok" to getString(R.string.去分享), "cancel" to getString(R.string.不分享)
|
)
|
tipDialog.setCallback(object : TipDialog.OnClickCallback {
|
override fun onOk() {
|
val shareDialog = ShareDialog()
|
shareDialog.setCallback(object : ShareDialog.Callback {
|
override fun onOk(way: Int) { //0:wx 1:qq 2:msg
|
val language = SPUtils.instance().getString("language", "en")
|
val languageP =
|
if (language == "ch") 1 else if (language == "en") 2 else 3
|
val url = String.format(
|
Apis.SHARE_URL,
|
languageP,
|
languageP,
|
SPUtils.instance().getInt(Const.User.USER_ID)
|
)
|
if (way == 3) {
|
IGoShareUtils.shareWA(
|
this@OrderDetailActivity,
|
getString(R.string.下载注册即送打车券),
|
url
|
)
|
} else
|
if (way == 4) {
|
IGoShareUtils.shareFB(
|
this@OrderDetailActivity,
|
url,
|
getString(R.string.下载注册即送打车券),
|
null
|
)
|
} else if (way == 5) {
|
IGoShareUtils.shareTweet(
|
this@OrderDetailActivity,
|
getString(R.string.下载注册即送打车券),
|
url
|
)
|
} else {
|
ShareUtils.share(
|
this@OrderDetailActivity,
|
if (way == 0) SHARE_MEDIA.WEIXIN else if (way == 1) SHARE_MEDIA.QQ else
|
SHARE_MEDIA.MORE,
|
getString(R.string.下载注册即送打车券),
|
Const.Share.TITLE,
|
url,
|
this@OrderDetailActivity,
|
""
|
)
|
}
|
shareDialog.dismiss()
|
if (!hasGetRed) {
|
hasGetRed = true
|
getRed(money)
|
}
|
}
|
})
|
shareDialog.showAllowingStateLoss(supportFragmentManager, "share")
|
}
|
|
override fun onCancel() {}
|
})
|
tipDialog.showAllowingStateLoss(supportFragmentManager, "red")
|
}
|
}
|
|
}
|
}
|
|
private fun setStateUI() {
|
tv_pay_offline.gone()
|
tv_confirm_fee.gone()
|
cl_driver.visible()
|
when (order?.state) {
|
6 -> { //已送达
|
title = getString(R.string.待确认费用)
|
tv_action.gone()
|
tv_money.text = ""
|
tv_confirm_fee.visible()
|
}
|
|
7 -> { //待支付
|
cl_driver.gone()
|
payMoney = order!!.orderMoney!!
|
tv_money.text = payMoney.showMoney(this)
|
title = getString(R.string.支付费用)
|
if (order?.isFrozen != 2) {
|
tv_pay_offline.visible() //新增提示文字
|
tv_action.visible()
|
}
|
tv_title.visible()
|
tv_action.text = getString(R.string.立即支付)
|
queryBalance()
|
if (order!!.device == 2) {//车载端,显示线下付款按钮 2.0客户反馈,不要该按钮
|
// tv_pay_offline.visible()
|
}
|
if (type == Const.OrderType.TYPE_SPECIAL || type == Const.OrderType.TYPE_SAME_CITY) //专车有查看明细 ,物流也有
|
tv_detail.visible()
|
}
|
|
8 -> { //待评价
|
title =
|
if (type == Const.OrderType.TYPE_CROSS_CITY) getString(R.string.已完成) else getString(
|
R.string.evaluate
|
)
|
tv_money.text = order!!.payMoney.showMoney(this)
|
if (0.0 == order!!.payMoney && order!!.tipMoney == 0.0) { //其他方式收费
|
tv_money.invisible()
|
tv_tip.invisible()
|
}
|
tv_title.hide()
|
tv_action.text = getString(R.string.匿名评价)
|
titleBar.getRightButton(0)?.visible()
|
if (order?.isFrozen != 2) {
|
cl_evaluate.visible()
|
}
|
tv_detail.visible()
|
if (type == Const.OrderType.TYPE_SPECIAL) //专车有查看明细
|
tv_detail.visible()
|
if (type == Const.OrderType.TYPE_CROSS_CITY) {//跨城要提示摆渡车
|
val specialSuggestDialog = SpecialSuggestDialog()
|
specialSuggestDialog.setCallback(object : StringCallback {
|
override fun onRlt(rlt: String) {
|
if (rlt == "ok")
|
startActivity<ShuttleBusActivity>(
|
"order" to order,
|
"isStart" to false
|
)
|
}
|
})
|
specialSuggestDialog.show(supportFragmentManager, "suggest")
|
}
|
}
|
|
9 -> { //已完成
|
title = getString(R.string.行程结束)
|
tv_money.text = order!!.payMoney.showMoney(this)
|
if (0.0 == order!!.payMoney && order!!.tipMoney == 0.0) { //其他方式收费
|
tv_money.invisible()
|
tv_tip.invisible()
|
}
|
tv_action.gone()
|
titleBar.getRightButton(0)?.visible()
|
if (order?.isFrozen != 2) {
|
cl_evaluate.visible()
|
}
|
rating.isClickable = false
|
order?.orderScore?.let {
|
rating.setStar(order!!.orderScore!!.toFloat())
|
}
|
|
fl_label.removeAllViews()
|
val list = arrayListOf<String>()
|
order?.orderScore?.let {
|
list.addAll(getLabelList(order!!.orderScore!!))
|
}
|
|
val split = order!!.evaluate!!.split(",")
|
list.forEach {
|
val view = layoutInflater.inflate(R.layout.item_score_label, null) as CheckBox
|
view.text = it
|
view.isEnabled = false
|
if (it in split)
|
view.isChecked = true
|
fl_label.addView(view)
|
}
|
tv_detail.visible()
|
}
|
|
10 -> {
|
title = getString(R.string.已取消)
|
tv_money.text = order!!.cancelPayMoney.showMoney(this)
|
titleBar.getRightButton(0)?.gone() //刘矩:已取消没有投诉
|
if (type == Const.OrderType.TYPE_CROSS_CITY) { //跨城取消没有扣钱
|
tv_money.gone()
|
tv_tip.gone()
|
}
|
}
|
|
12 -> {//取消待支付
|
title = getString(R.string.支付费用)
|
titleBar.getRightButton(0)?.gone()
|
order?.cancelPayMoney?.let {
|
payMoney = order!!.cancelPayMoney!!
|
}
|
|
tv_money.text = payMoney.showMoney(this)
|
if (order?.isFrozen != 2) {
|
tv_action.visible()
|
}
|
tv_title.visible()
|
tv_action.text = getString(R.string.立即支付)
|
}
|
}
|
}
|
|
//一至五星评价内容
|
private val list1 by lazy {
|
arrayListOf(
|
getString(R.string.车辆不符),
|
getString(R.string.司机不符),
|
getString(R.string.态度恶劣),
|
getString(R.string.行为不端),
|
getString(R.string.违反交通),
|
getString(R.string.额外收费)
|
)
|
}
|
private val list2 by lazy {
|
arrayListOf(
|
getString(R.string.故意绕路),
|
getString(R.string.额外加人),
|
getString(R.string.送错地点),
|
getString(R.string.车辆肮脏),
|
getString(R.string.司机迟到),
|
getString(R.string.中途换车)
|
)
|
}
|
private val list3 by lazy {
|
arrayListOf(
|
getString(R.string.车内异味),
|
getString(R.string.开车不稳),
|
getString(R.string.道路不熟),
|
getString(R.string.接打电话),
|
getString(R.string.索要好评),
|
getString(R.string.索要小费)
|
)
|
}
|
private val list4 by lazy {
|
arrayListOf(
|
getString(R.string.基本整洁),
|
getString(R.string.基本礼貌),
|
getString(R.string.基本平稳),
|
getString(R.string.基本准时),
|
getString(R.string.基本友好),
|
getString(R.string.基本合理)
|
)
|
}
|
private val list5 by lazy {
|
arrayListOf(
|
getString(R.string.车辆美观),
|
getString(R.string.内部整洁),
|
getString(R.string.路线优化),
|
getString(R.string.接待礼貌),
|
getString(R.string.驾驶平稳),
|
getString(R.string.服务卓越)
|
)
|
}
|
|
private fun getLabelList(star: Int): List<String> {
|
return when (star) {
|
5 -> list5
|
4 -> list4
|
3 -> list3
|
2 -> list2
|
else -> list1
|
}
|
}
|
|
private val checkList = arrayListOf<String>()
|
private fun inputLabel(start: Int) {
|
fl_label.removeAllViews()
|
checkList.clear()
|
val list = arrayListOf<String>()
|
list.addAll(getLabelList(start))
|
list.forEach {
|
val view = layoutInflater.inflate(R.layout.item_score_label, null) as CheckBox
|
view.text = it
|
view.setOnCheckedChangeListener { _, isChecked ->
|
if (isChecked)
|
checkList.add(view.text.toString())
|
else
|
checkList.remove(view.text.toString())
|
}
|
fl_label.addView(view)
|
}
|
}
|
|
/**
|
* 查询余额和优惠券以供支付
|
*/
|
private fun queryBalance() {
|
HttpManager.queryBalance(id, type).request(this) { _, data ->
|
data?.let {
|
isCancel = order?.state == 12
|
balance = it.optDouble("balance")
|
coupon = it.optInt("coupon")
|
redTotal = it.optDouble("redTotal")
|
deductionAmount = it.optDouble("deductionAmount")
|
if (doPay)
|
tv_action.callOnClick()
|
}
|
}
|
}
|
|
/**
|
* @param way 1=微信,2=支付宝,3=余额,4=现金
|
*/
|
private fun pay(way: Int, couponId: Int, cardId: String?, useRed: Boolean) {
|
tv_action.isEnabled = false
|
if (order!!.state == 12)
|
HttpManager.cancleOrderTaxi(id, way, order!!.cancelId!!, type, cardId)
|
.request(this, success = { _, data ->
|
tv_action.isEnabled = true
|
if (way == 3)
|
onPaySuccess()
|
else {
|
isGotoWx = true
|
toBrowser(data ?: "")
|
}
|
}) { _, _ ->
|
tv_action.isEnabled = true
|
}
|
else {
|
Log.e("当前订单详情: ", "开始支付${type} ")
|
HttpManager.payTaxiOrder(
|
id,
|
way,
|
type,
|
if (couponId == 0) null else couponId,
|
cardId,
|
if (useRed) 1 else 0
|
).request(this, success = { _, data ->
|
|
tv_action.isEnabled = true
|
if (way in 3..4) {
|
if (type == 4) {
|
Log.e("当前订单详情: ", "小件物流支付成功进入下个流程 ")
|
queryTripping()
|
} else {
|
|
}
|
onPaySuccess()
|
|
} else {
|
isGotoWx = true
|
toBrowser(data.toString() ?: "")
|
}
|
}) { _, _ ->
|
tv_action.isEnabled = true
|
}
|
}
|
|
}
|
|
/**
|
* 查询是否有进行中的订单
|
*/
|
fun queryTripping() {
|
HttpManager.queryServingOrder().request(this, false) { _, data ->
|
data?.let {
|
if (!it.isNullOrEmpty()) {
|
|
val order = data[0]
|
|
Log.e("当前订单详情: ", "order.state ${order.state}")
|
Log.e("当前订单详情: ", "order.orderType ${order.orderType}")
|
if (order.state in (1..5) || order.state == 11)
|
startActivity<TripActivity>(
|
"id" to order.orderId,
|
"type" to order.orderType
|
)
|
else if (order.state == 7 && order.orderType == Const.OrderType.TYPE_CROSS_CITY) {
|
startActivity<PayCrossActivity>("id" to order.orderId)
|
} else
|
startActivity<OrderDetailActivity>(
|
"id" to order.orderId,
|
"type" to order.orderType
|
)
|
if (!IGoApplication.hasAutoGoTripping) {
|
tv_tip.callOnClick()
|
IGoApplication.hasAutoGoTripping = true
|
}
|
|
finish()
|
}
|
}
|
}
|
}
|
|
|
/**
|
* 分享后获得红包
|
*/
|
private fun getRed(money: Double) {
|
HttpManager.shareRedEnvelope(id, type).request(this) { _, _ ->
|
val tipDialog = TipDialog()
|
tipDialog.arguments = bundleOf(
|
"msg" to String.format(
|
getString(R.string.您收到一个打车红包下次打车可抵扣金额),
|
money.showMoney(this)
|
),
|
"ok" to getString(R.string.确定), "isAlert" to true
|
)
|
tipDialog.showAllowingStateLoss(supportFragmentManager, "red")
|
}
|
}
|
|
override fun onPaySuccess() {
|
myToast(getString(R.string.支付成功))
|
setResult(Activity.RESULT_OK)
|
tv_title.hide()
|
tv_action.gone()
|
if (order?.state == 12) {
|
title = getString(R.string.已取消)
|
titleBar.getRightButton(0).gone()
|
} else {
|
showDialog()
|
getData()
|
}
|
|
|
}
|
|
override fun onPayCancel() {
|
|
}
|
|
override fun onResume() {
|
super.onResume()
|
if (isGotoWx) {
|
isGotoWx = false
|
HttpManager.queryOrderInfo(id, type).request(this) { _, data ->
|
if (data?.state == order?.state) {
|
myToast(getString(R.string.支付失败))
|
} else {
|
onPaySuccess()
|
}
|
}
|
}
|
}
|
|
|
override fun onDestroy() {
|
super.onDestroy()
|
PayUtil.removePayListener(this)
|
app.removeTripStateListener(this)
|
}
|
|
override fun onResult(p0: SHARE_MEDIA?) {
|
}
|
|
override fun onCancel(p0: SHARE_MEDIA?) {
|
}
|
|
override fun onError(p0: SHARE_MEDIA?, p1: Throwable?) {
|
}
|
|
override fun onStart(p0: SHARE_MEDIA?) {
|
|
}
|
|
override fun onStateChanged(id: Int, state: Int) {
|
if (id == this.id && order?.state == 6) { //当前是待司机确认费用,需要重新获取订单信息
|
getData()
|
}
|
}
|
|
override fun onTrippingChanged(info: TrippingInfo) {
|
}
|
|
override fun onAddressChanged(info: TrippingInfo) {
|
}
|
|
override fun onShuttleConfirm(id: Int, type: Int) {
|
}
|
|
}
|