添加:经销商升级条件 - 团队业绩满多少升级支持去除业绩最多的一条线

This commit is contained in:
wuhui_zzw 2023-11-04 18:01:37 +08:00
parent 2a992b56c7
commit 31684afd8b
3 changed files with 27 additions and 26 deletions

View File

@ -393,9 +393,9 @@ class TeamAgencyController extends BaseController
public function test(){
//因为model偶尔会出现status异常的问题所以重新查询一遍
// $model = Order::with('hasManyOrderGoods')->find(84);
// $set = \Setting::get('plugin.team_dividend');
// (new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
$model = Order::with('hasManyOrderGoods')->find(84);
$set = \Setting::get('plugin.team_dividend');
(new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
// $order = Order::find(87);
// $TeamReturnService = ReturnConfig::getClass();

View File

@ -443,13 +443,11 @@ class UpgrateConditionService{
if(Setting::get('plugin.team_dividend.level_up_choose') == 1){
$column = 'yz_order.goods_price';
$amount_name = '订单商品现价';
}
else{
}else{
$column = 'yz_order.price';
$amount_name = '订单实付金额';
}
if(!$type){
//$this->addErrorChild($type);
$this->uplogService->pushCondition([
'type' => $this->typeName,
'type_name' => '团队业绩'.$amount_name.'满',
@ -461,11 +459,23 @@ class UpgrateConditionService{
]);
return FALSE;
}
$teamOrderPrice = MemberChild::select(['yz_member_children.child_id','yz_member_children.member_id'])
->join('yz_order','yz_member_children.child_id','=','yz_order.uid')
->where('yz_order.status','>=',$this->order_status)
->where('yz_member_children.member_id',$this->uid)
->sum($column);
// 获取直推下级列表
$subIds = MemberChild::uniacid()
->where('level',1)
->where('member_id',$this->uid)
->pluck('child_id')
->toArray();
$subPerformance = [];// 每条线的业绩
foreach($subIds as $subUid){
$lineAllUid = MemberChild::uniacid()->where('member_id',$subUid)->pluck('child_id')->toArray();
$lineAllUid[] = $subUid;
$subPerformance[$subUid] = Order::whereIn('uid',$lineAllUid)->where('status','>=',$this->order_status)->sum($column);
}
// 计算团队总业绩 判断:是否去除最大业绩
$maxAmount = 0;
if((int)$this->upgradeParase['team_order_amount_close_max'] == 1) $maxAmount = max($subPerformance);
$teamOrderPrice = (float)sprintf("%.2f",array_sum($subPerformance) - $maxAmount);
// 判断:是否开启自购
$logremark = '不计算自购订单';
if($this->set['including_self'] == 1){
$logremark = '计算自购订单';
@ -473,12 +483,8 @@ class UpgrateConditionService{
->where('status','>=',$this->order_status)
->sum($column);
}
// 判断:是否符合条件
$condition = $teamOrderPrice >= $this->upgradeParase[$this->typeName];
/*dump($this->typeName);
dump($this->upgradeParase[$this->typeName]);
dump($teamOrderPrice);
return true;*/ // 记录详情
//$this->addLogChild($teamOrderPrice);
$this->uplogService->pushCondition([
'type' => $this->typeName,
'type_name' => '团队业绩'.$amount_name.'满['.$logremark.']',
@ -488,9 +494,7 @@ class UpgrateConditionService{
'result' => $condition,
'remark' => $condition ? '满足条件' : '不满足条件'
]);
if($condition){
return TRUE;
}
if($condition) return TRUE;
return FALSE;
}
/**

View File

@ -281,16 +281,13 @@
<div class="input-group row">
<label class="radio-inline col-xs-12 col-sm-6">
<input type="checkbox" name="upgrade_type[team_order_amount]" value="1"
@if ($upgrade_type['team_order_amount'])
checked
@endif
>
<input type="checkbox" name="upgrade_type[team_order_amount]" value="1" @if ($upgrade_type['team_order_amount']) checked @endif>
(编号:<a href='JavaScript:'>1007</a>)<br>
团队业绩金额满
<input type="text" name="upgrade_value[team_order_amount]"
value="{{$upgrade_value['team_order_amount']}}">
<input type="text" name="upgrade_value[team_order_amount]" value="{{$upgrade_value['team_order_amount']}}">
<span></span>
去除业绩最大的那条线
<input type="checkbox" name="upgrade_value[team_order_amount_close_max]" value="1" @if ($upgrade_value['team_order_amount_close_max']) checked @endif>
</label>
<label class="radio-inline col-xs-12 col-sm-6">
<input type="checkbox" name="upgrade_type[team_shop_order_amount]" value="1"