diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 6f432d25..f8aa262b 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -1234,24 +1234,24 @@ class Orders extends HD_Controller $money_json = json_decode($row['money_json'],true); $services = json_decode($row['srv_ids'],true); if($this->input->method()=='post'){ + $new_services = []; $info = $this->input->post(); if(is_array($info['money'])){ foreach ($info['money'] as $key => $val) { if($val['checkbox']){ - $money_json[$key] = floatval($val['value']); + unset($val['checkbox']); + $new_services[] = $val; + $money_json[$key] = floatval($val['price']); }else{ $money_json[$key] = 0; - foreach ($services as $k => $v) { - if($key==$v['key']){ - unset($services[$k]); - break; - } - } } } } + $srv_ids = is_array($new_services) ? array_column($new_services,'id') : []; $updata = [ - 'srv_ids' => json_encode($services,JSON_UNESCAPED_UNICODE), + 'if_insure' => in_array(1,$srv_ids) ? 0 : 1, + 'if_num' => in_array(2,$srv_ids) ? 0 : 1, + 'srv_ids' => json_encode($new_services,JSON_UNESCAPED_UNICODE), 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE) ]; $res = $this->receiver_orders_v2_model->update($updata,['id'=>$id]); @@ -1273,21 +1273,15 @@ class Orders extends HD_Controller } } //获取车辆服务费 - $lists = []; - if($services){ - $srv_ids = array_column($services,'id'); - $ids = implode(',',$srv_ids); - if($srv_ids){ - $where["id in ($ids)"] = null; - $rows = $this->services_model->map('id','title',$where,'','','','id,title'); - foreach($services as $key=>$val){ - $lists[] = [ - 'title' => $rows[$val['id']], - 'key' => $val['key'], - 'money' => $money_json[$val['key']] - ]; - } - } + $lists = [ + ['id'=>1,'key'=>'price_insure','title'=>'代办保险'], + ['id'=>2,'key'=>'fee_carno','title'=>'代办上牌'] + ]; + !$row['payway'] && $lists[] = ['id'=>4,'key'=>'price_finance','title'=>'代办分期']; + $srv_ids = is_array($services) ? array_column($services,'id') : []; + foreach($lists as $key=>$val){ + $lists[$key]['money'] = $money_json[$val['key']] ? $money_json[$val['key']] : 0; + $lists[$key]['checked'] = in_array($val['id'],$srv_ids) ? 'checked' : ''; } $this->data['srv_info'] = $lists; $this->data['id'] = $id; diff --git a/admin/views/receiver/orderv2/edit_srv.php b/admin/views/receiver/orderv2/edit_srv.php index fbb6bb18..9b1762e0 100644 --- a/admin/views/receiver/orderv2/edit_srv.php +++ b/admin/views/receiver/orderv2/edit_srv.php @@ -1,13 +1,15 @@
- + $value) {?>
+ +
- /> + />