18034727885
2026-07-02 d77799acf739190f905011182a57b187caeff568
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
package com.igo.user.ui.trip
 
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import cn.sinata.xldutils.gone
import cn.sinata.xldutils.utils.SPUtils
import cn.sinata.xldutils.visible
import com.igo.user.R
import com.igo.user.network.entity.Order
import com.igo.user.ui.ShowPictureActivity
import com.igo.user.ui.TransparentStatusBarActivity
import com.igo.user.ui.trip.adapter.ExpressPictureAdapter
import com.igo.user.utils.Const
import com.igo.user.utils.showMoney
import org.jetbrains.anko.find
 
class PriceDetailActivity : TransparentStatusBarActivity() {
    override fun setContentView() = R.layout.activity_price_detail
 
    private val order by lazy {
        intent.getParcelableExtra<Order>("order")!!
    }
    private val pickupAdapter by lazy { ExpressPictureAdapter(ArrayList<String>()) }
    private val deliveryAdapter by lazy { ExpressPictureAdapter(ArrayList<String>()) }
    override fun initClick() {
    }
    private val tv_total by lazy { find<TextView>(R.id.tv_total) }
    private val tv_price_by_platform by lazy { find<TextView>(R.id.tv_price_by_platform) }
    private val ll_detail by lazy { find<LinearLayout>(R.id.ll_detail) }
    private val ll_pickup_picture by lazy { find<LinearLayout>(R.id.ll_pickup_picture) }
    private val rv_pickup by lazy { find<RecyclerView>(R.id.rv_pickup) }
    private val ll_delivery_picture by lazy { find<LinearLayout>(R.id.ll_delivery_picture) }
    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(",",".")
        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)
            }else
                tv_price_by_platform.gone()
//            if (order.startMoney!=0.0){
                val view1 = layoutInflater.inflate(R.layout.item_price_detail, null)
            val tv_name = view1.find<TextView>(R.id.tv_name)
            val tv_price = view1.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.起步价及公里数,order.startMileage,order.startDuration).replace(",",".")
                tv_price.text = order.startMoney.showMoney(this)
                ll_detail.addView(view1)
//            }
//            if (order.mileageMoney!=0.0){
            val view3 = layoutInflater.inflate(R.layout.item_price_detail, null)
            val tv_name3 = view3.find<TextView>(R.id.tv_name)
            val tv_price3 = view3.find<TextView>(R.id.tv_price)
            tv_name3.text = getString(R.string.里程费及公里数,order.mileage).replace(",",".")
            tv_price3.text = order.mileageMoney.showMoney(this)
            ll_detail.addView(view3)
//            }
//            if (order.durationMoney!=0.0){
               /* val view2 = layoutInflater.inflate(R.layout.item_price_detail, null)
            val tv_name2 = view2.find<TextView>(R.id.tv_name)
            val tv_price2 = view2.find<TextView>(R.id.tv_price)
                tv_name2.text = getString(R.string.时长费及时长分钟,order.duration)
                tv_price2.text = order.durationMoney.showMoney(this)
                ll_detail.addView(view2)*/
//            }
//            if (order.waitMoney!=0.0){
               /* val view4 = layoutInflater.inflate(R.layout.item_price_detail, null)
            val tv_name4 = view4.find<TextView>(R.id.tv_name)
            val tv_price4 = view4.find<TextView>(R.id.tv_price)
                tv_name4.text =  getString(R.string.等待费,order.wait)
                tv_price4.text = order.waitMoney.showMoney(this)
                ll_detail.addView(view4)*/
//            }
            if (order.parkMoney != 0.0) {
                val view5 = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name5 = view5.find<TextView>(R.id.tv_name)
                val tv_price5 = view5.find<TextView>(R.id.tv_price)
                tv_name5.text = getString(R.string.停车费)
                tv_price5.text = order.parkMoney.showMoney(this)
                ll_detail.addView(view5)
            }
            if (order.roadTollMoney != 0.0) {
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.过路费)
                tv_price.text = order.roadTollMoney.showMoney(this)
                ll_detail.addView(view)
            }
            if (order.longDistanceMoney!=0.0){
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.远途费及公里数,order.longDistance).replace(",",".")
                tv_price.text = order.longDistanceMoney.showMoney(this)
                ll_detail.addView(view)
            }
//            if (
//                order.travelMoney!=0.0&& order.moneyType!=1
//            ){
//                val view7 = layoutInflater.inflate(R.layout.item_price_detail, null)
//                view7.tv_name.text = String.format("%s(%s,%s)",if(order.moneyType == 2) "夜间行驶费" else "高峰期费",order.moneyTime,getString(
//                                    R.string.全程公里).format(order.longDistance).replace(",","."))
//                view7.tv_price.text = order.travelMoney.showMoney(this)
//                ll_detail.addView(view7)
//            }
 
            if (order.redPacketMoney != 0.0) {
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.红包抵扣)
                tv_price.text = "-"+order.redPacketMoney.showMoney(this)
                ll_detail.addView(view)
            }
            if (order.couponMoney != 0.0) {
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.优惠券)
                tv_price.text = "-"+order.couponMoney.showMoney(this)
                ll_detail.addView(view)
            }
            if (order.discountMoney != 0.0) {
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.活动折扣)
                tv_price.text = "-"+order.discountMoney.showMoney(this)
                ll_detail.addView(view)
            }
            if (order.discount!=0.0){
                val view1 = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name1 = view1.find<TextView>(R.id.tv_name)
                val tv_price1 = view1.find<TextView>(R.id.tv_price)
                tv_name1.text = getString(R.string.活动折扣)
                val language = SPUtils.instance().getString("language")
                tv_price1.text = when(language){
                    Const.Language.ENGLISH->"${100-(order.discount*10).toInt()}%"
                    Const.Language.CHINESE->"${order.discount}折"
                    else->"${100-(order.discount*10).toInt()}%"
                }
                ll_detail.addView(view1)
            }
            if (order.priceDifference != 0.0) {
                val view = layoutInflater.inflate(R.layout.item_price_detail, null)
                val tv_name = view.find<TextView>(R.id.tv_name)
                val tv_price = view.find<TextView>(R.id.tv_price)
                tv_name.text = getString(R.string.差价)
                tv_price.text = order.priceDifference.showMoney(this)
                ll_detail.addView(view)
            }
            rv_pickup.adapter = pickupAdapter
            rv_pickup.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
            rv_delivery.adapter = deliveryAdapter
            rv_delivery.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
 
            ll_pickup_picture.isVisible = !order.imgOne.isNullOrEmpty()
            pickupAdapter.mData = ArrayList<String>().apply { addAll(order.getPickupPictures()) }
            ll_delivery_picture.isVisible = !order.imgTwo.isNullOrEmpty()
            deliveryAdapter.mData = ArrayList<String>().apply { addAll(order.getDeliveryPictures()) }
        }
        pickupAdapter.setOnItemClickListener { _, position ->
            startActivity(
                ShowPictureActivity.getIntent(
                    this,
                    "",
                    ArrayList<String>().apply { addAll(pickupAdapter.mData) },
                    position
                )
            )
        }
        deliveryAdapter.setOnItemClickListener { _, position ->
            startActivity(
                ShowPictureActivity.getIntent(
                    this,
                    "",
                    ArrayList<String>().apply { addAll(deliveryAdapter.mData) },
                    position
                )
            )
        }
    }
}