From 7161233eb9ed47c11cb876614988fb7e64968d37 Mon Sep 17 00:00:00 2001 From: xxb Date: Wed, 15 Sep 2021 09:55:03 +0800 Subject: [PATCH] liche update for admin finance get select car bug --- admin/views/auto/finance/get.php | 43 +++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/admin/views/auto/finance/get.php b/admin/views/auto/finance/get.php index eafbe989..2576331d 100644 --- a/admin/views/auto/finance/get.php +++ b/admin/views/auto/finance/get.php @@ -16,6 +16,7 @@
@@ -126,8 +127,8 @@ } }); } - if(vm.info.v_id){ - $.get('auto/finance/get_cars',{brand_id:vm.info.brand_id,s_id:vm.info.s_id,v_id:vm.info.v_id},function(response){ + if(vm.info.v_id>0){ + $.get('auto/finance/get_cars',{brand_id:vm.info.brand_id,s_id:vm.info.s_id,v_id:vm.info.v_id,tp:1},function(response){ if (response.code == 1) { vm.cars_arr = response.data.lists } @@ -158,12 +159,19 @@ that.s_arr = []; that.v_arr = []; that.info.s_id = 0; - that.info.car_id = 0; - that.info.v_id = 0; } else { $.get('common/auto',{pid:that.info.brand_id,type:2,tp:1},function(response){ if (response.code == 1) { - that.s_arr = response.data + that.s_arr = response.data; + var s_id = 0; + for(var i in that.s_arr){ + var v = that.s_arr[i]; + if(that.info.s_id == v.id){ + s_id = v.id; + break; + } + } + that.info.s_id = s_id; } }); } @@ -173,12 +181,20 @@ if(nv == 0){ that.v_arr = []; that.cars_arr = []; - that.info.car_id = 0; that.info.v_id = 0; } else { - $.get('common/auto',{pid:that.info.s_id,type:3},function(response){ + $.get('common/auto',{pid:that.info.s_id,type:3,tp:1},function(response){ if (response.code == 1) { - that.v_arr = response.data; + that.v_arr = response.data[3]; + var v_id = 0; + for(var i in that.v_arr){ + var v = that.v_arr[i]; + if(that.info.v_id == v.id){ + v_id = v.id; + break; + } + } + that.info.v_id = v_id; } }); } @@ -191,7 +207,16 @@ } else { $.get('auto/finance/get_cars',{brand_id:that.info.brand_id,s_id:that.info.s_id,v_id:that.info.v_id},function(response){ if (response.code == 1) { - that.cars_arr = response.data.lists + that.cars_arr = response.data.lists; + var car_id = 0; + for(var i in that.cars_arr){ + var v = that.cars_arr[i]; + if(that.info.car_id == v.id){ + car_id = v.id; + break; + } + } + that.info.car_id = car_id; } }); }