From e0df382080dc8d106aba82d06d480194a933b032 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Fri, 6 Jan 2023 17:59:27 +0800 Subject: [PATCH] edit-admin-const --- admin/controllers/items/Cost.php | 31 ++++- admin/views/items/cost/get.php | 159 +++++++++++++++++------ api/controllers/plan/Order.php | 1 + common/models/items/Items_cost_model.php | 10 +- sql/item.sql | 4 +- 5 files changed, 160 insertions(+), 45 deletions(-) diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index c86dbbac..956321ec 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -11,10 +11,12 @@ class Cost extends HD_Controller{ $this->load->model('items/items_model'); $this->load->model("biz/biz_model"); $this->load->model('app/licheb/app_licheb_users_model'); + $this->load->model('app/liche/app_liche_orders_model'); $this->load->model('sys/sys_company_model'); $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_attr_model'); + $this->load->library('receiver/orders_v2_entity'); } public function index(){ $this->lists(); @@ -98,12 +100,11 @@ class Cost extends HD_Controller{ $promotion_json = json_decode($row['promotion_json'],true); !$promotion_json['sale_price'] && $promotion_json['sale_price'] = 0; !$promotion_json['other'] && $promotion_json['other'] = 0; - !$promotion_json['subsidy'] && $promotion_json['subsidy'] = 0; + !$promotion_json['factory_price'] && $promotion_json['factory_price'] = 0; $cost_json = json_decode($row['cost_json'],true); !$cost_json['select_price'] && $cost_json['select_price'] = 0; !$cost_json['labor_price'] && $cost_json['labor_price'] = 0; $srv_json = json_decode($row['srv_json'],true); - !$srv_json['interest_price'] && $srv_json['interest_price'] = 0; !$srv_json['commission_price'] && $srv_json['commission_price'] = 0; !$srv_json['back_price'] && $srv_json['back_price'] = 0; !$srv_json['loan_offset_price'] && $srv_json['loan_offset_price'] = 0; @@ -112,6 +113,7 @@ class Cost extends HD_Controller{ !$srv_json['loan_out_price'] && $srv_json['loan_out_price'] = 0; !$srv_json['other_out_price'] && $srv_json['other_out_price'] = 0; !$srv_json['other_in_price'] && $srv_json['other_in_price'] = 0; + !$srv_json['ori_price'] && $srv_json['ori_price'] = 0; $info = [ 'bill_name' => $row['bill_name'], 'bill_time' => date('Y-m-d',strtotime($row['bill_time'])), @@ -125,12 +127,15 @@ class Cost extends HD_Controller{ 'biz_type' => $this->biz_model->type_ary($biz['type']), 'biz_name' => $biz['biz_name'], 'admin_name' => $admin['uname'], - 'order_time' => date('Y-m-d H:i:s',$order_row['c_time']), + 'order_time' => date('Y-m-d',$order_row['c_time']), 'promotion_json' => $promotion_json, 'cost_json' => $cost_json, 'srv_json' => $srv_json, 'row' => $row ]; + $sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$row['o_id'],'status'=>1,'pay_price <>'=>0]); + $info['pay_price'] = $sum['total_price'] ? $sum['total_price'] : 0; + $info['need_price'] = $this->orders_v2_entity->recevable_price($row['o_id']); //获取车信息 $brand = $this->auto_brand_model->get(['id' => $item_row['brand_id']], 'name'); $serie = $this->auto_series_model->get(['id' => $item_row['s_id']], 'name'); @@ -154,6 +159,7 @@ class Cost extends HD_Controller{ return $this->show_json(SYS_CODE_FAIL,'参数错误'); } $data = [ + 'price' => $post_data['price'] ? $post_data['price'] : 0, 'cost_json' => json_encode($post_data['cost_json'],JSON_UNESCAPED_UNICODE), 'promotion_json' => json_encode($post_data['promotion_json'],JSON_UNESCAPED_UNICODE), 'srv_json' => json_encode($post_data['srv_json'],JSON_UNESCAPED_UNICODE), @@ -167,6 +173,25 @@ class Cost extends HD_Controller{ } } + public function edit_pay(){ + $post_data = $this->input->post(); + $row = $this->items_cost_model->get(['id'=>$post_data['id']]); + if(!$row){ + return $this->show_json(SYS_CODE_FAIL,'参数错误'); + } + $srv_json = json_decode($row['srv_json'],true); + $srv_json['if_pay'] = $post_data['status'] == 1 ? 1 : 0; + $data = [ + 'srv_json' => json_encode($srv_json,JSON_UNESCAPED_UNICODE), + ]; + $res = $this->items_cost_model->update($data,['id'=>$row['id']]); + if(is_numeric($res)){ + return $this->show_json(SYS_CODE_SUCCESS,'保存成功'); + }else{ + return $this->show_json(SYS_CODE_FAIL,'保存失败'); + } + } + public function del(){ } diff --git a/admin/views/items/cost/get.php b/admin/views/items/cost/get.php index f66d2cdc..1bcb1c40 100644 --- a/admin/views/items/cost/get.php +++ b/admin/views/items/cost/get.php @@ -44,7 +44,7 @@