pull/5/head
戴余标 2 years ago
commit 21b9869aec

@ -384,6 +384,7 @@ class Business extends ApiCommon
$userInfo = $this->userInfo;
$userModel = new \app\admin\model\User();
$is_end = $param['is_end'] ?: 0; //1赢单2输单3无效
$remark = $param['statusRemark'];
if (!$param['business_id']) {
return resultArray(['error' => '参数错误']);
}
@ -408,6 +409,7 @@ class Business extends ApiCommon
$data = [];
$data['update_time'] = time();
$data['is_end'] = $is_end;
$data['remark'] = $remark;
// if ($is_end) {
// $status_id = $is_end;
// }

@ -716,6 +716,8 @@ class Business extends Common
$sql_a = CrmBusinessModel::field([
'SUM(CASE WHEN is_end = 1 THEN money ELSE 0 END) AS sum_ying',
'SUM(CASE WHEN is_end = 2 THEN money ELSE 0 END) AS sum_shu',
'count(if (is_end = 1,true,null)) as count_ying',
'count(if (is_end = 2,true,null)) as count_shu',
'type_id'
])
->where($map)
@ -729,7 +731,7 @@ class Business extends Common
'type_id'
])
->where($where)
->whereNotIn('is_end', '1,2,3')
->whereNotIn('is_end', '3')
->group('status_id')
->fetchSql()
->select();
@ -754,6 +756,8 @@ class Business extends Common
$data['list'] = $statusList;
$data['sum_ying'] = $res_a[0]['sum_ying'] ?: 0;
$data['sum_shu'] = $res_a[0]['sum_shu'] ?: 0;
$data['count_ying']=$res_a[0]['count_ying']?:0;
$data['count_shu']=$res_a[0]['count_shu']?:0;
$data['sum_money'] = $sum_money ?: 0;
$data['total'] = ['name' => '合计', 'money_count' => $moneyCount, 'count' => $count];

@ -422,7 +422,7 @@ class ExamineLogic extends Common
}
break;
case '3':
case '3'://发票
$list = db('crm_invoice')
->alias('a')
->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT')
@ -446,6 +446,29 @@ class ExamineLogic extends Common
->where($whereOr)
->count();
break;
case 4:// 商机
$list = db('crm_bussiness')
->alias('a')
->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT')
->join('__ADMIN_EXAMINE_FLOW__ examine_flow', 'examine_flow.flow_id = a.flow_id', 'LEFT')
->where($where)
->where($whereOr)
->field(
'a.invoice_id as catagory_id ,a.invoice_apple_number as name,a.create_time,a.check_status,a.create_user_id,a.check_user_id,a.flow_user_id,user.realname,examine_flow.name as examine_name'
)
->page($param['page'], $param['limit'])
->order('a.create_time desc')
->select();
foreach ($list as $k => $v) {
$list[$k]['create_user_info'] = $userModel->getUserById($v['create_user_id']);
}
$dataCount = db('crm_invoice')
->alias('a')
->join('__ADMIN_USER__ user', 'user.id = a.create_user_id', 'LEFT')
->where($where)
->where($whereOr)
->count();
}

Loading…
Cancel
Save