lmw
2023-06-13 4b7d8d9a038f6522df46d0f14fa07eb940a1b34d
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
package com.kuanzhai.driver.ui.driver_server
 
import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import cn.sinata.xldutils.utils.*
import com.driver.emanagercar.ui.base.BaseWebActivity
import com.kuanzhai.driver.R
import com.kuanzhai.driver.base.BaseEvent
import com.kuanzhai.driver.base.local.BasePhotoActivity
import com.kuanzhai.driver.bean.*
import com.kuanzhai.driver.netUtls.Api
import com.kuanzhai.driver.netUtls.callNet
import com.kuanzhai.driver.netUtls.getMapByAny
import com.kuanzhai.driver.ui.DialogUtil
import com.kuanzhai.driver.ui.adapter.CarUpPhotoAdapter
import com.kuanzhai.driver.ui.adapter.UpPhotoAdapter
import com.kuanzhai.driver.ui.driver_server.adapter.CarAddAdapter
import com.kuanzhai.driver.ui.pub.ImageActivity
import com.kuanzhai.driver.utils.AndroidBug5497Workaround
import com.kuanzhai.driver.utils.Cache.CacheKey
import com.kuanzhai.driver.utils.DateUtil
import com.kuanzhai.driver.utils.citypickerview.picker.widget.builder.TimePickerBuilder
import com.kuanzhai.driver.utils.citypickerview.picker.widget.listener.OnOptionsSelectListener
import com.kuanzhai.driver.utils.glide.GlideUtil
import com.lljjcoder.Interface.OnCityItemClickListener
import com.lljjcoder.bean.CityBean
import com.lljjcoder.bean.DistrictBean
import com.lljjcoder.bean.ProvinceBean
import kotlinx.android.synthetic.main.activity_sell_car_send.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
import java.util.*
 
class SellCarSendActivity : BasePhotoActivity() {
    val carId by lazy {
        intent.getStringExtra("carId")
    }
 
    var category = true //是否营运车辆
    var isPledge = false //是否有抵押
    var containUserMoney = false //是否包含过户费用
    var selectBook = false //是否勾选协议
    var select_car_p_id = "" //品牌id
    var img = "" //描述图片
    var videoUrl = "" //视频图片
    var contactsProvinceCode = "" //联系人省code
    var contactscityCode = "" //联系人市code
 
    val carAddAdapter by lazy {
        CarAddAdapter()
    }
 
    val upPhotoAdapter by lazy {
        CarUpPhotoAdapter()
    }
 
 
    val upPhotoAdapterOne by lazy {
        CarUpPhotoAdapter()
    }
 
    override fun setContentView() {
        setContentView(R.layout.activity_sell_car_send)
    }
 
    override fun onEventMainThread(event: BaseEvent?) {
        super.onEventMainThread(event)
        if (event!!.code == BaseEvent.UPDATE_CAE_NUM){
            tv_car_phone_num.text = "*车辆图片"+ (upPhotoAdapter.data.size-1) +"/15"
        }
    }
 
 
    override fun onBackPressed() {
        DialogUtil.getDelAndSureDialog(this,"您的数据还未提交,确认返回?",{}){
            super.onBackPressed()
        }
    }
 
 
    override fun initView() {
        AndroidBug5497Workaround.assistActivity(this)
        setTitleText("卖车信息发布")
        et_phone_num.setText(CacheKey.getUserInfo().phone)
        et_phone_num.isEnabled = false
        recycler_view_add.layoutManager = GridLayoutManager(this, 2)
        recycler_view_add.adapter = carAddAdapter
        carAddAdapter.setData()
 
        recycler_view_img_all.layoutManager = GridLayoutManager(this, 3)
        upPhotoAdapter.data.add("")
        upPhotoAdapter.maxLength = 15
        recycler_view_img_all.adapter = upPhotoAdapter
 
        recycler_view_img_all_one.layoutManager = GridLayoutManager(this, 3)
        upPhotoAdapterOne.data.add("")
        upPhotoAdapterOne.maxLength = 8
        recycler_view_img_all_one.adapter = upPhotoAdapterOne
 
        showType(true)
        if (!carId.isNullOrEmpty()){
            callDetail()
        }
    }
 
    fun showType(left: Boolean) {
        category = left
        ll_user_num.visibility = if (left) View.VISIBLE else View.GONE
        ll_time_over.visibility = if (!left) View.VISIBLE else View.GONE
        ll_time_change_car_company.visibility = if (!left) View.VISIBLE else View.GONE
        if (left) {
            tv_pub_car.setBackgroundResource(R.drawable.bg_main_back)
            tv_pub_car.textColor(this, R.color.white)
            tv_company_car.setBackgroundResource(R.color.white)
            tv_company_car.textColor(this, R.color.color_989bb0)
        } else {
            tv_company_car.setBackgroundResource(R.drawable.bg_main_back)
            tv_company_car.textColor(this, R.color.white)
            tv_pub_car.setBackgroundResource(R.color.white)
            tv_pub_car.textColor(this, R.color.color_989bb0)
        }
    }
 
 
 
    override fun setOnclick() {
 
        upPhotoAdapter.setOnItemClickListener { view, position ->
            if (upPhotoAdapter.data[position].isEmpty()){
                imgType = 2
                showSelectPhone(16 - upPhotoAdapter.data.size,false)
            }else{
                startActivity<ImageActivity>("url" to upPhotoAdapter.data[position])
            }
        }
 
        ll_photo_site.clickDelay {
            hideKeyboard(this.window.decorView)
            showCityPop() { province, city, area,provinceCode,cityCode, areaCode ->
                tv_card_site.text = city
            }
        }
 
        upPhotoAdapterOne.setOnItemClickListener { view, position ->
            if (upPhotoAdapterOne.data[position].isEmpty()){
                imgType = 1
                showSelectPhone(9 - upPhotoAdapterOne.data.size,false)
            }else{
                startActivity<ImageActivity>("url" to upPhotoAdapterOne.data[position])
            }
        }
        iv_select_video.clickDelay {
            imgType = 3
            openAlbumVideo(1)
        }
 
 
        ll_pai.clickDelay {
            hideKeyboard(this.window.decorView)
            callNet(Api.queryAllBrand, getMapByAny()) { carallStr ->
                var carAll = gson.fromJson<AllCarBean>(carallStr, AllCarBean::class.java)
                var position = getPositionCar(carAll,select_car_p_id)
                DialogUtil.getNetOneDialog(position,carAll.data as ArrayList<AllCarBean.DataBean>, window.decorView, this) { selectCar ->
                    tv_select_car_p.text = selectCar.name
                    select_car_p_id = selectCar.id.toString()
                }
            }
        }
 
        ll_rank.clickDelay {
            hideKeyboard(this.window.decorView)
            var rankstr = "微型车、小型车、紧凑型车、中型车、中大型车、大型车、小型SUV、紧凑型SUV、中型SUV、中大型SUV、大型SUV、紧凑型MPV、中型MPV、中大型MPV、大型MPV、跑车、皮卡、微面、轻客、微卡";
            var ranklist = rankstr.split("、").toMutableList()
            DialogUtil.getOptionListDialog("选择级别",this,ranklist,object : OnOptionsSelectListener{
                override fun onOptionsSelect(
                    view: View?,
                    options1: Int,
                    options2: Int,
                    options3: Int
                ): Boolean {
                    tv_rank.text = ranklist[options1]
                    return false
                }
            })
        }
 
        tv_pub_car.clickDelay {
            hideKeyboard(this.window.decorView)
            showType(true)
        }
        tv_company_car.clickDelay {
            hideKeyboard(this.window.decorView)
            showType(false)
        }
 
        tv_have.clickDelay {
            hideKeyboard(this.window.decorView)
            isPledge = true
            setPledges(isPledge)
        }
 
 
 
        tv_none.clickDelay {
            hideKeyboard(this.window.decorView)
            isPledge = false
            setPledges(isPledge)
        }
 
        ll_time_first_car.clickDelay {
            hideKeyboard(this.window.decorView)
            var startCalendar = Calendar.getInstance()
            var endCalendar = Calendar.getInstance()
            startCalendar.set(1950, 1, 1)
            endCalendar.timeInMillis = (System.currentTimeMillis())
            showTime(startCalendar,endCalendar,Calendar.getInstance()){
                tv_first_time_str.text = DateUtil.getTime(DateUtil.TYPE1, it.time)
            }
        }
 
 
        iv_select_add_user_money.clickDelay {
            containUserMoney = !containUserMoney
            iv_select_add_user_money.setImageResource(if (containUserMoney) R.mipmap.car_select_blue else R.mipmap.car_select_blue_false)
        }
 
        ll_time_change_car_company.clickDelay {
            hideKeyboard(this.window.decorView)
            var startCalendar = Calendar.getInstance()
            var endCalendar = Calendar.getInstance()
            startCalendar.timeInMillis = (System.currentTimeMillis() - (1000L * 3600L * 24L * 365L * 50L))
            showTime(startCalendar,endCalendar,Calendar.getInstance()){
                tv_time_change_car_company.text = DateUtil.getTime(DateUtil.TYPE1, it.time)
            }
        }
 
 
        ll_insurance.clickDelay {
            hideKeyboard(this.window.decorView)
            var startCalendar = Calendar.getInstance()
            var endCalendar = Calendar.getInstance()
            endCalendar.timeInMillis = (System.currentTimeMillis() + (1000L * 3600L * 24L * 365L * 50L))
            showTime(startCalendar,endCalendar,Calendar.getInstance()){
                tv_insurance.text = DateUtil.getTime(DateUtil.TYPE1, it.time)
            }
        }
 
        ll_year_time.clickDelay {
            hideKeyboard(this.window.decorView)
            var startCalendar = Calendar.getInstance()
            var endCalendar = Calendar.getInstance()
            endCalendar.timeInMillis = (System.currentTimeMillis() + (1000L * 3600L * 24L * 365L * 50L))
            showTime(startCalendar,endCalendar,Calendar.getInstance()){
                tv_year_time.text = DateUtil.getTime(DateUtil.TYPE1, it.time)
            }
        }
 
        ll_business_time.clickDelay {
            hideKeyboard(this.window.decorView)
            var startCalendar = Calendar.getInstance()
            var endCalendar = Calendar.getInstance()
            endCalendar.timeInMillis = (System.currentTimeMillis() + (1000L * 3600L * 24L * 365L * 50L))
            showTime(startCalendar,endCalendar,Calendar.getInstance()){
                tv_business_time.text = DateUtil.getTime(DateUtil.TYPE1, it.time)
            }
        }
 
 
        iv_select_book.clickDelay {
            selectBook = !selectBook
            iv_select_book.setImageResource(if (selectBook) R.mipmap.select_ture else R.mipmap.select_false)
        }
 
        tv_select_book.clickDelay {
            hideKeyboard(this.window.decorView)
            var map = getMapByAny()
            map["type"] = 20
            callNet(Api.queryByType, map) {
                var data = gson.fromJson<AgreeBean>(it, AgreeBean::class.java)
                BaseWebActivity.to(mContext, data.data.content, "宽窄优行汽车售卖协议", "1")
            }
        }
 
 
 
        ll_contacts_site.clickDelay {
            hideKeyboard(this.window.decorView)
            showCityPop() { province, city, area,provinceCode,cityCode, areaCode ->
                contactsProvinceCode = provinceCode
                contactscityCode = cityCode
                tv_province.text = province
                tv_city_contacts.text = city
            }
        }
 
        tv_add_commit.clickDelay {
            hideKeyboard(this.window.decorView)
            if (et_titie.getContent().isEmpty()
                || et_code.getContent().isEmpty()
                || et_plate.getContent().isEmpty()
                || tv_select_car_p.getContent().isEmpty()
                || et_color.getContent().isEmpty()
                || tv_first_time_str.getContent().isEmpty()
                || et_mileage.getContent().isEmpty()
                || tv_card_site.getContent().isEmpty()
                || (category && et_change_username_num.getContent().isEmpty())
                || tv_displacement.getContent().isEmpty()
                || et_transmission_case.getContent().isEmpty()
                || tv_rank.getContent().isEmpty()
                || (!category && et_time_over.getContent().isEmpty())
                || et_transfer_price.getContent().isEmpty()
                || et_remark.getContent().isEmpty()){
                toast("请输入完整基本信息")
                return@clickDelay
            }
            if (upPhotoAdapter.data.size < 2){
                toast("上传完整车辆信息")
                return@clickDelay
            }
            if (tv_insurance.getContent().isEmpty()
                || tv_year_time.getContent().isEmpty()
                || tv_business_time.getContent().isEmpty()){
                toast("请填写完成更多信息模块")
                return@clickDelay
            }
            if (et_phone_num.getContent().isEmpty()
                || et_phone_num.getContent().length < 11
                || tv_contacts_name.getContent().isEmpty()
                || tv_province.getContent().isEmpty()
                || tv_city_contacts.getContent().isEmpty()
                || tv_detail_site.getContent().isEmpty()){
                toast("请填写完整联系人信息")
                return@clickDelay
            }
            if (!selectBook){
                toast("请勾选卖车协议")
                return@clickDelay
            }
            var map = getMapByAny()
            map["addres"] = tv_detail_site.getContent() //地址
//            map["authRemark"] = ""//审核备注
            map["brandId"] = select_car_p_id//品牌id
            map["brandName"] = tv_select_car_p.getContent()//品牌名称
            map["carColor"] = et_color.getContent()// 车辆颜色
            map["carIdentificationCode"] = et_code.getContent()//车辆识别码
            map["carLicensePlate"] = et_plate.getContent()//车牌号
            map["category"] = if (category) 1 else 2 //类别 1 非运营 2营运
            map["cityCode"] = contactscityCode//市Code
            map["cityName"] = tv_city_contacts.getContent()//cityName
            map["contactsName"] = tv_contacts_name.getContent()//联系人名称
            map["contactsPhone"] = et_phone_num.getContent()
            map["describe"] = et_remark.getContent()//描述
            map["describeImgUrl"] = img//描述图片
            map["displacement"] = tv_displacement.getContent()//排量
            map["dueTimeOfCompulsoryInsurance"] = tv_insurance.getContent()//交强险到期时间
            map["expirationTimeOfAnnualInspection"] = tv_year_time.getContent()//年检到期时间
            if (!carId.isNullOrEmpty()){
                map["id"] = carId//
            }
            map["imgUrl"] = upPhotoAdapter.getImg()//
            map["includingTransferFee"] = if (containUserMoney) "1" else "2"//是否包含过户费(1=是,2=否)
            map["installationConfiguration"] = carAddAdapter.getDataStr()//加装配置
            map["level"] = tv_rank.getContent()//
            map["licensingTime"] = tv_first_time_str.getContent()//上牌时间
            map["locationOfLicensePlate"] = tv_card_site.getContent()//牌照所在地
            map["maturityTimeOfCommercialInsurance"] = tv_business_time.getContent()//商业险到期时间
            map["mileage"] = et_mileage.getContent()//行驶里程
            map["mortgage"] = if (isPledge) "1" else "2"//是否有抵押(1=是,2=否)
            map["newCarPrice"] = et_new_car_money.getContent()//新车价格
            map["operationUpdateTime"] = tv_time_change_car_company.getContent()//营运更新时间
            map["provinceCode"] = contactsProvinceCode //省Code
            map["provinceName"] =  tv_province.getContent()//
            if (!et_time_over.getContent().isNullOrEmpty()){
                map["remainingOperationTime"] = et_time_over.getContent()//剩余营运时间
            }
//            map["status"] = ""//状态(1=待审核,2=已上架,3=已下架,4=审核通过待上架,5=已拒绝,6=删除)
            map["title"] = et_titie.getContent()//标题
            map["transferPrice"] = et_transfer_price.getContent()//转让费
            if (!et_change_username_num.getContent().isNullOrEmpty()){
                map["transferTimes"] = et_change_username_num.getContent()//过户次数
            }
            map["transmissionCase"] = et_transmission_case.getContent()//变速箱
            map["userId"] = CacheKey.getUserId()//
            map["userType"] = "2"//
            map["videoUrl"] = videoUrl//
            callNet(Api.insertOrUpdateSellingCar,map){
                startActivity<SendOverActivity>("title" to "卖车信息发布")
                finish()
            }
        }
 
    }
 
    var imgType = -1 // 1 车况图片选择  2 车辆图片 3 车辆视频
 
    fun showTime(startTime:Calendar,endTime:Calendar,currentTime:Calendar,function:(Date) -> Unit){
        var timePic = TimePickerBuilder(
            this
        ) { date, v ->
            function(date)
        }
            .setTitleText("")
            .setBgColor(ContextCompat.getColor(this, R.color.white))
            .setCancelColor(ContextCompat.getColor(this, R.color.black_333333))
            .setSubmitColor(ContextCompat.getColor(this, R.color.main_yellow))
            .setRangDate(startTime, endTime)
            .setDate(currentTime)
            .setSubmitText("确认")
            .setLineSpacingMultiplier(2f)
            .build()
        timePic.show()
    }
 
 
    override fun getPhoneUrl(url: String, type: Int, path: String) {
        super.getPhoneUrl(url, type, path)
        if (imgType == 1){
            upPhotoAdapterOne.data.add(0,url)
            upPhotoAdapterOne.notifyDataSetChanged()
            img = upPhotoAdapterOne.getImg()
        }
        if (imgType == 2){
            upPhotoAdapter.data.add(0,url)
            upPhotoAdapter.notifyDataSetChanged()
            tv_car_phone_num.text = "*车辆图片"+ (upPhotoAdapter.data.size-1) +"/15"
        }
        if (imgType == 3){
            videoUrl = url
            GlideUtil.load(this,url,iv_select_video,1)
            tv_video_num.text = "车辆视频1/1"
        }
    }
 
 
    /***
     * type 1 2 3 省市县
     */
    private fun showCityPop(onclick: (province: String, city: String, area: String, areaCode: String) -> Unit) {
        DialogUtil.getCityDialog(this, object : OnCityItemClickListener() {
            override fun onSelected(
                province: ProvinceBean?,
                city: CityBean?,
                district: DistrictBean?
            ) {
                super.onSelected(province, city, district)
                onclick(
                    province!!.name,
                    city!!.name,
                    district!!.name,
                    district.id
                )
            }
        })
    }
 
    /***
     * type 1 2 3 省市县
     */
    private fun showCityPop(onclick: (province: String, city: String, area: String,provinceCode:String,cityCode:String, areaCode: String) -> Unit) {
        DialogUtil.getCityTwoDialog(this, object : OnCityItemClickListener() {
            override fun onSelected(
                province: ProvinceBean?,
                city: CityBean?,
                district: DistrictBean?
            ) {
                super.onSelected(province, city, district)
                onclick(
                    province!!.name,
                    city!!.name,
                    district!!.name,
                    province.id,
                    city.id,
                    district.id
                )
            }
        })
    }
 
    private fun setPledges(b:Boolean){
        if (b){
            tv_have.setBackgroundResource(R.drawable.car_get_start_4)
            tv_have.textColor(this, R.color.white)
            tv_none.setBackgroundResource(R.drawable.city_color_btn)
            tv_none.textColor(this, R.color.color_1d99ea)
        }else{
            tv_none.setBackgroundResource(R.drawable.car_get_start_4)
            tv_none.textColor(this, R.color.white)
            tv_have.setBackgroundResource(R.drawable.city_color_btn)
            tv_have.textColor(this, R.color.color_1d99ea)
        }
    }
 
    private fun callDetail() {
        var map = getMapByAny()
        map["id"] = carId
        callNet(Api.getSellingCarDetail,map){
            var bean = gson.fromJson<MyBuyCar>(it, MyBuyCar::class.java)
            bean.data.apply {
                et_titie.setText(title)
                et_code.setText(carIdentificationCode)
                et_plate.setText(carLicensePlate)
                tv_select_car_p.setText(brandName)
                et_color.setText(carColor)
                tv_first_time_str.setText(licensingTime)
                et_mileage.setText(mileage)
                tv_card_site.setText(locationOfLicensePlate)
                et_change_username_num.setText(transferTimes)
                tv_displacement.setText(displacement)
                et_transmission_case.setText(transmissionCase)
                tv_rank.setText(level)
                et_time_over.setText(remainingOperationTime)
                tv_time_change_car_company.setText(operationUpdateTime)
                et_transfer_price.setText(getTransferPriceStr().toString())
                containUserMoney = includingTransferFee == 1
                iv_select_add_user_money.setImageResource(if (containUserMoney) R.mipmap.car_select_blue else R.mipmap.car_select_blue_false)
                et_new_car_money.setText(getNewCarPriceStr().toString())
                et_remark.setText(describe)
                img = this.describeImgUrl
                upPhotoAdapterOne.data.addAll(this.describeImgUrl.split(","))
                upPhotoAdapterOne.notifyDataSetChanged()
                upPhotoAdapter.data.addAll(this.imgUrl.split(","))
                upPhotoAdapter.notifyDataSetChanged()
                this@SellCarSendActivity.videoUrl = this.videoUrl
                tv_video_num.text = "车辆视频1/1"
                GlideUtil.load(this@SellCarSendActivity,videoUrl,iv_select_video,1)
                tv_insurance.setText(dueTimeOfCompulsoryInsurance)
                tv_year_time.setText(expirationTimeOfAnnualInspection)
                tv_business_time.setText(maturityTimeOfCommercialInsurance)
                isPledge = mortgage == 1
                setPledges(isPledge)
                for (item in carAddAdapter.data){
                    if (installationConfiguration.contains(item.content)){
                        item.select = true
                    }
                }
                carAddAdapter.notifyDataSetChanged()
                et_phone_num.setText(contactsPhone)
                tv_contacts_name.setText(contactsName)
                contactsProvinceCode = provinceCode
                contactscityCode = cityCode
                tv_province.text = provinceName
                tv_city_contacts.text = cityName
                tv_detail_site.setText(addres)
                this@SellCarSendActivity.category =  category == "1"
                showType(this@SellCarSendActivity.category)
                select_car_p_id = brandId.toString()
 
 
 
            }
        }
    }
 
    private fun getPositionCar(carAll: AllCarBean?, selectCarPId: String): Int {
        if (selectCarPId.isEmpty()){
            return 0
        }else{
            for (position in carAll?.data!!.indices){
                if (carAll?.data!![position].id.toString() == selectCarPId){
                    return position
                }
            }
        }
        return 0
    }
 
 
}