Commit e298e283 authored by hujun's avatar hujun

修改财务审核

parent 39b1a1ab
......@@ -29,88 +29,9 @@ class Finance extends Basic
*/
public function reportList() {
if ($this->request->isAjax()) {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
if ($this->request->isGet()) {
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee,a.order_no,content';
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['e.audit_level'] = 0;
$where['a.status'] = 10;
$check_status = [0,1,2,3,4];
if (in_array($this->params['check_status'], $check_status)) {
switch ($this->params['check_status']) {
case 1 :
//成交报告列表-专员审核
$where['e.audit_level'] = ['NOT IN', '0,2,3'];
break;
case 2 :
//成交报告列表-经理审核
$where['e.audit_level'] = ['NOT IN', '0,1,3'];
break;
case 3 :
//成交报告列表-总监审核
$where['e.audit_level'] = ['NOT IN', '0,1,2'];
break;
case 4 :
//成交报告列表-已结单
$where['e.audit_level'] = 3;
$where['a.status'] = 11;
if(!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['e.create_time'] = ['> time', $this->params['create_time'] . ' 00:00:00'];
}
if(!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['e.create_time'] = ['< time', $this->params['create_time'] . ' 23:59:59'];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$where['e.create_time'] = ['between time', [$this->params['create_time'] . ' 00:00:00', $this->params['create_time'] . ' 23:59:59']];
}
if (!empty($this->params['internal_address'])) {
$where['d.internal_address'] = ['like', '%'.$this->params['internal_address'].'%'];
}
if (!empty($this->params['user_phone'])) {
$where['b.user_phone'] = ['like', '%'.$this->params['user_phone'].'%'];
}
break;
case 5 :
//成交报告列表-待撤销
$where['a.status'] = 20;
break;
case 6 :
//成交报告列表-已撤销
$where['a.status'] = 21;
break;
default :
$where['e.audit_level'] = ['NULL'];
}
} else {
$where['e.audit_level'] = ['NULL'];
}
if (!empty($this->params['status'])) {
$where['a.status'] = 20;
}
$bargain = new OBargainModel();
$data['data']['list'] = $bargain->getBargain($pageNo, $pageSize, 'a.id DESC', $fields, $where);
$data['data']['total'] = $bargain->getBargainTotal($where);
}
$result = $this->response($data['code'], $data['msg'], $data['data']);
} else {
if (!$this->request->isAjax()) {
$result = '';
switch ($this->params['check_status']) {
case 0 :
//未结单
......@@ -125,9 +46,86 @@ class Finance extends Basic
//已撤销
$result = view('finance/statement_backout');break;
}
return $result;
}
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$fields = 'a.id,a.create_time,b.user_phone,b.user_name,d.internal_title,d.internal_address,a.commission,a.practical_fee,a.order_no,content';
$where['a.father_id'] = 0;
$where['c.is_del'] = 0;
$where['a.status'] = 10;
$order = 'e.id desc';
switch ($this->params['check_status']) {
case 1 :
//成交报告列表-经理审核
$where['e.audit_level'] = 0;
break;
case 2 :
//成交报告列表-总监审核
$where['e.audit_level'] = 1;
break;
case 3 :
//成交报告列表-出纳审核
$where['e.audit_level'] = 2;
break;
case 4 :
//成交报告列表-已结单
$where['e.audit_level'] = 3;
$where['a.status'] = 11;
if(!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['e.create_time'] = ['> time', $this->params['create_time'] . ' 00:00:00'];
}
if(!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['e.create_time'] = ['< time', $this->params['create_time'] . ' 23:59:59'];
}
if (!empty($this->params['end_time']) && !empty($this->params['create_time'])) {
$where['e.create_time'] = ['between time', [$this->params['create_time'] . ' 00:00:00', $this->params['create_time'] . ' 23:59:59']];
}
if (!empty($this->params['internal_address'])) {
$where['d.internal_address'] = ['like', '%'.$this->params['internal_address'].'%'];
}
if (!empty($this->params['user_phone'])) {
$where['b.user_phone'] = ['like', '%'.$this->params['user_phone'].'%'];
}
break;
case 5 :
//成交报告列表-待撤销
$where['a.status'] = 20;
break;
case 6 :
//成交报告列表-已撤销
$where['a.status'] = 21;
break;
default :
//成交报告列表-专员审核
$where['e.audit_level'] = NULL;
$order = 'a.id DESC';
}
if (!empty($this->params['status'])) {
$where['a.status'] = 20;
}
return $result;
$bargain = new OBargainModel();
$data['data']['list'] = $bargain->getBargain($pageNo, $pageSize, $order, $fields, $where);
$data['data']['total'] = $bargain->getBargainTotal($where);
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
......@@ -144,7 +142,7 @@ class Finance extends Basic
$data['data'] = [];
$bargain = new OBargainModel();
//dump($this->params);die;
if (empty($this->params['id']) || empty($this->params['source']) || empty($this->params['status'])) {
$data['code'] = 101;
$data['msg'] = 'Id is null';
......
......@@ -278,7 +278,7 @@ class OBargainModel extends Model
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function addCheckBargain(int $id,array $data, int $source, int $status) : array {
public function addCheckBargain(int $id,array $data, int $source, int $status) : bool {
$this->startTrans();
$bargain_data = $this->field('id,report_id,agent_id,order_no,order_id')->where([
'id' => $id,
......
define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
follow = {
bargain = {
pageNo: 1,
/*第几页*/
pageSize: 10,
/*每页显示多少条*/
id: '',
house_id: '',
bargain_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
......@@ -15,68 +14,74 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
init: function() {
//初始化dot
$(document.body).append(template);
follow.getList(0);
follow.event();
bargain.getList(0);
bargain.event();
},
event: function() {
$("#search").click(function() {
follow.getList(1);
bargain.getList(1);
});
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
});
$ (document).delegate (".timeline", "click", function () {//时间轴
follow.Timeline();
bargain.Timeline();
});
$ (document).delegate (".edit", "click", function () {//点击编辑
follow.house_id = $ (this).attr ("data-id");
follow.Edit();
bargain.bargain_id = $ (this).attr ("data-id");
bargain.Edit();
});
$ (document).delegate ("#confirm_edit", "click", function () {//点击成交信息确定
follow.confirmEdit();
$ (document).delegate (".is_pass", "click", function () {//点击编辑
bargain.bargain_id = $ (this).attr ("data-id");
});
$ (document).delegate ("#confirm_edit", "click", function () {//点击成交信息确定
bargain.confirmEdit();
});
$ (document).delegate (".caozuo", "click", function () {//点击分佣提成
follow.Caozuo();
$ (document).delegate (".caozuo", "click", function () {//点击分佣提成
bargain.Caozuo();
});
$ (document).delegate ("#records", "click", function () {//点击收款记录
follow.Records();
bargain.Records();
});
$ (document).delegate ("#confirm_pass", "click", function () {//点击通过按钮
follow.confirmPass();
bargain.confirmPass();
});
// 点击新增分佣提成
$ (document).delegate ("#new-commission", "click", function () {//点击分佣提成
follow.newCommission();
follow.Caozuo();
bargain.newCommission();
bargain.Caozuo();
});
//table切换
$ (document).delegate ("#information", "click", function () {
follow.Information();
bargain.Information();
});
$ (document).delegate ("#fees", "click", function () {
follow.Fees();
bargain.Fees();
});
//专员审核 总监审核 经理审核 出纳审核
$ (document).delegate ("#commissioner", "click", function () {
follow.Commissioner();
bargain.Commissioner();
});
$ (document).delegate ("#manager", "click", function () {
follow.Manager();
bargain.Manager();
});
$ (document).delegate ("#director", "click", function () {
follow.Director();
bargain.Director();
});
$ (document).delegate ("#cashier", "click", function () {
follow.Cashier();
bargain.Cashier();
});
},
Timeline:function(){//获取时间轴
$.ajax({
'type': 'GET',
'url' : '/index/selectReportAll',
data: {"order_id":follow.house_id},
data: {"order_id":bargain.bargain_id},
dataType: "json",
success: function(data){
if(data.code == 200){
......@@ -102,7 +107,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$.ajax({
'type': 'GET',
'url' : '/index/bargainInfo',
data: {"id":follow.house_id},
data: {"id":bargain.bargain_id},
dataType: "json",
success: function(data){
if(data.code == 200){
......@@ -125,7 +130,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$.ajax({
'type': 'POST',
'url' : '/index/editBargainInfo',
data: { "id":follow.house_id,
data: { "id":bargain.bargain_id,
"scale_fee":$(".commission").val(),
"practical_fee":$(".practical_fee").val()
},
......@@ -142,48 +147,43 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
},
//通过
confirmPass:function(){//点击通过
console.log($('.btn-info').index());
var a_url;
if($('.btn-info').index()==0){
a_url="/index/checkReportAttache/0"
};
if ($('.btn-info').index()==1) {
a_url="/index/checkReportManager/1"
};
if ($('.btn-info').index()==2) {
a_url="/index/checkReportMajordomo/2"
};
if ($('.btn-info').index()==3) {
a_url="/index/checkReportCashier/3"
};
// console.log($('.btn-info').index());
console.log(follow.house_id);
$.ajax({
'type': 'POST',
'url' : a_url,
data: {"id":follow.house_id,
"source":1,
"status":10,
"remark":$("#note_text").val(),
},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
console.log(666);
}
} else {
alert('获取失败!');
}
}
});
},
var a_url;
if($('.btn-info').index()==0){
a_url="/index/checkReportAttache/0"
};
if ($('.btn-info').index()==1) {
a_url="/index/checkReportManager/1"
};
if ($('.btn-info').index()==2) {
a_url="/index/checkReportMajordomo/2"
};
if ($('.btn-info').index()==3) {
a_url="/index/checkReportCashier/3"
};
$.ajax({
'type': 'POST',
'url' : a_url,
data: {"id":bargain.bargain_id,
"source":1,
"status":10,
"remark":$("#note_text").val(),
},
dataType: "json",
success: function(data){
if(data.code == 200){
bargain.getList(1);
} else {
alert('通过失败!');
}
}
});
},
Caozuo:function(){//分佣提成数据
$.ajax({
'type': 'GET',
'url' : '/index/commissionList',
data: {"id":follow.house_id},
data: {"id":bargain.bargain_id},
dataType: "json",
success: function(data){
if(data.code == 200){
......@@ -221,7 +221,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$.ajax({
'type': 'GET',
'url' : '/index/payLogList',
data: {"id":follow.house_id},
data: {"id":bargain.bargain_id},
dataType: "json",
success: function(data){
if(data.code == 200){
......@@ -298,7 +298,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$.ajax({
'type': 'POST',
'url' : '/index/addBargain',
data: {"id":follow.house_id,
data: {"id":bargain.bargain_id,
"role":$("#is_carefully_chosen").val(),
"scale":$("#commission-rate").val(),
"scale_fee":$("#should-commission").val(),
......@@ -345,10 +345,10 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
'type': 'POST',
'url': '/index/pcEditClient',
data: {
"id": follow.house_id,
"id": bargain.bargain_id,
"user_nick": $("#cus_name").val(),
"user_phone": $("#cus_phone").html(),
"agent_id":follow.agent_id,//客方
"agent_id":bargain.agent_id,//客方
"sex": $("#sex").val()
},
dataType: "json",
......@@ -370,12 +370,12 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$("#director").removeClass("btn-info");
$("#director").addClass("btn-default");
$("#cashier").removeClass("btn-info");
$("#cashier").addClass("btn-default");
console.log($('.btn-info').index());
follow.pageNo = pageNo;
var params = {};
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
$("#cashier").addClass("btn-default");
bargain.pageNo = pageNo;
var params = {};
params.pageNo = bargain.pageNo;
params.pageSize = bargain.pageSize;
$.ajax({
type: 'GET',
......@@ -390,9 +390,8 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
var doTtmpl = doT.template(document.getElementById('reportList_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
// var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo')));
// console.log(user_info_obj.level);
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total,pageNo,bargain.pageSize,bargain.getList);
}else {
alert(data['msg']);
......@@ -423,11 +422,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$("#director").addClass("btn-default");
$("#cashier").removeClass("btn-info");
$("#cashier").addClass("btn-default");
console.log($('.btn-info').index());
follow.pageNo = pageNo;
bargain.pageNo = pageNo;
var params = {};
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
params.pageNo = bargain.pageNo;
params.pageSize = bargain.pageSize;
$.ajax({
type: 'GET',
......@@ -442,9 +441,9 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
var doTtmpl = doT.template(document.getElementById('reportList_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo')));
console.log(user_info_obj.level);
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total,pageNo,bargain.pageSize,bargain.getList);
}else {
alert(data['msg']);
......@@ -476,11 +475,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$("#director").addClass("btn-info");
$("#cashier").removeClass("btn-info");
$("#cashier").addClass("btn-default");
console.log($('.btn-info').index());
follow.pageNo = pageNo;
bargain.pageNo = pageNo;
var params = {};
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
params.pageNo = bargain.pageNo;
params.pageSize = bargain.pageSize;
$.ajax({
type: 'GET',
......@@ -495,9 +494,9 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
var doTtmpl = doT.template(document.getElementById('reportList_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo')));
console.log(user_info_obj.level);
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total,pageNo,bargain.pageSize,bargain.getList);
}else {
alert(data['msg']);
......@@ -528,11 +527,11 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
$("#director").addClass("btn-default");
$("#cashier").removeClass("btn-default");
$("#cashier").addClass("btn-info");
console.log($('.btn-info').index());
follow.pageNo = pageNo;
bargain.pageNo = pageNo;
var params = {};
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
params.pageNo = bargain.pageNo;
params.pageSize = bargain.pageSize;
$.ajax({
type: 'GET',
......@@ -547,9 +546,9 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
var doTtmpl = doT.template(document.getElementById('reportList_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo')));
console.log(user_info_obj.level);
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total,pageNo,bargain.pageSize,bargain.getList);
}else {
alert(data['msg']);
......@@ -571,10 +570,10 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
//出纳审核
getList: function(pageNo) {
follow.pageNo = pageNo;
bargain.pageNo = pageNo;
var params = {};
params.pageNo = follow.pageNo;
params.pageSize = follow.pageSize;
params.pageNo = bargain.pageNo;
params.pageSize = bargain.pageSize;
$.ajax({
type: 'GET',
......@@ -589,7 +588,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
var doTtmpl = doT.template(document.getElementById('reportList_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
// var user_info_obj = JSON.parse(decodeURIComponent(sessionStorage.getItem('pcUserInfo')));
// console.log(user_info_obj.level);
// $(".edit").hide();
// $(".is_pass").hide();
// $(".genjing").hide();
......@@ -599,7 +598,7 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
// }
/*分页代码*/
add_page(data.data.total,pageNo,follow.pageSize,follow.getList);
add_page(data.data.total,pageNo,bargain.pageSize,bargain.getList);
}else {
alert(data['msg']);
......@@ -619,5 +618,5 @@ define(['doT', 'text!temp/reportList_template_tpl.html', 'css!style/home.css', '
});
}
};
return follow;
return bargain;
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment