| | |
| | | import cn.sinata.xldutils.utils.myToast |
| | | import cn.sinata.xldutils.visible |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.ui.trip.ChooseCouponActivity |
| | | import com.igo.user.utils.Const |
| | | import com.igo.user.utils.showMoney |
| | |
| | | } |
| | | if (deductionAmount!=0.0){ |
| | | group_red.visible() |
| | | val redMoney = getString(R.string.money_is,deductionAmount).replace(",",".") |
| | | val redTotals = getString(R.string.money_is,redTotal).replace(",",".") |
| | | val redMoney = getString(R.string.money_is,deductionAmount).replace(",",".").extClearInvalidZero() |
| | | val redTotals = getString(R.string.money_is,redTotal).replace(",",".").extClearInvalidZero() |
| | | val redBalance = getString(R.string.红包余额).format(redTotals) |
| | | val s = getString(R.string.红包余额和可用红包抵扣).format(redBalance,redMoney) |
| | | cb_red.text = SpanBuilder(s).bold(0,s.indexOf(redBalance)).bold(s.indexOf(redBalance)+redBalance.length,s.length) |
| | |
| | | cb_red.isChecked = false |
| | | couponId = data.getIntExtra("id",0) |
| | | couponMoney = data.getDoubleExtra("money", 0.0) |
| | | tv_coupon.text = String.format("-%.2f", couponMoney) |
| | | tv_coupon.text = String.format("-%.2f", couponMoney).extClearInvalidZero() |
| | | tv_money.text = (money-couponMoney).showMoney(requireContext()) |
| | | } |
| | | } |
| New file |
| | |
| | | package com.igo.user.extension |
| | | |
| | | //扩展函数 清除无效0 |
| | | fun String.extClearInvalidZero(): String { |
| | | if (endsWith(".000")) { |
| | | return replace(".000", "") |
| | | } |
| | | if (endsWith(".00")) { |
| | | return replace(".00", "") |
| | | } |
| | | if (endsWith(".0")) { |
| | | return replace(".0", "") |
| | | } |
| | | return this |
| | | } |
| | |
| | | import android.content.Context |
| | | import android.os.Parcelable |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import kotlinx.android.parcel.Parcelize |
| | | |
| | | @Parcelize |
| | | data class Order( |
| | | val differenceMoney: Double = 0.0, |
| | | val differenceMoney: String = "", |
| | | val serverCarModel: String = "", |
| | | val cancelReason: String = "", |
| | | val cancelRemark: String = "", |
| | |
| | | val startLon: Double = 0.0, |
| | | val cancelPayMoney: Double = 0.0, |
| | | val cancelMoney: Double = 0.0, |
| | | val orderMoney: Double = 0.0, |
| | | val orderMoney: String = "", |
| | | val startAddress: String = "", |
| | | val cargoType: String = "", |
| | | val remark: String = "", |
| | |
| | | val imgOne: String? = "", //司机取快件拍摄照片 |
| | | val imgTwo: String? = "", //司机送达快件拍摄照片 |
| | | ) : Parcelable { |
| | | fun getDifferenceMoneyValue(): Double { |
| | | return differenceMoney.toDoubleOrNull() ?: 0.0 |
| | | } |
| | | |
| | | fun getShowDifferenceMoney(): String { |
| | | return differenceMoney.extClearInvalidZero() |
| | | } |
| | | |
| | | fun getOrderMoneyValue(): Double { |
| | | return orderMoney.toDoubleOrNull() ?: 0.0 |
| | | } |
| | | |
| | | fun getShowOrderMoney(): String { |
| | | return orderMoney.extClearInvalidZero() |
| | | } |
| | | |
| | | fun getStateStr() = when(state){ |
| | | 1->R.string.等待应答 |
| | |
| | | else |
| | | R.string.已完成 |
| | | } |
| | | |
| | | 10->R.string.已取消 |
| | | 11->R.string.改派中 |
| | | 12->R.string.取消待支付 |
| | |
| | | else |
| | | R.string.已完成 |
| | | } |
| | | |
| | | 10->R.string.已取消 |
| | | 11->R.string.改派中 |
| | | 12->R.string.取消待支付 |
| | |
| | | 4->R.string.小件物流优惠券 |
| | | else->0 |
| | | } |
| | | |
| | | fun getTypeBg() = when(userType){ |
| | | 0->R.mipmap.bg_coupon_blue |
| | | 1->R.mipmap.bg_coupon_green |
| | |
| | | 4->R.mipmap.bg_coupon_orange |
| | | else->R.mipmap.bg_coupon_grey |
| | | } |
| | | |
| | | fun getRangeStr() = when(userType){ |
| | | 4->R.string.仅限小件物流使用 |
| | | 0->R.string.可用于打车和快件 |
| | | else->R.string.仅限专车使用 |
| | | } |
| | | |
| | | fun getFullMoney(context: Context) = if (type == 1) "" else context.getString(R.string.full_discount).format(fullMoney.toString(),money.toString()) |
| | | fun getFullMoney(context: Context) = |
| | | if (type == 1) "" else context.getString(R.string.full_discount) |
| | | .format(fullMoney.toString().extClearInvalidZero(), money.toString().extClearInvalidZero()) |
| | | |
| | | fun getNameStr() = if (name.length <= 6) name else "${name.substring(0,6)}..." |
| | | } |
| | |
| | | HttpManager.queryBalance(id,Const.OrderType.TYPE_CROSS_CITY).request(this,success = {_,data-> |
| | | data?.let { |
| | | mPayDialog.arguments = bundleOf("balance" to it.optDouble("balance"), |
| | | "coupon" to it.optInt("coupon"),"money" to order!!.orderMoney,"id" to id,"type" to Const.OrderType.TYPE_CROSS_CITY) |
| | | "coupon" to it.optInt("coupon"),"money" to order!!.getOrderMoneyValue(),"id" to id,"type" to Const.OrderType.TYPE_CROSS_CITY) |
| | | } |
| | | }){_,_-> |
| | | myToast("余额获取失败") |
| | | mPayDialog.arguments = bundleOf("money" to order!!.orderMoney,"id" to id,"type" to Const.OrderType.TYPE_CROSS_CITY) |
| | | mPayDialog.arguments = bundleOf("money" to order!!.getOrderMoneyValue(),"id" to id,"type" to Const.OrderType.TYPE_CROSS_CITY) |
| | | } |
| | | } |
| | | |
| | |
| | | import org.jetbrains.anko.support.v4.startActivityForResult |
| | | import java.math.RoundingMode |
| | | import androidx.core.view.isVisible |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | |
| | | class LogisticsFragment : BaseFragment(), PayListener { |
| | | override fun contentViewId() = R.layout.fragment_logistics |
| | |
| | | val ll_car = view.find<View>(R.id.ll_car) |
| | | tv_name.text = it.name |
| | | tv_price.text = |
| | | getString(R.string.预估价格, it.amount).replace(",", ".") |
| | | getString(R.string.预估价格, it.amount).replace(",", ".").extClearInvalidZero() |
| | | iv_car.setImageURI(it.img) |
| | | ll_estimate_price.visible() |
| | | tv_estimate_price.visible() |
| | |
| | | 2, |
| | | RoundingMode.HALF_UP |
| | | ).toDouble() |
| | | tv_estimate_price.text = "FCFA $estimatePrice" |
| | | tv_estimate_price.text = "FCFA $estimatePrice".extClearInvalidZero() |
| | | |
| | | if (index == 0) { //默认选择第一个 |
| | | carTypeId = it.id |
| | |
| | | "isCancel" to false, |
| | | "balance" to balance, |
| | | "coupon" to coupon, |
| | | "money" to order!!.orderMoney, |
| | | "money" to order!!.getOrderMoneyValue(), |
| | | "id" to id, |
| | | "type" to type, |
| | | "isFrozen" to (order?.isDispute == 1), |
| | |
| | | import cn.sinata.xldutils.callPhone |
| | | import com.facebook.drawee.view.SimpleDraweeView |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.network.HttpManager |
| | | import com.igo.user.network.request |
| | | import com.igo.user.ui.TransparentStatusBarActivity |
| | |
| | | iv_call.setOnClickListener { |
| | | callPhone(driverPhone) |
| | | } |
| | | tv_money.text = getString(R.string.money_is,payMoney) |
| | | tv_money.text = getString(R.string.money_is,payMoney).extClearInvalidZero() |
| | | val view = layoutInflater.inflate(R.layout.item_price_detail, null) |
| | | view.find<TextView>(R.id.tv_name).text = getString(R.string.里程费及公里数,mileage).replace(",",".") |
| | | view.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,mileageMoney) |
| | | view.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,mileageMoney).extClearInvalidZero() |
| | | ll_detail.addView(view) |
| | | // if (differenceMoney!=0.0){ |
| | | val view1 = layoutInflater.inflate(R.layout.item_price_detail, null) |
| | | view1.find<TextView>(R.id.tv_name).text = getString(R.string.补差价) |
| | | view1.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,differenceMoney) |
| | | view1.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,differenceMoney).extClearInvalidZero() |
| | | ll_detail.addView(view1) |
| | | // } |
| | | // if (couponMoney!=0.0){ |
| | | val view2 = layoutInflater.inflate(R.layout.item_price_detail, null) |
| | | view2.find<TextView>(R.id.tv_name).text = getString(R.string.优惠券) |
| | | view2.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,couponMoney) |
| | | view2.find<TextView>(R.id.tv_price).text = getString(R.string.money_is,couponMoney).extClearInvalidZero() |
| | | ll_detail.addView(view2) |
| | | // } |
| | | } |
| | |
| | | HttpManager.queryUserInfo().requestByF(this@TripOrderFragment){_,data-> |
| | | data?.let { |
| | | val payDialog = PayDialog() |
| | | payDialog.arguments = bundleOf("money" to order.differenceMoney,"isLogistics" to true, |
| | | payDialog.arguments = bundleOf("money" to order.getDifferenceMoneyValue(),"isLogistics" to true, |
| | | "balance" to it.balance) |
| | | payDialog.setCallback(object :PayDialog.Callback{ |
| | | override fun onOk(way: Int, couponId: Int,useRed:Boolean) { |
| | |
| | | package com.igo.user.ui.mine.adapter |
| | | |
| | | import android.util.Log |
| | | import android.view.View |
| | | import android.widget.TextView |
| | | import cn.sinata.xldutils.adapter.HFRecyclerAdapter |
| | |
| | | import cn.sinata.xldutils.utils.myToast |
| | | import cn.sinata.xldutils.visible |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.network.entity.Order |
| | | import org.jetbrains.anko.sdk27.coroutines.onClick |
| | | import org.jetbrains.anko.textColorResource |
| | |
| | | } |
| | | 7->{ |
| | | pay.visible() |
| | | pay.text = context.getString(R.string.立即支付含金额,data.orderMoney).replace(",",".") |
| | | pay.text = context.getString(R.string.立即支付含金额,data.getShowOrderMoney()).replace(",",".").extClearInvalidZero() |
| | | line.visible() |
| | | pay.onClick { |
| | | callback.onPay(position) |
| | |
| | | } |
| | | 13->{ |
| | | pay.visible() |
| | | pay.text = context.getString(R.string.支付差价及金额,data.differenceMoney).replace(",",".") |
| | | pay.text = context.getString(R.string.支付差价及金额,data.getShowDifferenceMoney()).replace(",",".") |
| | | line.visible() |
| | | pay.onClick { |
| | | callback.onPay(position) |
| | |
| | | import cn.sinata.xldutils.visible |
| | | import com.daimajia.swipe.SwipeLayout |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.interfaces.OnDelCallback |
| | | import com.igo.user.network.entity.Coupon |
| | | import com.igo.user.utils.Const |
| | |
| | | holder.setText(R.id.tv_agency,data.getNameStr()) |
| | | holder.setText(R.id.tv_deadline,context.getString(R.string.有效期至,data.time)) |
| | | holder.setText(R.id.tv_range,context.getString(data.getRangeStr())+data.getFullMoney(context)) |
| | | holder.setText(R.id.tv_money, String.format("%.2f",data.money)) |
| | | holder.setText(R.id.tv_money, String.format("%.2f",data.money).extClearInvalidZero()) |
| | | holder.bind<CheckedTextView>(R.id.radio_check).invisible() |
| | | // holder.setText(R.id.tv_condition, if (data.type == 2) String.format("满%.2f元可用",data.fullMoney) else "") |
| | | holder.bind<View>(R.id.cl_left).backgroundResource = if (type == 2) R.mipmap.bg_coupon_grey else data.getTypeBg() |
| | |
| | | import androidx.core.view.isVisible |
| | | import androidx.core.net.toUri |
| | | import androidx.core.graphics.toColorInt |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | |
| | | class MapTripFragment : BaseFragment() { |
| | | override fun contentViewId() = R.layout.fragment_map_trip |
| | |
| | | val ll_car = view.find<View>(R.id.ll_car) |
| | | tv_name.text = it.name |
| | | tv_price.text = |
| | | getString(R.string.预估价格, it.amount).replace(",", ".") |
| | | getString(R.string.预估价格, it.amount).replace(",", ".").extClearInvalidZero() |
| | | iv_car.setImageURI(it.img) |
| | | if (index == 0) { //默认选择第一个 |
| | | carTypeId = it.id |
| | |
| | | import com.igo.user.dialog.ShareDialog |
| | | import com.igo.user.dialog.SpecialSuggestDialog |
| | | import com.igo.user.dialog.TipDialog |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.interfaces.OrderStateChangeListener |
| | | import com.igo.user.interfaces.StringCallback |
| | | import com.igo.user.network.Apis |
| | |
| | | startActivity<ComplainActivity>("id" to it) |
| | | } |
| | | }) |
| | | titleBar.getRightButton(0)?.gone() |
| | | tv_action2.gone() |
| | | showDialog() |
| | | getData() |
| | |
| | | tv_tip.invisible() |
| | | } else { |
| | | tv_tip.typeface = Typeface.DEFAULT_BOLD |
| | | val content = getString(R.string.tips_is, tipMoney) |
| | | val content = getString(R.string.tips_is, tipMoney).extClearInvalidZero() |
| | | tv_tip.text = SpanBuilder(content).color( |
| | | this@OrderDetailActivity, |
| | | 6, |
| | |
| | | |
| | | 7 -> { //待支付 |
| | | cl_driver.gone() |
| | | payMoney = order!!.orderMoney!! |
| | | payMoney = order!!.getOrderMoneyValue() |
| | | tv_money.text = payMoney.showMoney(this) |
| | | title = getString(R.string.支付费用) |
| | | if (order?.isFrozen != 2) { |
| | |
| | | tv_action.text = getString(R.string.立即支付) |
| | | tv_action2.text = getString(R.string.取消订单) |
| | | tv_action2.visible() |
| | | titleBar.getRightButton(0)?.gone() |
| | | queryBalance() |
| | | if (order!!.device == 2) {//车载端,显示线下付款按钮 2.0客户反馈,不要该按钮 |
| | | // tv_pay_offline.visible() |
| | |
| | | import cn.sinata.xldutils.utils.LanguageUtil |
| | | import cn.sinata.xldutils.visible |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.network.entity.Order |
| | | import com.igo.user.ui.ShowPictureActivity |
| | | import com.igo.user.ui.TransparentStatusBarActivity |
| | |
| | | private val rv_delivery by lazy { find<RecyclerView>(R.id.rv_delivery) } |
| | | override fun initView() { |
| | | title = getString(R.string.费用明细) |
| | | tv_total.text = getString(R.string.money_is, if (order.state == 7) order.orderMoney else order.payMoney).replace(",",".") |
| | | tv_total.text = getString(R.string.money_is, if (order.state == 7) order.getOrderMoneyValue() else order.payMoney).replace(",",".").extClearInvalidZero() |
| | | if (order.orderType != Const.OrderType.TYPE_TAXI) { |
| | | if (order.isDispute == 1){ |
| | | tv_price_by_platform.visible() |
| | | tv_price_by_platform.text = getString(R.string.争议订单协商价格).format(order.orderMoney) |
| | | tv_price_by_platform.text = getString(R.string.争议订单协商价格).format(order.getShowOrderMoney()) |
| | | }else |
| | | tv_price_by_platform.gone() |
| | | // if (order.startMoney!=0.0){ |
| | |
| | | import androidx.core.app.ActivityCompat |
| | | import androidx.core.os.bundleOf |
| | | import androidx.core.view.isVisible |
| | | import androidx.lifecycle.Lifecycle |
| | | import androidx.lifecycle.lifecycleScope |
| | | import androidx.lifecycle.repeatOnLifecycle |
| | | import androidx.recyclerview.widget.LinearLayoutManager |
| | | import androidx.recyclerview.widget.RecyclerView |
| | | import cn.sinata.rxnetty.LogHelper.logRecord |
| | |
| | | import com.igo.user.utils.google.AMapKit |
| | | import com.igo.user.utils.google.JsonAuthTokenFactory |
| | | import com.tbruyelle.rxpermissions2.RxPermissions |
| | | import kotlinx.coroutines.launch |
| | | import org.jetbrains.anko.dip |
| | | import org.jetbrains.anko.find |
| | | import org.jetbrains.anko.imageResource |
| | |
| | | * 超时无应答 |
| | | */ |
| | | fun noResponse(id: Int) { |
| | | lifecycleScope.launch { |
| | | // 等待生命周期至少达到 RESUMED(即 onResume 之后) |
| | | if (id == this@TripActivity.id && !noResponseDialog.isAdded) { |
| | | repeatOnLifecycle(Lifecycle.State.RESUMED) { |
| | | noResponseDialog.show(supportFragmentManager, "noResponse") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 行程中的UI,展示不同状态下的动态数据 |
| | |
| | | import cn.sinata.xldutils.adapter.HFRecyclerAdapter |
| | | import cn.sinata.xldutils.adapter.util.ViewHolder |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | import com.igo.user.network.entity.Coupon |
| | | import org.jetbrains.anko.backgroundResource |
| | | |
| | |
| | | holder.setText(R.id.tv_agency,data.getNameStr()) |
| | | holder.setText(R.id.tv_deadline,context.getString(R.string.有效期至,data.time)) |
| | | holder.setText(R.id.tv_range,context.getString(data.getRangeStr())+data.getFullMoney(context)) |
| | | holder.setText(R.id.tv_money, String.format("%.2f",data.money)) |
| | | holder.setText(R.id.tv_money, String.format("%.2f",data.money).extClearInvalidZero()) |
| | | // holder.setText(R.id.tv_condition, if (data.type == 2) context.getString(R.string.满多少元可用,data.fullMoney) else "") |
| | | holder.bind<CheckedTextView>(R.id.radio_check).isChecked = checkedPosition == position |
| | | holder.itemView.alpha = if (checkedPosition == position) 1f else 0.5f |
| | |
| | | |
| | | import android.content.Context |
| | | import com.igo.user.R |
| | | import com.igo.user.extension.extClearInvalidZero |
| | | |
| | | fun Double?.showMoney(context: Context):String{ |
| | | return context.getString(R.string.money_is,this).replace(",",".") |
| | | return context.getString(R.string.money_is, this).replace(",", ".").extClearInvalidZero() |
| | | } |
| | | |
| | | fun Double.showMoney(context: Context):String{ |
| | | return context.getString(R.string.money_is,this).replace(",",".") |
| | | return context.getString(R.string.money_is, this).replace(",", ".").extClearInvalidZero() |
| | | } |
| | | |
| | | fun String?.showMoney(context: Context): String { |
| | | return context.getString(R.string.money_is, (this?.toDoubleOrNull()) ?: 0.0).replace(",", ".") |
| | | .extClearInvalidZero() |
| | | } |
| | |
| | | |
| | | <string name="领取点">Pickup point:</string> |
| | | |
| | | <string name="支付差价及金额">Pay the\n difference(FCFA%1$.2f)</string> |
| | | <string name="支付差价及金额">Pay the\n difference(FCFA %s)</string> |
| | | |
| | | <string name="取货中">Picking up</string> |
| | | |
| | | <string name="立即支付含金额">Pay\n(FCFA%1$.2f)</string> |
| | | <string name="立即支付含金额">Pay\n(FCFA %s)</string> |
| | | |
| | | <string name="紧急联系人">Emergency contact</string> |
| | | |
| | |
| | | |
| | | <string name="差价">Fee difference</string> |
| | | |
| | | <string name="争议订单协商价格">( Note: Disputed order, after tripartite negotiation, the final pricing of the platform is FCFA %.2f )</string> |
| | | <string name="争议订单协商价格">( Note: Disputed order, after tripartite negotiation, the final pricing of the platform is FCFA %s )</string> |
| | | |
| | | <string name="订单号">Order No.:%1$s</string> |
| | | |
| | |
| | | |
| | | <string name="领取点">Point de retrait :</string> |
| | | |
| | | <string name="支付差价及金额">Payer la\n différence (FCFA %1$.2f)</string> |
| | | <string name="支付差价及金额">Payer la\n différence (FCFA %s)</string> |
| | | |
| | | |
| | | <string name="取货中">En cours de collecte</string> |
| | | |
| | | <string name="立即支付含金额">Payer\n(FCFA %1$.2f)</string> |
| | | <string name="立即支付含金额">Payer\n(FCFA %s)</string> |
| | | |
| | | <string name="紧急联系人">Contact d’urgence</string> |
| | | |
| | |
| | | |
| | | <string name="差价">Supplément</string> |
| | | |
| | | <string name="争议订单协商价格">( Note : commande en litige. Après négociation tripartite, le tarif final fixé par la plateforme est de FCFA %.2f )</string> |
| | | <string name="争议订单协商价格">( Note : commande en litige. Après négociation tripartite, le tarif final fixé par la plateforme est de FCFA %s )</string> |
| | | |
| | | <string name="订单号">N° de commande : %1$s</string> |
| | | |
| | |
| | | <string name="调度取消">调度取消</string> |
| | | <string name="无">无</string> |
| | | <string name="领取点">领取点:</string> |
| | | <string name="支付差价及金额">支付差价\n(FCFA%1$.2f)</string> |
| | | <string name="立即支付含金额">立即支付\n(FCFA%1$.2f)</string> |
| | | <string name="支付差价及金额">支付差价\n(FCFA %s)</string> |
| | | <string name="立即支付含金额">立即支付\n(FCFA %s)</string> |
| | | <string name="紧急联系人">紧急联系人</string> |
| | | <string name="实名认证">实名认证</string> |
| | | <string name="编辑">编辑</string> |
| | |
| | | <string name="收据不可用">收据不可用</string> |
| | | <string name="行程分享内容">您的好友(%1$s)正在使用GOPOST打车。</string> |
| | | <string name="差价">差价</string> |
| | | <string name="争议订单协商价格">( 注意: 争议订单,经过三方协商,平台最终定价为 FCFA %.2f )</string> |
| | | <string name="争议订单协商价格">( 注意: 争议订单,经过三方协商,平台最终定价为 FCFA %s )</string> |
| | | <string name="订单号">订单号:%1$s</string> |
| | | <string name="请完善邮箱地址包裹提示">“要接收包裹取件码和付款收据,您必须填写您的电子邮件地址,否则无法下单。”</string> |
| | | <string name="可用于打车和包裹">可乘车及包裹配送</string> |