From 47be82d5aab98e4f584c8bd5aba62a617bca6d7b Mon Sep 17 00:00:00 2001 From: qianhy Date: Thu, 15 Jun 2023 13:44:19 +0800 Subject: [PATCH] orders add edit_price_car --- admin/controllers/receiver/orderv2/Orders.php | 41 +++++++++++++++++++ .../views/receiver/orderv2/edit_price_car.php | 16 ++++++++ admin/views/receiver/orderv2/get/oinfo.php | 1 + 3 files changed, 58 insertions(+) create mode 100644 admin/views/receiver/orderv2/edit_price_car.php diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index e6c2c32f..6cccebb4 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -1962,6 +1962,47 @@ class Orders extends HD_Controller return $this->show_view('receiver/orderv2/edit_price'); } + public function edit_price_car(){ + $id = $this->input->get_post('id'); + $row = $this->receiver_orders_v2_model->get(['id' => $id]); + if (!$row) { + return $this->show_json(SYS_CODE_FAIL, '订单不存在!'); + } + $money_json = json_decode($row['money_json'],true); + if($this->input->method()=='post'){ + $price_car = $this->input->post('price_car'); + if ($money_json['price_car'] > floatval($price_car)){ + return $this->show_json(SYS_CODE_FAIL, '售价不能下调!'); + } + $money_json['price_car'] = floatval($price_car); + $updata = [ + 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE) + ]; + $res = $this->receiver_orders_v2_model->update($updata,['id'=>$id]); + if($res){ + //更新尾款订单 + if(!$this->app_liche_orders_model->count(['type'=>3,'status'=>1,'o_id'=>$id])){ //不存在支付尾款更新尾款 + $this->app_liche_orders_model->update(['status'=>-1],['type'=>3,'o_id'=>$id,'status'=>0]); + //生成购车订单 + $userinfo = $this->app_liche_users_model->get(['mobile'=>$row['mobile']]); + $this->orders_v2_entity->add_order($id,$userinfo['id']); + } + $this->order_status_check_after_adjust_fee($id); + //重新生成合同 + $this->order_contracts_model->delete(['o_id'=>$id]); + $url = http_host_com('api')."/wxapp/licheb/protocol/create_pdf?id={$id}"; + file_get_contents($url); +// $this->orders_v2_entity->create_pdf($id); + return $this->show_json(SYS_CODE_SUCCESS, '保存成功!'); + }else{ + return $this->show_json(SYS_CODE_FAIL, '保存失败!'); + } + } + $this->data['price_car'] = $money_json['price_car']; + $this->data['id'] = $id; + return $this->show_view('receiver/orderv2/edit_price_car'); + } + public function edit_srv(){ $this->load->model('receiver/receiver_services_model','services_model'); $id = $this->input->get_post('id'); diff --git a/admin/views/receiver/orderv2/edit_price_car.php b/admin/views/receiver/orderv2/edit_price_car.php new file mode 100644 index 00000000..66142d17 --- /dev/null +++ b/admin/views/receiver/orderv2/edit_price_car.php @@ -0,0 +1,16 @@ +
+
+ +
+ +
+
+ +
+
+ + +
+
+
\ No newline at end of file diff --git a/admin/views/receiver/orderv2/get/oinfo.php b/admin/views/receiver/orderv2/get/oinfo.php index e205ded6..4a046a58 100644 --- a/admin/views/receiver/orderv2/get/oinfo.php +++ b/admin/views/receiver/orderv2/get/oinfo.php @@ -29,6 +29,7 @@ ({{info.sale_detail}}) 修改优惠 + 修改售价