|
|
@@ -154,10 +154,12 @@ class FinanceRepository extends BaseRepository
|
|
154
|
154
|
$userByCodeCount = array_column($userByCodeCount, 'count', 'temp1');
|
|
155
|
155
|
|
|
156
|
156
|
$data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
|
|
157
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => 'V客'];
|
|
158
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '大V经理'];
|
|
159
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '区县代理'];
|
|
160
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '省级代理'];
|
|
|
157
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => '业务员'];
|
|
|
158
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '业务经理'];
|
|
|
159
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '初级合伙人'];
|
|
|
160
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '中级合伙人'];
|
|
|
161
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[7] ?? 0), 'name' => '高级合伙人'];
|
|
|
162
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[8] ?? 0), 'name' => '董事'];
|
|
161
|
163
|
$list1 = array(
|
|
162
|
164
|
array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-2'] ?? 0), 'name' => '集团会员'),//is_show=2
|
|
163
|
165
|
array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-1'] ?? 0), 'name' => '电商创客'),
|
|
|
@@ -240,10 +242,34 @@ class FinanceRepository extends BaseRepository
|
|
240
|
242
|
$query->where('mer_id', $mer_id);
|
|
241
|
243
|
})
|
|
242
|
244
|
->where('day', $lastDay)->value('balance');
|
|
|
245
|
+
|
|
|
246
|
+
|
|
243
|
247
|
$integral = Db::name('user_sign_score')
|
|
244
|
248
|
->where('pm', 1)
|
|
245
|
|
- ->whereBetween('settlement_time', date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600))
|
|
|
249
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
246
|
250
|
->sum('reward_socre');
|
|
|
251
|
+
|
|
|
252
|
+ $gongxian = Db::name('user_sign_gongxian')
|
|
|
253
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
|
254
|
+ ->sum('number');
|
|
|
255
|
+
|
|
|
256
|
+ $jingdou = Db::name('user_sign_jingdou')
|
|
|
257
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
|
258
|
+ ->sum('number');
|
|
|
259
|
+
|
|
|
260
|
+ $hongbao = Db::name('user_sign_hongbao')
|
|
|
261
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
|
262
|
+ ->sum('number');
|
|
|
263
|
+
|
|
|
264
|
+ $fugou = Db::name('user_sign_fugou')
|
|
|
265
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
|
266
|
+ ->sum('number');
|
|
|
267
|
+
|
|
|
268
|
+ $vr = Db::name('user_sign_vr')
|
|
|
269
|
+ ->whereBetween('settlement_time', [date('Y-m-d H:i:s', strtotime($day)), date('Y-m-d H:i:s', strtotime($day) + 24 * 3600)])
|
|
|
270
|
+ ->sum('number');
|
|
|
271
|
+
|
|
|
272
|
+
|
|
247
|
273
|
} else if ($type == 2 and $day != '') {
|
|
248
|
274
|
$date = new \DateTime($day);
|
|
249
|
275
|
$year = $date->format('Y');
|
|
|
@@ -304,6 +330,27 @@ class FinanceRepository extends BaseRepository
|
|
304
|
330
|
->where('pm', 1)
|
|
305
|
331
|
->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
306
|
332
|
->sum('reward_socre');
|
|
|
333
|
+
|
|
|
334
|
+ $gongxian = Db::name('user_sign_gongxian')
|
|
|
335
|
+ ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
|
336
|
+ ->sum('number');
|
|
|
337
|
+
|
|
|
338
|
+ $jingdou = Db::name('user_sign_jingdou')
|
|
|
339
|
+ ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
|
340
|
+ ->sum('number');
|
|
|
341
|
+
|
|
|
342
|
+ $hongbao = Db::name('user_sign_hongbao')
|
|
|
343
|
+ ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
|
344
|
+ ->sum('number');
|
|
|
345
|
+
|
|
|
346
|
+ $fugou = Db::name('user_sign_fugou')
|
|
|
347
|
+ ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
|
348
|
+ ->sum('number');
|
|
|
349
|
+
|
|
|
350
|
+ $vr = Db::name('user_sign_vr')
|
|
|
351
|
+ ->whereBetween('settlement_time', [date('Y-m-01 00:00:00', strtotime($year)), date('Y-m-d H:i:s', strtotime($lastDay) + 24 * 3600)])
|
|
|
352
|
+ ->sum('number');
|
|
|
353
|
+
|
|
307
|
354
|
} else {
|
|
308
|
355
|
$ruzhang = Db::name('enterprise_platform_income_detail')->where("deal_time <'" . date('Y-m-d H:i:s') . "'")
|
|
309
|
356
|
->when($mer_id, function ($query) use ($mer_id) {
|
|
|
@@ -349,13 +396,28 @@ class FinanceRepository extends BaseRepository
|
|
349
|
396
|
$integral = Db::name('user_sign_score')
|
|
350
|
397
|
->where('pm', 1)
|
|
351
|
398
|
->sum('reward_socre');
|
|
|
399
|
+
|
|
|
400
|
+ $gongxian = Db::name('user_sign_gongxian')
|
|
|
401
|
+ ->sum('number');
|
|
|
402
|
+
|
|
|
403
|
+ $jingdou = Db::name('user_sign_jingdou')
|
|
|
404
|
+ ->sum('number');
|
|
|
405
|
+
|
|
|
406
|
+ $hongbao = Db::name('user_sign_hongbao')
|
|
|
407
|
+ ->sum('number');
|
|
|
408
|
+
|
|
|
409
|
+ $fugou = Db::name('user_sign_fugou')
|
|
|
410
|
+ ->sum('number');
|
|
|
411
|
+
|
|
|
412
|
+ $vr = Db::name('user_sign_vr')
|
|
|
413
|
+ ->sum('number');
|
|
352
|
414
|
}
|
|
353
|
415
|
|
|
354
|
416
|
|
|
355
|
417
|
$yingyemoney = Db::name('store_order')->where($where)->sum('pay_price');
|
|
356
|
418
|
$hf_fee_amt = Db::name('store_order')->where($where_order)->sum('hf_fee_amt');//汇付手续费
|
|
357
|
419
|
|
|
358
|
|
- return compact('yingyemoney', 'hf_fee_amt', 'my_money', 'tixinan', 'ruzhang', 'shouyi', 'jieyu', 'integral', 'yanglao');
|
|
|
420
|
+ return compact('yingyemoney', 'hf_fee_amt', 'my_money', 'tixinan', 'ruzhang', 'shouyi', 'jieyu', 'integral', 'yanglao', 'gongxian', 'jingdou', 'hongbao', 'fugou', 'vr');
|
|
359
|
421
|
|
|
360
|
422
|
}
|
|
361
|
423
|
|
|
|
@@ -402,6 +464,7 @@ class FinanceRepository extends BaseRepository
|
|
402
|
464
|
});
|
|
403
|
465
|
$query1 = clone $query;
|
|
404
|
466
|
$query2 = clone $query;
|
|
|
467
|
+ $query3 = clone $query;
|
|
405
|
468
|
$data['list'] = $this->date_where($query, $where['date'], 'ub.create_time')
|
|
406
|
469
|
->field('ub.bill_id,ub.title,ub.number,ub.take_time,ub.commission_type,u.uid,u.phone,u.nickname,u.user_group,ub.order_sn,ub.take_time,ub.status,ub.create_time')
|
|
407
|
470
|
->order('ub.bill_id', 'desc')
|
|
|
@@ -415,28 +478,35 @@ class FinanceRepository extends BaseRepository
|
|
415
|
478
|
$data['count'] = $query->count();
|
|
416
|
479
|
$statistics = $query1->field('sum(ub.number) money,ub.commission_type')->group('ub.commission_type')->select()->toArray();
|
|
417
|
480
|
$statistics = array_column($statistics, 'money', 'commission_type');
|
|
|
481
|
+
|
|
|
482
|
+ $statistics_tow = $query3->field('sum(ub.number) money,ub.status')->group('ub.status')->select()->toArray();
|
|
|
483
|
+ $statistics_tow = array_column($statistics_tow, 'money', 'status');
|
|
|
484
|
+
|
|
418
|
485
|
//佣金类型 1代理费 2 消费佣金 3直推奖√ 4辖区佣金\r\n5 养老金√ 6 广告费 7 跨店奖励√ 8平台奖励 9渠道商\r\n10 推荐创客收益√ 11分红奖金√ 12区县代区域收益√ 13消费循环佣金 14-推荐代理收益√ 15邀请小区团长升级√ 16大V经理分享奖√ 17创客合伙人√ 18积分奖励√ 19创客补贴√' 20省级代理区域收益√
|
|
419
|
486
|
$data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(array_sum($statistics)), 'name' => '佣金奖励总额'];
|
|
420
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[3] ?? 0), 'name' => '直推奖'];
|
|
421
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[16] ?? 0), 'name' => '大V经理分享奖'];
|
|
422
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[14] ?? 0), 'name' => '推荐代理商收益'];
|
|
423
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[10] ?? 0), 'name' => '推荐创客收益'];
|
|
424
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[12] ?? 0), 'name' => '区县代区域收益'];
|
|
425
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[20] ?? 0), 'name' => '省级代理区域收益'];
|
|
426
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[15] ?? 0), 'name' => '邀请小区团长升级奖'];
|
|
427
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[7] ?? 0), 'name' => '跨店奖励'];
|
|
428
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[19] ?? 0), 'name' => '创客实际补贴'];
|
|
|
487
|
+ $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics_tow[1] ?? 0), 'name' => '已结算佣金'];
|
|
|
488
|
+ $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics_tow[0] ?? 0), 'name' => '未结算佣金'];
|
|
|
489
|
+ $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(0), 'name' => '转VR佣金'];
|
|
|
490
|
+ $user_extra_money = Db::name('user_extract')->where('status', 1)->sum('extract_price');
|
|
|
491
|
+ $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现佣金'];
|
|
|
492
|
+ $data['statistics'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
|
|
|
493
|
+
|
|
|
494
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[3] ?? 0), 'name' => '直推奖'];
|
|
|
495
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[16] ?? 0), 'name' => '大V经理分享奖'];
|
|
|
496
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[14] ?? 0), 'name' => '推荐代理商收益'];
|
|
|
497
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[10] ?? 0), 'name' => '推荐创客收益'];
|
|
|
498
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[12] ?? 0), 'name' => '区县代区域收益'];
|
|
|
499
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[20] ?? 0), 'name' => '省级代理区域收益'];
|
|
|
500
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[15] ?? 0), 'name' => '邀请小区团长升级奖'];
|
|
|
501
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[7] ?? 0), 'name' => '跨店奖励'];
|
|
|
502
|
+ // $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[19] ?? 0), 'name' => '创客实际补贴'];
|
|
429
|
503
|
|
|
430
|
504
|
$statistics = $query2->field('sum(ub.number) money,ub.status')->group('ub.status')->select()->toArray();
|
|
431
|
505
|
$statistics = array_column($statistics, 'money', 'status');
|
|
|
506
|
+ $data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(array_sum($statistics)), 'name' => '养老金总额'];
|
|
432
|
507
|
$data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[1] ?? 0), 'name' => '已结算养老金'];
|
|
433
|
508
|
$data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[0] ?? 0), 'name' => '未结算养老金'];
|
|
434
|
509
|
$data['statistics']['yanglao'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($statistics[-1] ?? 0), 'name' => '已失效养老金'];
|
|
435
|
|
- $user_extra_money = Db::name('user_extract')
|
|
436
|
|
- ->where('status', 1)
|
|
437
|
|
- ->sum('extract_price');
|
|
438
|
|
- $data['statistics']['commission'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
|
|
439
|
|
- $data['statistics'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($user_extra_money), 'name' => '已提现金额'];
|
|
440
|
510
|
return $data;
|
|
441
|
511
|
}
|
|
442
|
512
|
|
|
|
@@ -564,9 +634,9 @@ class FinanceRepository extends BaseRepository
|
|
564
|
634
|
$date['statistics']['all'] = decimal2($query1->where('pm', 1)->sum('reward_socre'));
|
|
565
|
635
|
$date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->where('pm', 1)->sum('reward_socre'));
|
|
566
|
636
|
$date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->where('pm', 1)->sum('reward_socre'));
|
|
567
|
|
- $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->where('pm', 1)->sum('reward_socre'));
|
|
568
|
|
- $date['statistics']['deduct'] = decimal2($query5->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
|
|
569
|
|
- $date['statistics']['all_mp1'] = decimal2($query6->where('uss.status', 1)->where('pm', 1)->sum('reward_socre') - $query7->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
|
|
|
637
|
+ $date['statistics']['lost'] = decimal2($query4->where('pm', 2)->sum('reward_socre'));
|
|
|
638
|
+ // $date['statistics']['deduct'] = decimal2($query5->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
|
|
|
639
|
+ // $date['statistics']['all_mp1'] = decimal2($query6->where('uss.status', 1)->where('pm', 1)->sum('reward_socre') - $query7->where('uss.status', 1)->where('pm', 2)->sum('reward_socre'));
|
|
570
|
640
|
|
|
571
|
641
|
return $date;
|
|
572
|
642
|
}
|
|
|
@@ -629,7 +699,7 @@ class FinanceRepository extends BaseRepository
|
|
629
|
699
|
$date['statistics']['all'] = decimal2($query1->sum('number'));
|
|
630
|
700
|
$date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
|
|
631
|
701
|
$date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
|
|
632
|
|
- $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
|
|
|
702
|
+ $date['statistics']['lost'] = decimal2($query4->where('uss.type', 2)->sum('number'));
|
|
633
|
703
|
|
|
634
|
704
|
return $date;
|
|
635
|
705
|
}
|
|
|
@@ -680,7 +750,7 @@ class FinanceRepository extends BaseRepository
|
|
680
|
750
|
$date['list'] = $this->date_where($query, $where['date'], 'uss.addtime', '-', 2)
|
|
681
|
751
|
->field('uss.id,uss.addtime,u.nickname,u.phone,uss.number,o.order_sn,uss.status,uss.mark,u.score')
|
|
682
|
752
|
->page($page, $limit)
|
|
683
|
|
- ->order('uss.id', 'desc')
|
|
|
753
|
+ ->order('uss.number', 'desc')
|
|
684
|
754
|
->select()
|
|
685
|
755
|
->each(function ($item) {
|
|
686
|
756
|
$item['mark'] = $item['mark'];
|
|
|
@@ -754,7 +824,7 @@ class FinanceRepository extends BaseRepository
|
|
754
|
824
|
$date['statistics']['all'] = decimal2($query1->sum('number'));
|
|
755
|
825
|
$date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
|
|
756
|
826
|
$date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
|
|
757
|
|
- $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
|
|
|
827
|
+ $date['statistics']['lost'] = decimal2($query4->where('uss.type', 2)->sum('number'));
|
|
758
|
828
|
|
|
759
|
829
|
return $date;
|
|
760
|
830
|
}
|
|
|
@@ -816,7 +886,8 @@ class FinanceRepository extends BaseRepository
|
|
816
|
886
|
$date['statistics']['all'] = decimal2($query1->sum('number'));
|
|
817
|
887
|
$date['statistics']['clear'] = decimal2($query2->where('uss.status', 1)->sum('number'));
|
|
818
|
888
|
$date['statistics']['nclear'] = decimal2($query3->where('uss.status', -1)->sum('number'));
|
|
819
|
|
- $date['statistics']['lost'] = decimal2($query4->where('uss.status', 0)->sum('number'));
|
|
|
889
|
+ $date['statistics']['tixian'] = decimal2($query4->where('uss.status', 0)->sum('number'));
|
|
|
890
|
+ $date['statistics']['zhuan_vr'] = decimal2('0');
|
|
820
|
891
|
|
|
821
|
892
|
return $date;
|
|
822
|
893
|
}
|
|
|
@@ -877,7 +948,7 @@ class FinanceRepository extends BaseRepository
|
|
877
|
948
|
});
|
|
878
|
949
|
$date['count'] = $query->count();
|
|
879
|
950
|
$date['statistics']['all'] = decimal2($query1->sum('number'));
|
|
880
|
|
- $date['statistics']['clear'] = decimal2($query2->where('uss.type', 1)->sum('number'));
|
|
|
951
|
+ // $date['statistics']['clear'] = decimal2($query2->where('uss.type', 1)->sum('number'));
|
|
881
|
952
|
$date['statistics']['nclear'] = decimal2($query3->where('uss.type', 2)->sum('number'));
|
|
882
|
953
|
|
|
883
|
954
|
return $date;
|