18034727885
2026-07-31 909cc48c563b8f10609f704332f7ab30311d1e08
app/src/main/java/com/igo/user/network/entity/OrderData.kt
@@ -3,17 +3,18 @@
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 cancelUserType: Int = 0,
    val timeOutCancel: Long = 0,
    val driverTimeOut: String= "",
    val driverTimeOut: String = "",
    val driverTimeOutTime: Int = 0,
    val snatchOrderTime: String = "",
    val endAddress: String = "",
@@ -51,7 +52,7 @@
    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 = "",
@@ -64,7 +65,7 @@
    val roadTollMoney: Double = 0.0,
    val parkMoney: Double = 0.0,
    val discountMoney: Double = 0.0,
    val discount:Double = 0.0,
    val discount: Double = 0.0,
    val priceDifference: Double = 0.0,//补差价金额
    val couponMoney: Double = 0.0,
    val redPacketMoney: Double = 0.0,
@@ -86,86 +87,116 @@
    val isFrozen: Int = 0, //是否冻结(1=否,2=是,3=冻结已处理)
    val seatNumber: String = "",
    val moneyTime: String = "",
    val isFree: String = "" //是否首单免费 1否2是
    ) : Parcelable {
    val isFree: String = "", //是否首单免费 1否2是
    val code: String? = "", //快件取件码
    val imgOne: String? = "", //司机取快件拍摄照片
    val imgTwo: String? = "", //司机送达快件拍摄照片
) : Parcelable {
    fun getDifferenceMoneyValue(): Double {
        return differenceMoney.toDoubleOrNull() ?: 0.0
    }
    fun getStateStr() = when(state){
        1->R.string.等待应答
        2,3->R.string.等待接驾
        4->R.string.等待上车
        5->R.string.服务中
        6->R.string.行程结束
        7->R.string.待支付
        8->R.string.待评价
        9->{
    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.等待应答
        2, 3 -> R.string.等待接驾
        4 -> R.string.等待上车
        5 -> R.string.服务中
        6 -> R.string.行程结束
        7 -> R.string.待支付
        8 -> R.string.待评价
        9 -> {
            if (cancelMidway == 1)
                R.string.中途取消已完成
            else
                R.string.已完成
        }
        10->R.string.已取消
        11->R.string.改派中
        12->R.string.取消待支付
        else->0
        10 -> R.string.已取消
        11 -> R.string.改派中
        12 -> R.string.取消待支付
        else -> 0
    }
    fun getCharterState() = when(state){
        1->"待处理"
        2->"已处理"
        3->"已取消"
        else->""
    fun getCharterState() = when (state) {
        1 -> "待处理"
        2 -> "已处理"
        3 -> "已取消"
        else -> ""
    }
    //小件物流订单状态 状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付,13=补差价)
    fun getLogisticsState() = when(state){
        1->R.string.待接单
        2,3->R.string.待取货
        4->R.string.取货中
        5->R.string.送货中
        6->R.string.已送达
        7->R.string.待支付
        8->R.string.待评价
        9->{
    fun getLogisticsState() = when (state) {
        1 -> R.string.待接单
        2, 3 -> R.string.待取货
        4 -> R.string.取货中
        5 -> R.string.送货中
        6 -> R.string.已送达
        7 -> R.string.待支付
        8 -> R.string.待评价
        9 -> {
            if (cancelMidway == 1)
                R.string.中途取消已完成
            else
                R.string.已完成
        }
        10->R.string.已取消
        11->R.string.改派中
        12->R.string.取消待支付
        13->R.string.补差价
        else->0
        10 -> R.string.已取消
        11 -> R.string.改派中
        12 -> R.string.取消待支付
        13 -> R.string.补差价
        else -> 0
    }
    fun getStateColor() = when(state){
        7-> R.color.colorRed
        10-> R.color.textColor66
        else->R.color.colorPrimary
    fun getStateColor() = when (state) {
        7 -> R.color.colorRed
        10 -> cn.sinata.xldutils.R.color.textColor66
        else -> R.color.colorPrimary
    }
    fun getCharterStateColor() = when(state){
        3-> R.color.textColor66
        else->R.color.colorPrimary
    fun getCharterStateColor() = when (state) {
        3 -> cn.sinata.xldutils.R.color.textColor66
        else -> R.color.colorPrimary
    }
    //获取取件图片
    fun getPickupPictures(): List<String> {
        return imgOne?.split(",") ?: emptyList()
    }
    //获取送达图片
    fun getDeliveryPictures(): List<String> {
        return imgTwo?.split(",") ?: emptyList()
    }
}
data class TrippingInfo(
    val lat: String = "",
    val laveMileage: String = "",
    val laveTime: String = "",
    val lon: String = "",
    val orderId: Int = 0,
    val orderType: Int = 0,
    val reassignNotice: String = "",
    val reservationMileage: String = "",
    val reservationTime: String = "",
    val servedMileage: String = "",
    val servedTime: String = "",
    val orderPositionList: String = "",
    val state: Int = 0,
    val money: Double = 0.0,
    val status: Int = 0 //1=申请,2=同意,3=拒绝
    val lat: String? = "",
    val lon: String? = "",
    val orderId: Int? = 0,
    val orderType: Int? = 0,
    val reassignNotice: String? = "",
    val laveMileage: String? = "", // 距离终点剩余未服务的里程数
    val laveTime: String? = "", // 距离终点剩余未服务的预计时间
    val reservationMileage: String? = "", // 当前位置距离预约点剩余里程数
    val reservationTime: String? = "", // 当前位置距离预约点剩余时间
    val servedMileage: String? = "", // 距离起点已服务的里程数
    val servedTime: String? = "", // 距离起点已服务的时间
    val orderPositionList: String? = "",
    val state: Int? = 0,
    val money: Double? = 0.0,
    val status: Int? = 0 //1=申请,2=同意,3=拒绝
)
data class Coupon(
@@ -177,43 +208,47 @@
    val type: Int = 0, //1=抵扣,2=满减
    val state: Int = 0, //1: 未使用 2:已使用 3:已过期
    val userType: Int = 0 //(0=通用,1=专车,2=出租车,3=城际,4=小件物流)
){
    fun getTypeStr() = when(userType){
        0->R.string.通用优惠券
        1->R.string.专车优惠券
        2->R.string.出租车优惠券
        3->R.string.跨城出行优惠券
        4->R.string.小件物流优惠券
        else->0
    }
    fun getTypeBg() = when(userType){
        0->R.mipmap.bg_coupon_blue
        1->R.mipmap.bg_coupon_green
        2->R.mipmap.bg_coupon_green
        3->R.mipmap.bg_coupon_red
        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 getTypeStr() = when (userType) {
        0 -> R.string.通用优惠券
        1 -> R.string.专车优惠券
        2 -> R.string.出租车优惠券
        3 -> R.string.跨城出行优惠券
        4 -> R.string.小件物流优惠券
        else -> 0
    }
    fun getFullMoney(context: Context) = if (type == 1) "" else context.getString(R.string.full_discount).format(fullMoney.toString(),money.toString())
    fun getTypeBg() = when (userType) {
        0 -> R.mipmap.bg_coupon_blue
        1 -> R.mipmap.bg_coupon_green
        2 -> R.mipmap.bg_coupon_green
        3 -> R.mipmap.bg_coupon_red
        4 -> R.mipmap.bg_coupon_orange
        else -> R.mipmap.bg_coupon_grey
    }
    fun getNameStr() = if (name.length <= 6) name else "${name.substring(0,6)}..."
    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().extClearInvalidZero(), money.toString().extClearInvalidZero())
    fun getNameStr() = if (name.length <= 6) name else "${name.substring(0, 6)}..."
}
data class Point(
    val lat:Double = 0.0,
    val lon:Double = 0.0
    val lat: Double = 0.0,
    val lon: Double = 0.0
)
/**
 * 开票参数
 */
data class OrderParam(val type: Int,val id: Int)
data class OrderParam(val type: Int, val id: Int)
/**
 * 开票记录