add-admin-paylog

This commit is contained in:
lccsw
2021-09-30 11:29:24 +08:00
parent 31dfb94e11
commit 2aa1cf43b8
5 changed files with 76 additions and 7 deletions
+38 -3
View File
@@ -21,6 +21,7 @@ class Orders extends HD_Controller
$this->load->model('auto/auto_attr_model');
$this->load->model('auto/auto_finance_model');
$this->load->model('sys/sys_finance_model');
$this->load->model('app/liche/app_liche_orders_model');
$this->load->library('receiver/orders_entity');
}
@@ -667,9 +668,8 @@ class Orders extends HD_Controller
$this->data['info'] = $info;
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
//支付列表
public function get_paylog(){
$this->load->model('app/liche/app_liche_orders_model');
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$params = $this->input->post();
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
@@ -678,7 +678,6 @@ class Orders extends HD_Controller
$where = [
'o_id' => $params['id'],
'status' => 1,
'pid>' => 0,
'pay_price>' => 0
];
$count = $this->app_liche_orders_model->count($where);
@@ -701,4 +700,40 @@ class Orders extends HD_Controller
$this->data['id'] = $this->input->get('id');
return $this->show_view('receiver/orders/paylog');
}
//添加支付日志
public function add_paylog(){
if($this->input->method()=='post'){
$id = $this->input->post('id');
$row = $this->orders_model->get(['id'=>$id]);
$money = $this->input->post('money');
$pay_time = $this->input->post('pay_time');
if(!$money || !$pay_time ||!$row){
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$this->load->helper('order');
$sid = create_order_no(350200,'liche',1,5);
$data = [
'o_id' => $row['id'],
'sid' => $sid,
'brand_id' => $row['brand_id'],
's_id' => $row['s_id'],
'v_id' => $row['v_id'],
'cor_id' => $row['cor_id'],
'incor_id' => $row['incor_id'],
'total_price' => $money,
'pay_price' => $money,
'type' => 5,
'status' => 1,
'pay_time' => date('Y-m-d H:i:s',strtotime($pay_time)),
'c_time' => time()
];
$res = $this->app_liche_orders_model->add($data);
if(!$res){
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
$this->data['id'] = $this->input->get('id');
return $this->show_view('receiver/orders/add_paylog');
}
}
@@ -0,0 +1,32 @@
<form class="am-form am-form-horizontal" action="/receiver/orders/add_paylog" data-auto="true" method="post"
style="width: 90%;padding-top: 10px">
<input type="hidden" name="id" value="<?= $id ?>">
<div class="am-form-group">
<label class="am-para-label">支付金额:</label>
<div class="am-para-input">
<input type="number" value="" name="money">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">支付时间:</label>
<div class="am-para-input">
<input type="text" value="" id="pay_time" name="pay_time" readonly>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="submit">保存</button>
</div>
</div>
</form>
<script>
require(['laydate'], function (laydate) {
laydate.render({
elem: '#pay_time'
, type: 'date'
});
});
</script>
+4 -2
View File
@@ -1,5 +1,7 @@
<div class="coms-table-wrap mt10" id="paylog_content" style="min-height:400px;overflow:hidden">
<div class="align-r">
<a class="am-btn am-btn-primary am-btn-xs mr10" data-modal="/receiver/orders/add_paylog?id=<?=$id?>">添加收款记录</a>
</div>
<div class="">
<table class="am-table">
<thead>
@@ -36,6 +38,7 @@
</div>
</div>
</div>
<script>
$(function () {
vue_obj = new Vue({
@@ -72,7 +75,6 @@
vm.page.page++;
vm.getData(vm.page.page);
},
}
})
})
+1 -1
View File
@@ -158,7 +158,6 @@ class Protocol extends CI_Controller{
$biz = $this->biz_model->get(['id'=>$row['biz_id']]);
$company = $this->sys_company_model->get(['id'=>$biz['company_id']]);
$row['company'] = $company;
$p_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'pid'=>0,'status>='=>0],'id');
$where = [
'o_id' => $row['id'],
'status' => 1,
@@ -166,6 +165,7 @@ class Protocol extends CI_Controller{
];
$pay = $this->app_liche_orders_model->sum('total_price',$where);
//尾款
$p_row = $this->app_liche_orders_model->get(['o_id'=>$row['id'],'pid'=>0,'status>='=>0],'id');
$where = [
'o_id' => $row['id'],
'status' => 1,
@@ -9,7 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class App_liche_orders_model extends HD_Model{
private $table_name = 'lc_app_liche_orders';
private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金'];
private $type_arr = [ 1 => '定金', 2 => '委托服务费' , 3 => '尾款' ,4 => '意向金' ,5 => '后台添加'];
public function __construct()
{