添加:经销商列表显示升级赠送名额
This commit is contained in:
parent
3c0efc948e
commit
e72aa80fd3
|
|
@ -10,6 +10,7 @@ use app\common\exceptions\ShopException;
|
|||
use app\common\helpers\PaginationHelper;
|
||||
use app\common\helpers\Url;
|
||||
use app\common\models\Member;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\TeamDividend\admin\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\models\CodeRecordModel;
|
||||
use Yunshop\TeamDividend\models\Log;
|
||||
|
|
@ -85,8 +86,31 @@ class TeamAgencyController extends BaseController
|
|||
$level = TeamDividendLevelModel::getList()->get();
|
||||
// 获取所有经销商的排名信息
|
||||
$rankList = TeamDividendLevelModel::getRanking();
|
||||
// 获取每个经销商的赠送名额
|
||||
$uidS = array_column($list['data'],'uid');
|
||||
$quotaInfo = Uplog::uniacid()
|
||||
->select([DB::raw("sum(give_limit) as total_quota"),'uid'])
|
||||
->whereIn('uid',$uidS)
|
||||
->orderBy('created_at','ASC')
|
||||
->groupBy('uid')
|
||||
->get()
|
||||
->toArray();
|
||||
$quotaInfo = array_column($quotaInfo,'total_quota','uid');
|
||||
// 已使用
|
||||
$useQuota = TeamDividendAgencyModel::uniacid()
|
||||
->select([DB::raw("count(id) as total_use_quota"),'give_uid'])
|
||||
->whereIn('give_uid',$uidS)
|
||||
->groupBy('uid')
|
||||
->get()
|
||||
->toArray();
|
||||
$useQuota = array_column($useQuota,'total_use_quota','give_uid');
|
||||
foreach ($list['data'] as $key => $item) {
|
||||
$list['data'][$key]['total'] = count($item['has_many_member_children']);
|
||||
// 剩余名额处理
|
||||
$list['data'][$key]['total_quota'] = (int)$quotaInfo[$item['uid']];
|
||||
$list['data'][$key]['surplus_quota'] = (int)$quotaInfo[$item['uid']] - (int)$useQuota[$item['uid']];
|
||||
$list['data'][$key]['use_quota'] = (int)$useQuota[$item['uid']];
|
||||
// 排名处理
|
||||
$list['data'][$key]['rank_list'] = array_filter(array_map(function($rankInfo) use ($item){
|
||||
$rankSort = (string)$rankInfo['up_log'][$item['uid']];
|
||||
if($rankSort === '0' || $rankSort) {
|
||||
|
|
|
|||
|
|
@ -107,12 +107,13 @@
|
|||
<table class="table table-hover" >
|
||||
<thead class="navbar-inner">
|
||||
<tr>
|
||||
<th width="5.5%">ID</th>
|
||||
<th width="8.5%">会员ID</th>
|
||||
<th width="13.5%">成为经销商时间<br>升级时间</th>
|
||||
<th width="8.5%">经销商</th>
|
||||
<th width="10.5%">等级</th>
|
||||
<th style="width: 50px;">ID</th>
|
||||
<th style="width: 50px;">UID</th>
|
||||
<th style="width: 160px;">成为经销商时间<br>升级时间</th>
|
||||
<th style="width: 120px;">经销商</th>
|
||||
<th style="width: 120px;">等级</th>
|
||||
<th style="width: 100px;">排名</th>
|
||||
<th style="width: 150px;">名额(剩余/已使用)</th>
|
||||
<th width="8.5%">直属总经销商人数</th>
|
||||
<th width="8.5%">经销商比例<br>累计提成</th>
|
||||
<th width="8.5%">已结算提成<br>未结算提成</th>
|
||||
|
|
@ -166,6 +167,10 @@
|
|||
@endforeach
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{$item['surplus_quota']}} / {{$item['use_quota']}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{$item['total'] ?? 0}}人
|
||||
<a href="{{yzWebUrl('plugin.team-dividend.admin.team-agency',['uid'=>$item['uid']])}}">
|
||||
|
|
|
|||
Loading…
Reference in New Issue