|
@@ -668,7 +668,7 @@ class TemplateController extends Controller
|
668
|
668
|
|
669
|
669
|
//1.获取当月新粉
|
670
|
670
|
$phones = DB::table('customers')->whereRaw('left(fanTime,7)="'.$v['month'].'"')->lists('phone');
|
671
|
|
- $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
|
|
671
|
+ $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(createTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
|
672
|
672
|
//当月新粉下单单数
|
673
|
673
|
$v['order_count'] = $order->order_count;
|
674
|
674
|
//当月新粉下单人数
|
|
@@ -681,7 +681,7 @@ class TemplateController extends Controller
|
681
|
681
|
$v['new_order_rate'] = $v['fan_add']>0 ? round($v['cust_count'] / $v['fan_add'], 4) * 100 . '%' : '';
|
682
|
682
|
//新粉复购率
|
683
|
683
|
//复购用户数 = 下单超过一单的用户数
|
684
|
|
- $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
|
|
684
|
+ $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(createTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
|
685
|
685
|
$customer_fugou_count = count($order_cust_fugou);
|
686
|
686
|
$v['cust_fugou_rate'] = $v['cust_count']>0 ? round($customer_fugou_count / $v['cust_count'], 4) * 100 . '%' : '';
|
687
|
687
|
//新粉订单复购率
|
|
@@ -757,7 +757,7 @@ class TemplateController extends Controller
|
757
|
757
|
|
758
|
758
|
//1.获取当月新粉
|
759
|
759
|
$phones = DB::table('customers')->whereRaw('left(fanTime,7)="'.$v['month'].'"')->lists('phone');
|
760
|
|
- $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
|
|
760
|
+ $order = Order::select(DB::raw('count(1) as order_count, count(distinct(receiverMobile)) as cust_count, sum(receivedAmount) as order_amount'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->whereRaw('left(createTime,7)="'.$v['month'].'"')->where('is_del', 0)->first();
|
761
|
761
|
//当月新粉下单单数
|
762
|
762
|
$v['order_count'] = $order->order_count;
|
763
|
763
|
//当月新粉下单人数
|
|
@@ -770,7 +770,7 @@ class TemplateController extends Controller
|
770
|
770
|
$v['new_order_rate'] = $v['fan_add']>0 ? round($v['cust_count'] / $v['fan_add'], 4) * 100 . '%' : '';
|
771
|
771
|
//新粉复购率
|
772
|
772
|
//复购用户数 = 下单超过一单的用户数
|
773
|
|
- $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(creatTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
|
|
773
|
+ $order_cust_fugou = Order::select(DB::raw('count(1) as counts,receiverMobile'))->where('admin_id', $v['admin_id'])->whereIn('receiverMobile', $phones)->where('is_del', 0)->whereRaw('left(createTime,7)="'.$v['month'].'"')->groupBy('receiverMobile')->having('counts', '>', 1)->get();
|
774
|
774
|
$customer_fugou_count = count($order_cust_fugou);
|
775
|
775
|
$v['cust_fugou_rate'] = $v['cust_count']>0 ? round($customer_fugou_count / $v['cust_count'], 4) * 100 . '%' : '';
|
776
|
776
|
//新粉订单复购率
|