|
|
|
@ -49,6 +49,7 @@ class Business extends Common
|
|
|
|
|
$businessTypeId = $request['typesId']; // 针对mobile
|
|
|
|
|
$businessStatusId = $request['statusId']; // 针对mobile
|
|
|
|
|
$overdue = $request['overdue']; // 待办事项下需联系商机(逾期)
|
|
|
|
|
$businessIdArray = $request['businessIdArray']; // 待办事项提醒参数
|
|
|
|
|
$isMessage = !empty($request['isMessage']);
|
|
|
|
|
unset($request['scene_id']);
|
|
|
|
|
unset($request['search']);
|
|
|
|
@ -62,6 +63,7 @@ class Business extends Common
|
|
|
|
|
unset($request['statusId']);
|
|
|
|
|
unset($request['overdue']);
|
|
|
|
|
unset($request['isMessage']);
|
|
|
|
|
unset($request['businessIdArray']);
|
|
|
|
|
$request = $this->fmtRequest($request);
|
|
|
|
|
$requestMap = $request['map'] ?: [];
|
|
|
|
|
$sceneModel = new \app\admin\model\Scene();
|
|
|
|
@ -182,7 +184,9 @@ class Business extends Common
|
|
|
|
|
$map['is_end'] = abs($businessStatusId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 待办事项查询参数
|
|
|
|
|
$dealtWhere = [];
|
|
|
|
|
if (!empty($businessIdArray)) $dealtWhere['business.business_id'] = ['in', $businessIdArray];
|
|
|
|
|
// 待办事项下需联系商机(逾期)
|
|
|
|
|
$overdueWhere = '';
|
|
|
|
|
if (!empty($overdue)) {
|
|
|
|
@ -195,7 +199,7 @@ class Business extends Common
|
|
|
|
|
$dataCount = db('crm_business')
|
|
|
|
|
->alias('business')
|
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'business.customer_id = customer.customer_id', 'LEFT')
|
|
|
|
|
->where($map)->where($partMap)->where($authMap)->where($overdueWhere)->count('business_id');
|
|
|
|
|
->where($map)->where($partMap)->where($authMap)->where($overdueWhere)->where($dealtWhere)->count('business_id');
|
|
|
|
|
if (!empty($getCount) && $getCount == 1) {
|
|
|
|
|
$data['dataCount'] = !empty($dataCount) ? $dataCount : 0;
|
|
|
|
|
# 商机总金额
|
|
|
|
@ -204,6 +208,7 @@ class Business extends Common
|
|
|
|
|
$data['extraData']['money'] = ['businessSumMoney' => !empty($sumMoney) ? sprintf("%.2f", $sumMoney) : 0.00];
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$list = db('crm_business')
|
|
|
|
|
->alias('business')
|
|
|
|
|
->join('__CRM_CUSTOMER__ customer', 'business.customer_id = customer.customer_id', 'LEFT')
|
|
|
|
@ -211,6 +216,7 @@ class Business extends Common
|
|
|
|
|
->where($partMap)
|
|
|
|
|
->where($authMap)
|
|
|
|
|
->where($overdueWhere)
|
|
|
|
|
->where($dealtWhere)
|
|
|
|
|
->limit($request['offset'], $request['length'])
|
|
|
|
|
->field('business.*,customer.name as customer_name')
|
|
|
|
|
->orderRaw($order)
|
|
|
|
|