parent
7dd5e3b8ef
commit
14623f2d98
|
|
@ -18,6 +18,7 @@ use app\common\services\finance\IncomeService;
|
|||
use app\framework\Database\Eloquent\Collection;
|
||||
use app\frontend\modules\finance\models\Withdraw;
|
||||
use app\frontend\modules\member\models\MemberBankCard;
|
||||
use Yunshop\Commission\models\CommissionOrder;
|
||||
use Yunshop\ShareholderDividend\models\ShareholderDividendModel;
|
||||
use Yunshop\ShopEsignV2\common\models\BaseSetting;
|
||||
use Yunshop\ShopEsignV2\common\models\Company;
|
||||
|
|
@ -505,7 +506,20 @@ class IncomeWithdrawController extends ApiController
|
|||
$amountList = ShareholderDividendModel::getIncome((int)$uid,(int)1,'undrawn')
|
||||
->select(['yz_member_income.id','yz_member_income.amount'])
|
||||
->get()->toArray();
|
||||
}else{
|
||||
}
|
||||
else if($income['type'] == 'commission'){
|
||||
// 分销商分红 - 分销商分红
|
||||
$amountList = CommissionOrder::getIncome((int)$uid,(int)0,'undrawn')
|
||||
->select(['yz_member_income.id','yz_member_income.amount'])
|
||||
->get()->toArray();
|
||||
}
|
||||
else if($income['type'] == 'commission_share_reward'){
|
||||
// 分销商分红 - 分享奖励
|
||||
$amountList = CommissionOrder::getIncome((int)$uid,(int)1,'undrawn')
|
||||
->select(['yz_member_income.id','yz_member_income.amount'])
|
||||
->get()->toArray();
|
||||
}
|
||||
else{
|
||||
$amountList = $this->getIncomeModel()->select(['id','amount'])->where('incometable_type', $income['class'])->get()->toArray();
|
||||
}
|
||||
$this->withdraw_amounts = sprintf("%.2f",array_sum(array_column($amountList,'amount')));
|
||||
|
|
|
|||
|
|
@ -29,16 +29,22 @@ class PluginApplication extends \app\common\services\PluginApplication
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getIncomeItems()
|
||||
{
|
||||
return ['commission' => [
|
||||
'title' => \Setting::get('shop.lang.zh_cn.commission.commission_amount') ?: trans('Yunshop\Commission::index.commission'),
|
||||
'type' => 'commission',
|
||||
'class' => 'Yunshop\Commission\models\CommissionOrder',
|
||||
'name' => 'updatedWithdraw',
|
||||
'value' => 'withdraw',
|
||||
]];
|
||||
public function getIncomeItems(){
|
||||
return [
|
||||
'commission' => [
|
||||
'title' => \Setting::get('shop.lang.zh_cn.commission.commission_amount') ?: trans('Yunshop\Commission::index.commission'),
|
||||
'type' => 'commission',
|
||||
'class' => 'Yunshop\Commission\models\CommissionOrder',
|
||||
'name' => 'updatedWithdraw',
|
||||
'value' => 'withdraw',
|
||||
],
|
||||
'commission_share_reward' => [
|
||||
'title' => '分享奖励',
|
||||
'type' => 'commission_share_reward',
|
||||
'type_name' => '分享奖励',
|
||||
'class' => 'Yunshop\Commission\models\CommissionOrder',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getTemplateItems()
|
||||
|
|
|
|||
|
|
@ -539,4 +539,32 @@ class CommissionOrder extends BaseModel
|
|||
}, []);
|
||||
return $query->whereIn('id', $errorCommissionOrderIds);
|
||||
}
|
||||
/**
|
||||
* Common: 获取对应的分销商提成信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/23 16:58
|
||||
* @param int $uid
|
||||
* @param int $levelType
|
||||
* @param string $incomeStatus
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getIncome(int $uid,int $levelType,string $incomeStatus = 'all'){
|
||||
// $levelType 0=普通分销商订单,1=文创分销商订单
|
||||
return self::uniacid()
|
||||
->leftJoin('yz_member_income', function ($join) {
|
||||
$join->on('yz_member_income.member_id', 'yz_commission_order.member_id')->on('yz_member_income.incometable_id', 'yz_commission_order.id');
|
||||
})
|
||||
->where('yz_member_income.dividend_code',1)
|
||||
->where('yz_commission_order.level_type',$levelType)
|
||||
->where('yz_commission_order.member_id',$uid)
|
||||
->when($incomeStatus != 'all',function($query) use ($incomeStatus){
|
||||
$query->where('yz_member_income.status',$incomeStatus == 'undrawn' ? 0 : 1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ use app\common\services\credit\ConstService;
|
|||
use app\common\services\finance\BalanceChange;
|
||||
use app\common\services\password\PasswordService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\Commission\models\CommissionOrder;
|
||||
use Yunshop\CulturalSpace\models\ContributionBonusLog;
|
||||
use Yunshop\CulturalSpace\models\ContributionLog;
|
||||
use Yunshop\CulturalSpace\models\CulturalOrderFundLog;
|
||||
|
|
@ -125,6 +126,16 @@ class IndexController extends ApiController{
|
|||
break;
|
||||
// 股权收益明细
|
||||
case 'shareholding_income':$result = [];break;
|
||||
// 分享奖励明细
|
||||
case 'share_reward':
|
||||
$result = CommissionOrder::getIncome((int)$uid,(int)1)
|
||||
->select([
|
||||
'yz_commission_order.created_at',
|
||||
'yz_member_income.amount'
|
||||
])
|
||||
->paginate(20)
|
||||
->toArray();
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->successJson('success',[
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use app\common\models\member\MemberParent;
|
|||
use app\common\models\Order;
|
||||
use app\common\models\OrderGoods;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\Commission\models\CommissionOrder;
|
||||
use Yunshop\ShareholderDividend\models\ShareholderDividendModel;
|
||||
use Yunshop\TeamDividend\admin\models\MemberChild;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
|
|
@ -334,7 +335,7 @@ class CulturalSpace extends BaseModel
|
|||
// 获取加权收益
|
||||
$weightIncome = ShareholderDividendModel::getIncome((int)$uid,(int)1)->sum('yz_member_income.amount');
|
||||
// 分享奖励
|
||||
$shareReward = 0;
|
||||
$shareReward = CommissionOrder::getIncome((int)$uid,(int)1,'undrawn')->sum('yz_member_income.amount');
|
||||
|
||||
// $isPartner = 0;
|
||||
$list = [
|
||||
|
|
@ -348,7 +349,7 @@ class CulturalSpace extends BaseModel
|
|||
'team_performance' => ['key_name' => 'team_performance','title' => '团队总业绩','num' => $teamAmount['team_amount'],'sort' => 8],
|
||||
'weight_income' => ['key_name' => 'weight_income','title' => '加权收益','num' => $weightIncome,'sort' => 9],
|
||||
'shareholding_income' => ['key_name' => 'shareholding_income','title' => '股权收益','num' => 0,'sort' => 10],
|
||||
'share_reward' => ['key_name' => 'shareholding_income','title' => '分享奖励','num' => $shareReward,'sort' => 11],
|
||||
'share_reward' => ['key_name' => 'share_reward','title' => '分享奖励','num' => $shareReward,'sort' => 11],
|
||||
];
|
||||
// 合伙人等级增加显示加权收益,不显示服务收益、贡献收益、贡献值分红
|
||||
// if($isPartner) unset($list['service_income'],$list['contribution_income'],$list['contribution_bonus']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue