From 7baaf24ff37a66a74cbcd4c104c1a2628d35c0ef Mon Sep 17 00:00:00 2001 From: qianhy Date: Sun, 23 Apr 2023 10:06:29 +0800 Subject: [PATCH] orders upload bill_file, loan_file, notice_file --- admin/controllers/receiver/orderv2/Orders.php | 39 +++++++++++++++++++ admin/views/receiver/orderv2/get/index.php | 30 +++++++++++++- admin/views/receiver/orderv2/get/loaninfo.php | 24 +++++++++++- admin/views/upload.php | 10 +++-- 4 files changed, 96 insertions(+), 7 deletions(-) diff --git a/admin/controllers/receiver/orderv2/Orders.php b/admin/controllers/receiver/orderv2/Orders.php index 0d990e06..60b7b4b8 100644 --- a/admin/controllers/receiver/orderv2/Orders.php +++ b/admin/controllers/receiver/orderv2/Orders.php @@ -698,6 +698,45 @@ class Orders extends HD_Controller return $this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis')); } + //修改分期图片 + public function edit_loanfile() + { + $params = $this->input->post(); + $oid = $params['id']; + $file = $params['value']; + + $row_order = $this->receiver_orders_v2_model->get(array('id' => $oid)); + if(!$file || !$row_order){ + return $this->show_json(SYS_CODE_FAIL, '参数错误'); + } + + $row = $this->order_loans_model->get(['o_id' => $oid]); + if (!$row) { + $this->order_loans_model->add(['o_id' => $oid, 'c_time' => time()]); + $row = $this->order_loans_model->get(['o_id' => $oid]); + } + $notify_file_list = $row['notify_file'] ? explode(',',$row['notify_file']) : []; + $update = []; + if ($file) { //上传按揭通知函 + if ($params['type']) { + $update['lend_file'] = $file; + # 此处不检查load_time为空的情况,最后做“按揭完成”时也会检查 + $loan_time = $params['loan_time']; + if ($loan_time) { + $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); + } + } else { + $notify_file_list[] = $file; + $update['notify_file'] = implode(',',$notify_file_list); + } + $this->data['file_url'] = build_qiniu_image_url($file); + } + if($update){ + $result = $this->order_loans_model->update($update, ['id' => $row['id']]); + } + return $result ? $this->show_json(SYS_CODE_SUCCESS, '保存成功') : $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + //修改分期 public function edit_loan() { diff --git a/admin/views/receiver/orderv2/get/index.php b/admin/views/receiver/orderv2/get/index.php index bc788fdb..834b9971 100644 --- a/admin/views/receiver/orderv2/get/index.php +++ b/admin/views/receiver/orderv2/get/index.php @@ -307,9 +307,10 @@
查看发票 @@ -715,6 +716,33 @@ }, 'json'); } + function upLoanFile(type, obj) { + var that = this; + var params = { + 'id':, + 'value': $(obj).val(), + 'type': type + }; + if (type) { + var loan_time = $('#loan_time').val(); + if (!loan_time) { + layer.msg("请填写放款时间"); + return; + } + params['loan_time'] = loan_time; + } + $.post("/receiver/orderv2/orders/edit_loanfile", params, function (data) { + layer.closeAll() + if (data.code==1) { + layer.msg(data.msg, {time: 2000, icon: 1}, function () { + $.form.reload(); + }); + } else { + layer.msg(data.msg, {icon: 2}); + } + }, 'json'); + } + function edit_bill_img(obj) { var loading = layer.msg('上传中', { icon: 16 diff --git a/admin/views/receiver/orderv2/get/loaninfo.php b/admin/views/receiver/orderv2/get/loaninfo.php index dd1c3c6d..bfc80162 100644 --- a/admin/views/receiver/orderv2/get/loaninfo.php +++ b/admin/views/receiver/orderv2/get/loaninfo.php @@ -76,12 +76,23 @@