+
0,
'm_assets' => 0,
'm_asset_price' => 0,
+ 'month_write_num' => 0,
'name' => '合计',
'admin' => [
'username' => '合计',
@@ -96,6 +97,8 @@ class DataController extends base
$list[$k]['month_write_rate'] = 0;
// 当月核销率(按销售额)
$list[$k]['month_write_rate_price'] = 0;
+ // 当月核销数(按核销时间)
+ $list[$k]['month_write_num'] = Orders::query()->where('verification_date', '>', date('Y-m-01'))->count();
if (isset($currentList[$v['admin_id']])) {
$currentAdmin = $currentList[$v['admin_id']];
$list[$k]['month_write_rate'] = number_format(($currentAdmin['assets']/$currentAdmin['orders'])*100,2);
@@ -113,11 +116,20 @@ class DataController extends base
$totalArr[1]['asset_price'] += $list[$k]['asset_price'];
$totalArr[1]['nopays'] += $list[$k]['nopays'];
$totalArr[1]['nopay_price'] += $list[$k]['nopay_price'];
+ $totalArr[1]['month_write_num'] += $list[$k]['month_write_num'];
+ }
+ if (isset($totalArr[1]['orders']) && $totalArr[1]['orders'] > 0) {
+ $totalArr[1]['write_rate'] = $totalArr[1]['orders'] ?: (float)number_format(($totalArr[1]['assets']/$totalArr[1]['orders'])*100,2);
+ }
+ if (isset($totalArr[1]['total_price']) && $totalArr[1]['total_price'] > 0) {
+ $totalArr[1]['write_rate_price'] = $totalArr[1]['total_price'] ?: (float)number_format(($totalArr[1]['asset_price']/$totalArr[1]['total_price'])*100,2);
+ }
+ if (isset($totalArr[1]['m_orders']) && $totalArr[1]['m_orders'] > 0) {
+ $totalArr[1]['month_write_rate'] = $totalArr[1]['m_orders'] ?: (float)number_format(($totalArr[1]['m_assets']/$totalArr[1]['m_orders'])*100,2);
+ }
+ if (isset($totalArr[1]['m_total_price']) && $totalArr[1]['m_total_price'] > 0) {
+ $totalArr[1]['month_write_rate_price'] = $totalArr[1]['m_total_price'] ?: (float)number_format(($totalArr[1]['m_asset_price']/$totalArr[1]['m_total_price'])*100,2);
}
- $totalArr[1]['write_rate'] = (float)number_format(($totalArr[1]['assets']/$totalArr[1]['orders'])*100,2);
- $totalArr[1]['write_rate_price'] = (float)number_format(($totalArr[1]['asset_price']/$totalArr[1]['total_price'])*100,2);
- $totalArr[1]['month_write_rate'] = (float)number_format(($totalArr[1]['m_assets']/$totalArr[1]['m_orders'])*100,2);
- $totalArr[1]['month_write_rate_price'] = (float)number_format(($totalArr[1]['m_asset_price']/$totalArr[1]['m_total_price'])*100,2);
$list = array_merge($list->toArray(), $totalArr);
$excel = $request->get('excel');
@@ -228,4 +240,4 @@ class DataController extends base
return $this->success($list);
}
-}
\ No newline at end of file
+}
diff --git a/service/app/admin/controller/OrderController.php b/service/app/admin/controller/OrderController.php
index 6a3edef1..fd772695 100644
--- a/service/app/admin/controller/OrderController.php
+++ b/service/app/admin/controller/OrderController.php
@@ -44,12 +44,22 @@ class OrderController extends base
// $where[] = ['appointment_status', '=', $appointment_status];
// }
+ switch ($request->get('order_by')) {
+ case 'verify_date_asc':
+ $orderBy['verification_date'] = 'asc';
+ break;
+ case 'verify_date_desc':
+ $orderBy['verification_date'] = 'desc';
+ break;
+ default:
+ $orderBy['create_at'] = 'desc';
+ break;
+ }
+
$status = $request->get('status', null);
$query = Orders::attimes($timetype, $times)->with(['admin','anchor','backs', 'mobileInfo'])->where($where)
- ->order('create_at','desc')
- ->order('update_time','desc')
- ->order('id','desc');
+ ->order($orderBy);
if($os_status) {
if ($os_status[0] == array_search(Orders::OSS[4],Orders::OSS)){
@@ -306,6 +316,11 @@ class OrderController extends base
$item->next_follow = strtotime($next_follow??'') * 1000;
$item->remark = $desc;
+ // 记录核销日期
+ if ($status == 2 && $item->status !=2) {
+ $item->verification_date = date('Y-m-d H:i:s');
+ }
+
$back = $item->save();
// }
@@ -664,4 +679,4 @@ class OrderController extends base
return $this->error(2006, '出错了:' . $e->getMessage());
}
}
-}
\ No newline at end of file
+}