From 677d22900ad6dc99fbb150a4eaa2a8291dee8882 Mon Sep 17 00:00:00 2001 From: qianhy Date: Thu, 25 May 2023 09:46:04 +0800 Subject: [PATCH] orderv2 add fines about --- admin/controllers/receiver/orderv2/Orders.php | 55 ++++- admin/views/receiver/orderv2/edit_srv.php | 197 +++++++++++++++++- 2 files changed, 240 insertions(+), 12 deletions(-) diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 5c81a58d..cc73d410 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -1876,14 +1876,45 @@ class Orders extends HD_Controller }else{ $money_json[$val['key']] = 0; } + # form改用vue后 + if (in_array('checked', array_keys($val))){ + $val['price'] = $val['money']; + $checked = $val['checked'] == 'true' ? true : false;#var_dump($checked); + unset($val['checked']); + unset($val['title']); + unset($val['money']); + $checked && $new_services[] = $val; + $money_json[$val['key']] = $checked ? floatval($val['price']) : 0; + } + } + }#var_dump($new_services);exit(); + + # form改用vue后 增加精品选装 + $price_fine_select = 0; + $fines = []; + if(is_array($info['fines'])){ + $fines = $info['fines'] ? $info['fines'] : []; + foreach ($fines as $key => $val){ + if ($val['id'] == -1 && intval($val['price']) == 0){ + unset($fines[$key]); + continue; + } + if ($val['txt'] == '' && intval($val['price']) == 0){ + unset($fines[$key]); + continue; + } + $price_fine_select += intval($val['price']); } } + $money_json['price_fine_select'] = $price_fine_select; + $srv_ids = is_array($new_services) ? array_column($new_services,'id') : []; $updata = [ 'if_insure' => in_array(1,$srv_ids) ? 1 : 0, 'if_num' => in_array(2,$srv_ids) ? 1 : 0, 'srv_ids' => json_encode($new_services,JSON_UNESCAPED_UNICODE), - 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE) + 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE), + 'fines' => json_encode($fines,JSON_UNESCAPED_UNICODE), ]; $res = $this->receiver_orders_v2_model->update($updata,['id'=>$id]); if($res){ @@ -1913,10 +1944,30 @@ class Orders extends HD_Controller $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' : ''; + //$lists[$key]['checked'] = in_array($val['id'],$srv_ids) ? 'checked' : ''; + $lists[$key]['checked'] = in_array($val['id'],$srv_ids) ? true : false; // form 改 vue } $this->data['srv_info'] = $lists; $this->data['id'] = $id; + + // 0522增加精品选装(biz_type==1后台手工添加的均为自定义,biz_type!=1只能修改price) + /*$this->load->model('receiver/receiver_fine_model'); + $where = [ + 'status' => 1 + ]; + $where['biz_id'] = $row['biz_id']; + $fines_list = $this->receiver_fine_model->select($where,'id desc',0,0,'id,title,price'); + $this->data['fines_list'] = $fines_list;*/ + $biz = $this->biz_model->get(['id' => $row['biz_id']], 'id,city_id,type'); + $this->data['biz_type'] = $biz['type']; + $this->data['fines'] = $row['fines'] ? json_decode($row['fines'], true) : []; + if (!$this->data['fines']){ + if ($biz['type'] != 1){ + $this->data['fines'] = [array("id"=>"-1", "txt"=>"服务费", "price"=>"0")]; + } + } + $this->data['price_fine_select'] = sprintf("%.2f", $money_json['price_fine_select']); + return $this->show_view('receiver/orderv2/edit_srv'); } diff --git a/admin/views/receiver/orderv2/edit_srv.php b/admin/views/receiver/orderv2/edit_srv.php index 9b1762e0..a171f260 100644 --- a/admin/views/receiver/orderv2/edit_srv.php +++ b/admin/views/receiver/orderv2/edit_srv.php @@ -1,22 +1,199 @@ -
- $value) {?> + $value) {*/?>
- - + +
- /> + />
- + +
- +
-
+--> + +
+ + +
+ +
+ {{price_fine_select}} +
+
+ + + + + + + + + + + + + + + + +
项目金额(非服务费时,0为赠送) + 添加 +
+
+
+ +
+
+ + +
+
+
+ + \ No newline at end of file