diff --git a/app/frontend/modules/finance/controllers/IncomeWithdrawController.php b/app/frontend/modules/finance/controllers/IncomeWithdrawController.php index e157d988..52c5353c 100644 --- a/app/frontend/modules/finance/controllers/IncomeWithdrawController.php +++ b/app/frontend/modules/finance/controllers/IncomeWithdrawController.php @@ -479,7 +479,7 @@ class IncomeWithdrawController extends ApiController ->where('yz_member_income.incometable_type', $income['class']) ->where('yz_member_income.status', Income::STATUS_INITIAL) ->where('yz_member_income.member_id', $uid) - ->whereNotIn('yz_team_dividend.type', [4,5]) + ->whereNotIn('yz_team_dividend.type', [4,5,6]) ->get()->toArray(); } else if($income['type'] == 'teamDividendCultural'){ @@ -495,6 +495,41 @@ class IncomeWithdrawController extends ApiController ->whereIn('yz_team_dividend.type', [4,5]) ->get()->toArray(); } + else if($income['type'] == 'ecological_services'){ + // 生态服务 + $amountList = Income::uniacid() + ->select(['yz_member_income.id','yz_member_income.amount']) + ->leftJoin('yz_team_dividend','yz_team_dividend.id','yz_member_income.incometable_id') + ->where('yz_member_income.incometable_type', $income['class']) + ->where('yz_member_income.status', Income::STATUS_INITIAL) + ->where('yz_member_income.member_id', $uid) + ->where('yz_team_dividend.type',6) + ->get()->toArray(); + } + else if($income['type'] == 'ecological_construction'){ + // 生态建设 + $startTime = strtotime(date("Y-m-1"));// 本月1号0点 + $amountList = Income::uniacid() + ->select(['yz_member_income.id','yz_member_income.amount']) + ->leftJoin('yz_team_dividend','yz_team_dividend.id','yz_member_income.incometable_id') + ->where('yz_member_income.incometable_type', $income['class']) + ->where('yz_member_income.status', Income::STATUS_INITIAL) + ->where('yz_member_income.member_id', $uid) + ->where('yz_member_income.created_at', '<',$startTime) + ->where('yz_team_dividend.type', 4) + ->get()->toArray(); + } + else if($income['type'] == 'ecological_contribution'){ + // 生态贡献 + $amountList = Income::uniacid() + ->select(['yz_member_income.id','yz_member_income.amount']) + ->leftJoin('yz_team_dividend','yz_team_dividend.id','yz_member_income.incometable_id') + ->where('yz_member_income.incometable_type', $income['class']) + ->where('yz_member_income.status', Income::STATUS_INITIAL) + ->where('yz_member_income.member_id', $uid) + ->where('yz_team_dividend.type', 5) + ->get()->toArray(); + } else if($income['type'] == 'shaerholderDividend'){ // 股东分红 - 股东分红 $amountList = ShareholderDividendModel::getIncome((int)$uid,(int)0,'undrawn') @@ -514,7 +549,7 @@ class IncomeWithdrawController extends ApiController ->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(); diff --git a/plugins/commission/src/PluginApplication.php b/plugins/commission/src/PluginApplication.php index 32a1bbb1..969cf54d 100644 --- a/plugins/commission/src/PluginApplication.php +++ b/plugins/commission/src/PluginApplication.php @@ -39,9 +39,9 @@ class PluginApplication extends \app\common\services\PluginApplication 'value' => 'withdraw', ], 'commission_share_reward' => [ - 'title' => '分享奖励', + 'title' => '生态发展', 'type' => 'commission_share_reward', - 'type_name' => '分享奖励', + 'type_name' => '生态发展', 'class' => 'Yunshop\Commission\models\CommissionOrder', ] ]; diff --git a/plugins/cultural-space/src/api/IndexController.php b/plugins/cultural-space/src/api/IndexController.php index ba6028d5..84b15af0 100644 --- a/plugins/cultural-space/src/api/IndexController.php +++ b/plugins/cultural-space/src/api/IndexController.php @@ -70,8 +70,9 @@ class IndexController extends ApiController{ $uid = \YunShop::app()->getMemberId(); // 根据类型获取对应的列表 switch($keyName){ - // 服务收益明细 + // 服务收益明细 || 生态建设 case 'service_income': + case 'ecological_construction': $result = TeamDividendModel::getTypeTotalIncome((int)$uid,(int)4) ->select(['yz_team_dividend.agent_level','yz_team_dividend.order_sn','yz_team_dividend.status','yz_team_dividend.type','yz_team_dividend.created_at','yz_member_income.amount']) ->paginate(20) @@ -138,7 +139,7 @@ class IndexController extends ApiController{ break; // 股权收益明细 case 'shareholding_income':$result = [];break; - // 分享奖励明细 + // 生态发展明细 case 'share_reward': $result = CommissionOrder::getIncome((int)$uid,(int)1) ->select([ @@ -148,6 +149,13 @@ class IndexController extends ApiController{ ->paginate(20) ->toArray(); break; + // 生态服务 + case 'ecological_services': + $result = TeamDividendModel::getTypeTotalIncome((int)$uid,(int)6) + ->select(['yz_team_dividend.agent_level','yz_team_dividend.order_sn','yz_team_dividend.status','yz_team_dividend.type','yz_team_dividend.created_at','yz_member_income.amount']) + ->paginate(20) + ->toArray(); + break; } return $this->successJson('success',[ @@ -470,7 +478,7 @@ class IndexController extends ApiController{ switch($typeName){ // 生态发展收益 case 'ecological': - $amount = Income::uniacid() + /*$amount = Income::uniacid() ->select(['yz_member_income.id','yz_member_income.amount']) ->leftJoin('yz_team_dividend','yz_team_dividend.id','yz_member_income.incometable_id') ->where('yz_member_income.incometable_type', 'Yunshop\TeamDividend\models\TeamDividendModel') @@ -488,15 +496,16 @@ class IndexController extends ApiController{ ->where('yz_member_income.member_id', $uid) ->whereIn('yz_team_dividend.type', [4,5]) ->groupBy('yz_withdraw_income_apply.withdraw_id') - ->sum('yz_withdraw.poundage'); + ->sum('yz_withdraw.poundage');*/ $info = [ - 'service_income' => TeamDividendModel::getTypeTotalIncome((int)$uid,(int)4)->sum('yz_member_income.amount'),// 生态服务 + 'service_income' => TeamDividendModel::getTypeTotalIncome((int)$uid,(int)4)->sum('yz_member_income.amount'),// 生态建设 'contribution_income' => TeamDividendModel::getTypeTotalIncome((int)$uid,(int)5)->sum('yz_member_income.amount'),// 生态贡献 - 'share_reward' => CommissionOrder::getIncome((int)$uid,(int)1,'undrawn')->sum('yz_member_income.amount'),// 分享奖励 - 'commission' => $poundage,// 总手续费 - 'withdrawal' => $amount,// 总提现金额 + 'commission' => TeamDividendModel::getTypeTotalIncome((int)$uid,(int)6)->sum('yz_member_income.amount'),// 生态服务 + 'share_reward' => CommissionOrder::getIncome((int)$uid,(int)1,'undrawn')->sum('yz_member_income.amount'),// 生态发展 + // 'commission' => $poundage,// 总手续费 + // 'withdrawal' => $amount,// 总提现金额 ]; break; // 贡献分红 @@ -562,7 +571,7 @@ class IndexController extends ApiController{ ->where('yz_member_income.incometable_type', 'Yunshop\TeamDividend\models\TeamDividendModel') ->where('yz_member_income.status', Income::STATUS_WITHDRAW) ->where('yz_member_income.member_id', $uid) - ->whereIn('yz_team_dividend.type', [4,5]) + ->whereIn('yz_team_dividend.type', [4,5,6]) ->groupBy('yz_withdraw_income_apply.withdraw_id') ->orderBy('yz_withdraw.created_at','DESC') ->paginate(20) diff --git a/plugins/cultural-space/src/models/CulturalSpace.php b/plugins/cultural-space/src/models/CulturalSpace.php index 34b43589..934f7f1b 100644 --- a/plugins/cultural-space/src/models/CulturalSpace.php +++ b/plugins/cultural-space/src/models/CulturalSpace.php @@ -322,13 +322,13 @@ class CulturalSpace extends BaseModel * @return array[] */ public function getStatistics($uid){ - // 服务收益(生态服务) 经销商 津贴(补贴) 奖励 + // 服务收益(生态服务) 经销商 生态建设 奖励 $serviceIncome = TeamDividendModel::getTypeTotalIncome((int)$uid,(int)4)->sum('yz_member_income.amount'); // 获取用户当前经销商等级对应的文创补贴名称 // $teamDividendLevel = TeamDividendAgencyModel::where('uid',$uid)->value('cultural_level_id'); $serviceIncomeTitle = '生态服务';//TeamDividendLevelModel::uniacid()->where('id',$teamDividendLevel)->value('cultural_level_name'); - // 贡献收益(生态贡献) 经销商 津贴(补贴)平级奖 奖励 + // 贡献收益(生态贡献) 经销商 生态贡献 奖励 $contributionIncome = TeamDividendModel::getTypeTotalIncome((int)$uid,(int)5)->sum('yz_member_income.amount'); // 贡献值分红 $contributionBonus = ContributionBonusLog::getIncomeSum($uid)->sum('yz_member_income.amount'); @@ -358,7 +358,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' => 'share_reward','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']); diff --git a/plugins/team-dividend/src/PluginApplication.php b/plugins/team-dividend/src/PluginApplication.php index e2d1eac2..1827724c 100644 --- a/plugins/team-dividend/src/PluginApplication.php +++ b/plugins/team-dividend/src/PluginApplication.php @@ -639,13 +639,13 @@ class PluginApplication extends \app\common\services\PluginApplication $lang = \Setting::get('shop.lang', ['lang' => 'zh_cn'])['zh_cn']['team_dividend']; $title = $lang['title'] ?: trans('Yunshop\TeamDividend::index.name'); $dividend = $lang['dividend'] ?: trans('Yunshop\TeamDividend::index.dividend'); - $teamDividendCulturalName = '服务津贴'; - $uid = \YunShop::app()->getMemberId(); - if($uid > 0){ - $culturalLevelId = TeamDividendAgencyModel::uniacid()->where('uid',$uid)->value('cultural_level_id'); - $teamDividendCulturalName = TeamDividendLevelModel::uniacid()->where('id',$culturalLevelId)->value('cultural_level_name'); - $teamDividendCulturalName = !empty($teamDividendCulturalName) ? $teamDividendCulturalName : '服务津贴'; - } + // $teamDividendCulturalName = '生态建设'; + // $uid = \YunShop::app()->getMemberId(); + // if($uid > 0){ + // $culturalLevelId = TeamDividendAgencyModel::uniacid()->where('uid',$uid)->value('cultural_level_id'); + // $teamDividendCulturalName = TeamDividendLevelModel::uniacid()->where('id',$culturalLevelId)->value('cultural_level_name'); + // $teamDividendCulturalName = !empty($teamDividendCulturalName) ? $teamDividendCulturalName : '生态建设'; + // } return [ 'teamDividend' => [ 'title' => $lang['title'] ?: trans('Yunshop\TeamDividend::index.title'), @@ -659,12 +659,32 @@ class PluginApplication extends \app\common\services\PluginApplication // 'type_name' => '店长店补', // 'class' => 'Yunshop\TeamDividend\Common\models\StoreManagerRecordModel', // ], - 'teamDividendCultural' => [ - 'title' => $teamDividendCulturalName, - 'type' => 'teamDividendCultural', - 'type_name' => $teamDividendCulturalName, + // 'teamDividendCultural' => [ + // 'title' => $teamDividendCulturalName, + // 'type' => 'teamDividendCultural', + // 'type_name' => $teamDividendCulturalName, + // 'class' => 'Yunshop\TeamDividend\models\TeamDividendModel', + // ], + + 'ecological_services' => [ + 'title' => '生态服务', + 'type' => 'ecological_services', + 'type_name' => '生态服务', 'class' => 'Yunshop\TeamDividend\models\TeamDividendModel', ], + 'ecological_construction' => [ + 'title' => '生态建设', + 'type' => 'ecological_construction', + 'type_name' => '生态建设', + 'class' => 'Yunshop\TeamDividend\models\TeamDividendModel', + ], + 'ecological_contribution' => [ + 'title' => '生态贡献', + 'type' => 'ecological_contribution', + 'type_name' => '生态贡献', + 'class' => 'Yunshop\TeamDividend\models\TeamDividendModel', + ], + ]; } diff --git a/plugins/team-dividend/src/widgets/TeamDividendWithdrawWidget.php b/plugins/team-dividend/src/widgets/TeamDividendWithdrawWidget.php index c73d4848..b325f4a4 100644 --- a/plugins/team-dividend/src/widgets/TeamDividendWithdrawWidget.php +++ b/plugins/team-dividend/src/widgets/TeamDividendWithdrawWidget.php @@ -10,10 +10,20 @@ class TeamDividendWithdrawWidget extends Widget public function run() { $set = Setting::get('withdraw.teamDividend', ['roll_out_limit' => '', 'poundage_rate' => '']); - $teamDividendCulturalSet = Setting::get('withdraw.teamDividendCultural', ['roll_out_limit' => '', 'poundage_rate' => '']); + // $teamDividendCulturalSet = Setting::get('withdraw.teamDividendCultural', ['roll_out_limit' => '', 'poundage_rate' => '']); + + + $ecological_services = Setting::get('withdraw.ecological_services', ['roll_out_limit' => '', 'poundage_rate' => '']); + $ecological_construction = Setting::get('withdraw.ecological_construction', ['roll_out_limit' => '', 'poundage_rate' => '']); + $ecological_contribution = Setting::get('withdraw.ecological_contribution', ['roll_out_limit' => '', 'poundage_rate' => '']); + + return view('Yunshop\TeamDividend::admin.withdraw-set', [ 'set' => $set, - 'teamDividendCulturalSet' => $teamDividendCulturalSet + // 'teamDividendCulturalSet' => $teamDividendCulturalSet, + 'ecological_services' => $ecological_services, + 'ecological_construction' => $ecological_construction, + 'ecological_contribution' => $ecological_contribution, ])->render(); } } \ No newline at end of file diff --git a/plugins/team-dividend/views/admin/withdraw-set.blade.php b/plugins/team-dividend/views/admin/withdraw-set.blade.php index 9faf2cd8..4fd43f11 100644 --- a/plugins/team-dividend/views/admin/withdraw-set.blade.php +++ b/plugins/team-dividend/views/admin/withdraw-set.blade.php @@ -50,7 +50,7 @@ {{--服务津贴提现设置--}} -
+{{--
服务津贴提现设置
@@ -96,7 +96,162 @@
+ --}} + + +
+
+
生态服务设置
+
+ +
+ + 当前代理的佣金达到此额度时才能提现 +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+
生态建设设置
+
+
+ +
+ + 当前代理的佣金达到此额度时才能提现 +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+
生态贡献设置
+
+
+ +
+ + 当前代理的佣金达到此额度时才能提现 +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ + + + + @@ -113,7 +268,7 @@ } }); - $(":radio[name='withdraw[teamDividendCultural][poundage_type]']").click(function () { +/* $(":radio[name='withdraw[teamDividendCultural][poundage_type]']").click(function () { if ($(this).val() == 1) { $("#teamDividendCultural_poundage_unit").html('元'); $("#teamDividendCultural_poundage_hint").html('固定金额'); @@ -122,7 +277,43 @@ $("#teamDividendCultural_poundage_unit").html('%'); $("#teamDividendCultural_poundage_hint").html('手续费比例') } + });*/ + + + $(":radio[name='withdraw[ecological_services][poundage_type]']").click(function () { + if ($(this).val() == 1) { + $("#ecological_services_poundage_unit").html('元'); + $("#ecological_services_poundage_hint").html('固定金额'); + } + else { + $("#ecological_services_poundage_unit").html('%'); + $("#ecological_services_poundage_hint").html('手续费比例') + } }); + $(":radio[name='withdraw[ecological_construction][poundage_type]']").click(function () { + if ($(this).val() == 1) { + $("#ecological_construction_poundage_unit").html('元'); + $("#ecological_construction_poundage_hint").html('固定金额'); + } + else { + $("#ecological_construction_poundage_unit").html('%'); + $("#ecological_construction_poundage_hint").html('手续费比例') + } + }); + + $(":radio[name='withdraw[ecological_contribution][poundage_type]']").click(function () { + if ($(this).val() == 1) { + $("#ecological_contribution_poundage_unit").html('元'); + $("#ecological_contribution_poundage_hint").html('固定金额'); + } + else { + $("#ecological_contribution_poundage_unit").html('%'); + $("#ecological_contribution_poundage_hint").html('手续费比例') + } + }); + + + })