parent
02fd5099c7
commit
ed4e4c02a7
|
|
@ -9,6 +9,9 @@ use Yunshop\CollectionRoom\models\CollectionRoomIdentifierModel;
|
|||
class PluginApplication extends \app\common\services\PluginApplication{
|
||||
|
||||
protected function setMenuConfig(){
|
||||
|
||||
|
||||
return [];
|
||||
\app\backend\modules\menu\Menu::current()->setPluginMenu('collection-room', [
|
||||
'name' => '典藏室',
|
||||
'type' => 'marketing',
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ use Yunshop\CulturalSpace\models\CulturalSpaceAreaCycle;
|
|||
class PluginApplication extends \app\common\services\PluginApplication{
|
||||
|
||||
protected function setMenuConfig(){
|
||||
|
||||
return [];
|
||||
\app\backend\modules\menu\Menu::current()->setPluginMenu('cultural-space', [
|
||||
'name' => '文创空间',
|
||||
'type' => 'marketing',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2017/7/10
|
||||
* Time: 下午2:38
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/6
|
||||
* Time: 6:21 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/6
|
||||
* Time: 6:21 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class OrderCreatedListener
|
|||
|
||||
$set = $order->getSetting('plugin.team_dividend');
|
||||
|
||||
// \Log::debug('经销商管理基础设置',$set);
|
||||
\Log::debug('经销商管理基础设置',$set);
|
||||
|
||||
//是否开启经销商插件
|
||||
if (!$set['is_team_dividend']) {
|
||||
|
|
@ -88,22 +88,17 @@ class OrderCreatedListener
|
|||
$buyMember = $order->belongsToMember;
|
||||
|
||||
$agents = GetAgentsService::index($set, $order->uid, $order->create_time);
|
||||
// \Log::debug('经销商-获取经销商',$agents);
|
||||
try{
|
||||
foreach ($order->hasManyOrderGoods as $order_goods) {
|
||||
// 普通经销商提成处理
|
||||
$TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents);
|
||||
$TeamReturnService->handle();
|
||||
$this->totalDividend += $TeamReturnService->totalDividend;
|
||||
}
|
||||
// 订单插件分红记录
|
||||
(new OrderBonusJob('yz_team_dividend', 'team-dividend', 'order_sn', 'order_sn', 'dividend_amount', $order, $this->totalDividend))->handle();
|
||||
\Log::debug('经销商-获取经销商',$agents);
|
||||
foreach ($order->hasManyOrderGoods as $order_goods) {
|
||||
|
||||
}catch(\Exception $e){
|
||||
\Log::debug('经销商奖励 - 错误',$e->getMessage());
|
||||
$TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents);
|
||||
$TeamReturnService->handle();
|
||||
$this->totalDividend += $TeamReturnService->totalDividend;
|
||||
}
|
||||
|
||||
\Log::debug('经销商奖励完成',$this->totalDividend);
|
||||
// 订单插件分红记录
|
||||
(new OrderBonusJob('yz_team_dividend', 'team-dividend', 'order_sn', 'order_sn', 'dividend_amount', $order, $this->totalDividend))->handle();
|
||||
\Log::debug('经销商奖励完成');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2017/9/13
|
||||
* Time: 下午7:00
|
||||
*/
|
||||
|
|
@ -56,16 +56,16 @@ class OrderPaidListener
|
|||
|
||||
//添加字段
|
||||
$teamDividendData['is_pay'] = $model->status >= 1 ? 1 : 0;
|
||||
// \Log::debug('--------更改已支付状态 0/1--------', [
|
||||
// 'order_status' => $model->status,
|
||||
// 'is_pay' => $teamDividendData['is_pay'],
|
||||
// 'order_sn' => $model->order_sn,
|
||||
// ]);
|
||||
\Log::debug('--------更改已支付状态 0/1--------', [
|
||||
'order_status' => $model->status,
|
||||
'is_pay' => $teamDividendData['is_pay'],
|
||||
'order_sn' => $model->order_sn,
|
||||
]);
|
||||
$team_dividend_ids = TeamDividendModel::where('order_sn', $model->order_sn)->orderBy('id', 'asc')->pluck('id');
|
||||
$result = TeamDividendModel::whereIn('id', $team_dividend_ids)->update($teamDividendData);
|
||||
// $teamDividendWhere = ['order_sn' => $model->order_sn];
|
||||
// $result = TeamDividendModel::updatedTeamDividend($teamDividendData, $teamDividendWhere);
|
||||
// \Log::debug('--------记录更新影响条数--------', $result);
|
||||
\Log::debug('--------记录更新影响条数--------', $result);
|
||||
|
||||
//支付后发送公众号消息通知
|
||||
(new SendMessageService($model))->handle();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Email: livsyitian@163.com
|
||||
* QQ: 995265288
|
||||
* IDE: PhpStorm
|
||||
* User:
|
||||
* User: 芸众商城 www.yunzshop.com
|
||||
****************************************************************/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ use Yunshop\TeamDividend\Listener\OrderPaidListener;
|
|||
use Yunshop\TeamDividend\Listener\OrderReceiveListener;
|
||||
use Yunshop\TeamDividend\Listener\RegisterByAgentListener;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\services\GoodsDetailService;
|
||||
|
||||
class PluginApplication extends \app\common\services\PluginApplication
|
||||
|
|
@ -578,137 +577,81 @@ class PluginApplication extends \app\common\services\PluginApplication
|
|||
],
|
||||
],
|
||||
// 店长管理
|
||||
// 'team_dividend_store_manager' => [
|
||||
// 'name' => '店长管理',
|
||||
// 'url' => 'plugin.team-dividend.admin.store-manager.index',
|
||||
// 'url_params' => '',
|
||||
// 'permit' => 1,
|
||||
// 'menu' => 1,
|
||||
// 'icon' => '',
|
||||
// 'item' => 'team_dividend',
|
||||
// 'parents' => ['team_dividend'],
|
||||
// 'child' => [
|
||||
// 'team_dividend_store_manager_index' => [
|
||||
// 'name' => '店长列表',
|
||||
// 'url' => 'plugin.team-dividend.admin.store-manager.index',
|
||||
// 'url_params' => '',
|
||||
// 'permit' => 1,
|
||||
// 'menu' => 0,
|
||||
// 'icon' => '',
|
||||
// 'item' => 'team_dividend_store_manager_index',
|
||||
// 'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
// ],
|
||||
// 'team_dividend_store_manager_addInfo' => [
|
||||
// 'name' => '添加店长',
|
||||
// 'url' => 'plugin.team-dividend.admin.store-manager.addInfo',
|
||||
// 'url_params' => '',
|
||||
// 'permit' => 1,
|
||||
// 'menu' => 0,
|
||||
// 'icon' => '',
|
||||
// 'item' => 'team_dividend_store_manager_addInfo',
|
||||
// 'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
// ],
|
||||
// 'team_dividend_store_manager_change_status' => [
|
||||
// 'name' => '删除店长',
|
||||
// 'url' => 'plugin.team-dividend.admin.store-manager.change-status',
|
||||
// 'url_params' => '',
|
||||
// 'permit' => 1,
|
||||
// 'menu' => 0,
|
||||
// 'icon' => '',
|
||||
// 'item' => 'team_dividend_store_manager_change_status',
|
||||
// 'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
// ],
|
||||
// 'team_dividend_store_manager_change_see_info' => [
|
||||
// 'name' => '查看店补',
|
||||
// 'url' => 'plugin.team-dividend.admin.store-manager.see-info',
|
||||
// 'url_params' => '',
|
||||
// 'permit' => 1,
|
||||
// 'menu' => 0,
|
||||
// 'icon' => '',
|
||||
// 'item' => 'team_dividend_store_manager_see_info',
|
||||
// 'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
// ],
|
||||
//
|
||||
// ]
|
||||
// ],
|
||||
'team_dividend_store_manager' => [
|
||||
'name' => '店长管理',
|
||||
'url' => 'plugin.team-dividend.admin.store-manager.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend',
|
||||
'parents' => ['team_dividend'],
|
||||
'child' => [
|
||||
'team_dividend_store_manager_index' => [
|
||||
'name' => '店长列表',
|
||||
'url' => 'plugin.team-dividend.admin.store-manager.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend_store_manager_index',
|
||||
'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
],
|
||||
'team_dividend_store_manager_addInfo' => [
|
||||
'name' => '添加店长',
|
||||
'url' => 'plugin.team-dividend.admin.store-manager.addInfo',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend_store_manager_addInfo',
|
||||
'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
],
|
||||
'team_dividend_store_manager_change_status' => [
|
||||
'name' => '删除店长',
|
||||
'url' => 'plugin.team-dividend.admin.store-manager.change-status',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend_store_manager_change_status',
|
||||
'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
],
|
||||
'team_dividend_store_manager_change_see_info' => [
|
||||
'name' => '查看店补',
|
||||
'url' => 'plugin.team-dividend.admin.store-manager.see-info',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend_store_manager_see_info',
|
||||
'parents' => ['team_dividend', 'team_dividend_store_manager'],
|
||||
],
|
||||
|
||||
// 团队信息
|
||||
'team_dividend_team' => [
|
||||
'name' => '团队信息',
|
||||
'url' => 'plugin.team-dividend.admin.team.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend',
|
||||
'parents' => ['team_dividend'],
|
||||
'child' => [
|
||||
'team_dividend_team_index' => [
|
||||
'name' => '团队信息',
|
||||
'url' => 'plugin.team-dividend.admin.team.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'team_dividend_team_index',
|
||||
'parents' => ['team_dividend', 'team_dividend_team'],
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function getIncomeItems(){
|
||||
public function getIncomeItems()
|
||||
{
|
||||
$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 : '生态建设';
|
||||
// }
|
||||
return [
|
||||
'teamDividend' => [
|
||||
'title' => '团队收益',//$lang['title'] ?: trans('Yunshop\TeamDividend::index.title'),
|
||||
'title' => $lang['title'] ?: trans('Yunshop\TeamDividend::index.title'),
|
||||
'type' => 'teamDividend',
|
||||
'type_name' => '团队收益',//$title.$dividend,
|
||||
'type_name' => $title.$dividend,
|
||||
'class' => 'Yunshop\TeamDividend\models\TeamDividendModel',
|
||||
],
|
||||
// 'storeManager' => [
|
||||
// 'title' => '店补',
|
||||
// 'type' => 'storeManager',
|
||||
// 'type_name' => '店长店补',
|
||||
// 'class' => 'Yunshop\TeamDividend\Common\models\StoreManagerRecordModel',
|
||||
// ],
|
||||
// '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',
|
||||
],
|
||||
|
||||
'storeManager' => [
|
||||
'title' => '店补',
|
||||
'type' => 'storeManager',
|
||||
'type_name' => '店长店补',
|
||||
'class' => 'Yunshop\TeamDividend\Common\models\StoreManagerRecordModel',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -763,12 +706,27 @@ class PluginApplication extends \app\common\services\PluginApplication
|
|||
*/
|
||||
$events->subscribe(\Yunshop\TeamDividend\Listener\AreaDividendListener::class);
|
||||
|
||||
|
||||
// 店长相关
|
||||
\Event::listen('cron.collectJobs', function () {
|
||||
// 每天0点30 执行一次店长信息统计
|
||||
\Cron::add('Team-dividend-store-manager', '30 0 * * *', function () {
|
||||
\Log::debug('--- 经销商 - 店长统计 - 开始 ----');
|
||||
(new StoreManagerModel())->infoStatistics();
|
||||
return;
|
||||
});
|
||||
// 每天1点30 执行一次店长信息统计
|
||||
\Cron::add('Team-dividend-store-manager-settlement', '30 1 * * *', function () {
|
||||
\Log::debug('--- 经销商 - 店长结算 - 开始 ----');
|
||||
(new StoreManagerModel())->settlement();
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function cronConfig(){
|
||||
public function cronConfig()
|
||||
{
|
||||
\Event::listen('cron.collectJobs', function () {
|
||||
// 经销商佣金结算 由10分钟执行一次修改为1分钟执行一次 2023-9-25
|
||||
\Cron::add('Team-dividend', '*/1 * * * *', function () {
|
||||
|
|
@ -800,20 +758,6 @@ class PluginApplication extends \app\common\services\PluginApplication
|
|||
return;
|
||||
});
|
||||
});
|
||||
// 店长相关
|
||||
\Event::listen('cron.collectJobs', function () {
|
||||
// 每天0点30 执行一次店长信息统计
|
||||
\Cron::add('Team-dividend-store-manager', '30 0 * * *', function () {
|
||||
\Log::debug('--- 经销商 - 店长统计 - 开始 ----');
|
||||
(new StoreManagerModel())->infoStatistics();
|
||||
return;
|
||||
});
|
||||
// 每天1点30 执行一次店长信息统计
|
||||
\Cron::add('Team-dividend-store-manager-settlement', '30 1 * * *', function () {
|
||||
\Log::debug('--- 经销商 - 店长结算 - 开始 ----');
|
||||
(new StoreManagerModel())->settlement();
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -106,8 +106,8 @@ class CodeRecordController extends BaseController
|
|||
// $excel->setTitle('Office 2005 XLSX Document');
|
||||
//
|
||||
// // Chain the setters
|
||||
// $excel->setCreator('')
|
||||
// ->setLastModifiedBy("")
|
||||
// $excel->setCreator('芸众商城')
|
||||
// ->setLastModifiedBy("芸众商城")
|
||||
// ->setSubject("Office 2005 XLSX Test Document")
|
||||
// ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
|
||||
// ->setKeywords("office 2005 openxml php")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/24
|
||||
* Time: 10:17 AM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/24
|
||||
* Time: 4:55 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 5:07 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 5:01 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,19 +10,13 @@ use app\common\exceptions\ShopException;
|
|||
use app\common\helpers\PaginationHelper;
|
||||
use app\common\helpers\Url;
|
||||
use app\common\models\Member;
|
||||
use app\common\models\Order;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\TeamDividend\admin\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\jobs\NewUpgrateJob;
|
||||
use Yunshop\TeamDividend\models\CodeRecordModel;
|
||||
use Yunshop\TeamDividend\models\Log;
|
||||
use Yunshop\TeamDividend\models\OrderModel;
|
||||
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelUpgrade;
|
||||
use Yunshop\TeamDividend\models\Uplog;
|
||||
use Yunshop\TeamDividend\services\GetAgentsService;
|
||||
use Yunshop\TeamDividend\services\ReturnConfig;
|
||||
use Yunshop\TeamDividend\services\UpgradeService;
|
||||
use Yunshop\TeamDividend\services\FundPoolAwardService;
|
||||
use app\common\services\ExportService;
|
||||
|
|
@ -88,50 +82,13 @@ class TeamAgencyController extends BaseController
|
|||
$endtime = strtotime($parames['times']['end']);
|
||||
}
|
||||
}
|
||||
// 获取所有经销商的排名信息
|
||||
$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');
|
||||
$level = TeamDividendLevelModel::getList()->get();
|
||||
|
||||
|
||||
|
||||
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) && $rankInfo['level_type'] == 0) {
|
||||
return [
|
||||
'id' => $rankInfo['id'],
|
||||
'level_name' => $rankInfo['level_name'],
|
||||
'ranking' => ((int)$rankInfo['up_log'][$item['uid']] + 1),
|
||||
];
|
||||
}
|
||||
return [];
|
||||
},$rankList));
|
||||
}
|
||||
|
||||
|
||||
$level = TeamDividendLevelModel::getList()->where('level_type',0)->get();
|
||||
$culturalLevel = TeamDividendLevelModel::getList()->where('level_type',1)->get();
|
||||
|
||||
return view('Yunshop\TeamDividend::admin.team-agency', [
|
||||
'list' => $list,
|
||||
'endtime' => $endtime,
|
||||
|
|
@ -140,7 +97,6 @@ class TeamAgencyController extends BaseController
|
|||
'pager' => $pager,
|
||||
'title' => $title,
|
||||
'level' => $level,
|
||||
'culturalLevel' => $culturalLevel,
|
||||
'request' => \YunShop::request(),
|
||||
])->render();
|
||||
}
|
||||
|
|
@ -152,29 +108,71 @@ class TeamAgencyController extends BaseController
|
|||
*/
|
||||
public function add()
|
||||
{
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
if (\Request::getMethod() == 'POST') {
|
||||
$agentData = \YunShop::request()->team;
|
||||
// $agent = TeamDividendAgencyModel::getAgencyInfoByUid($agentData['uid']);
|
||||
// if($agent){
|
||||
// return $this->message('添加失败,此会员已是代理商', '', 'error');
|
||||
// }
|
||||
|
||||
$agentData['uniacid'] = \YunShop::app()->uniacid;
|
||||
$agentData['upgrade_at'] = time();
|
||||
if((int)$agentData['level'] <= 0 && (int)$agentData['cultural_level_id'] <= 0) return $this->message('添加失败,请选择代理等级!', '', 'error');
|
||||
$agency_model = new TeamDividendAgencyModel();
|
||||
$agency_model->fill($agentData);
|
||||
$validator = $agency_model->validator();
|
||||
if ($validator->fails()) {
|
||||
$this->error($validator->messages());
|
||||
} else {
|
||||
// $agency_model->uniacid = \YunShop::app()->uniacid;
|
||||
// $agency_model->uid = $agentData['uid'];
|
||||
// $agency_model->level = $agentData['level'];
|
||||
// $agency_model->parent_id = floatval($agentData['parent_id']);
|
||||
// $agency_model->relation = $agentData['relation'];
|
||||
|
||||
try{
|
||||
TeamDividendAgencyModel::addTeamAgency($agentData);
|
||||
if ($agency_model->save()) {
|
||||
//签合同
|
||||
$data=[
|
||||
'member_id'=>$agentData['uid'],
|
||||
'created_at' => time(),
|
||||
];
|
||||
event(new \app\common\events\plugin\TeamDividendEvent($data));
|
||||
//激活码
|
||||
$upgrade_set = (new UpgradeService())->getUpgradeById($agentData['level']);
|
||||
|
||||
if ($upgrade_set) {
|
||||
$set = \Setting::get('plugin.team_dividend');
|
||||
|
||||
|
||||
return $this->message('经销商操作成功', yzWebUrl('plugin.team-dividend.admin.team-agency'));
|
||||
}catch(\Exception $e){
|
||||
return $this->message($e->getMessage(), '', 'error');
|
||||
// if ($set['is_activation_code'] && isset($set['code_level'])) {
|
||||
// $level_set = TeamDividendLevelModel::getLevelById($set['code_level']);
|
||||
//
|
||||
// (new UpgradeService())->senCode($agentData['uid'], $upgrade_set[0]->code_num, $set['code_level'], $level_set->level_name);
|
||||
// \Log::debug('激活码');
|
||||
// }
|
||||
if ($set['is_activation_code'] && $upgrade_set[0]->code_num) {
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
$code_num = unserialize($upgrade_set[0]->code_num);
|
||||
foreach($level_list as $key => $level) {
|
||||
if($code_num['level_'.$level->id]) {
|
||||
(new UpgradeService())->senCode($agentData['uid'], $code_num['level_'.$level->id], $level->id, $level->level_name);
|
||||
}
|
||||
}
|
||||
\Log::debug('激活码');
|
||||
}
|
||||
}
|
||||
(new UpgradeService())->becomeAgencyNotify($agentData['uid']);
|
||||
//直推奖 todo 直推奖不用了
|
||||
// (new UpgradeService())->sendBonus($agentData['uid']);
|
||||
// \Log::debug('直推奖');
|
||||
|
||||
return $this->message('经销商操作成功', yzWebUrl('plugin.team-dividend.admin.team-agency'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$level_list = TeamDividendLevelModel::getList()->where('level_type',0)->get();
|
||||
$cultural_level = TeamDividendLevelModel::getList()->where('level_type',1)->get();
|
||||
|
||||
return view('Yunshop\TeamDividend::admin.team-agency-add', [
|
||||
'level' => $level_list,
|
||||
'cultural_level' => $cultural_level
|
||||
'level' => $level_list
|
||||
])->render();
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +229,7 @@ class TeamAgencyController extends BaseController
|
|||
}
|
||||
}
|
||||
}
|
||||
$export_data[0] = ['ID', '会员', '推荐人会员ID', '成为代理时间', '推荐人姓名', '推荐人手机号', '经销商', '手机号','等级', '文创等级', '一级(直系)总经销商人数', '分红比例', '已结算分红', '未结算分红', '累计结算分红','团队业绩','团队商品销量'];
|
||||
$export_data[0] = ['ID', '会员', '推荐人会员ID', '成为代理时间', '推荐人姓名', '推荐人手机号', '经销商', '手机号','等级', '一级(直系)总经销商人数', '分红比例', '已结算分红', '未结算分红', '累计结算分红','团队业绩','团队商品销量'];
|
||||
foreach ($list as $key => $item) {
|
||||
if (!empty($item['status'])) {
|
||||
$status = '已使用';
|
||||
|
|
@ -257,7 +255,6 @@ class TeamAgencyController extends BaseController
|
|||
$item['dividend_open'] = 0;
|
||||
|
||||
$item['dividend_total'] = $item['has_many_team_dividend'][2]['total_amount'] + $item['has_many_team_dividend'][1]['total_amount'] + $item['has_many_team_dividend'][0]['total_amount']?:0;
|
||||
|
||||
$export_data[$key + 1] = [
|
||||
$item['id'],
|
||||
$item['has_one_member']['uid'],
|
||||
|
|
@ -268,7 +265,6 @@ class TeamAgencyController extends BaseController
|
|||
$item['has_one_member']['username'],
|
||||
$item['has_one_member']['mobile'],
|
||||
$item['has_one_level']['level_name'],
|
||||
$item['cultural_level']['level_name'],
|
||||
$item['total'],
|
||||
$item['has_one_level']['dividend_ratio'],
|
||||
$item['dividend_final'],
|
||||
|
|
@ -284,8 +280,8 @@ class TeamAgencyController extends BaseController
|
|||
// $excel->setTitle('Office 2005 XLSX Document');
|
||||
//
|
||||
// // Chain the setters
|
||||
// $excel->setCreator('')
|
||||
// ->setLastModifiedBy("")
|
||||
// $excel->setCreator('芸众商城')
|
||||
// ->setLastModifiedBy("芸众商城")
|
||||
// ->setSubject("Office 2005 XLSX Test Document")
|
||||
// ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
|
||||
// ->setKeywords("office 2005 openxml php")
|
||||
|
|
@ -315,108 +311,55 @@ class TeamAgencyController extends BaseController
|
|||
public function change()
|
||||
{
|
||||
$id = \YunShop::request()->id;
|
||||
$levelId = \YunShop::request()->value;
|
||||
$leveType = \YunShop::request()->leve_type;
|
||||
|
||||
TeamDividendAgencyModel::changeLevel($id,$levelId,$leveType);
|
||||
}
|
||||
$agency = TeamDividendAgencyModel::find($id);
|
||||
$level = $agency->level;
|
||||
$agency->level = \YunShop::request()->value;
|
||||
$agency->upgrade_at = time();
|
||||
|
||||
|
||||
|
||||
public function test(){
|
||||
if ($agency->save()) {
|
||||
|
||||
// 经销商升级模拟
|
||||
// $model = Order::with('hasManyOrderGoods')->find(34);
|
||||
// $set = \Setting::get('plugin.team_dividend');
|
||||
// (new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
|
||||
// 经销商等级变动记录
|
||||
/*Log::create([
|
||||
'uid' => $agency->uid,
|
||||
'befor_level_id' => $level,
|
||||
'up_code' => '无',
|
||||
'after_level_id' => $agency->level,
|
||||
'remark' => '后台修改',
|
||||
'level_ups' => []
|
||||
]);*/
|
||||
|
||||
// 升级后等级
|
||||
$c_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find($agency->level);
|
||||
// 升级前等级
|
||||
$o_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find($level);
|
||||
|
||||
// 经销商提成模拟
|
||||
// $order = Order::find(43);
|
||||
// $TeamReturnService = ReturnConfig::getClass();
|
||||
// if (app('plugins')->isEnabled('team-sideways')) debug('经销商订单创建终止:team-sideways');
|
||||
// $set = $order->getSetting('plugin.team_dividend');
|
||||
// if (!$set['is_team_dividend']) debug('是否开启经销商插件');
|
||||
// $buyMember = $order->belongsToMember;
|
||||
// $agents = GetAgentsService::index($set, $order->uid, $order->create_time);
|
||||
// foreach ($order->hasManyOrderGoods as $order_goods) {
|
||||
// // 普通经销商提成处理
|
||||
// $TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents);
|
||||
// $TeamReturnService->handle();
|
||||
// $this->totalDividend += $TeamReturnService->totalDividend;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// 等级 升级记录校准
|
||||
/*$teamDividendList = TeamDividendAgencyModel::uniacid()->select(['id','uid','level','cultural_level_id'])->get()->toArray();
|
||||
$notUpLog = [];
|
||||
foreach($teamDividendList as $teamInfo){
|
||||
// 判断:普通等级是否存在升级记录
|
||||
if((int)$teamInfo['level'] > 0){
|
||||
$isHasLevelLog = (int)Uplog::uniacid()->where('uid',$teamInfo['uid'])->where('after_level_id',$teamInfo['level'])->value('id');
|
||||
if($isHasLevelLog <= 0) $notUpLog[$teamInfo['id']]['level_res'] = $teamInfo;
|
||||
}
|
||||
// 文创等级是否存在升级记录
|
||||
if((int)$teamInfo['cultural_level_id'] > 0){
|
||||
$isHasCulturalLevelLog = (int)Uplog::uniacid()->where('uid',$teamInfo['uid'])->where('after_level_id',$teamInfo['cultural_level_id'])->value('id');
|
||||
if($isHasCulturalLevelLog <= 0) {
|
||||
$teamInfo['info_count'] = Uplog::uniacid()->where('uid',$teamInfo['uid'])->count();
|
||||
$teamInfo['info_max_id'] = Uplog::uniacid()->where('uid',$teamInfo['uid'])->max('id');
|
||||
$teamInfo['info_list'] = Uplog::uniacid()->select('id','uid','before_level_id','after_level_id')->where('uid',$teamInfo['uid'])->get()->toArray();
|
||||
$notUpLog[$teamInfo['id']]['cultural_level_res'] = $teamInfo;
|
||||
|
||||
|
||||
// if($teamInfo['info_count'] >= 2 && $teamInfo['cultural_level_id'] == 6){
|
||||
// Uplog::uniacid()->where('id',$teamInfo['info_max_id'])->update([
|
||||
// 'after_level_id' => $teamInfo['cultural_level_id'],
|
||||
// 'after_level_setting' => '{"id":6,"uniacid":2,"level_name":"\u6d88\u8d39\u5546","cultural_level_name":"\u5e02\u573a\u670d\u52a1\u6d25\u8d34","level_weight":1,"level_type":1,"dividend_ratio":0,"code_num":"0","award_hierarchy":0,"award_ratio":"0","created_at":"2023-11-24 15:05:32","updated_at":"2023-11-30 10:49:36","deleted_at":null,"upgrade_reward_point":"0.00","upgrade_reward_gold":"0.00","award_gratitude":"0","hierarchy_limit":0,"auto_withdraw_day":"","auto_withdraw_period":"","number_limit":0,"culate_model":0,"current_md":null,"upgrade_reward_draw":0,"identity_type":0,"give_limit":0,"give_limit_level_id":5,"has_one_upgrade_set":{"id":6,"uniacid":"2","dividend_id":6,"parase":[{"self_buy_count":"1","become":"0"},{"order_money_2":"","order_num_2":"","order_money":"","first_money":"","order_count":"","first_order_count":"","first_order_count_to_goods":"","team_order_amount":"","team_shop_order_amount":"","team_profit_amount":"","team_goods_amount":"","team_goods_amount_to_goods":"","team_merchants_count":"","team_member_count":"","team_member_count_to_goods":"","first_lower_team_count":"","first_lower_team_count_to_goods":"","all_lower_team_count":"","first_lower_count":"","self_buy_money":"1","self_buy_count":"1","level":{"13":"","12":"","11":"","10":"","9":"","8":"","5":"","7":"","4":"","6":"","3":""},"first_child_level":{"13":"","12":"","11":"","10":"","9":"","8":"","5":"","7":"","4":"","6":"","3":""},"group_level":{"13":"","12":"","11":"","10":"","9":"","8":"","5":"","7":"","4":"","6":"","3":""},"level_line_num":"","level_line_level_id":"5","oneself":"0","level_line_people":"","level_line_area_num":"","level_line_area_level_id":"1","level_line_area_people":"","settle_money":"","first_cost_count":"","first_cost_num":"","dividend_and_peer_sum":"","first_second_cost_count":"","first_second_cost_num":"","team_new_order_number":"","team_new_order_number_to_goods":"","one_or_two":{"one_or_two_level_id":"5","one_or_two_people":""},"goods":"","many_good":["12","13","14"]}],"created_at":"2023-11-24 15:05:32","updated_at":"2023-11-30 10:49:36","deleted_at":null}}'
|
||||
//
|
||||
//
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// 升级日志
|
||||
Uplog::addLog($agency, $o_level, $c_level);
|
||||
|
||||
if ($c_level->level_weight > $o_level->level_weight) {
|
||||
//激活码
|
||||
$upgrade_set = (new UpgradeService())->getUpgradeById($agency->level);
|
||||
|
||||
if ($upgrade_set) {
|
||||
$set = \Setting::get('plugin.team_dividend');
|
||||
if ($set['is_activation_code'] && $upgrade_set[0]->code_num) {
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
$code_num = is_array($upgrade_set[0]->code_num) ? $upgrade_set[0]->code_num : unserialize($upgrade_set[0]->code_num) ? : [];
|
||||
foreach($level_list as $key => $level) {
|
||||
if($code_num['level_'.$level->id]) {
|
||||
(new UpgradeService())->senCode($agency->uid, $code_num['level_'.$level->id], $level->id, $level->level_name);
|
||||
}
|
||||
}
|
||||
\Log::debug('激活码');
|
||||
}
|
||||
}
|
||||
|
||||
//代理商升级通知
|
||||
(new UpgradeService())->agencyUpgradeNotify($agency->uid, $o_level->level_name, $o_level->dividend_ratio_name, $agency->level);
|
||||
}
|
||||
}
|
||||
|
||||
debug([
|
||||
'总数' => count($notUpLog),
|
||||
'uid' => implode(',',array_column(array_column($notUpLog,'cultural_level_res'),'uid')),
|
||||
'列表' => $notUpLog
|
||||
|
||||
]);*/
|
||||
|
||||
|
||||
|
||||
// 全部订单重新处理分红
|
||||
// $orderList = Order::uniacid()->get();
|
||||
// foreach($orderList as $order){
|
||||
// // $order = Order::find(43);
|
||||
// $TeamReturnService = ReturnConfig::getClass();
|
||||
// if (app('plugins')->isEnabled('team-sideways')) debug('经销商订单创建终止:team-sideways');
|
||||
// $set = $order->getSetting('plugin.team_dividend');
|
||||
// if (!$set['is_team_dividend']) debug('是否开启经销商插件');
|
||||
// $buyMember = $order->belongsToMember;
|
||||
// $agents = GetAgentsService::index($set, $order->uid, $order->create_time);
|
||||
// foreach ($order->hasManyOrderGoods as $order_goods) {
|
||||
// // 普通经销商提成处理
|
||||
// $TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents);
|
||||
// $TeamReturnService->handle();
|
||||
// $this->totalDividend += $TeamReturnService->totalDividend;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
debug("结束。。。");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ use Illuminate\Support\Str;
|
|||
use Yunshop\TeamDividend\admin\models\LevelRedPack;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelUpgrade;
|
||||
use Yunshop\WeightValue\models\GoodsWeightValue;
|
||||
|
||||
class TeamDividendLevelSetController extends BaseController
|
||||
{
|
||||
|
|
@ -61,7 +60,7 @@ class TeamDividendLevelSetController extends BaseController
|
|||
$validator = $team_dividend_level_model->validator();
|
||||
|
||||
if ($validator->fails()) {
|
||||
return $this->message(reset(array_values($validator->messages()->getMessages())[0]),'', 'error');
|
||||
$this->error($validator->messages());
|
||||
} else {
|
||||
if ($team_dividend_level_model->save()) {
|
||||
|
||||
|
|
@ -81,13 +80,6 @@ class TeamDividendLevelSetController extends BaseController
|
|||
|
||||
$upgrade_modle->save();
|
||||
|
||||
|
||||
// 权重值处理
|
||||
$wv = request()->wv ?? [];
|
||||
$wv['is_open'] = 1;// 经销商设置 默认开启
|
||||
if($wv) GoodsWeightValue::relationSave($team_dividend_level_model->id, $wv, 'created',true);
|
||||
|
||||
|
||||
return $this->message('经销商等级操作成功', yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set'), 'success');
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +200,6 @@ class TeamDividendLevelSetController extends BaseController
|
|||
$data['hierarchy_limit'] = !empty($data['hierarchy_limit']) ? $data['hierarchy_limit'] : 0;
|
||||
$data['auto_withdraw_day'] = !empty($data['auto_withdraw_day']) ? $data['auto_withdraw_day'] : '';
|
||||
$data['auto_withdraw_period'] = !empty($data['auto_withdraw_period']) ? $data['auto_withdraw_period'] : '';
|
||||
$data['number_limit'] = !empty($data['number_limit']) ? $data['number_limit'] : 0;
|
||||
$dividend_model->fill($data);
|
||||
$validator = $dividend_model->validator();
|
||||
|
||||
|
|
@ -244,11 +235,6 @@ class TeamDividendLevelSetController extends BaseController
|
|||
$upgrade_modle->save();
|
||||
}
|
||||
|
||||
// 权重值处理
|
||||
$wv = request()->wv ?? [];
|
||||
$wv['is_open'] = 1;// 经销商设置 默认开启
|
||||
if($wv) GoodsWeightValue::relationSave($id, $wv, 'updated',true);
|
||||
|
||||
return $this->message('经销商等级操作成功', yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set'), 'success');
|
||||
}
|
||||
}
|
||||
|
|
@ -258,12 +244,6 @@ class TeamDividendLevelSetController extends BaseController
|
|||
$goldSet = array_pluck(\Setting::getAllByGroup('Love')->toArray(), 'value', 'key');
|
||||
$goldTitle = $goldSet['name'] ? $goldSet['name'] : '爱心值';
|
||||
$settingData = \Setting::get('plugin.team_dividend');
|
||||
|
||||
// 权重值信息
|
||||
$wv = (new GoodsWeightValue())->getGoodsSet($id,true)->first();
|
||||
$wv = $wv ? $wv->toArray() : [];
|
||||
|
||||
|
||||
return view('Yunshop\TeamDividend::admin.level-set-add', [
|
||||
'dividend' => $dividend_model,
|
||||
'code_num' => $dividend_model->code_num,
|
||||
|
|
@ -277,7 +257,6 @@ class TeamDividendLevelSetController extends BaseController
|
|||
'goldTitle' => $goldTitle,
|
||||
'settingData' => $settingData,
|
||||
'goods' => $goods,
|
||||
'wv' => $wv
|
||||
])->render();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 1:45 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/6
|
||||
* Time: 6:23 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 3:55 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 4:20 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/6
|
||||
* Time: 6:21 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* Name: 系统
|
||||
* Author:
|
||||
* Profile:
|
||||
* Name: 芸众商城系统
|
||||
* Author: 广州市芸众信息科技有限公司
|
||||
* Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.cloudmall.com www.yunzshop.com
|
||||
* Date: 2021/6/8
|
||||
* Time: 15:40
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ namespace Yunshop\TeamDividend\Api;
|
|||
|
||||
use app\common\components\ApiController;
|
||||
use app\common\models\Member;
|
||||
use app\common\models\Order;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\TeamDividend\admin\models\MemberChild;
|
||||
use Yunshop\TeamDividend\models\CodeRecordModel;
|
||||
|
|
@ -276,48 +275,4 @@ class IndexController extends ApiController
|
|||
return $this->errorJson('激活码使用失败');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 业绩是否完成
|
||||
public function performanceComplete(){
|
||||
// 基本参数
|
||||
$target = 500000;
|
||||
$isComplete = 0;
|
||||
$memberId = \YunShop::app()->getMemberId();
|
||||
$areaAmount = 0;
|
||||
if($memberId > 0){
|
||||
// 获取直推下级列表
|
||||
$subIds = MemberChild::uniacid()
|
||||
->where('level',1)
|
||||
->where('member_id',$memberId)
|
||||
->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::uniacid()
|
||||
->leftJoin('yz_order_goods','yz_order_goods.order_id','yz_order.id')
|
||||
->leftJoin('yz_goods_cultural_space','yz_goods_cultural_space.goods_id','yz_order_goods.goods_id')
|
||||
->whereIn('yz_order.uid',$lineAllUid)
|
||||
->where('yz_order.status','>',0)
|
||||
->where('yz_goods_cultural_space.is_open',0)
|
||||
->sum('yz_order_goods.payment_amount');
|
||||
// $subPerformance[$subUid] = Order::whereIn('uid',$lineAllUid)->where('status','>=',0)->sum('yz_order.price');
|
||||
}
|
||||
// 计算业绩
|
||||
$teamAmount = (float)sprintf("%.2f",array_sum($subPerformance));// 总业绩
|
||||
$maxAmount = max($subPerformance);// 最大一条线的业绩
|
||||
$areaAmount = (float)sprintf("%.2f",$teamAmount - $maxAmount);// 小区业绩 = 总业绩 - 最大一条线的业绩
|
||||
$isComplete = $areaAmount >= $target ? 1 : 0;
|
||||
}
|
||||
|
||||
return $this->successJson('业绩是否完成', [
|
||||
'is_complete' => $isComplete,
|
||||
'area_amount' => $areaAmount
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/14
|
||||
* Time: 4:40 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/29
|
||||
* Time: 10:27 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/9
|
||||
* Time: 9:49 AM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
/******************************************************************************************************************
|
||||
* Author: king -- LiBaoJia
|
||||
* Date: 12/4/21 12:28 PM
|
||||
* Email: livsyitian@163.com
|
||||
* QQ: 995265288
|
||||
* IDE: PhpStorm
|
||||
* User: www.yunzshop.com www.yunzshop.com
|
||||
* Company: 广州市芸众信息科技有限公司
|
||||
* Profile: 专注移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务
|
||||
******************************************************************************************************************/
|
||||
|
||||
|
||||
namespace Yunshop\TeamDividend\events;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/26
|
||||
* Time: 4:19 PM
|
||||
*/
|
||||
|
|
@ -16,21 +16,18 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Illuminate\Support\Str;
|
||||
use Yunshop\CollectionRoom\models\CollectionRoomModel;
|
||||
use Yunshop\Love\Common\Services\LoveChangeService;
|
||||
use Yunshop\TeamDividend\models\Log;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelUpgrade;
|
||||
use Yunshop\TeamDividend\models\TeamUpgradeReward;
|
||||
use Yunshop\TeamDividend\models\Uplog;
|
||||
use Yunshop\TeamDividend\services\UpgradeService;
|
||||
use Yunshop\TeamDividend\services\upgrate\AgentsService;
|
||||
use Yunshop\TeamDividend\services\upgrate\UpgrateConditionService;
|
||||
use Yunshop\TeamDividend\services\upgrate\UplogService;
|
||||
use Yunshop\WeightValue\models\WeightValue;
|
||||
|
||||
/**
|
||||
* Class NewUpgrateJob
|
||||
|
|
@ -67,72 +64,84 @@ class NewUpgrateJob implements ShouldQueue
|
|||
$agents = $agentService->getAgents();
|
||||
// 循环上级
|
||||
foreach ($agents as $agent) {
|
||||
// 黑名单不升级
|
||||
if ($agent['teamDividend']->is_black) continue;
|
||||
// 升级处理
|
||||
\Log::debug('经销商升级 - 开始:',$agent['uid']);
|
||||
$this->eachLevelHandle($agent);// 普通等级升级处理
|
||||
$this->eachCulturalLevelHandle($agent);// 文创等级升级处理
|
||||
}
|
||||
|
||||
|
||||
// 订单支付成功 处理权重值相关内容(因为需要兼容 用户不是经销商,但是成为经销商后当前订单如果存在赠送权重值,则需要同步赠送。因此只能在这里调用赠送操作 )
|
||||
if($this->order_status == TeamDividendLevelUpgrade::ORDER_PAY && $this->order){
|
||||
(new WeightValue())->giveInit($this->order);
|
||||
// 循环等级
|
||||
$this->eachLevelHandle($agent);
|
||||
}
|
||||
}
|
||||
|
||||
// 普通等级升级处理
|
||||
public function eachLevelHandle($agent){
|
||||
/**
|
||||
* @name 查询等级权重比当前大的等级集合
|
||||
* @param $agent
|
||||
* @return mixed
|
||||
* @author
|
||||
*/
|
||||
public function eachLevelHandle($agent)
|
||||
{
|
||||
if ($agent['teamDividend']->is_black){ //黑名单不升级
|
||||
return;
|
||||
}
|
||||
// $up_code = $this->setting['upgrate_type'] == 1 ? '或' : '与';
|
||||
// 升级日志
|
||||
$this->uplogService = new UplogService($agent['uid'], \YunShop::app()->uniacid, $agent['teamDividend']->level, $this->setting['upgrate_type']);
|
||||
$this->uplogService->setUpCode(1);
|
||||
// 原 升级 类
|
||||
$oldUpgrade = new UpgradeService();
|
||||
$upgradeLevels = $this->getUpgrateLevelsByWeight($agent);
|
||||
|
||||
// 经销商等级变动记录
|
||||
/*$logModel = Log::create([
|
||||
'uid' => $agent['uid'],
|
||||
'befor_level_id' => $agent['teamDividend']->level,
|
||||
'up_code' => $up_code,
|
||||
'after_level_id' => '-1',
|
||||
'remark' => '升级预备',
|
||||
'level_ups' => []
|
||||
]);*/
|
||||
|
||||
if ($upgradeLevels->isEmpty()) {
|
||||
/*$logModel->remark = '没有更高的等级可以升级';
|
||||
$logModel->save();*/
|
||||
|
||||
return;
|
||||
}
|
||||
// \Log::debug('经销商升级 - 开始处理:',$agent['uid']);
|
||||
|
||||
// 默认可以升级
|
||||
$upgradeRet = false;
|
||||
foreach ($upgradeLevels as $level) {
|
||||
// \Log::debug('经销商升级 - 当前等级信息:',$level->toArray());
|
||||
// 判断:如果当前等级人数已经达到限制 则不升级(上限小于等于已存在数量 不能升级到该等级)
|
||||
$hasNum = (int)Uplog::uniacid()->where('after_level_id',$level->id)->count(DB::raw('DISTINCT(uid)'));
|
||||
// \Log::debug('经销商升级 - 数量限制比较:',[$hasNum,(int)$level->number_limit]);
|
||||
if((int)$level->number_limit <= $hasNum && (int)$level->number_limit > 0) continue;
|
||||
|
||||
//dump($level->level_name);
|
||||
// 没有升级条件
|
||||
if (!$level->hasOneUpgradeSet || !$level->hasOneUpgradeSet->parase) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 升级条件
|
||||
$parase = unserialize($level->hasOneUpgradeSet->parase);
|
||||
|
||||
// 升级后的等级设置
|
||||
$afterLevelSetting = $level->toArray();
|
||||
$afterLevelSetting['has_one_upgrade_set']['parase'] = unserialize($afterLevelSetting['has_one_upgrade_set']['parase']);
|
||||
$this->uplogService->setAfterLevelSetting($afterLevelSetting);
|
||||
// 升级后的等级id
|
||||
$this->uplogService->setAfterLevelId($level['id']);
|
||||
|
||||
// 记录
|
||||
//$logModel->level_ups = $parase[0];
|
||||
|
||||
// 升级条件 组
|
||||
$upgradeGroup = $parase[0]['group'];
|
||||
|
||||
if ($this->order) {
|
||||
if ($parase[0]['become'] != $this->order_status) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($parase[0]['become'] == TeamDividendLevelUpgrade::ORDER_PAY) {
|
||||
$order_status = Order::WAIT_SEND;
|
||||
} else {
|
||||
$order_status = Order::COMPLETE;
|
||||
}
|
||||
|
||||
if ($upgradeGroup) {
|
||||
// 升级条件编号
|
||||
$upgradeGroupSerialNumber = TeamDividendLevelUpgrade::getUpgradeIsSerialNumber();
|
||||
|
|
@ -155,7 +164,7 @@ class NewUpgrateJob implements ShouldQueue
|
|||
// 升级类
|
||||
$upgrateService = new UpgrateConditionService($agent['uid'], $this->setting, $parase[1], $this->uniacid, $typeName, $order_status, $this->order, $this->uplogService);
|
||||
// 升级方法
|
||||
// \Log::debug('===123分组方法名:' . $typeName);
|
||||
\Log::debug('===123分组方法名:' . $typeName);
|
||||
$func = $this->getFunctionName($typeName);
|
||||
|
||||
if (!method_exists($upgrateService, $func)) {
|
||||
|
|
@ -188,13 +197,15 @@ class NewUpgrateJob implements ShouldQueue
|
|||
$next = true;
|
||||
// 如果升级方式为 或 $upgradeRet 为真 不继续
|
||||
if ($this->setting['upgrate_type'] == 1) {
|
||||
if ($upgradeRet) $next = false;
|
||||
|
||||
if ($upgradeRet) {
|
||||
$next = false;
|
||||
}
|
||||
} else {
|
||||
// 如果升级方式为 与 $upgradeRet 为假 不继续
|
||||
if (!$upgradeRet && $upgradeGroup) $next = false;
|
||||
if (!$upgradeRet && $upgradeGroup) {
|
||||
$next = false;
|
||||
}
|
||||
}
|
||||
// \Log::debug('经销商升级 - 是否继续:',$next);
|
||||
// 升级条件 单个 与 升级结果为false
|
||||
if ($next) {
|
||||
$upgradeOnly = $parase[0];
|
||||
|
|
@ -217,12 +228,12 @@ class NewUpgrateJob implements ShouldQueue
|
|||
foreach ($upgradeToFirstChildLevel as $levelId => $ret) {
|
||||
$upgradeOnly['first_child_level_' . $levelId . '_' . $parase[1]['first_child_level'][$levelId]] = '1';
|
||||
}
|
||||
// \Log::debug('经销商升级 - 继续 - 循环体:',$upgradeOnly);
|
||||
|
||||
foreach ($upgradeOnly as $upgrade => $only_item) {
|
||||
// 升级类
|
||||
$upgrateService = new UpgrateConditionService($agent['uid'], $this->setting, $parase[1], $this->uniacid, $upgrade, $order_status, $this->order, $this->uplogService);
|
||||
// 升级方法
|
||||
// \Log::debug('===123单个方法名:' . $upgrade);
|
||||
\Log::debug('===123单个方法名:' . $upgrade);
|
||||
$func = $this->getFunctionName($upgrade);
|
||||
// 升级条件 结果
|
||||
if (!method_exists($upgrateService, $func)) {
|
||||
|
|
@ -330,216 +341,6 @@ class NewUpgrateJob implements ShouldQueue
|
|||
$this->uplogService->resetCondition();
|
||||
}
|
||||
}
|
||||
// 文创等级升级处理
|
||||
public function eachCulturalLevelHandle($agent){
|
||||
// 升级日志
|
||||
$this->uplogService = new UplogService($agent['uid'], \YunShop::app()->uniacid, $agent['teamDividend']->cultural_level_id, $this->setting['upgrate_type']);
|
||||
$this->uplogService->setUpCode(1);
|
||||
// 原 升级 类
|
||||
$oldUpgrade = new UpgradeService();
|
||||
$upgradeLevels = $this->getUpgrateLevelsByWeight($agent,1);
|
||||
if ($upgradeLevels->isEmpty()) return;
|
||||
// \Log::debug('经销商升级 - 文创等级 - 开始处理:',$agent['uid']);
|
||||
// 默认可以升级
|
||||
$upgradeRet = false;
|
||||
foreach ($upgradeLevels as $level) {
|
||||
// 判断:如果当前等级人数已经达到限制 则不升级(上限小于等于已存在数量 不能升级到该等级)
|
||||
$hasNum = (int)Uplog::uniacid()->where('after_level_id',$level->id)->count(DB::raw('DISTINCT(uid)'));
|
||||
if((int)$level->number_limit <= $hasNum && (int)$level->number_limit > 0) continue;
|
||||
// 没有升级条件
|
||||
if (!$level->hasOneUpgradeSet || !$level->hasOneUpgradeSet->parase) {
|
||||
continue;
|
||||
}
|
||||
// 升级条件
|
||||
$parase = unserialize($level->hasOneUpgradeSet->parase);
|
||||
// 升级后的等级设置
|
||||
$afterLevelSetting = $level->toArray();
|
||||
$afterLevelSetting['has_one_upgrade_set']['parase'] = unserialize($afterLevelSetting['has_one_upgrade_set']['parase']);
|
||||
$this->uplogService->setAfterLevelSetting($afterLevelSetting);
|
||||
// 升级后的等级id
|
||||
$this->uplogService->setAfterLevelId($level['id']);
|
||||
// 升级条件 组
|
||||
$upgradeGroup = $parase[0]['group'];
|
||||
if ($this->order) {
|
||||
if ($parase[0]['become'] != $this->order_status) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($parase[0]['become'] == TeamDividendLevelUpgrade::ORDER_PAY) $order_status = Order::WAIT_SEND;
|
||||
else $order_status = Order::COMPLETE;
|
||||
if ($upgradeGroup) {
|
||||
// 升级条件编号
|
||||
$upgradeGroupSerialNumber = TeamDividendLevelUpgrade::getUpgradeIsSerialNumber();
|
||||
foreach ($upgradeGroup as $group_item) {
|
||||
// $group_item = 1001,1002,1003
|
||||
if (!$group_item) continue;
|
||||
$groupArr = explode(',', $group_item);
|
||||
//todo 2019/7/4 改为false 不明白为什么要先赋值true
|
||||
$upgradeGroupRet = false;
|
||||
foreach ($groupArr as $value) {
|
||||
// order_money_2
|
||||
$typeName = $upgradeGroupSerialNumber[$value];
|
||||
// 指定经销商等级
|
||||
if ($value > 2000) {
|
||||
$level_id = $value - 2000;
|
||||
$typeName = 'level_' . $level_id . '_' . $parase[1]['level'][$level_id];
|
||||
}
|
||||
// 升级类
|
||||
$upgrateService = new UpgrateConditionService($agent['uid'], $this->setting, $parase[1], $this->uniacid, $typeName, $order_status, $this->order, $this->uplogService, 1);
|
||||
// 升级方法
|
||||
\Log::debug('===123分组方法名:' . $typeName);
|
||||
$func = $this->getFunctionName($typeName);
|
||||
|
||||
if (!method_exists($upgrateService, $func)) {
|
||||
continue;
|
||||
}
|
||||
$upgradeGroupRet = $upgrateService->$func();
|
||||
// 条件组, 必须满足全部条件,不论设置的是或还是与
|
||||
if (!$upgradeGroupRet) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$upgradeRet = $upgradeGroupRet;
|
||||
// 条件 或
|
||||
if ($this->setting['upgrate_type'] == 1) {
|
||||
// 假 继续循环
|
||||
if (!$upgradeGroupRet) continue;
|
||||
// 真 跳出循环
|
||||
break;
|
||||
}
|
||||
// 条件 与
|
||||
if (!$upgradeGroupRet) {
|
||||
$upgradeRet = $upgradeGroupRet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 是否继续进行
|
||||
$next = true;
|
||||
if ($this->setting['upgrate_type'] == 1) {
|
||||
// 如果升级方式为 或 $upgradeRet 为真 不继续
|
||||
if ($upgradeRet) $next = false;
|
||||
} else {
|
||||
// 如果升级方式为 与 $upgradeRet 为假 不继续
|
||||
if (!$upgradeRet && $upgradeGroup) $next = false;
|
||||
}
|
||||
// 升级条件 单个 与 升级结果为false
|
||||
if ($next) {
|
||||
$upgradeOnly = $parase[0];
|
||||
$upgradeToLevel = $upgradeOnly['level'];
|
||||
$upgradeToGroupLevel = $upgradeOnly['group_level'];
|
||||
$upgradeToFirstChildLevel = $upgradeOnly['first_child_level'];
|
||||
unset($upgradeOnly['become']);
|
||||
unset($upgradeOnly['group']);
|
||||
unset($upgradeOnly['level']);
|
||||
unset($upgradeOnly['group_level']);
|
||||
unset($upgradeOnly['first_child_level']);
|
||||
foreach ($upgradeToLevel as $levelId => $ret) {
|
||||
$upgradeOnly['level_' . $levelId . '_' . $parase[1]['level'][$levelId]] = '1';
|
||||
}
|
||||
|
||||
foreach ($upgradeToGroupLevel as $levelId => $ret) {
|
||||
$upgradeOnly['group_level_' . $levelId . '_' . $parase[1]['group_level'][$levelId]] = '1';
|
||||
}
|
||||
|
||||
foreach ($upgradeToFirstChildLevel as $levelId => $ret) {
|
||||
$upgradeOnly['first_child_level_' . $levelId . '_' . $parase[1]['first_child_level'][$levelId]] = '1';
|
||||
}
|
||||
// \Log::debug('经销商升级 - 继续 - 循环体:',$upgradeOnly);
|
||||
foreach ($upgradeOnly as $upgrade => $only_item) {
|
||||
// 升级类
|
||||
$upgrateService = new UpgrateConditionService($agent['uid'], $this->setting, $parase[1], $this->uniacid, $upgrade, $order_status, $this->order, $this->uplogService, 1);
|
||||
// 升级方法
|
||||
\Log::debug('===123单个方法名:' . $upgrade);
|
||||
$func = $this->getFunctionName($upgrade);
|
||||
// 升级条件 结果
|
||||
if (!method_exists($upgrateService, $func)) {
|
||||
continue;
|
||||
}
|
||||
$upgrateOnlyRet = $upgrateService->$func();
|
||||
$upgradeRet = $upgrateOnlyRet;
|
||||
// 升级 或
|
||||
if ($this->setting['upgrate_type'] == 1) {
|
||||
// 假 继续循环
|
||||
if (!$upgrateOnlyRet) continue;
|
||||
// 真 跳出循环
|
||||
break;
|
||||
}
|
||||
// 升级 与
|
||||
if (!$upgrateOnlyRet) break;
|
||||
}
|
||||
}
|
||||
// 升级 退出
|
||||
if ($upgradeRet) {
|
||||
if (Redis::setnx('team_dividend_up' . $agent['uid'], 1)) {
|
||||
Redis::expire('team_dividend_up' . $agent['uid'], 2);
|
||||
} else {
|
||||
sleep(2);
|
||||
}
|
||||
$agency = TeamDividendAgencyModel::getAgencyInfoByUid($agent['uid']);
|
||||
if ($agency) {
|
||||
$o_level = $agency->hasOneLevel->level_name;
|
||||
$o_dividend_ratio = $agency->hasOneLevel->dividend_ratio;
|
||||
|
||||
//升级
|
||||
$agency->cultural_level_id = $level->id;
|
||||
$agency->cultural_upgrade_at = time();
|
||||
$agency->save();
|
||||
|
||||
//升级通知
|
||||
$oldUpgrade->agencyUpgradeNotify($agent['uid'], $o_level, $o_dividend_ratio, $level->id);
|
||||
} else {
|
||||
if (Member::find($agent['uid'])){
|
||||
//会员升级为团队代理
|
||||
$this->memberUpgradeToAgency($agent['uid'], $level->id,1);
|
||||
|
||||
//更新上级代理团队的下级代理总人数
|
||||
$oldUpgrade->updateChildAgencyNumForParent($agent['uid']);
|
||||
|
||||
//团队代理人数升级
|
||||
$oldUpgrade->upgradeForAgency($agent['uid']);
|
||||
|
||||
//成为团队代理通知
|
||||
$oldUpgrade->becomeAgencyNotify($agent['uid']);
|
||||
|
||||
//新增下级团队代理通知
|
||||
$member_model = Member::getUserInfos($agent['uid'])->first();
|
||||
|
||||
//新增下级团队代理通知
|
||||
if ($member_model && !empty($member_model->yzMember->parent_id)) {
|
||||
$oldUpgrade->newChileAgencyNotify($member_model->yzMember->parent_id, $agent['uid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 升级日志
|
||||
$this->uplogService->store();
|
||||
// 记录
|
||||
$agentData = [
|
||||
'member_id' => $agent['uid'],
|
||||
'created_at' => time(),
|
||||
];
|
||||
//监听经销商签合同
|
||||
event(new \app\common\events\plugin\TeamDividendEvent($agentData));
|
||||
//监听会员同步等级
|
||||
$pluginLevel = [
|
||||
'member_id' => $agent['uid'],
|
||||
'level_id' => $level->id,
|
||||
'plugin_type' => 3,
|
||||
'self_up' => 1,
|
||||
];
|
||||
event(new \app\common\events\PluginLevelEvent($pluginLevel));
|
||||
// 升级奖励
|
||||
$this->upgradeAward($agent['uid'], $level);
|
||||
// 奖励激活码
|
||||
$this->awardCode($agent['uid'], $level);
|
||||
// 升级后退出
|
||||
break;
|
||||
}
|
||||
$this->uplogService->resetCondition();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name 升级奖励激活码
|
||||
|
|
@ -564,8 +365,15 @@ class NewUpgrateJob implements ShouldQueue
|
|||
}
|
||||
}
|
||||
|
||||
// 升级奖励
|
||||
public function upgradeAward($uid, $level){
|
||||
/**
|
||||
* @name 升级奖励积分爱心值
|
||||
* @param $uid
|
||||
* @param $level
|
||||
* @throws \app\common\exceptions\ShopException
|
||||
* @author
|
||||
*/
|
||||
public function upgradeAward($uid, $level)
|
||||
{
|
||||
$isPluginGold = \YunShop::plugin()->get('love');//爱心值插件
|
||||
$upgradeRewardPoint = $level->upgrade_reward_point;
|
||||
$upgradeRewardGold = $level->upgrade_reward_gold;
|
||||
|
|
@ -614,10 +422,6 @@ class NewUpgrateJob implements ShouldQueue
|
|||
];
|
||||
(new LoveChangeService())->teamLevelAward($data);
|
||||
}
|
||||
// 升级赠送权重值
|
||||
(new WeightValue())->upgradeGiveInit($uid,(int)$level->id);
|
||||
// 升级赠送画
|
||||
CollectionRoomModel::addInfo($uid,(int)$level->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -631,60 +435,70 @@ class NewUpgrateJob implements ShouldQueue
|
|||
return Str::camel(preg_replace("/\\d+/", '', $str));
|
||||
}
|
||||
|
||||
|
||||
// 查询等级权重比当前大的等级集合 - 根据等级类型查询
|
||||
private function getUpgrateLevelsByWeight($agent,$levelType = 0)
|
||||
/**
|
||||
* @name 获取当前会员的等级权重
|
||||
* @param $agent
|
||||
* @return int
|
||||
* @author
|
||||
*/
|
||||
private function getLevelWeight($agent)
|
||||
{
|
||||
$levelWeight = $this->getLevelWeight($agent,$levelType);
|
||||
$upgradeLevels = TeamDividendLevelModel::select()
|
||||
->with(['hasOneUpgradeSet'])
|
||||
->where('uniacid', $this->uniacid)
|
||||
->where('level_weight', '>', $levelWeight)
|
||||
->where('level_type','=',(int)$levelType)
|
||||
->orderBy('level_weight', 'desc')
|
||||
->get();
|
||||
return $upgradeLevels;
|
||||
}
|
||||
// 获取当前会员的等级权重 - 根据等级类型查询
|
||||
private function getLevelWeight($agent,$levelType){
|
||||
$levelWeight = 0;
|
||||
if($agent['teamDividend']){
|
||||
if ($agent['teamDividend']) {
|
||||
// 等级升级设置关联查询
|
||||
$agentLevel = TeamDividendLevelModel::with(['hasOneUpgradeSet'])
|
||||
->when($levelType == 1,function($query) use ($agent){
|
||||
// 文创等级
|
||||
$query->where('id',$agent['teamDividend']->cultural_level_id);
|
||||
},function($query) use ($agent){
|
||||
// 普通等级
|
||||
$query->where('id',$agent['teamDividend']->level);
|
||||
})
|
||||
$agentLevel = TeamDividendLevelModel::with([
|
||||
'hasOneUpgradeSet',
|
||||
])
|
||||
->where('id', $agent['teamDividend']->level)
|
||||
->first();
|
||||
if($agentLevel){
|
||||
if ($agentLevel) {
|
||||
$levelWeight = $agentLevel->level_weight;
|
||||
|
||||
// 升级前的等级设置
|
||||
$agentLevel = $agentLevel->toArray();
|
||||
$agentLevel = $agentLevel->toArray();
|
||||
$agentLevel['has_one_upgrade_set']['parase'] = unserialize($agentLevel['has_one_upgrade_set']['parase']);
|
||||
$this->uplogService->setBeforeLevelSetting($agentLevel);
|
||||
|
||||
}
|
||||
}
|
||||
return $levelWeight;
|
||||
}
|
||||
// 会员成为经销商
|
||||
private function memberUpgradeToAgency($uid, $levelId,$levelType = 0){
|
||||
|
||||
/**
|
||||
* @name 查询等级权重比当前大的等级集合
|
||||
* @param $agent
|
||||
* @return mixed
|
||||
* @author
|
||||
*/
|
||||
private function getUpgrateLevelsByWeight($agent)
|
||||
{
|
||||
$levelWeight = $this->getLevelWeight($agent);
|
||||
$upgradeLevels = TeamDividendLevelModel::select()
|
||||
->with(['hasOneUpgradeSet'])
|
||||
->where('uniacid', $this->uniacid)
|
||||
->where('level_weight', '>', $levelWeight)
|
||||
->orderBy('level_weight', 'desc')
|
||||
->get();
|
||||
return $upgradeLevels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name 会员成为经销商
|
||||
* @param $uid
|
||||
* @param $levelId
|
||||
* @author
|
||||
*/
|
||||
private function memberUpgradeToAgency($uid, $levelId)
|
||||
{
|
||||
$member = Member::getUserInfos($uid)->first();
|
||||
$data = [
|
||||
|
||||
TeamDividendAgencyModel::replace([
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $member->uid,
|
||||
'parent_id' => floatval($member->yzMember->parent_id),
|
||||
'level' => $levelId,
|
||||
'relation' => $member->yzMember->relation,
|
||||
];
|
||||
if($levelType == 1){
|
||||
$data['cultural_level_id'] = $levelId;
|
||||
$data['cultural_upgrade_at'] = time();
|
||||
}else{
|
||||
$data['level'] = $levelId;
|
||||
$data['upgrade_at'] = time();
|
||||
}
|
||||
TeamDividendAgencyModel::replace($data);
|
||||
'upgrade_at' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 2:14 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 2:33 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/26
|
||||
* Time: 4:19 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/10/16
|
||||
* Time: 下午10:03
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,17 +18,18 @@ class GoodsTeamDividend extends BaseModel
|
|||
public $timestamps = true;
|
||||
protected $guarded = [''];
|
||||
public $attributes = [
|
||||
'is_dividend' => 1,
|
||||
'is_hierarchy' => 1,
|
||||
'is_restrict' => 0,
|
||||
'has_dividend' => 0,
|
||||
'is_dividend' => 1,
|
||||
'is_hierarchy' => 1,
|
||||
'is_restrict' => 0,
|
||||
'has_dividend' => 0,
|
||||
'has_dividend_price' => 0,
|
||||
'has_dividend_rate' => 0,
|
||||
'commission_rates' => 0
|
||||
'has_dividend_rate' => 0,
|
||||
];
|
||||
|
||||
public static function getGoodsByGoodsId($giidsId){
|
||||
return self::where('goods_id', $giidsId)->where('is_dividend', '1');
|
||||
public static function getGoodsByGoodsId($giidsId)
|
||||
{
|
||||
return self::where('goods_id', $giidsId)
|
||||
->where('is_dividend', '1');
|
||||
}
|
||||
|
||||
public static function relationSave($goodsId, $data, $operate)
|
||||
|
|
@ -64,7 +65,6 @@ class GoodsTeamDividend extends BaseModel
|
|||
$data['has_dividend_rates'] = $data['has_dividend_rates'] ? serialize($data['has_dividend_rates']) : '';
|
||||
$data['has_hierarchys'] = serialize($data['has_hierarchys']);
|
||||
$data['has_dividend_extra'] = $data['has_dividend_extra'] ? serialize($data['has_dividend_extra']) : '';
|
||||
$data['commission_rates'] = $data['commission_rates'] ? serialize($data['commission_rates']) : '';
|
||||
$dividendModel->setRawAttributes($data);
|
||||
return $dividendModel->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2019/1/11
|
||||
* Time: 3:01 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2019/1/11
|
||||
* Time: 3:01 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2019-10-29
|
||||
* Time: 14:16
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/9
|
||||
* Time: 10:13 AM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/27
|
||||
* Time: 10:26 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,17 +5,12 @@ namespace Yunshop\TeamDividend\models;
|
|||
|
||||
|
||||
use app\backend\models\BackendModel;
|
||||
use app\common\models\Member;
|
||||
use app\common\models\member\MemberChildren;
|
||||
use app\common\models\MemberShopInfo;
|
||||
use app\common\models\Order;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpace;
|
||||
use Yunshop\TeamDividend\admin\models\MemberChild;
|
||||
use Yunshop\TeamDividend\observers\DealerObserver;
|
||||
use Yunshop\TeamDividend\services\UpgradeService;
|
||||
|
||||
class TeamDividendAgencyModel extends BackendModel
|
||||
{
|
||||
|
|
@ -127,10 +122,6 @@ class TeamDividendAgencyModel extends BackendModel
|
|||
$result = $result->where('level', $parame['level_id']);
|
||||
}
|
||||
|
||||
if (!empty($parame['cultural_level_id'])) {
|
||||
$result = $result->where('cultural_level_id', $parame['cultural_level_id']);
|
||||
}
|
||||
|
||||
if (!empty($parame['member_id'])) {
|
||||
$result = $result->whereHas('hasOneMember', function ($query) use ($parame) {
|
||||
$query->where('uid', $parame['member_id']);
|
||||
|
|
@ -144,43 +135,26 @@ class TeamDividendAgencyModel extends BackendModel
|
|||
$result = $result->whereBetween('yz_team_dividend_agency.created_at', $range);
|
||||
}
|
||||
}
|
||||
$result = $result->with([
|
||||
'hasOneLevel' => function($query){
|
||||
return $query->select(['*']);
|
||||
},
|
||||
'culturalLevel' => function($query){
|
||||
return $query->select(['id','level_name','level_weight','level_type','dividend_ratio','award_ratio','culate_model']);
|
||||
},
|
||||
'hasOneMember' => function($query){
|
||||
return $query->select(['*']);
|
||||
},
|
||||
'toParent' => function($query){
|
||||
return $query->select('uid','realname','mobile');
|
||||
},
|
||||
'hasManyTeamDividend' => function($query){
|
||||
return $query->selectRaw('member_id, status, sum(dividend_amount) as total_amount')
|
||||
->groupBy('member_id','status');
|
||||
}
|
||||
])
|
||||
->orderBy('id','desc');
|
||||
|
||||
$result = $result->with(
|
||||
['hasOneLevel' => function($query){
|
||||
return $query->select(['*']);
|
||||
},'hasOneMember' => function($query){
|
||||
return $query->select(['*']);
|
||||
},'toParent' => function($query){
|
||||
return $query->select('uid', 'realname', 'mobile');
|
||||
},'hasManyTeamDividend' => function($query){
|
||||
return $query->selectRaw('member_id, status, sum(dividend_amount) as total_amount')->groupBy('member_id','status');
|
||||
}])->orderBy('id', 'desc');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function culturalLevel(){
|
||||
return $this->hasOne(TeamDividendLevelModel::class, 'id', 'cultural_level_id');
|
||||
}
|
||||
|
||||
|
||||
public static function getAgencyInfoByUid($uid)
|
||||
{
|
||||
return self::uniacid()
|
||||
->with(['hasOneLevel'=>function($query){
|
||||
// $query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight','level_type','commission_ratio']);
|
||||
},'culturalLevel'=>function($query){
|
||||
// $query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight','level_type','commission_ratio']);
|
||||
}])
|
||||
->with('hasOneLevel')
|
||||
->where('uid', $uid)
|
||||
->first();
|
||||
}
|
||||
|
|
@ -243,13 +217,7 @@ class TeamDividendAgencyModel extends BackendModel
|
|||
if (!$uids = MemberShopInfo::uniacid()->where('parent_id',$pid)->pluck('member_id')->toArray()){
|
||||
return 0;
|
||||
}
|
||||
return self::uniacid()->whereIn('uid',$uids)
|
||||
->where(function($query) use ($level){
|
||||
$query->where('level',$level)
|
||||
->orWhere('cultural_level_id',$level);
|
||||
})
|
||||
// ->where('level', $level)
|
||||
->count(DB::raw("distinct(uid)"));
|
||||
return self::uniacid()->whereIn('uid',$uids)->where('level', $level)->count(DB::raw("distinct(uid)"));
|
||||
// return self::uniacid()
|
||||
// ->where('parent_id', $pid)
|
||||
// ->where('level', $level)
|
||||
|
|
@ -329,254 +297,4 @@ class TeamDividendAgencyModel extends BackendModel
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 判断:当前等级是否为用户成为过的经销商中 等级最小的
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/26 18:03
|
||||
* @param $uid
|
||||
* @param $teamLevelId
|
||||
* @return bool
|
||||
*/
|
||||
public function isMinLevel($uid,$teamLevelId){
|
||||
$allLv = Uplog::uniacid()
|
||||
->select([
|
||||
'yz_team_dividend_uplog.after_level_id',
|
||||
'yz_team_dividend_level.level_weight',
|
||||
'yz_team_dividend_level.id',
|
||||
])
|
||||
->join('yz_team_dividend_level','yz_team_dividend_level.id','yz_team_dividend_uplog.after_level_id')
|
||||
->where('uid',$uid)
|
||||
->groupBy('after_level_id')
|
||||
->get()
|
||||
->toArray();
|
||||
// 判断:当前等级是否为最小等级
|
||||
$minWeight = (int)min(array_column($allLv,'level_weight'));// 最小权重值
|
||||
$weightList = array_column($allLv,'level_weight','after_level_id');
|
||||
|
||||
return (boolean)((int)$minWeight == (int)$weightList[$teamLevelId]);
|
||||
}
|
||||
|
||||
|
||||
public function addTeamAgency($agentData){
|
||||
// 其他验证
|
||||
$agency_model = new \Yunshop\TeamDividend\admin\models\TeamDividendAgencyModel();
|
||||
$agency_model->fill($agentData);
|
||||
$validator = $agency_model->validator();
|
||||
if ($validator->fails()) {
|
||||
throw new \Exception($validator->messages()->first());
|
||||
} else {
|
||||
if ($agency_model->save()) {
|
||||
// 升级后等级
|
||||
$c_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find($agentData['level']);
|
||||
// 升级前等级
|
||||
$o_level = NULL;
|
||||
// 升级日志
|
||||
Uplog::addLog($agency_model, $o_level, $c_level);
|
||||
|
||||
|
||||
if((int)$agentData['cultural_level_id'] > 0){
|
||||
// 升级后等级
|
||||
$c_c_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find((int)$agentData['cultural_level_id']);
|
||||
// 升级前等级
|
||||
$o_c_level = NULL;
|
||||
// 升级日志
|
||||
Uplog::addLog($agency_model, $o_c_level, $c_c_level);
|
||||
}
|
||||
|
||||
|
||||
//签合同
|
||||
$data=[
|
||||
'member_id'=>$agentData['uid'],
|
||||
'created_at' => time(),
|
||||
];
|
||||
event(new \app\common\events\plugin\TeamDividendEvent($data));
|
||||
//激活码
|
||||
$upgrade_set = (new UpgradeService())->getUpgradeById($agentData['level']);
|
||||
|
||||
if ($upgrade_set) {
|
||||
$set = \Setting::get('plugin.team_dividend');
|
||||
if ($set['is_activation_code'] && $upgrade_set[0]->code_num) {
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
$code_num = unserialize($upgrade_set[0]->code_num);
|
||||
foreach($level_list as $key => $level) {
|
||||
if($code_num['level_'.$level->id]) {
|
||||
(new UpgradeService())->senCode($agentData['uid'], $code_num['level_'.$level->id], $level->id, $level->level_name);
|
||||
}
|
||||
}
|
||||
\Log::debug('激活码');
|
||||
}
|
||||
}
|
||||
(new UpgradeService())->becomeAgencyNotify($agentData['uid']);
|
||||
|
||||
}else{
|
||||
throw new \Exception('添加失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function changeLevel($id,$levelId,$leveType){
|
||||
$agency = TeamDividendAgencyModel::find($id);
|
||||
|
||||
// 等级类型:''=普通等级,cultural=文创等级
|
||||
if((string)$leveType == 'cultural'){
|
||||
$level = $agency->cultural_level_id;
|
||||
$agency->cultural_level_id = $levelId;
|
||||
$agency->cultural_upgrade_at = time();
|
||||
}else{
|
||||
$level = $agency->level;
|
||||
$agency->level = $levelId;
|
||||
$agency->upgrade_at = time();
|
||||
}
|
||||
|
||||
// 升级后等级
|
||||
$c_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find($leveType == 'cultural' ? $agency->cultural_level_id : $agency->level);
|
||||
// 升级前等级
|
||||
$o_level = TeamDividendLevelModel::with(['hasOneUpgradeSet'])->find($level);
|
||||
|
||||
|
||||
if($c_level && $o_level && $c_level->level_type != $o_level->level_type ){
|
||||
// 非默认等级 且 类型不一致,升级失败
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($agency->save()) {
|
||||
// 升级日志
|
||||
Uplog::addLog($agency, $o_level, $c_level);
|
||||
|
||||
if ($c_level->level_weight > $o_level->level_weight) {
|
||||
//激活码
|
||||
$upgrade_set = (new UpgradeService())->getUpgradeById($agency->level);
|
||||
|
||||
if ($upgrade_set) {
|
||||
$set = \Setting::get('plugin.team_dividend');
|
||||
if ($set['is_activation_code'] && $upgrade_set[0]->code_num) {
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
$code_num = (is_array($upgrade_set[0]->code_num) ? $upgrade_set[0]->code_num : unserialize($upgrade_set[0]->code_num)) ?: [];
|
||||
foreach($level_list as $key => $level) {
|
||||
if($code_num['level_'.$level->id]) {
|
||||
(new UpgradeService())->senCode($agency->uid, $code_num['level_'.$level->id], $level->id, $level->level_name);
|
||||
}
|
||||
}
|
||||
\Log::debug('激活码');
|
||||
}
|
||||
}
|
||||
|
||||
//代理商升级通知
|
||||
(new UpgradeService())->agencyUpgradeNotify($agency->uid, $o_level->level_name, $o_level->dividend_ratio_name, $agency->level);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 团队信息 - 获取全部团队信息列表(分页)
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 13:32
|
||||
* @param $pageSize
|
||||
* @param $search
|
||||
* @return array
|
||||
*/
|
||||
public static function teamGetAllList($pageSize,$search){
|
||||
// 条件生成
|
||||
$where = [];
|
||||
if($search['uid'] > 0) $where[] = ['uid','=',$search['uid']];
|
||||
// 列表获取
|
||||
$model = self::uniacid()
|
||||
->select(['id','uid'])
|
||||
->where($where)
|
||||
->when(!empty($search['nickname']),function($query) use ($search){
|
||||
// 合伙人 昵称|真实姓名搜索
|
||||
$ids = Member::where('nickname','like',"%{$search['nickname']}%")
|
||||
->orwhere('realname','like',"%{$search['nickname']}%")
|
||||
->pluck('uid');
|
||||
if($ids) $ids = $ids->toArray();
|
||||
$query->whereIn('uid',(array)$ids);
|
||||
})
|
||||
->with([
|
||||
'hasOneMember' => function($query){
|
||||
$query->select(['uid','nickname','realname','avatar']);
|
||||
}
|
||||
])
|
||||
->orderBy('created_at','DESC')
|
||||
->orderBy('id','DESC');
|
||||
$list = $model->paginate($pageSize);
|
||||
|
||||
return $list ? $list->toArray() : [];
|
||||
}
|
||||
/**
|
||||
* Common: 团队信息 - 获某个用户的所有团队业绩信息(仅获取直推团队)
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 13:37
|
||||
* @param $uid
|
||||
* @return array
|
||||
*/
|
||||
public static function teamGetPerformanceList($uid):array{
|
||||
// 获取直推下级列表
|
||||
$subIds = MemberChild::uniacid()
|
||||
->where('level',1)
|
||||
->where('member_id',$uid)
|
||||
->pluck('child_id')
|
||||
->toArray();
|
||||
$data = [
|
||||
'line_list' => [],// 每条线的信息
|
||||
'min_line' => [],// 业绩最少的一条线的信息
|
||||
'max_line' => [],// 业绩最多的一条线的信息
|
||||
];
|
||||
foreach($subIds as $subUid){
|
||||
$lineAllUid = MemberChild::uniacid()->where('member_id',$subUid)->pluck('child_id')->toArray();
|
||||
$lineAllUid[] = $subUid;
|
||||
$subPerformance = Order::uniacid()
|
||||
->leftJoin('yz_order_goods','yz_order_goods.order_id','yz_order.id')
|
||||
->leftJoin('yz_goods_cultural_space','yz_goods_cultural_space.goods_id','yz_order_goods.goods_id')
|
||||
->whereIn('yz_order.uid',$lineAllUid)
|
||||
->where('yz_order.status','>',0)
|
||||
->where('yz_goods_cultural_space.is_open',1)
|
||||
->sum('yz_order_goods.payment_amount');
|
||||
// 信息处理赋值
|
||||
$currentLineData = [
|
||||
'sub_uid' => $subUid,
|
||||
'line_all_uid' => implode(',',$lineAllUid),
|
||||
'performance' => $subPerformance,
|
||||
];
|
||||
$data['line_list'][] = $currentLineData;
|
||||
// 判断:当前线是否为最小业绩
|
||||
if((float)$currentLineData['performance'] < (float)$data['min_line']['performance'] || (float)$data['min_line']['performance'] <= 0){
|
||||
$data['min_line'] = $currentLineData;
|
||||
}
|
||||
// 判断:当前线是否为大区业绩
|
||||
if((float)$currentLineData['performance'] > (float)$data['max_line']['performance']){
|
||||
$data['max_line'] = $currentLineData;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* Common: 团队信息 - 获取全部经销商的小区业绩之和
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 14:08
|
||||
* @return float|int
|
||||
*/
|
||||
public static function teamMinAreaSumAmount(){
|
||||
// 小区业绩 = 总业绩 - 最大一条线的业绩
|
||||
$uidList = self::uniacid()->pluck('uid');
|
||||
$totalPerformance = 0;// 全平台所有用户小区业绩之和
|
||||
foreach($uidList as $uid){
|
||||
// 获取团队业绩信息
|
||||
$teamPerformance = (new CulturalSpace())->getTeamOrderAmount($uid);
|
||||
$totalPerformance += (float)$teamPerformance['area_amount'];
|
||||
}
|
||||
|
||||
return $totalPerformance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,14 +17,13 @@ class TeamDividendLevelModel extends BackendModel
|
|||
protected $guarded = [''];
|
||||
public $attributes = [
|
||||
'upgrade_reward_point' => 0,
|
||||
'upgrade_reward_gold' => 0,
|
||||
'code_num' => 0,
|
||||
'award_hierarchy' => 0,
|
||||
'award_ratio' => 0,
|
||||
'award_gratitude' => 0,
|
||||
'auto_withdraw_day' => 0,
|
||||
'upgrade_reward_gold' => 0,
|
||||
'code_num' => 0,
|
||||
'award_hierarchy' => 0,
|
||||
'award_ratio' => 0,
|
||||
'award_gratitude' => 0,
|
||||
'auto_withdraw_day' => 0,
|
||||
'auto_withdraw_period' => 0,
|
||||
'number_limit' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +197,7 @@ class TeamDividendLevelModel extends BackendModel
|
|||
'level_weight' => [
|
||||
'required',
|
||||
'integer',
|
||||
Rule::unique($this->table)->ignore($this->id)->where('uniacid', $this->uniacid)->where('level_type', $this->level_type)->whereNull('deleted_at'),
|
||||
Rule::unique($this->table)->ignore($this->id)->where('uniacid', $this->uniacid)->whereNull('deleted_at'),
|
||||
'min:1'
|
||||
],
|
||||
'upgrade_reward_point' => 'required',
|
||||
|
|
@ -209,47 +208,4 @@ class TeamDividendLevelModel extends BackendModel
|
|||
'award_ratio' => 'required'
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Common: 获取全部的等级信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/23 9:16
|
||||
* @param $field
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getAll($field){
|
||||
return self::getList()->select($field)->get()->toArray();
|
||||
}
|
||||
|
||||
public function upLog(){
|
||||
return $this->hasMany(Uplog::class, 'after_level_id', 'id');
|
||||
}
|
||||
/**
|
||||
* Common: 获取所有等级所有经销商排名信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/23 15:45
|
||||
* @return array|false|null
|
||||
*/
|
||||
public static function getRanking(){
|
||||
// 获取全部经销商 以此来获取排名信息
|
||||
$upRank = TeamDividendLevelModel::uniacid()
|
||||
->select(['id','level_name','level_weight','level_type'])
|
||||
->with(['upLog'=>function($query){
|
||||
$query->select(['id','uid','after_level_id','created_at'])
|
||||
->orderBy('created_at','ASC')
|
||||
->groupBy('after_level_id')
|
||||
->groupBy('uid');
|
||||
}])
|
||||
->get();
|
||||
$allTeamDividend = $upRank->map(function($upItem){
|
||||
return [
|
||||
'id' => $upItem->id,
|
||||
'level_name' => $upItem->level_name,
|
||||
'level_type' => $upItem->level_type,
|
||||
'up_log' => array_flip($upItem->upLog->pluck('uid')->toArray()),
|
||||
];
|
||||
})->toArray();
|
||||
return array_column($allTeamDividend,null,'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -70,33 +70,8 @@ class TeamDividendLevelUpgrade extends BackendModel
|
|||
'1030' => 'agent_love', // 会员累计获得{{ LOVE_NAME }}数量达到
|
||||
'1031' => 'team_new_order_number', // 团队新订单数量满
|
||||
'1032' => 'team_shop_order_amount', // 团队自营订单实付金额满
|
||||
'1050' => 'one_or_two', // 直推间推 某个等级 满多少人
|
||||
'1051' => 'team_consumption_people',// 团队消费人数满多少人 支持去除人数最多的线
|
||||
];
|
||||
// 等级为 2000 + 等级id
|
||||
return $ret;
|
||||
}
|
||||
/**
|
||||
* Common: 获取所有升级商品(仅限条件开启状态)
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/18 15:32
|
||||
* @return []|array
|
||||
*/
|
||||
public static function getUpgradeGoods(){
|
||||
$list = self::uniacid()->pluck('parase');
|
||||
$goodsIds = [];
|
||||
foreach($list as $key => $item){
|
||||
$parase = unserialize($item);
|
||||
if((int)$parase[0]['goods'] == 1) $goodsIds = array_merge($goodsIds,[$parase[1]['goods']]);
|
||||
if((int)$parase[0]['many_good'] == 1) $goodsIds = array_merge($goodsIds,(array)$parase[1]['many_good']);
|
||||
}
|
||||
|
||||
return array_unique($goodsIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -200,15 +200,6 @@ class TeamDividendModel extends BaseModel
|
|||
case 3:
|
||||
$this->TypeService = '额外分红';
|
||||
break;
|
||||
case 4:
|
||||
$this->TypeService = '经销商受益';//生态建设
|
||||
break;
|
||||
case 5:
|
||||
$this->TypeService = '生态贡献';
|
||||
break;
|
||||
case 6:
|
||||
$this->TypeService = '生态服务';// 生态服务
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $this->TypeService;
|
||||
|
|
@ -470,29 +461,4 @@ class TeamDividendModel extends BaseModel
|
|||
|
||||
return $query->orderBy('yz_team_dividend.id', 'desc');
|
||||
}
|
||||
/**
|
||||
* Common: 获取用户某个类型的提成
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/20 15:15
|
||||
* @param int $uid 用户id
|
||||
* @param int $type 4=生态建设,5=生态贡献,6=生态服务
|
||||
* @param string $incomeStatus all=全部收益;undrawn=未提现收益,withdrawn=已提现收益
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getTypeTotalIncome(int $uid,int $type,string $incomeStatus = 'all'){
|
||||
return self::uniacid()
|
||||
->leftJoin('yz_member_income', function ($join) {
|
||||
$join->on('yz_member_income.member_id', 'yz_team_dividend.member_id')->on('yz_member_income.incometable_id', 'yz_team_dividend.id');
|
||||
})
|
||||
->where('yz_member_income.dividend_code',2)
|
||||
->where('yz_team_dividend.type',$type)
|
||||
->where('yz_team_dividend.member_id',$uid)
|
||||
->when($incomeStatus != 'all',function($query) use ($incomeStatus){
|
||||
$query->where('yz_member_income.status',$incomeStatus == 'undrawn' ? 0 : 1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2017/6/21
|
||||
* Time: 下午2:05
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@ namespace Yunshop\TeamDividend\models;
|
|||
use app\common\models\BaseModel;
|
||||
use app\common\models\Member;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Yunshop\CollectionRoom\models\CollectionRoomModel;
|
||||
use Yunshop\TeamDividend\services\upgrate\UplogService;
|
||||
use Yunshop\WeightValue\models\WeightValue;
|
||||
|
||||
class Uplog extends BaseModel
|
||||
{
|
||||
|
|
@ -88,7 +86,7 @@ class Uplog extends BaseModel
|
|||
{
|
||||
$beforeLevelSetting = !is_null($beforeLevel) ? $beforeLevel->toArray() : [];
|
||||
|
||||
$afterLevelSetting = !is_null($afterLevel) ? $afterLevel->toArray() : [];
|
||||
$afterLevelSetting = $afterLevel->toArray();
|
||||
$uplogService = new UplogService($agency->uid, $agency->uniacid, $beforeLevelSetting['id']);
|
||||
$beforeLevelSetting['has_one_upgrade_set']['parase'] = unserialize($beforeLevelSetting['has_one_upgrade_set']['parase']);
|
||||
$uplogService->setBeforeLevelSetting($beforeLevelSetting);
|
||||
|
|
@ -97,17 +95,6 @@ class Uplog extends BaseModel
|
|||
$uplogService->setAfterLevelId($afterLevelSetting['id']);
|
||||
$uplogService->setUpCode($upCode);
|
||||
$uplogService->store();
|
||||
|
||||
|
||||
|
||||
if(!is_null($afterLevel)){
|
||||
\Log::debug('经销商等级变更 - 权重值操作:',['uid' => $agency->uid,'old_lv'=>$beforeLevelSetting['id'],'lv'=>$afterLevelSetting['id']]);
|
||||
// 经销商升级赠送权重值处理
|
||||
(new WeightValue())->upgradeGiveInit((int)$agency->uid,(int)$afterLevelSetting['id']);
|
||||
// 会员升级经销商 赠送画
|
||||
CollectionRoomModel::addInfo((int)$agency->uid,(int)$afterLevelSetting['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
|
|
@ -117,34 +104,4 @@ class Uplog extends BaseModel
|
|||
$builder->uniacid();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Common: 获取某个用户持有某个等级的名额信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/24 19:04
|
||||
* @param $uid
|
||||
* @param $teamLevelId
|
||||
* @return int[]
|
||||
*/
|
||||
public static function getQuota($uid,$teamLevelId){
|
||||
$info = Uplog::uniacid()
|
||||
->where('uid',$uid)
|
||||
->where('after_level_id',$teamLevelId)
|
||||
->orderBy('created_at','ASC')
|
||||
->first();
|
||||
// 已使用
|
||||
$useQuota = TeamDividendAgencyModel::uniacid()
|
||||
->where('give_uid',$uid)
|
||||
->where('give_level_id',$info['give_limit_level_id'])
|
||||
->count();
|
||||
|
||||
return [
|
||||
'total_quota' => (int)$info->give_limit,// 总数
|
||||
'use_quota' => (int)$useQuota,// 已使用
|
||||
'surplus_quota' => (int)$info->give_limit - (int)$useQuota,// 剩余
|
||||
'give_limit_level_id' => (int)$info->give_limit_level_id,// 升级等级id
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
/******************************************************************************************************************
|
||||
* Author: king -- LiBaoJia
|
||||
* Date: 12/4/21 12:16 PM
|
||||
* Email: livsyitian@163.com
|
||||
* QQ: 995265288
|
||||
* IDE: PhpStorm
|
||||
* User: www.yunzshop.com www.yunzshop.com
|
||||
* Company: 广州市芸众信息科技有限公司
|
||||
* Profile: 专注移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务
|
||||
******************************************************************************************************************/
|
||||
|
||||
|
||||
namespace Yunshop\TeamDividend\observers;
|
||||
|
|
@ -6,43 +16,25 @@ namespace Yunshop\TeamDividend\observers;
|
|||
|
||||
use app\common\observers\BaseObserver;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\CollectionRoom\models\CollectionRoomModel;
|
||||
use Yunshop\TeamDividend\events\LevelChangeEvent;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\models\Uplog;
|
||||
use Yunshop\WeightValue\models\WeightValue;
|
||||
|
||||
class DealerObserver extends BaseObserver{
|
||||
// 修改前
|
||||
public function updating(Model $model){
|
||||
class DealerObserver extends BaseObserver
|
||||
{
|
||||
public function updating(Model $model)
|
||||
{
|
||||
/**
|
||||
* @var TeamDividendAgencyModel $model
|
||||
*/
|
||||
if ($model->getOriginal('level') != $model->level) {
|
||||
/**
|
||||
* @var TeamDividendAgencyModel $model
|
||||
*/
|
||||
event(new LevelChangeEvent($model));
|
||||
// 判断:如果当前等级人数已经达到限制 则不升级(上限小于等于已存在数量 不能升级到该等级)
|
||||
// $hasNum = (int)TeamDividendAgencyModel::uniacid()->where('uid','!=',$model->uid)->where('level',$model->level)->count();
|
||||
$hasNum = (int)Uplog::uniacid()->where('after_level_id',$model->level)->where('uid','!=',$model->uid)->count(DB::raw('DISTINCT(uid)'));
|
||||
$levelNumberLimit = (int)TeamDividendLevelModel::uniacid()->where('id',$model->level)->value('number_limit');
|
||||
if((int)$levelNumberLimit <= $hasNum && (int)$levelNumberLimit > 0) return false;
|
||||
}
|
||||
}
|
||||
// 添加前
|
||||
public function creating(Model $model){
|
||||
public function creating(Model $model)
|
||||
{
|
||||
/**
|
||||
* @var TeamDividendAgencyModel $model
|
||||
*/
|
||||
event(new LevelChangeEvent($model));
|
||||
// 判断:如果当前等级人数已经达到限制 则不升级(上限小于等于已存在数量 不能升级到该等级)
|
||||
// $hasNum = (int)TeamDividendAgencyModel::uniacid()->where('uid','!=',$model->uid)->where('level',$model->level)->count();
|
||||
$hasNum = (int)Uplog::uniacid()->where('after_level_id',$model->level)->where('uid','!=',$model->uid)->count(DB::raw('DISTINCT(uid)'));
|
||||
$levelNumberLimit = (int)TeamDividendLevelModel::uniacid()->where('id',$model->level)->value('number_limit');
|
||||
if((int)$levelNumberLimit <= $hasNum && (int)$levelNumberLimit > 0) return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/5
|
||||
* Time: 9:55 PM
|
||||
*/
|
||||
|
|
@ -28,11 +28,7 @@ class GetAgentsService
|
|||
// 所有上级
|
||||
$parents = MemberParent::with([
|
||||
'hasOneTeam' => function ($team) {
|
||||
$team->with(['hasOneLevel'=>function($query){
|
||||
// $query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight']);
|
||||
},'culturalLevel'=>function($query){
|
||||
// $query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight']);
|
||||
}]);
|
||||
$team->with(['hasOneLevel']);
|
||||
}
|
||||
])->whereHas('hasOneParentMember')
|
||||
->where('member_id', $uid)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/6
|
||||
* Time: 1:47 PM
|
||||
*/
|
||||
|
|
@ -24,7 +24,6 @@ class GetAmountService
|
|||
public $amount;
|
||||
public $fixed;
|
||||
public $ratio;
|
||||
private $dividendType = 0;
|
||||
|
||||
/**
|
||||
* GetAmountService constructor.
|
||||
|
|
@ -35,18 +34,15 @@ class GetAmountService
|
|||
* @param $team_goods
|
||||
* @param $finish_ratio
|
||||
* @param $finish_price
|
||||
* @param $dividendType
|
||||
*/
|
||||
public function __construct($agent, $order, $order_goods, $set, $team_goods, $finish_ratio, $finish_price, $dividendType = 0,$finish_ratio_service = 0)
|
||||
public function __construct($agent, $order, $order_goods, $set, $team_goods, $finish_ratio, $finish_price)
|
||||
{
|
||||
$this->dividendType = $dividendType;
|
||||
$this->agent = $agent;
|
||||
$this->order = $order;
|
||||
$this->order_goods = $order_goods;
|
||||
$this->set = $set;
|
||||
$this->team_goods = $team_goods;
|
||||
$this->finish_ratio = $finish_ratio;
|
||||
$this->finish_ratio_service = $finish_ratio_service;
|
||||
$this->finish_price = $finish_price;
|
||||
}
|
||||
|
||||
|
|
@ -60,11 +56,6 @@ class GetAmountService
|
|||
return unserialize($this->team_goods->has_dividend_rates);
|
||||
}
|
||||
|
||||
private function getCommissionRates()
|
||||
{
|
||||
return unserialize($this->team_goods->commission_rates);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name 商品独立设置-固定金额-解序列化
|
||||
* @author
|
||||
|
|
@ -163,10 +154,10 @@ class GetAmountService
|
|||
*/
|
||||
public function getAwardHierarchy()
|
||||
{
|
||||
$award_hierarchy = $this->dividendType == 1 ? $this->agent['cultural_level']['award_hierarchy'] : $this->agent['has_one_level']['award_hierarchy'];
|
||||
$award_hierarchy = $this->agent['has_one_level']['award_hierarchy'];
|
||||
if ($this->hasPeers()) {
|
||||
$hierarchys = $this->getHierarchys();
|
||||
$hierarchy_level = $hierarchys[$this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level']];
|
||||
$hierarchy_level = $hierarchys[$this->agent['level']];
|
||||
if ($hierarchy_level && $hierarchy_level['hierarchy'] > 0) {
|
||||
$award_hierarchy = $hierarchy_level['hierarchy'];
|
||||
}
|
||||
|
|
@ -181,10 +172,10 @@ class GetAmountService
|
|||
*/
|
||||
public function getAwardHierarchyRatio()
|
||||
{
|
||||
$ratio = $this->dividendType == 1 ? $this->agent['cultural_level']['award_ratio'] : $this->agent['has_one_level']['award_ratio'];
|
||||
$ratio = $this->agent['has_one_level']['award_ratio'];
|
||||
if ($this->hasPeers()) {
|
||||
$hierarchys = $this->getHierarchys();
|
||||
$hierarchy_level = $hierarchys[$this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level']];
|
||||
$hierarchy_level = $hierarchys[$this->agent['level']];
|
||||
$ratio = $hierarchy_level['ratio'];
|
||||
}
|
||||
return $ratio;
|
||||
|
|
@ -198,19 +189,19 @@ class GetAmountService
|
|||
if ($this->hasDividend()) {
|
||||
if ($this->hasDividendRates()) {
|
||||
$dividend_rates = $this->getDividendRates();
|
||||
$ratio = $dividend_rates['level_' . ($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])];
|
||||
// if (isset($ratio) && $ratio > 0) {
|
||||
$ratio = $dividend_rates['level_' . $this->agent['level']];
|
||||
if (isset($ratio) && $ratio > 0) {
|
||||
// 提成结算金额
|
||||
$amount = $this->order_goods->payment_amount;
|
||||
return $amount;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// 商城商品设置奖励固定金额
|
||||
if ($this->hasDividendPrices()) {
|
||||
$dividend_prices = $this->getDividendPrices();
|
||||
// 提成结算金额
|
||||
$amount = $this->order_goods->total * $dividend_prices['level_' . ($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])];
|
||||
$amount = $this->order_goods->total * $dividend_prices['level_' . $this->agent['level']];
|
||||
}
|
||||
}
|
||||
if ($this->order->plugin_id == 48 && app('plugins')->isEnabled('hotel-supply')) {
|
||||
|
|
@ -258,7 +249,7 @@ class GetAmountService
|
|||
\Log::debug('经销商特殊结算商城商品1---',$this->order_goods->payment_amount);
|
||||
$dividend_prices = $this->getDividendPrices();
|
||||
// 提成结算金额
|
||||
$this->amount = $this->order_goods->total * $dividend_prices['level_' . ($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])];
|
||||
$this->amount = $this->order_goods->total * $dividend_prices['level_' . $this->agent['level']];
|
||||
$this->fixed = 1;
|
||||
$this->ratio = 0;
|
||||
// 奖励金额
|
||||
|
|
@ -302,86 +293,30 @@ class GetAmountService
|
|||
// 收银台商品 与 存在独立奖励设置 else 商城
|
||||
if ($this->hasDividendRate()) {
|
||||
// 经销商奖励比例 - 下级经销商奖励比例 = 奖励比例
|
||||
if($this->dividendType == 1){
|
||||
$ratio = bcsub($this->agent['cultural_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['cultural_level']['dividend_ratio'];
|
||||
}else{
|
||||
$ratio = bcsub($this->agent['has_one_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['has_one_level']['dividend_ratio'];
|
||||
}
|
||||
|
||||
$ratio = bcsub($this->agent['has_one_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['has_one_level']['dividend_ratio'];
|
||||
return $ratio;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// 商城商品设置奖励比例 else 商城商品设置奖励固定金额
|
||||
if ($this->hasDividendRates()) {
|
||||
$dividend_rates = $this->getDividendRates();
|
||||
$ratio = bcsub($dividend_rates['level_'. ($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $dividend_rates['level_' . ($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])];
|
||||
$ratio = bcsub($dividend_rates['level_'. $this->agent['level']], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $dividend_rates['level_' . $this->agent['level']];
|
||||
return $ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 基础设置
|
||||
if($this->dividendType == 1){
|
||||
$ratio = bcsub($this->agent['cultural_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['cultural_level']['dividend_ratio'];
|
||||
}else{
|
||||
$ratio = bcsub($this->agent['has_one_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['has_one_level']['dividend_ratio'];
|
||||
}
|
||||
} else {
|
||||
$ratio = bcsub($this->agent['has_one_level']['dividend_ratio'], $this->finish_ratio,2);
|
||||
$this->finish_ratio = $this->agent['has_one_level']['dividend_ratio'];
|
||||
return $ratio;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取生态服务比例
|
||||
public function getServiceRatio(){
|
||||
// 商品独立设置 else 基础设置
|
||||
if($this->hasDividend()){
|
||||
// 收银台商品 与 存在独立奖励设置 else 商城
|
||||
if($this->hasDividendRate()){
|
||||
// 经销商奖励比例 - 下级经销商奖励比例 = 奖励比例
|
||||
if($this->dividendType == 1){
|
||||
$ratio = bcsub($this->agent['cultural_level']['commission_ratio'],$this->finish_ratio_service,2);
|
||||
$this->finish_ratio_service = $this->agent['cultural_level']['commission_ratio'];
|
||||
}
|
||||
else{
|
||||
$ratio = bcsub($this->agent['has_one_level']['commission_ratio'],$this->finish_ratio_service,2);
|
||||
$this->finish_ratio_service = $this->agent['has_one_level']['commission_ratio'];
|
||||
}
|
||||
return $ratio;
|
||||
}
|
||||
else{
|
||||
// 商城商品设置奖励比例 else 商城商品设置奖励固定金额
|
||||
if($this->hasDividendRates()){
|
||||
$dividend_rates = $this->getCommissionRates();
|
||||
$ratio = bcsub($dividend_rates['level_'.($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])],$this->finish_ratio_service,2);
|
||||
$this->finish_ratio_service = $dividend_rates['level_'.($this->dividendType == 1 ? $this->agent['cultural_level_id'] : $this->agent['level'])];
|
||||
return $ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
// 基础设置
|
||||
if($this->dividendType == 1){
|
||||
$ratio = bcsub($this->agent['cultural_level']['commission_ratio'],$this->finish_ratio_service,2);
|
||||
$this->finish_ratio_service = $this->agent['cultural_level']['commission_ratio'];
|
||||
}
|
||||
else{
|
||||
$ratio = bcsub($this->agent['has_one_level']['commission_ratio'],$this->finish_ratio_service,2);
|
||||
$this->finish_ratio_service = $this->agent['has_one_level']['commission_ratio'];
|
||||
}
|
||||
return $ratio;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取最大奖励
|
||||
*/
|
||||
public function getTotalDividend(){
|
||||
public function getTotalDividend()
|
||||
{
|
||||
$maxRatio = max(TeamDividendLevelModel::uniacid()->select('dividend_ratio')->get()->toArray());
|
||||
if ($this->hasDividend()) {
|
||||
|
||||
|
|
@ -416,13 +351,4 @@ class GetAmountService
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 6:01 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/13
|
||||
* Time: 5:44 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 2:18 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/15
|
||||
* Time: 2:36 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/5
|
||||
* Time: 9:08 PM
|
||||
*/
|
||||
|
|
@ -11,7 +11,6 @@ namespace Yunshop\TeamDividend\services;
|
|||
use app\common\models\MemberShopInfo;
|
||||
use app\common\services\finance\PointService;
|
||||
use Carbon\Carbon;
|
||||
use Yunshop\CulturalSpace\models\GoodsCulturalSpace;
|
||||
use Yunshop\SpecialSettlement\common\Recalculate;
|
||||
use Yunshop\TeamDividend\models\GoodsTeamDividend;
|
||||
use Yunshop\TeamDividend\models\MemberChild;
|
||||
|
|
@ -34,8 +33,6 @@ class TeamReturnService
|
|||
private $lower_ratio = 0;
|
||||
// 已获得奖励的比例
|
||||
private $finish_ratio = 0;
|
||||
// 已获得服务奖励的比例
|
||||
private $finish_ratio_service = 0;
|
||||
// 已完成的经销商奖励 用于感恩奖
|
||||
private $finish_team_award_amount = 0;
|
||||
// 已奖励金额 用于计算极差
|
||||
|
|
@ -62,11 +59,20 @@ class TeamReturnService
|
|||
|
||||
protected $flat_prize_limit;
|
||||
|
||||
private $dividendType = 0;// 分红类型:0=普通经销商提成,1=文创经销商生态建设
|
||||
// public function __construct($order, $set, $buyMember, $order_goods, $agents)
|
||||
// {
|
||||
// $this->order = $order;
|
||||
// $this->set = $set;
|
||||
// $this->buyMember = $buyMember;
|
||||
// $this->order_goods = $order_goods;
|
||||
// $this->agents = $agents;
|
||||
// $this->team_goods = GoodsTeamDividend::getGoodsByGoodsId($this->order_goods->goods_id)->first();
|
||||
// $this->levels = TeamDividendLevelModel::uniacid()->orderBy('level_weight','asc')->get()->toArray();
|
||||
//
|
||||
// }
|
||||
|
||||
private $upUserDividendAmount = 0;// 上一位用户的经销商佣金提成金额 只有存在佣金时才会刷新该数据,如果用户为领取佣金则该金额保留 直到某位用户获取佣金为止
|
||||
|
||||
public function setData($order, $set, $buyMember, $order_goods, $agents){
|
||||
public function setData($order, $set, $buyMember, $order_goods, $agents)
|
||||
{
|
||||
$this->order = $order;
|
||||
$this->set = $set;
|
||||
$this->buyMember = $buyMember;
|
||||
|
|
@ -75,34 +81,24 @@ class TeamReturnService
|
|||
$this->team_goods = GoodsTeamDividend::getGoodsByGoodsId($this->order_goods->goods_id)->first();
|
||||
$this->levels = TeamDividendLevelModel::uniacid()->orderBy('level_weight','asc')->get()->toArray();
|
||||
$this->flat_prize_limit = 0;
|
||||
// \Log::debug('经销商创建-team_goods:' . $this->order_goods->goods_id, $this->team_goods ? $this->team_goods->toArray() : []);
|
||||
\Log::debug('经销商创建-team_goods:' . $this->order_goods->goods_id, $this->team_goods ? $this->team_goods->toArray() : []);
|
||||
$this->init();
|
||||
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->team_goods) return;
|
||||
// 判断:文创空间商品 不参与普通分红;非文创空间商品不参与文创空间相关分红
|
||||
$isOpenCultural = (int)GoodsCulturalSpace::uniacid()->where('goods_id',$this->order_goods->goods_id)->value('is_open');
|
||||
if($isOpenCultural){
|
||||
// 开启文创空间
|
||||
// 文创处理
|
||||
$this->flat_prize_limit = 0;
|
||||
$this->dividendType = 1;
|
||||
$this->init();
|
||||
$this->totalDividend();
|
||||
$this->running();
|
||||
}else{
|
||||
// 未开启文创空间
|
||||
// 普通处理
|
||||
$this->init();
|
||||
$this->totalDividend();
|
||||
$this->running();
|
||||
}
|
||||
$this->totalDividend();
|
||||
$this->running();
|
||||
}
|
||||
|
||||
private function running(){
|
||||
private function running()
|
||||
{
|
||||
foreach ($this->agents as $agent) {
|
||||
$this->amount_service = new GetAmountService($agent, $this->order, $this->order_goods, $this->set, $this->team_goods, $this->finish_ratio, $this->finish_price, $this->dividendType, $this->finish_ratio_service);
|
||||
|
||||
$this->amount_service = new GetAmountService($agent, $this->order, $this->order_goods, $this->set, $this->team_goods, $this->finish_ratio, $this->finish_price);
|
||||
|
||||
//商品分红限制 不计入平级奖层级 不算感恩奖
|
||||
if ($agent['is_black'] || $this->getIsRestrict($agent)) {
|
||||
continue;
|
||||
|
|
@ -113,24 +109,25 @@ class TeamReturnService
|
|||
$this->order_goods->payment_amount = $this->order_goods->goods_price;
|
||||
}
|
||||
}
|
||||
|
||||
// 感恩奖
|
||||
$this->gratitudeAward($agent);
|
||||
|
||||
// 经销商奖励
|
||||
$this->dividendAward($agent);
|
||||
// 生态服务
|
||||
if($this->dividendType == 1) $this->dividendAwardService($agent);
|
||||
// 平级奖
|
||||
$this->hierarchyAward($agent);
|
||||
// 额外分红
|
||||
$this->extraDividend($agent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function totalDividend()
|
||||
{
|
||||
$amount_service = new GetAmountService('', $this->order, $this->order_goods, $this->set, $this->team_goods, $this->finish_ratio, $this->finish_price,$this->dividendType,$this->finish_ratio_service);
|
||||
$amount_service = new GetAmountService('', $this->order, $this->order_goods, $this->set, $this->team_goods, $this->finish_ratio, $this->finish_price);
|
||||
// 经销商奖励总金额 不包括感恩奖和平级奖
|
||||
$this->totalDividend += $amount_service->getTotalDividend();
|
||||
$this->totalDividend = $amount_service->getTotalDividend();
|
||||
}
|
||||
|
||||
// 感恩奖
|
||||
|
|
@ -149,18 +146,17 @@ class TeamReturnService
|
|||
return;
|
||||
}
|
||||
// 如果 已完成经销商奖励金额 * 经销商等级设置的感恩奖比例 <= 0
|
||||
if($this->dividendType == 1) $amount = proportionMath($this->finish_team_award_amount,$agent['cultural_level']['award_gratitude']);
|
||||
else $amount = proportionMath($this->finish_team_award_amount,$agent['has_one_level']['award_gratitude']);
|
||||
$amount = proportionMath($this->finish_team_award_amount,$agent['has_one_level']['award_gratitude']);
|
||||
if ($amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dividendData = [
|
||||
'amount' => $this->finish_team_award_amount,
|
||||
'dividend_rate' => $this->dividendType == 1 ? $agent['cultural_level']['award_gratitude'] : $agent['has_one_level']['award_gratitude'],
|
||||
'amount' => $this->finish_team_award_amount,
|
||||
'dividend_rate' => $agent['has_one_level']['award_gratitude'],
|
||||
'lower_level_rate' => 0,
|
||||
'dividend_amount' => $amount,
|
||||
'type' => 2
|
||||
'dividend_amount' => $amount,
|
||||
'type' => 2
|
||||
];
|
||||
//添加到明细
|
||||
$dividend_model = $this->addDividend($agent, $dividendData);
|
||||
|
|
@ -169,12 +165,12 @@ class TeamReturnService
|
|||
$member = Member::getMemberByUid($agent['uid'])->with('hasOneFans')->first();
|
||||
$notice = [
|
||||
'lower_level_name' => $this->buyMember->nickname,
|
||||
'order_amount' => $this->order->price,
|
||||
'amount' => $this->finish_team_award_amount,
|
||||
'dividendRate' => $this->dividendType == 1 ? $agent['cultural_level']['award_gratitude'] : $agent['has_one_level']['award_gratitude'],
|
||||
'rate' => $this->lower_ratio,
|
||||
'dividend_amount' => $amount,
|
||||
'dividend_id' => $dividend_model ? $dividend_model->id : 0,
|
||||
'order_amount' => $this->order->price,
|
||||
'amount' => $this->finish_team_award_amount,
|
||||
'dividendRate' => $agent['has_one_level']['award_gratitude'],
|
||||
'rate' => $this->lower_ratio,
|
||||
'dividend_amount' => $amount,
|
||||
'dividend_id' => $dividend_model ? $dividend_model->id : 0,
|
||||
];
|
||||
if ($this->set['notice_event'] == 1) {
|
||||
NoticeLog::create([
|
||||
|
|
@ -195,12 +191,13 @@ class TeamReturnService
|
|||
// 经销商奖励
|
||||
private function dividendAward($agent)
|
||||
{
|
||||
|
||||
//平级跳出
|
||||
if ($this->dividend_level_ids[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']]) {
|
||||
if ($this->dividend_level_ids[$agent['level']]) {
|
||||
return;
|
||||
}
|
||||
// 平级奖处理初始化
|
||||
$this->dividend_level_ids[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']]['hierarchy'] = 0;
|
||||
$this->dividend_level_ids[$agent['level']]['hierarchy'] = 0;
|
||||
$this->hierarchy_uid = $agent['uid'];
|
||||
|
||||
// 分红比例
|
||||
|
|
@ -216,7 +213,7 @@ class TeamReturnService
|
|||
return;
|
||||
}
|
||||
|
||||
$this->upUserDividendAmount = $dividend_amount;
|
||||
|
||||
// 计算基数
|
||||
$amount = $this->amount_service->amount;
|
||||
|
||||
|
|
@ -229,6 +226,7 @@ class TeamReturnService
|
|||
];
|
||||
// 分红
|
||||
$dividend_model = $this->addDividend($agent, $dividendData);
|
||||
|
||||
$member = Member::getMemberByUid($agent['uid'])->with('hasOneFans')->first();
|
||||
$notice = [
|
||||
'lower_level_name' => $this->buyMember->nickname,
|
||||
|
|
@ -255,69 +253,25 @@ class TeamReturnService
|
|||
$this->setAttributeTheValue($dividendData['dividend_amount'], $agent);
|
||||
}
|
||||
|
||||
// 生态服务
|
||||
private function dividendAwardService($agent){
|
||||
// 生态服务比例
|
||||
$ratio = $this->amount_service->getServiceRatio();
|
||||
// 生态服务金额
|
||||
$dividend_amount = $this->amount_service->getDividendAmount($ratio);
|
||||
if($dividend_amount <= 0) return;
|
||||
// 计算基数
|
||||
$amount = $this->amount_service->amount;
|
||||
$dividendData = [
|
||||
'dividend_amount' => $dividend_amount,
|
||||
'type' => 6,
|
||||
'amount' => $amount,
|
||||
'dividend_rate' => $ratio,
|
||||
'lower_level_rate' => $this->finish_ratio_service ?: 0
|
||||
];
|
||||
// 生态服务受益
|
||||
$dividend_model = $this->addDividend($agent,$dividendData);
|
||||
$member = Member::getMemberByUid($agent['uid'])->with('hasOneFans')->first();
|
||||
$notice = [
|
||||
'lower_level_name' => $this->buyMember->nickname,
|
||||
'order_amount' => $this->order->price,
|
||||
'amount' => $dividendData['amount'],
|
||||
'dividendRate' => $ratio,
|
||||
'rate' => $this->finish_ratio_service,
|
||||
'dividend_amount' => $dividendData['dividend_amount'],
|
||||
'order_sn' => $this->order->order_sn,
|
||||
'dividend_id' => $dividend_model ? $dividend_model->id : 0,
|
||||
];
|
||||
if($this->set['notice_event'] == 1){
|
||||
NoticeLog::create([
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $agent['uid'],
|
||||
'order_id' => $this->order->id,
|
||||
'type' => $dividendData['type'],
|
||||
'notice_data' => json_encode($notice),
|
||||
]);
|
||||
}
|
||||
else{
|
||||
MessageService::dividendOrder($notice,$member->hasOneFans);
|
||||
}
|
||||
// 属性赋值
|
||||
$this->finish_ratio_service = $this->amount_service->finish_ratio_service;
|
||||
//保存已获得分红的分红金额 感恩奖触发就清0
|
||||
$this->finish_team_award_amount = $dividend_amount;
|
||||
//保存已获得分红的分红金额 (ps:上级是固定金额 减去 该金额)
|
||||
$this->finish_price = $this->amount_service->amount;
|
||||
// 获得奖励的UID
|
||||
$this->award_uid = $agent['uid'];
|
||||
$this->obtainInfos[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']] = $dividend_amount;
|
||||
}
|
||||
|
||||
// 平级奖
|
||||
private function hierarchyAward($agent)
|
||||
{
|
||||
// 是否开启平级奖
|
||||
if (!$this->set['is_flat_prize']) return;
|
||||
if (!$this->set['is_flat_prize']) {
|
||||
return;
|
||||
}
|
||||
// 商品是否开启平级奖
|
||||
if (!$this->amount_service->isHierarchy()) return;
|
||||
if ($this->flat_prize_limit) return;
|
||||
if (!$this->amount_service->isHierarchy()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->flat_prize_limit) {
|
||||
\Log::debug('经销商平级奖限制,取消平级奖', $this->order->id.'_'.$this->order_goods->id.'_'.$agent['uid']);
|
||||
return;
|
||||
}
|
||||
|
||||
// 经销商奖励层级 经销商等级奖励层级 >= 当前奖励层级
|
||||
$dividend_level = $this->dividend_level_ids[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']];
|
||||
$dividend_level = $this->dividend_level_ids[$agent['level']];
|
||||
if ($dividend_level == null) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -326,20 +280,17 @@ class TeamReturnService
|
|||
if ($dividend_level && ($award_hierarchy <= $dividend_level['hierarchy'] || $this->hierarchy_uid == $agent['uid'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 平级奖奖励比例
|
||||
$award_ratio = $this->amount_service->getAwardHierarchyRatio();
|
||||
if (!isset($award_ratio) || $award_ratio <= 0) return;
|
||||
// 计算结算金额 普通经销商为订单金额,文创经销商为上一位的分红佣金
|
||||
if($this->dividendType == 1){
|
||||
// 文创等级 使用上一位的分红佣金
|
||||
$amount = $this->upUserDividendAmount;
|
||||
}else{
|
||||
// 普通等级 使用订单金额
|
||||
$amount = $this->amount_service->getAwardHierarchyAmount();
|
||||
if (!isset($award_ratio) || $award_ratio <= 0) {
|
||||
return;
|
||||
}
|
||||
$amount = $this->amount_service->getAwardHierarchyAmount();
|
||||
if ($amount <= 0) {
|
||||
return;
|
||||
}
|
||||
if ($amount <= 0) return;
|
||||
$dividend_amount = proportionMath($amount, $award_ratio);
|
||||
|
||||
$dividendData = [
|
||||
'amount' => $amount,
|
||||
'dividend_rate' => $award_ratio,
|
||||
|
|
@ -348,9 +299,10 @@ class TeamReturnService
|
|||
'hierarchy' => $dividend_level['hierarchy'] + 1,
|
||||
'dividend_amount' => $dividend_amount
|
||||
];
|
||||
|
||||
// 是否开启平级奖下级获得经销商奖励计算方式
|
||||
if ($this->set['calculate_formula'] == 1) {
|
||||
$finishPrice = $this->obtainInfos[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']];
|
||||
$finishPrice = $this->obtainInfos[$agent['level']];
|
||||
if (!$finishPrice) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -380,21 +332,11 @@ class TeamReturnService
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if($this->dividendType == 1){
|
||||
if ($last_agent['cultural_level']['id'] != $agent['cultural_level']['id']){
|
||||
\Log::debug('经销商平级奖限制,下级经销商等级与当前会员不相等',$this->order->id.'_'.$this->order_goods->id.'_'.$agent['uid']);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
if ($last_agent['has_one_level']['id'] != $agent['has_one_level']['id']){
|
||||
\Log::debug('经销商平级奖限制,下级经销商等级与当前会员不相等',$this->order->id.'_'.$this->order_goods->id.'_'.$agent['uid']);
|
||||
return;
|
||||
}
|
||||
if ($last_agent['has_one_level']['id'] != $agent['has_one_level']['id']){
|
||||
\Log::debug('经销商平级奖限制,下级经销商等级与当前会员不相等',$this->order->id.'_'.$this->order_goods->id.'_'.$agent['uid']);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$yz_member = MemberShopInfo::where('member_id',$last_agent['uid'])->first();
|
||||
if (!$yz_member || $yz_member->parent_id != $agent['uid']){
|
||||
\Log::debug('经销商平级奖限制,下级经销商非当前会员直属下级',$this->order->id.'_'.$this->order_goods->id.'_'.$agent['uid']);
|
||||
|
|
@ -408,11 +350,11 @@ class TeamReturnService
|
|||
$member = Member::getMemberByUid($agent['uid'])->with('hasOneFans')->first();
|
||||
$notice = [
|
||||
'lower_level_name' => $this->buyMember->nickname,
|
||||
'order_amount' => $this->order->price,
|
||||
'amount' => $dividendData['amount'],
|
||||
'dividendRate' => $this->dividendType == 1 ? $agent['cultural_level']['award_ratio'] : $agent['has_one_level']['award_ratio'],
|
||||
'dividend_amount' => $dividendData['dividend_amount'],
|
||||
'dividend_id' => $dividend_model ? $dividend_model->id : 0,
|
||||
'order_amount' => $this->order->price,
|
||||
'amount' => $dividendData['amount'],
|
||||
'dividendRate' => $agent['has_one_level']['award_ratio'],
|
||||
'dividend_amount' => $dividendData['dividend_amount'],
|
||||
'dividend_id' => $dividend_model ? $dividend_model->id : 0,
|
||||
];
|
||||
if ($this->set['notice_event'] == 1) {
|
||||
NoticeLog::create([
|
||||
|
|
@ -427,7 +369,7 @@ class TeamReturnService
|
|||
}
|
||||
|
||||
// 平级奖层数增加
|
||||
$this->dividend_level_ids[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']]['hierarchy'] += 1;
|
||||
$this->dividend_level_ids[$agent['level']]['hierarchy'] += 1;
|
||||
}
|
||||
|
||||
//额外分红
|
||||
|
|
@ -442,44 +384,27 @@ class TeamReturnService
|
|||
return;
|
||||
}
|
||||
|
||||
if (!$dividend_extra['level_' . ($this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level'])]) {
|
||||
if (!$dividend_extra['level_' . $agent['level']]) {
|
||||
return;
|
||||
}
|
||||
|
||||
//计算总获得分红
|
||||
$dividendData['amount'] = $this->order_goods->total * $dividend_extra['level_' . ($this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level'])];
|
||||
$dividendData['amount'] = $this->order_goods->total * $dividend_extra['level_' . $agent['level']];
|
||||
|
||||
if($this->dividendType == 1) {
|
||||
$agent['cultural_level']['dividend_ratio'] = 1;
|
||||
$agent['cultural_level']['dividend_ratio'] = 1;
|
||||
if (!isset($this->extraHierarchy['first_weight'])) {
|
||||
$this->extraHierarchy['first_weight'] = $agent['cultural_level']['level_weight'];
|
||||
}
|
||||
if (!empty($this->extraHierarchy['weight'])) {
|
||||
if ($agent['cultural_level']['level_weight'] <= $this->extraHierarchy['weight']) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->extraHierarchy['weight'] = $agent['cultural_level']['level_weight'];
|
||||
//查看等级是否小于或等于第一级
|
||||
$this->extraHierarchy['finish_weight'] = $agent['cultural_level']['level_weight'] - $this->extraHierarchy['first_weight'];
|
||||
$agent['has_one_level']['dividend_ratio'] = 1;
|
||||
|
||||
if (!isset($this->extraHierarchy['first_weight'])) {
|
||||
$this->extraHierarchy['first_weight'] = $agent['has_one_level']['level_weight'];
|
||||
}
|
||||
else {
|
||||
$agent['has_one_level']['dividend_ratio'] = 1;
|
||||
if (!isset($this->extraHierarchy['first_weight'])) {
|
||||
$this->extraHierarchy['first_weight'] = $agent['has_one_level']['level_weight'];
|
||||
if (!empty($this->extraHierarchy['weight'])) {
|
||||
if ($agent['has_one_level']['level_weight'] <= $this->extraHierarchy['weight']) {
|
||||
return;
|
||||
}
|
||||
if (!empty($this->extraHierarchy['weight'])) {
|
||||
if ($agent['has_one_level']['level_weight'] <= $this->extraHierarchy['weight']) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->extraHierarchy['weight'] = $agent['has_one_level']['level_weight'];
|
||||
//查看等级是否小于或等于第一级
|
||||
$this->extraHierarchy['finish_weight'] = $agent['has_one_level']['level_weight'] - $this->extraHierarchy['first_weight'];
|
||||
}
|
||||
$this->extraHierarchy['weight'] = $agent['has_one_level']['level_weight'];
|
||||
|
||||
|
||||
//查看等级是否小于或等于第一级
|
||||
$this->extraHierarchy['finish_weight'] = $agent['has_one_level']['level_weight'] - $this->extraHierarchy['first_weight'];
|
||||
if ($this->extraHierarchy['finish_weight'] < 0) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -490,7 +415,7 @@ class TeamReturnService
|
|||
}
|
||||
|
||||
$dividendData['member_id'] = $agent['uid'];
|
||||
$dividendData['agent_level'] = $this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level'];
|
||||
$dividendData['agent_level'] = $agent['level'];
|
||||
$dividendData['dividend_rate'] = 0;
|
||||
$dividendData['type'] = 3;
|
||||
$dividendData['lower_level_rate'] = $this->finish_ratio;
|
||||
|
|
@ -526,27 +451,41 @@ class TeamReturnService
|
|||
$this->extraCount++;
|
||||
}
|
||||
|
||||
private function addDividend($agent, $dividendData){
|
||||
private function addDividend($agent, $dividendData)
|
||||
{
|
||||
$dividendData += [
|
||||
'uniacid' => $this->order->uniacid,
|
||||
'member_id' => $agent['uid'],
|
||||
'order_sn' => $this->order->order_sn,
|
||||
'order_amount' => $this->order->price,
|
||||
'agent_level' => $this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level'],
|
||||
'status' => 0,
|
||||
'create_month' => date('Y-m'),
|
||||
'settle_days' => $this->set['settle_days'] ?: 0,
|
||||
'culate_method' => intval($this->set['culate_method']) ?: 0,
|
||||
'created_at' => time(),
|
||||
'uniacid' => $this->order->uniacid,
|
||||
'member_id' => $agent['uid'],
|
||||
'order_sn' => $this->order->order_sn,
|
||||
'order_amount' => $this->order->price,
|
||||
'agent_level' => $agent['level'],
|
||||
'status' => 0,
|
||||
'create_month' => date('Y-m'),
|
||||
'settle_days' => $this->set['settle_days'] ?: 0,
|
||||
'culate_method'=>intval($this->set['culate_method']) ? : 0,
|
||||
'created_at' => time()
|
||||
];
|
||||
// 判断:如果当前是 文创生态建设 修改对应的类型值
|
||||
if($this->dividendType == 1 && $dividendData['type'] < 6) {
|
||||
if($dividendData['type'] == 1) $dividendData['type'] = 5;
|
||||
else if($dividendData['type'] == 0) $dividendData['type'] = 4;
|
||||
}
|
||||
|
||||
//如果存在对应记录 todo 由于商品不同规格的数据相同会重复
|
||||
// $exist = TeamDividendModel::where([
|
||||
// 'member_id' => $agent['uid'],
|
||||
// 'agent_level' => $agent['level'],
|
||||
// 'order_sn' => $dividendData['order_sn'],
|
||||
// 'type' => $dividendData['type'],
|
||||
// ])->count();
|
||||
// if ($exist) {
|
||||
// \Log::info("订单{$dividendData['order_sn']}:", "经销商{$agent['uid']}的{$dividendData['type']}分红记录已存在");
|
||||
// return;
|
||||
// }
|
||||
|
||||
//取小数点后两位数四舍五入 例如设置独立金额0.003元
|
||||
if (round($dividendData['dividend_amount'], 2) <= 0) return;
|
||||
if (empty($dividendData['lower_level_rate'])) $dividendData['lower_level_rate'] = 0;
|
||||
if (round($dividendData['dividend_amount'], 2) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($dividendData['lower_level_rate'])){
|
||||
$dividendData['lower_level_rate'] = 0;
|
||||
}
|
||||
|
||||
//todo 防止多队列支付先走
|
||||
$order = \app\common\models\Order::find($this->order->id);
|
||||
|
|
@ -578,7 +517,7 @@ class TeamReturnService
|
|||
// $this->dividend_level_ids[$agent['level']]['hierarchy'] = 0;
|
||||
// 获得奖励的UID
|
||||
$this->award_uid = $agent['uid'];
|
||||
$this->obtainInfos[$this->dividendType == 1 ? $agent['cultural_level_id'] : $agent['level']] = $dividend_amount;
|
||||
$this->obtainInfos[$agent['level']] = $dividend_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -630,9 +569,5 @@ class TeamReturnService
|
|||
$this->extraCount = 0;
|
||||
// 获得经销商奖励的等级id与金额
|
||||
$this->obtainInfos = [];
|
||||
// 上一位获取的佣金 只有存在新佣金时才会刷新,否则不刷新
|
||||
$this->upUserDividendAmount = 0;
|
||||
// 已获得生态服务奖励的比例
|
||||
$this->finish_ratio_service = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/5
|
||||
* Time: 9:08 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/11/6
|
||||
* Time: 1:47 PM
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class TimedTaskService
|
|||
'lower_level_name' => $name->nickname,
|
||||
'dividend_id' => $item['id'],
|
||||
];
|
||||
// \Log::debug('===================hahaha==========',$notice);
|
||||
\Log::debug('===================hahaha==========',$notice);
|
||||
MessageService::dividend($notice, $member->hasOneFans);
|
||||
}
|
||||
DB::commit();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Author:
|
||||
* Author: 芸众商城 www.yunzshop.com
|
||||
* Date: 2018/12/26
|
||||
* Time: 4:25 PM
|
||||
*/
|
||||
|
|
@ -28,31 +28,29 @@ class AgentsService
|
|||
{
|
||||
return $this->agents;
|
||||
}
|
||||
private function _init(){
|
||||
|
||||
private function _init()
|
||||
{
|
||||
// 开启内购
|
||||
//if ($this->setting['buy_self'] == 1) {
|
||||
$teamDividend = TeamDividendAgencyModel::select(['uid','level','cultural_level_id'])
|
||||
->where('uid',$this->uid)
|
||||
->first();
|
||||
$this->agents[] = [
|
||||
'uid' => $this->uid,
|
||||
'teamDividend' => $teamDividend
|
||||
];
|
||||
$teamDividend = TeamDividendAgencyModel::select(['uid', 'level'])
|
||||
->where('uid', $this->uid)
|
||||
->first();
|
||||
$this->agents[] = [
|
||||
'uid' => $this->uid,
|
||||
'teamDividend' => $teamDividend
|
||||
];
|
||||
//}
|
||||
// 上级
|
||||
$agents = MemberParent::with([
|
||||
'hasOneTeamDividendAgency' => function($query){
|
||||
$query->select(['uid','level','cultural_level_id']);
|
||||
}
|
||||
])
|
||||
->where('member_id',$this->uid)
|
||||
->orderBy('level','asc')
|
||||
$agents = MemberParent::with(['hasOneTeamDividendAgency'])
|
||||
->where('member_id', $this->uid)
|
||||
->orderBy('level', 'asc')
|
||||
->get();
|
||||
if(!$agents->isEmpty()){
|
||||
foreach($agents as $agent){
|
||||
if (!$agents->isEmpty()) {
|
||||
foreach ($agents as $agent) {
|
||||
$this->agents[] = [
|
||||
'uid' => $agent->parent_id,
|
||||
'teamDividend' => $agent->hasOneTeamDividendAgency
|
||||
'uid' => $agent->parent_id,
|
||||
'teamDividend' => $agent->hasOneTeamDividendAgency
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,6 @@
|
|||
namespace Yunshop\TeamDividend\services\upgrate;
|
||||
|
||||
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
use Yunshop\TeamDividend\models\Uplog;
|
||||
|
||||
class UplogService
|
||||
|
|
@ -53,13 +52,6 @@ class UplogService
|
|||
|
||||
public function store()
|
||||
{
|
||||
|
||||
if($this->uplogModel->after_level_id > 0){
|
||||
$lvInfo = TeamDividendLevelModel::find($this->uplogModel->after_level_id);
|
||||
$this->uplogModel->give_limit = (int)$lvInfo->give_limit;
|
||||
$this->uplogModel->give_limit_level_id = (int)$lvInfo->give_limit_level_id;
|
||||
}
|
||||
|
||||
$this->uplogModel->conditions = $this->conditions;
|
||||
$this->uplogModel->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Email: livsyitian@163.com
|
||||
* QQ: 995265288
|
||||
* IDE: PhpStorm
|
||||
* User:
|
||||
* User: 芸众商城 www.yunzshop.com
|
||||
****************************************************************/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,16 @@ class DividendVueWidget extends BaseGoodsWidget
|
|||
$item['has_dividend_rates'] = unserialize($item['has_dividend_rates']);
|
||||
$item['has_hierarchys'] = unserialize($item['has_hierarchys']);
|
||||
$item['has_dividend_extra'] = unserialize($item['has_dividend_extra']);
|
||||
$item['commission_rates'] = unserialize($item['commission_rates']);
|
||||
$dividendLevel = TeamDividendLevelModel::getList()->get()->toArray();
|
||||
|
||||
foreach ($dividendLevel as $key=>$value) {
|
||||
$dividendLevel[$key]['has_dividend_rates'] = isset($item['has_dividend_rates']['level_'.$value['id']])?$item['has_dividend_rates']['level_'.$value['id']]:''; //提成比例百分比
|
||||
$dividendLevel[$key]['has_dividend_prices'] = isset($item['has_dividend_prices']['level_'.$value['id']])?$item['has_dividend_prices']['level_'.$value['id']]:''; //提成比例固定
|
||||
$dividendLevel[$key]['has_dividend_extra'] = isset($item['has_dividend_extra']['level_'.$value['id']])?$item['has_dividend_extra']['level_'.$value['id']]:''; //提成比例-额外奖励
|
||||
$dividendLevel[$key]['commission_rates'] = isset($item['commission_rates']['level_'.$value['id']])?$item['commission_rates']['level_'.$value['id']]:''; //
|
||||
|
||||
$dividendLevel[$key]['hierarchy'] = isset($item['has_hierarchys'][$value['id']]['hierarchy'])?$item['has_hierarchys'][$value['id']]['hierarchy']:''; //提成比例-额外奖励
|
||||
$dividendLevel[$key]['ratio'] = isset($item['has_hierarchys'][$value['id']]['ratio'])?$item['has_hierarchys'][$value['id']]['ratio']:''; //提成比例-额外奖励
|
||||
|
||||
}
|
||||
|
||||
$data['teamSet'] = $set;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class DividendWidget extends Widget
|
|||
$item['has_dividend_rates'] = unserialize($item['has_dividend_rates']);
|
||||
$item['has_hierarchys'] = unserialize($item['has_hierarchys']);
|
||||
$item['has_dividend_extra'] = unserialize($item['has_dividend_extra']);
|
||||
$item['commission_rates'] = unserialize($item['commission_rates']);
|
||||
$dividendLevel = TeamDividendLevelModel::getList()->get()->toArray();
|
||||
|
||||
return view('Yunshop\TeamDividend::admin.goods', [
|
||||
|
|
|
|||
|
|
@ -10,20 +10,11 @@ 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' => '']);
|
||||
|
||||
|
||||
$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' => '']);
|
||||
|
||||
$shopSet = Setting::get('withdraw.storeManager', ['roll_out_limit' => '', 'poundage_rate' => '']);
|
||||
|
||||
return view('Yunshop\TeamDividend::admin.withdraw-set', [
|
||||
'set' => $set,
|
||||
// 'teamDividendCulturalSet' => $teamDividendCulturalSet,
|
||||
'ecological_services' => $ecological_services,
|
||||
'ecological_construction' => $ecological_construction,
|
||||
'ecological_contribution' => $ecological_contribution,
|
||||
'shop_set' => $shopSet
|
||||
])->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -65,9 +65,6 @@
|
|||
<option value='1' @if($search['type'] == '1') selected @endif>平级奖励</option>
|
||||
<option value='2' @if($search['type'] == '2') selected @endif>感恩奖励</option>
|
||||
<option value='3' @if($search['type'] == '3') selected @endif>额外分红</option>
|
||||
<option value='4' @if($search['type'] == '4') selected @endif>{{--生态建设--}}经销商受益</option>
|
||||
<option value='5' @if($search['type'] == '5') selected @endif>生态贡献</option>
|
||||
<option value='5' @if($search['type'] == '6') selected @endif>生态服务</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
|
@ -131,33 +128,33 @@
|
|||
<table class="table table-hover" style="overflow:visible;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='width:70px;text-align: center;'>ID</th>
|
||||
<th style='width:160px;text-align: center;'>提成时间</th>
|
||||
<th style='width:80px;text-align: center;'>会员ID</th>
|
||||
<th style='width:180px;text-align: center;'>订单号</th>
|
||||
<th style='width:120px;text-align: center;'>经销商</th>
|
||||
<th style='width:230px;text-align: center;'>经销商等级 <br> 分红类型 / 分红比例</th>
|
||||
<th style='width:8%;text-align: center;'>订单金额</th>
|
||||
<th style='width:10%;text-align: center;'>提成结算金额</th>
|
||||
<th style='width:10%;text-align: center;'>下级经销商提成</th>
|
||||
<th style='width:8%;text-align: center;'>提成金额</th>
|
||||
<th style='width:8%;text-align: center;'>提成状态</th>
|
||||
<th style='width:8%;text-align: center;'>操作</th>
|
||||
<th style='width:6%;'>ID</th>
|
||||
<th style='width:15%;'>提成时间</th>
|
||||
<th style='width:6%;'>会员ID</th>
|
||||
<th style='width:20%;'>订单号</th>
|
||||
<th style='width:8%;'>经销商</th>
|
||||
<th style='width:15%;'>经销商等级 <br> 分红类型 / 分红比例</th>
|
||||
<th style='width:8%;'>订单金额</th>
|
||||
<th style='width:10%;'>提成结算金额</th>
|
||||
<th style='width:10%;'>下级经销商提成</th>
|
||||
<th style='width:8%;'>提成金额</th>
|
||||
<th style='width:8%;'>提成状态</th>
|
||||
<th style='width:8%;'>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list['data'] as $row)
|
||||
<tr>
|
||||
<td style='text-align: center;'>{{$row['id']}}</td>
|
||||
<td style='text-align: center;'>{{$row['created_at']}}</td>
|
||||
<td style='text-align: center;'>{{$row['member_id']}}</td>
|
||||
<td style='text-align: center;'>
|
||||
<td>{{$row['id']}}</td>
|
||||
<td>{{$row['created_at']}}</td>
|
||||
<td>{{$row['member_id']}}</td>
|
||||
<td>
|
||||
<a target="_blank"
|
||||
href="{{yzWebUrl('order.detail.vue-index',['id' => $row['has_one_order']['id']])}}">
|
||||
{{$row['order_sn']}}
|
||||
</a>
|
||||
</td>
|
||||
<td style='text-align: center;'>
|
||||
<td>
|
||||
<a target="_blank"
|
||||
href="{{yzWebUrl('member.member.detail',['id'=>$row['has_one_member']['uid']])}}">
|
||||
<img src="{{tomedia($row['has_one_member']['avatar'])}}"
|
||||
|
|
@ -166,16 +163,18 @@
|
|||
{{$row['has_one_member']['nickname']}}
|
||||
</a>
|
||||
</td>
|
||||
<td style='text-align: center;'>
|
||||
<td>
|
||||
{{$row['level_name']}}
|
||||
<br>
|
||||
{{ $row['type_name'] }} - 比例:{{$row['dividend_rate']}}%</td>
|
||||
<td style='text-align: center;'>{{$row['order_amount']}}</td>
|
||||
<td style='text-align: center;'>{{$row['amount']}}</td>
|
||||
<td style='text-align: center;'>{{$row['lower_level_rate']}}%</td>
|
||||
<td style='text-align: center;'>{{$row['dividend_amount']}}</td>
|
||||
<td style='text-align: center;'>{{$row['status_name']}}</td>
|
||||
<td style='text-align: center;'>
|
||||
{{ $row['type_name'] }}
|
||||
-
|
||||
比例:{{$row['dividend_rate']}}%</td>
|
||||
<td>{{$row['order_amount']}}</td>
|
||||
<td>{{$row['amount']}}</td>
|
||||
<td>{{$row['lower_level_rate']}}%</td>
|
||||
<td>{{$row['dividend_amount']}}</td>
|
||||
<td>{{$row['status_name']}}</td>
|
||||
<td>
|
||||
<a class="btn btn-primary" href="{{ yzWebUrl('plugin.team-dividend.admin.team-dividend.details',['id' => $row['id']]) }}">查看详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@
|
|||
<thead >
|
||||
<tr>
|
||||
<th class="col-sm-2 col-xs-2">经销商等级</th>
|
||||
<th class="col-sm-4 col-xs-4">提成比例/{{--生态建设--}}经销商受益比例</th>
|
||||
<th class="col-sm-4 col-xs-4">生态服务比例</th>
|
||||
<th class="col-sm-4 col-xs-4">提成比例</th>
|
||||
@if( $teamSet['is_extra_award'] )
|
||||
<th class="col-sm-4 col-xs-4">额外奖励</th>
|
||||
@endif
|
||||
|
|
@ -82,38 +81,34 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_rates][level_{{$level['id']}}]" class="form-control" value="{{$item['has_dividend_rates']['level_'.$level['id']]}}"/>
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_rates][level_{{$level['id']}}]"
|
||||
class="form-control"
|
||||
value="{{$item['has_dividend_rates']['level_'.$level['id']]}}"/>
|
||||
<div class="input-group-addon">% 固定</div>
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_prices][level_{{$level['id']}}]" class="form-control" value="{{$item['has_dividend_prices']['level_'.$level['id']]}}"/>
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_prices][level_{{$level['id']}}]"
|
||||
class="form-control"
|
||||
value="{{$item['has_dividend_prices']['level_'.$level['id']]}}"/>
|
||||
<div class="input-group-addon">元</div>
|
||||
</div>
|
||||
</td>
|
||||
@if( $teamSet['is_extra_award'] )
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input type="text" name="widgets[team_dividend][commission_rates][level_{{$level['id']}}]" class="form-control" value="{{$item['commission_rates']['level_'.$level['id']]}}"/>
|
||||
<div class="input-group-addon">%</div>
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_extra][level_{{$level['id']}}]"
|
||||
class="form-control"
|
||||
value="{{$item['has_dividend_extra']['level_'.$level['id']]}}"/>
|
||||
<div class="input-group-addon">元</div>
|
||||
</div>
|
||||
</td>
|
||||
@if( $teamSet['is_extra_award'] )
|
||||
<td>
|
||||
<div class="input-group">
|
||||
<input type="text" name="widgets[team_dividend][has_dividend_extra][level_{{$level['id']}}]" class="form-control" value="{{$item['has_dividend_extra']['level_'.$level['id']]}}"/>
|
||||
<div class="input-group-addon">元</div>
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<span class="help-block">
|
||||
如果比例都为空或等于0,则使用固定金额规则,如果比例和金额都为空或等于0则不获得提成<br>
|
||||
(ps:为了确保经销商能获得提成,建议统一设置为比例或者统一设置为固定金额,如果高等级设置比例低等级设置固定金额,有可能会造成部分经销商无提成)
|
||||
</span>
|
||||
<span class="help-block">
|
||||
商品启用经销商独立提成:如果商品经销商独立提成设置的是比例,那么平级奖计算金额则按照商品实际支付金额计算;
|
||||
如果商品经销商独立提成设置的是固定金额,那么平级奖计算金额则按照固定金额计算
|
||||
</span>
|
||||
<span class="help-block">如果比例都为空或等于0,则使用固定金额规则,如果比例和金额都为空或等于0则不获得提成<br>(ps:为了确保经销商能获得提成,建议统一设置为比例或者统一设置为固定金额,如果高等级设置比例低等级设置固定金额,有可能会造成部分经销商无提成)</span>
|
||||
<span class="help-block">商品启用经销商独立提成:如果商品经销商独立提成设置的是比例,那么平级奖计算金额则按照商品实际支付金额计算;
|
||||
如果商品经销商独立提成设置的是固定金额,那么平级奖计算金额则按照固定金额计算</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,62 +5,14 @@
|
|||
.radio-inline + .radio-inline {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.row {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#goodsthumb {
|
||||
margin-left: 20px;
|
||||
}
|
||||
.weight-value-content{}
|
||||
.weight-value-content .title{
|
||||
display: flex;
|
||||
height: 30px;
|
||||
line-height: 32px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
}
|
||||
.weight-value-content .title-left{
|
||||
width: 4px;
|
||||
height: 18px;
|
||||
margin-top: 6px;
|
||||
background: #29ba9c;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.weight-value-content .title-content{
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
}
|
||||
.weight-value-content .weight-value-top-content{
|
||||
height: 34px;
|
||||
display: -webkit-inline-box;
|
||||
}
|
||||
.weight-value-content .weight-value-top-content .weight-value-lable{
|
||||
width: 70px!important;
|
||||
height: 34px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.weight-value-content .weight-value-top-content .weight-value-radio{
|
||||
padding-right: 55px;
|
||||
height: 34px;
|
||||
}
|
||||
.weight-value-content .weight-value-top-content .radio-inline{
|
||||
padding: 0px!important;
|
||||
width: 50%;
|
||||
margin-left: 10px;
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.weight-value-content .weight-value-top-content .radio-inline:nth-child(2){
|
||||
margin-left: 20px!important;
|
||||
}
|
||||
.del-ladder-btn{
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<div class="w1200 ">
|
||||
<div class=" rightlist ">
|
||||
|
|
@ -82,20 +34,7 @@
|
|||
<span class="help-block">等级权重,数字越大级别越高。</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">等级类型</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[level_type]" value="0" @if (empty($dividend->level_type)) checked @endif> 普通等级
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[level_type]" value="1" @if (1 == $dividend->level_type) checked @endif style="margin: 4px 0 0; position:inherit"> 文创等级
|
||||
</label>
|
||||
</div>
|
||||
<span class="help-block">用户升级到普通等级会改变经销商等级不会改变文创等级,升级到文创等级则不会改变经销商等级只会改变文创等级</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
|
||||
style="color:red">*</span> 等级名称</label>
|
||||
|
|
@ -104,68 +43,9 @@
|
|||
value="{{$dividend->level_name}}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">
|
||||
<span style="color:red">*</span> 文创补贴名称
|
||||
</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<input type='text' name='dividend[cultural_level_name]' class="form-control" value="{{$dividend->cultural_level_name}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">身份类型</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[identity_type]" value="0" @if (empty($dividend->identity_type)) checked @endif> 无特殊身份
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[identity_type]" value="1" @if (1 == $dividend->identity_type) checked @endif style="margin: 4px 0 0; position:inherit"> 经纪人
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[identity_type]" value="2" @if (2 == $dividend->identity_type) checked @endif style="margin: 4px 0 0; position:inherit"> 代理商
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[identity_type]" value="3" @if (3 == $dividend->identity_type) checked @endif style="margin: 4px 0 0; position:inherit"> 省公司
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">等级人数限制</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group col-xs-4'>
|
||||
<input type='text' name='dividend[number_limit]' class="form-control discounts_value" value="{{$dividend->number_limit?$dividend->number_limit:0}}"/>
|
||||
<div class='input-group-addon waytxt'>人</div>
|
||||
</div>
|
||||
<span class="help-block">当前等级总人数达到指定数量后,其他人则不能升级到当前等级。为空或者0则不限制人数</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">赠送升级名额</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group col-xs-4'>
|
||||
<input type='text' name='dividend[give_limit]' class="form-control discounts_value" value="{{$dividend->give_limit?:0}}"/>
|
||||
<div class='input-group-addon waytxt'>个</div>
|
||||
</div>
|
||||
<span class="help-block">升级后赠送的名额,该名额可以赠送给其他用户,让其升级到指定等级!</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">名额升级等级</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<select name='dividend[give_limit_level_id]' class='form-control'>
|
||||
@foreach ($level_list as $key => $item)
|
||||
<option value='{{$item['id']}}' @if($dividend->give_limit_level_id == $item['id']) selected @endif>{{$item['level_name']}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">
|
||||
{{--<span id="dividend_ratio_text">{{ $dividend->level_type == 1 ? '生态建设比例' : '提成比例' }}</span>--}}
|
||||
<span id="dividend_ratio_text">{{ $dividend->level_type == 1 ? '经销商受益比例' : '提成比例' }}</span>
|
||||
</label>
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提成比例</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group'>
|
||||
<input type='text' name='dividend[dividend_ratio]'
|
||||
|
|
@ -176,15 +56,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group @if($dividend->level_type != 1) hide @endif " id="commission_ratio_set_content">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">生态服务比例</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group'>
|
||||
<input type='text' name='dividend[commission_ratio]' oninput="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)" class="form-control discounts_value" value="{{$dividend->commission_ratio?$dividend->commission_ratio:0}}"/>
|
||||
<div class='input-group-addon waytxt'>%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">经销提成层级限制</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
|
|
@ -197,20 +68,7 @@
|
|||
<span class="help-block">超过层级限制,无法获得经销商提成,感恩奖也随之无法获得</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否参与市场津贴</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[is_join_bonus]" value="0" @if (empty($dividend->is_join_bonus)) checked @endif> 不参与
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="dividend[is_join_bonus]" value="1" @if (1 == $dividend->is_join_bonus) checked @endif style="margin: 4px 0 0; position:inherit"> 参与
|
||||
</label>
|
||||
</div>
|
||||
<span class="help-block">当前等级的用户是否参与市场津贴</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">升级条件</label>
|
||||
<div class="col-xs-12 col-sm-9 col-md-10">
|
||||
|
|
@ -304,13 +162,16 @@
|
|||
|
||||
<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"
|
||||
|
|
@ -750,57 +611,6 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
{{-- 直推间推 某个等级 满多少人 START --}}
|
||||
<div class="input-group row">
|
||||
<label class="radio-inline col-xs-12 col-sm-12">
|
||||
<div class="col-xs-12 col-sm-6" style="padding-left: 0">
|
||||
<input type="checkbox" name="upgrade_type[one_or_two]" value="1" @if ($upgrade_type['one_or_two']) checked @endif>
|
||||
(编号:<a href='JavaScript:'>1050</a>)
|
||||
<br>
|
||||
<div class='input-group'>
|
||||
<div class='input-group-addon waytxt'>直推间推</div>
|
||||
<select name='upgrade_value[one_or_two][one_or_two_level_id]' class="form-control" style="width: 100px;">
|
||||
@foreach($level_list as $level)
|
||||
<option value='{{$level->id}}' @if($level->id == $upgrade_value['one_or_two']['one_or_two_level_id'])selected @endif >
|
||||
{{$level['level_name']}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class='input-group-addon waytxt'>等级,总人数达到</div>
|
||||
<input type="number" name="upgrade_value[one_or_two][one_or_two_people]" value="{{$upgrade_value['one_or_two']['one_or_two_people']}}" class="form-control">
|
||||
<div class='input-group-addon waytxt'>人(不填或0默认为1人)</div>
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
{{-- 直推间推 某个等级 满多少人 END --}}
|
||||
|
||||
|
||||
{{-- 直推间推 某个等级 满多少人 START --}}
|
||||
<div class="input-group row">
|
||||
<label class="radio-inline col-xs-12 col-sm-12">
|
||||
<div class="col-xs-12 col-sm-6" style="padding-left: 0">
|
||||
<input type="checkbox" name="upgrade_type[team_consumption_people]" value="1" @if ($upgrade_type['team_consumption_people']) checked @endif>
|
||||
(编号:<a href='JavaScript:'>1051</a>)
|
||||
<br>
|
||||
<div class='input-group'>
|
||||
<div class='input-group-addon waytxt'>团队消费人数满</div>
|
||||
<input type="number" name="upgrade_value[team_consumption_people][team_consumption_people_total]" value="{{$upgrade_value['team_consumption_people']['team_consumption_people_total']}}" class="form-control">
|
||||
<div class='input-group-addon waytxt'>人;</div>
|
||||
<div class='input-group-addon waytxt'>
|
||||
<input type="checkbox" name="upgrade_value[team_consumption_people][team_consumption_people_close_max]" value="1" @if ($upgrade_value['team_consumption_people']['team_consumption_people_close_max']) checked @endif>
|
||||
</div>
|
||||
<div class='input-group-addon waytxt'>去除业绩最大的那条线</div>
|
||||
</div>
|
||||
<span class="help-block">根据当前等级类型计算;当前等级类型为文创等级则统计文创商品业绩,为普通商品则统计非文创商品业绩;先计算所有人数(包含未消费),去除人数最多的线再计算消费用户数量</span>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
{{-- 直推间推 某个等级 满多少人 END --}}
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="input-group row">
|
||||
<div class="input-group">
|
||||
<label class="radio-inline">
|
||||
|
|
@ -837,6 +647,7 @@
|
|||
src="@if(isset($upgrade_data->thumb)) {{tomedia($upgrade_data->thumb) }} @endif"/></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-group row">
|
||||
<div class="input-group">
|
||||
<label class="radio-inline" >
|
||||
|
|
@ -887,6 +698,8 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
|
||||
<div class="col-xs-6">
|
||||
|
|
@ -903,12 +716,14 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
|
||||
<div class="col-xs-6">
|
||||
<span class='help-block'><input type="button" value="添加分组[选择升级方式编号,英文逗号分隔]" class="btn btn-success add-upgrade"/></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($settingData['is_activation_code'])
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">激活码发放</label>
|
||||
|
|
@ -965,76 +780,18 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
{{-- 升级奖励 start--}}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">升级奖励</label>
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">升级奖励积分</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group'>
|
||||
<div class='input-group-addon waytxt'>积分</div>
|
||||
<input type='text' name='dividend[upgrade_reward_point]' class="form-control discounts_value" value="{{$dividend->upgrade_reward_point?$dividend->upgrade_reward_point:0}}"/>
|
||||
<input type='text' name='dividend[upgrade_reward_point]'
|
||||
class="form-control discounts_value"
|
||||
value="{{$dividend->upgrade_reward_point?$dividend->upgrade_reward_point:0}}"/>
|
||||
<div class='input-group-addon waytxt'>个</div>
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<div class='input-group-addon waytxt'>数藏画</div>
|
||||
<input type='number' name='dividend[upgrade_reward_draw]' max="99" class="form-control discounts_value" value="{{$dividend->upgrade_reward_draw?$dividend->upgrade_reward_draw:0}}"/>
|
||||
<div class='input-group-addon waytxt'>幅</div>
|
||||
</div>
|
||||
<span class="help-block">数藏画仅第一次升级到当前等级赠送。如果降级后重新升级到当前等级则不会赠送</span>
|
||||
{{-- 权重值 --}}
|
||||
<div class="weight-value-content">
|
||||
<div class="title">
|
||||
<div class="title-left"></div>
|
||||
<div class="title-content">权重值设置</div>
|
||||
</div>
|
||||
<div class="input-group weight-value-top-content">
|
||||
<div class='input-group-addon waytxt weight-value-lable'>赠送方式</div>
|
||||
<div class='input-group-addon waytxt weight-value-radio'>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="wv[gift_type]" value="0" @if ((int)$wv['gift_type'] != 1) checked @endif> 固定值
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="wv[gift_type]" value="1" @if ((int)$wv['gift_type'] == 1) checked @endif> 阶梯赠送
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<span class="help-block">普通赠送-赠送指定的权重值;阶梯赠送-根据用户成为经销商的时间顺序排序,获取对应的权重值;超过最大名次则不赠送权重值</span>
|
||||
{{-- <div class="input-group weight-value-top-content">
|
||||
<div class='input-group-addon waytxt weight-value-lable'>赠送级别</div>
|
||||
<div class='input-group-addon waytxt weight-value-radio'>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="wv[lv_type]" value="0" @if ((int)$wv['lv_type'] != 1) checked @endif> 二级
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="wv[lv_type]" value="0" @if ((int)$wv['lv_type'] != 1) checked @endif> 二级
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="wv[lv_type]" value="1" @if ((int)$wv['lv_type'] == 1) checked @endif> 三级
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<span class="help-block">二级-赠送购买人、购买人上级;三级-赠送购买人、购买人上级、购买人上级的上级</span>--}}
|
||||
{{--赠送固定值--}}
|
||||
<div class='input-group wv-gift-type-num @if ((int)$wv['gift_type'] == 1) hide @endif'>
|
||||
<div class='input-group-addon waytxt'>赠送</div>
|
||||
<input type='number' name='wv[quantity]' class="form-control discounts_value" value="{{$wv['quantity']?:0}}"/>
|
||||
<div class='input-group-addon waytxt'>权重值</div>
|
||||
</div>
|
||||
{{--阶梯赠送 - 根据成为当前等级经销商的等级排名 进行赠送--}}
|
||||
<div class="ladder-content wv-gift-type-num @if ((int)$wv['gift_type'] != 1) hide @endif">
|
||||
<div id="ladder-content-list">
|
||||
{{--阶梯内容渲染--}}
|
||||
</div>
|
||||
<span class="help-block">例如:设置小于等于10赠送100权重值;小于等于32赠送120权重值。则第1~10位经销商赠送100权重值,第11~32位经销商赠送120权重值,第33位及之后所有经销商均不赠送权重值</span>
|
||||
<span class='help-block'>
|
||||
<input type="button" value="添加阶梯" class="btn btn-success add-ladder"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{{-- 权重值 end --}}
|
||||
<span class="help-block">权重值仅第一次升级到当前等级赠送。如果降级后重新升级到当前等级则不会赠送</span>
|
||||
</div>
|
||||
</div>
|
||||
{{-- 升级奖励 end--}}
|
||||
@if($isPluginGold)
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">升级奖励{{$goldTitle}}</label>
|
||||
|
|
@ -1048,6 +805,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">基金奖励</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
|
|
@ -1057,6 +815,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">红包奖励比例</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
|
|
@ -1068,6 +827,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">日期</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
|
|
@ -1083,6 +843,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(is_null($settingData['withdraw_type']) || $settingData['withdraw_type'] == 0)
|
||||
<div class="form-group" id="day" style="display: block">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">自动提现日期</label>
|
||||
|
|
@ -1103,6 +864,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提成类型</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
|
|
@ -1145,6 +907,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-9">
|
||||
<div id="modal-module-menus-goods" class="modal fade" tabindex="-1">
|
||||
|
|
@ -1177,6 +940,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal-goods" class="modal fade" tabindex="-1">
|
||||
<div class="modal-dialog" style='width: 920px;'>
|
||||
<div class="modal-content">
|
||||
|
|
@ -1194,6 +958,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group"></div>
|
||||
<script language='javascript'>
|
||||
function search_goods() {
|
||||
|
|
@ -1210,6 +975,7 @@
|
|||
)
|
||||
;
|
||||
}
|
||||
|
||||
function search_goods_two() {
|
||||
if( $.trim($('#search-kwd-goods-dividend').val())==''){
|
||||
Tip.focus('#search-kwd-goods-dividend','请输入关键词');
|
||||
|
|
@ -1222,6 +988,7 @@
|
|||
$('#module-menus-goods-two').html(dat);
|
||||
});
|
||||
}
|
||||
|
||||
function select_good(o) {
|
||||
$("#goodsid").val(o.id);
|
||||
$("#goodsthumb").show();
|
||||
|
|
@ -1229,6 +996,7 @@
|
|||
$("#goods").val("[" + o.id + "]" + o.title);
|
||||
$("#modal-module-menus-goods .close").click();
|
||||
}
|
||||
|
||||
function select_good_two(o) {
|
||||
var html = '<div class="multi-item" style="height: 220px" openid="' + o.id + '">';
|
||||
html += '<img class="img-responsive img-thumbnail" src="' + o.thumb + '" onerror="this.src=\'{{static_url('resource/images/nopic.jpg')}}\'; this.title=\'图片未找到.\'">';
|
||||
|
|
@ -1250,6 +1018,7 @@
|
|||
});
|
||||
$('#many_good').val(nickname);
|
||||
}
|
||||
|
||||
{{--var i = "{{ $income_count }}";--}}
|
||||
var i = "{{ count($upgrade_type['group']) }}";
|
||||
$('.add-upgrade').click(function () {
|
||||
|
|
@ -1291,88 +1060,5 @@
|
|||
})
|
||||
})
|
||||
|
||||
// 等级类型改变
|
||||
$(document).on('change',"[name='dividend[level_type]']",function(){
|
||||
let val = $(this).val();
|
||||
val = parseInt(val) && !isNaN(parseInt(val)) ? parseInt(val) : parseInt(0);
|
||||
// 0=普通等级 1=文创等级
|
||||
if(val === parseInt(1)){
|
||||
// $("#dividend_ratio_text").html('生态建设比例');
|
||||
$("#dividend_ratio_text").html('经销商受益比例');
|
||||
$("#commission_ratio_set_content").removeClass('hide');
|
||||
}else{
|
||||
$("#dividend_ratio_text").html('提成比例');
|
||||
$("#commission_ratio_set_content").addClass('hide');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
let ladder = JSON.parse(`{!! $wv['ladder'] ?? json_encode([]) !!}`) || {};
|
||||
$(function () {
|
||||
// 权重值 - 赠送方式改变
|
||||
$(document).on('change',"[name='wv[gift_type]']",function(){
|
||||
let val = $(this).val();
|
||||
val = parseInt(val) && !isNaN(parseInt(val)) ? parseInt(val) : parseInt(0);
|
||||
// 控制显示隐藏 固定值|阶梯列表
|
||||
$(".wv-gift-type-num").addClass('hide');
|
||||
if(val === parseInt(0)) $('.wv-gift-type-num:eq(0)').removeClass('hide');
|
||||
else $('.wv-gift-type-num:eq(1)').removeClass('hide');
|
||||
});
|
||||
// 权重值 - 点击添加阶梯
|
||||
$(document).on('click',".add-ladder",function(){
|
||||
ladder = Object.values(ladder).concat({where: '', num: ''});
|
||||
handleLadder();
|
||||
});
|
||||
// 权重值 - 修改条件
|
||||
$(document).on('keyup',".change-ladder-where",function(){
|
||||
let index = $(this).parent(".input-group").attr("index");
|
||||
let val = $(this).val();
|
||||
val = parseInt(val) && !isNaN(parseInt(val)) ? parseInt(val) : parseInt(0);
|
||||
ladder[index]['where'] = val;
|
||||
});
|
||||
// 权重值 - 修改数量
|
||||
$(document).on('change',".change-ladder-num",function(){
|
||||
let index = $(this).parent(".input-group").attr("index");
|
||||
let val = $(this).val();
|
||||
val = parseInt(val) && !isNaN(parseInt(val)) ? parseInt(val) : parseInt(0);
|
||||
ladder[index]['num'] = val;
|
||||
});
|
||||
// 权重值 - 点击删除阶梯
|
||||
$(document).on('click',".del-ladder-btn",function(){
|
||||
let index = $(this).parent(".input-group").attr("index");
|
||||
let newLadder = Object.assign({},ladder);
|
||||
delete newLadder[index];
|
||||
|
||||
ladder = Object.values(newLadder);
|
||||
handleLadder();
|
||||
});
|
||||
// 页面加载完成后执行一次
|
||||
handleLadder();
|
||||
});
|
||||
// 循环渲染阶梯设置
|
||||
function handleLadder(){
|
||||
let html = '';
|
||||
Object.values(ladder).forEach((item,index)=>{
|
||||
html += `<div class='input-group' index='${index}'>
|
||||
<div class='input-group-addon waytxt'>小于等于</div>
|
||||
<input type='number' name='wv[ladder][${index}][where]' class="form-control change-ladder-where" value="${item['where']}"/>
|
||||
<div class='input-group-addon waytxt'>名,赠送</div>
|
||||
<input type='number' name='wv[ladder][${index}][num]' class="form-control change-ladder-num" value="${item['num']}"/>
|
||||
<div class='input-group-addon waytxt'>权重值</div>
|
||||
<div class='input-group-addon waytxt del-ladder-btn'>
|
||||
<i class="fa fa-trash"></i>
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
$("#ladder-content-list").html(html);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -1,11 +1,6 @@
|
|||
@extends('layouts.base')
|
||||
@section('title', trans('经销商等级'))
|
||||
@section('content')
|
||||
<style>
|
||||
.panel-body .label{
|
||||
font-size: 14px!important;
|
||||
}
|
||||
</style>
|
||||
<div class="w1200 ">
|
||||
<script type="text/javascript" src="./resource/js/lib/jquery-ui-1.10.3.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
|
||||
|
|
@ -24,59 +19,29 @@
|
|||
<table class="table table-hover">
|
||||
<thead class="navbar-inner">
|
||||
<tr>
|
||||
<th style="width: 100px;text-align: center;">ID</th>
|
||||
<th style="width: 100px;text-align: center;">等级权重</th>
|
||||
<th style="text-align: center;">等级名称</th>
|
||||
<th style="text-align: center;">等级类型</th>
|
||||
<th style="width: 150px;text-align: center;">提成比例(%)</th>
|
||||
<th style="width: 150px;text-align: center;">{{--生态建设--}}经销商受益比例(%)</th>
|
||||
<th style="width: 150px;text-align: center;">生态服务比例(%)</th>
|
||||
{{--<th style="width: 245px;text-align: center;">激活码发放</th>--}}
|
||||
<th style="width: 150px;text-align: center;">平级奖励层级</th>
|
||||
<th style="width: 150px;text-align: center;">平级奖励比例</th>
|
||||
<th style="text-align: center;">操作</th>
|
||||
<th width="6%">等级权重</th>
|
||||
<th width="16%">等级名称</th>
|
||||
<th width="16%">提成比例</th>
|
||||
<th width="15%">激活码发放</th>
|
||||
<th width="15%">平级奖励层级</th>
|
||||
<th width="16%">平级奖励比例</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list['data'] as $item)
|
||||
<tr>
|
||||
<td style="text-align: center;">{{$item['id']}}</td>
|
||||
<td style="text-align: center;">
|
||||
<input type="text" class="form-control" name="display_order[{{$item['id']}}]" value="{{$item['level_weight']}}">
|
||||
<td>
|
||||
<input type="text" class="form-control"
|
||||
name="display_order[{{$item['id']}}]"
|
||||
value="{{$item['level_weight']}}">
|
||||
</td>
|
||||
<td style="text-align: center;">{{$item['level_name']}}</td>
|
||||
<td style="text-align: center;">
|
||||
@if($item['level_type'] == 1)
|
||||
<span class="label label-warning">文创等级</span>
|
||||
@else
|
||||
<span class="label label-default">普通等级</span>
|
||||
@endif
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
@if($item['level_type'] == 1)
|
||||
-
|
||||
@else
|
||||
{{$item['dividend_ratio']}}
|
||||
@endif
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
@if($item['level_type'] == 1)
|
||||
{{$item['dividend_ratio']}}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
@if($item['level_type'] == 1)
|
||||
{{$item['commission_ratio']}}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
{{--<td style="text-align: center;">{{array_sum(unserialize($item['code_num']))}}</td>--}}
|
||||
<td style="text-align: center;">{{$item['award_hierarchy']}}</td>
|
||||
<td style="text-align: center;">{{$item['award_ratio']}}</td>
|
||||
<td style="text-align: center;">
|
||||
<td>{{$item['level_name']}}</td>
|
||||
<td>{{$item['dividend_ratio']}}</td>
|
||||
<td>{{array_sum(unserialize($item['code_num']))}}</td>
|
||||
<td>{{$item['award_hierarchy']}}</td>
|
||||
<td>{{$item['award_ratio']}}</td>
|
||||
<td>
|
||||
<a class="btn btn-default" href="{!! yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set.edit', ['id'=>$item['id']]) !!}">编辑</a>
|
||||
<a class="btn btn-default" href="{!! yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set.deleted', ['id'=>$item['id']]) !!}" onclick="return confirm('{{$delete_msg}}');return false;">删除</a>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<li class="active"><a href="#">添加团队代理</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right-addbox"><!-- 此处是右侧内容新包一层div -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
|
@ -38,6 +39,7 @@
|
|||
{{--<input type='text' name='team[realname]' id="realname" class="form-control" value="" readonly/>--}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">联系方式</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
|
|
@ -45,24 +47,14 @@
|
|||
{{--<input type='text' name='team[contact]' id="mobile" class="form-control" value="" readonly/>--}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">代理等级</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<select class="form-control tpl-category-parent" name="team[level]">
|
||||
<option value="0">请选择团队代理等级</option>
|
||||
@foreach ($level as $item)
|
||||
<option value="{{$item->id}}">{{$item->level_name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">文创等级</label>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<select class="form-control tpl-category-parent" name="team[cultural_level_id]">
|
||||
<option value="0">请选择团队代理等级</option>
|
||||
@foreach ($cultural_level as $item)
|
||||
<option value="{{$item->id}}">{{$item->level_name}}</option>
|
||||
<option value="{{$item->id}}">{{$item->level_name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@
|
|||
padding-bottom: 80px;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.panel-body .label{
|
||||
font-size: 13px!important;
|
||||
}
|
||||
</style>
|
||||
<div class="w1200 ">
|
||||
<div class=" rightlist ">
|
||||
|
|
@ -49,7 +46,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-xs-12 col-sm-2">
|
||||
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-2">
|
||||
<select class="form-control tpl-category-parent" id="level" name="level_id">
|
||||
<option value="0">经销商等级</option>
|
||||
@foreach($level as $item)
|
||||
|
|
@ -62,18 +59,10 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-xs-12 col-sm-2">
|
||||
<select class="form-control tpl-category-parent" id="cultural_level" name="cultural_level_id">
|
||||
<option value="0">文创等级</option>
|
||||
@foreach($culturalLevel as $item)
|
||||
<option value="{{$item->id}}" @if($request['cultural_level_id']==$item->id) selected @endif>{{$item->level_name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-xs-12 col-sm-12 col-md-12 col-lg-6">
|
||||
|
||||
|
||||
<div class="form-group col-xs-12 col-sm-4">
|
||||
<div class="time">
|
||||
|
||||
<select name='searchtime' class='form-control'>
|
||||
<option value=''>成为经销商时间</option>
|
||||
<option value='1'
|
||||
|
|
@ -96,7 +85,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-xs-12 col-sm-6">
|
||||
<div class="form-group col-xs-12 col-sm-7 col-lg-4">
|
||||
<!--<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label"></label>-->
|
||||
<div class="">
|
||||
<button type="button" name="export" value="1" id="export" class="btn btn-default excel back ">导出 Excel</button>
|
||||
|
|
@ -118,23 +107,13 @@
|
|||
<table class="table table-hover" >
|
||||
<thead class="navbar-inner">
|
||||
<tr>
|
||||
<th style="width: 80px;text-align: center;">
|
||||
<span class="label label-default">ID</span>
|
||||
<br>
|
||||
<span class="label label-warning">UID</span>
|
||||
</th>
|
||||
<th style="width: 160px;">成为经销商时间<br>普通等级升级时间<br>文创等级升级时间</th>
|
||||
<th style="width: 120px;">经销商</th>
|
||||
<th style="width: 120px;">等级</th>
|
||||
<th style="width: 100px;">排名</th>
|
||||
<th style="width: 150px;">名额(剩余/已使用)</th>
|
||||
<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 width="8.5%">直属总经销商人数</th>
|
||||
<th width="8.5%">
|
||||
提成比例<br>累计提成
|
||||
<hr style="margin: 5px 0!important;"/>
|
||||
{{--生态建设比例<br>累计生态建设--}}
|
||||
经销商受益比例<br />累计经销商受益
|
||||
</th>
|
||||
<th width="8.5%">经销商比例<br>累计提成</th>
|
||||
<th width="8.5%">已结算提成<br>未结算提成</th>
|
||||
<th width="13%">黑名单<br>变动时间</th>
|
||||
<th width="8.5%">团队业绩<br>团队商品销量</th>
|
||||
|
|
@ -144,77 +123,59 @@
|
|||
<tbody>
|
||||
@foreach($list['data'] as $item)
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<span class="label label-default">{{$item['id']}}</span>
|
||||
<br>
|
||||
<span class="label label-warning">{{$item['has_one_member']['uid']}}</span>
|
||||
</td>
|
||||
<td>{{$item['id']}}</td>
|
||||
<td>{{$item['has_one_member']['uid']}}</td>
|
||||
<td>
|
||||
{{$item['created_at']}}
|
||||
<br>
|
||||
{{$item['upgrade_at'] ? date('Y-m-d H:i:s',$item['upgrade_at']) : '/'}}
|
||||
<br>
|
||||
{{$item['cultural_upgrade_at'] ? date('Y-m-d H:i:s',$item['cultural_upgrade_at']) : '/'}}
|
||||
</td>
|
||||
@if ($item['has_one_member'])
|
||||
<td>
|
||||
@if ($item['has_one_member'])
|
||||
<a href="{!! yzWebUrl('member.member.detail', ['id'=>$item['has_one_member']['uid']]) !!}">
|
||||
<img src="{{$item['has_one_member']['avatar']}}" style="width:30px;height:30px;padding:1px;border:1px solid #ccc">
|
||||
<br>
|
||||
{{$item['has_one_member']['nickname']}}
|
||||
</a>
|
||||
@else
|
||||
未更新
|
||||
@endif
|
||||
<a href="{!! yzWebUrl('member.member.detail', ['id'=>$item['has_one_member']['uid']]) !!}"><img src="{{$item['has_one_member']['avatar']}}" style="width:30px;height:30px;padding:1px;border:1px solid #ccc"><BR>{{$item['has_one_member']['nickname']}}</a>
|
||||
</td>
|
||||
<td title="{{$item['has_one_level']['level_name']}}" class='tdedit'>
|
||||
@else
|
||||
<td style="height: 59px">
|
||||
未更新
|
||||
</td>
|
||||
@endif
|
||||
<td title="{{$item['has_one_level']['level_name']}}" class='tdedit' width="26%">
|
||||
<span class=' fa-edit-item' style='cursor:pointer'>
|
||||
<span class="title">{{$item['has_one_level']['level_name'] ?? '/'}}</span>
|
||||
<span class="title">{{$item['has_one_level']['level_name']}}</span>
|
||||
<i class='fa fa-pencil' style="display:none"></i>
|
||||
</span>
|
||||
|
||||
<div class="input-group level" style="display:none">
|
||||
<select class="form-control tpl-agent-level" name="level_id" data-agencyid="{{$item['id']}}">
|
||||
<option>请选择等级</option>
|
||||
@foreach($level as $value)
|
||||
<option value="{{$value->id}}" @if($item['level']==$value->id) selected @endif>{{$value->level_name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<br />
|
||||
<span class=' fa-edit-item' style='cursor:pointer'>
|
||||
<span class="title">{{$item['cultural_level']['level_name'] ?? '/'}}</span>
|
||||
<i class='fa fa-pencil' style="display:none"></i>
|
||||
</span>
|
||||
<div class="input-group level" style="display:none">
|
||||
<select class="form-control tpl-agent-level" name="level_id" data-agencyid="{{$item['id']}}" data-leve_type="cultural">
|
||||
<option>请选择等级</option>
|
||||
@foreach($culturalLevel as $value)
|
||||
<option value="{{$value->id}}" @if($item['cultural_level_id']==$value->id) selected @endif>{{$value->level_name}}</option>
|
||||
<option value="{{$value->id}}"
|
||||
@if($item['level']==$value->id)
|
||||
selected
|
||||
@endif
|
||||
>{{$value->level_name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
@foreach($item['rank_list'] as $rankItem)
|
||||
<p>{{$rankItem['level_name']}}:{{$rankItem['ranking']}}</p>
|
||||
@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']])}}">
|
||||
查看
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
{{$item['has_one_level']['dividend_ratio']}}%
|
||||
<br>
|
||||
{{$item['has_many_team_dividend'][2]['total_amount'] + $item['has_many_team_dividend'][1]['total_amount'] + $item['has_many_team_dividend'][0]['total_amount']}}
|
||||
<hr style="margin: 5px 0!important;"/>
|
||||
{{$item['cultural_level']['dividend_ratio'] ?? 0}}%
|
||||
<br>
|
||||
0
|
||||
</td>
|
||||
{{--<td>{{$item['dividend_final']}}</td>--}}
|
||||
{{--<td>{{$item['dividend_open']}}</td>--}}
|
||||
{{--<td>{{$item['dividend_total']}}</td>--}}
|
||||
<td>
|
||||
@if($item['has_many_team_dividend'][0]['status'] == 1)
|
||||
{{$item['has_many_team_dividend'][0]['total_amount']}}
|
||||
|
|
@ -226,15 +187,15 @@
|
|||
0
|
||||
@endif
|
||||
<br>
|
||||
@if($item['has_many_team_dividend'][0]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][0]['total_amount']}}
|
||||
@elseif($item['has_many_team_dividend'][1]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][1]['total_amount']}}
|
||||
@elseif($item['has_many_team_dividend'][2]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][2]['total_amount']}}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
@if($item['has_many_team_dividend'][0]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][0]['total_amount']}}
|
||||
@elseif($item['has_many_team_dividend'][1]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][1]['total_amount']}}
|
||||
@elseif($item['has_many_team_dividend'][2]['status'] === 0)
|
||||
{{$item['has_many_team_dividend'][2]['total_amount']}}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($item['is_black'])
|
||||
|
|
@ -321,31 +282,18 @@
|
|||
$('.fa-edit-item').click(function () {
|
||||
$(this).closest('span').hide();
|
||||
$(this).next('.level').show();
|
||||
});
|
||||
|
||||
$('.level').mouseover(function () {
|
||||
// console.log('mouseover');
|
||||
}).mouseout(function () {
|
||||
$(this).prev('.fa-edit-item').show();
|
||||
$(this).closest('.level').hide();
|
||||
});
|
||||
|
||||
let is_submit = true;
|
||||
$('.tpl-agent-level').change(function () {
|
||||
var agencyId = $(this).data('agencyid');
|
||||
var leve_type = $(this).data('leve_type');
|
||||
var levelId = $(this).val();
|
||||
|
||||
if(is_submit){
|
||||
is_submit = false;
|
||||
fastChange(agencyId, levelId, leve_type);
|
||||
}
|
||||
fastChange(agencyId, levelId);
|
||||
});
|
||||
function fastChange(id, value, leve_type) {
|
||||
function fastChange(id, value) {
|
||||
$.ajax({
|
||||
url: "{!! yzWebUrl('plugin.team-dividend.admin.team-agency.change') !!}",
|
||||
type: "post",
|
||||
data: {id: id, value: value, leve_type: leve_type},
|
||||
data: {id: id, value: value},
|
||||
cache: false,
|
||||
success: function ($data) {
|
||||
console.log($data);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
|
||||
<div class='panel panel-default'>
|
||||
{{--经销商提成提现设置--}}
|
||||
<div class="vue-main-title">
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">{{ trans('Yunshop\TeamDividend::index.withdraw') }}设置</div>
|
||||
<div class="title" style="border-bottom: 1px solid #CCC;margin-bottom: 30px;">
|
||||
<b>经销商设置</b>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现额度</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="text" name="withdraw[teamDividend][roll_out_limit]" class="form-control"
|
||||
value="{{$set['roll_out_limit']}}"/>
|
||||
<input type="text" name="withdraw[teamDividend][roll_out_limit]" class="form-control" value="{{$set['roll_out_limit']}}"/>
|
||||
<span class="help-block">当前代理的佣金达到此额度时才能提现</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -18,14 +14,10 @@
|
|||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="switch">
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[teamDividend][poundage_type]' value='1'
|
||||
@if($set['poundage_type'] == 1) checked @endif />
|
||||
固定金额
|
||||
<input type='radio' name='withdraw[teamDividend][poundage_type]' value='1' @if($set['poundage_type'] == 1) checked @endif />固定金额
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[teamDividend][poundage_type]' value='0'
|
||||
@if(empty($set['poundage_type'])) checked @endif />
|
||||
手续费比例
|
||||
<input type='radio' name='withdraw[teamDividend][poundage_type]' value='0' @if(empty($set['poundage_type'])) checked @endif />手续费比例
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -36,29 +28,21 @@
|
|||
<div class="cost">
|
||||
<label class='radio-inline'>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon" id="teamDividend_poundage_hint"
|
||||
style="width: 120px;">@if($set['poundage_type'] == 1) 固定金额 @else
|
||||
手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[teamDividend][poundage_rate]"
|
||||
class="form-control" value="{{ $set['poundage_rate'] ?? '' }}"
|
||||
placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="teamDividend_poundage_unit">@if($set['poundage_type'] == 1) 元 @else
|
||||
% @endif</div>
|
||||
<div class="input-group-addon" id="teamDividend_poundage_hint" style="width: 120px;">@if($set['poundage_type'] == 1) 固定金额 @else手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[teamDividend][poundage_rate]" class="form-control" value="{{ $set['poundage_rate'] ?? '' }}" placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="teamDividend_poundage_unit">@if($set['poundage_type'] == 1) 元 @else% @endif</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{--服务津贴提现设置--}}
|
||||
{{-- <div class="vue-main-title">
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">服务津贴提现设置</div>
|
||||
<div class="title" style="border-bottom: 1px solid #CCC;margin-bottom: 30px;">
|
||||
<b>店补设置</b>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现额度</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="text" name="withdraw[teamDividendCultural][roll_out_limit]" class="form-control"
|
||||
value="{{$teamDividendCulturalSet['roll_out_limit']}}"/>
|
||||
<input type="text" name="withdraw[storeManager][roll_out_limit]" class="form-control" value="{{$shop_set['roll_out_limit']}}"/>
|
||||
<span class="help-block">当前代理的佣金达到此额度时才能提现</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -67,14 +51,10 @@
|
|||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="switch">
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[teamDividendCultural][poundage_type]' value='1'
|
||||
@if($teamDividendCulturalSet['poundage_type'] == 1) checked @endif />
|
||||
固定金额
|
||||
<input type='radio' name='withdraw[storeManager][poundage_type]' value='1' @if($shop_set['poundage_type'] == 1) checked @endif />固定金额
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[teamDividendCultural][poundage_type]' value='0'
|
||||
@if(empty($teamDividendCulturalSet['poundage_type'])) checked @endif />
|
||||
手续费比例
|
||||
<input type='radio' name='withdraw[storeManager][poundage_type]' value='0' @if(empty($shop_set['poundage_type'])) checked @endif />手续费比例
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -85,63 +65,9 @@
|
|||
<div class="cost">
|
||||
<label class='radio-inline'>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon" id="teamDividendCultural_poundage_hint" style="width: 120px;">
|
||||
@if($teamDividendCulturalSet['poundage_type'] == 1) 固定金额 @else 手续费比例 @endif
|
||||
</div>
|
||||
<input type="text" name="withdraw[teamDividendCultural][poundage_rate]" class="form-control" value="{{ $teamDividendCulturalSet['poundage_rate'] ?? '' }}" placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="teamDividendCultural_poundage_unit">
|
||||
@if($teamDividendCulturalSet['poundage_type'] == 1) 元 @else % @endif
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>--}}
|
||||
|
||||
|
||||
<div class="vue-main-title">
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">生态服务设置</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现额度</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="text" name="withdraw[ecological_services][roll_out_limit]" class="form-control"
|
||||
value="{{$ecological_services['roll_out_limit']}}"/>
|
||||
<span class="help-block">当生态服务达到此额度时才能提现</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现手续费</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="switch">
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_services][poundage_type]' value='1'
|
||||
@if($ecological_services['poundage_type'] == 1) checked @endif />
|
||||
固定金额
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_services][poundage_type]' value='0'
|
||||
@if(empty($ecological_services['poundage_type'])) checked @endif />
|
||||
手续费比例
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="cost">
|
||||
<label class='radio-inline'>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon" id="ecological_services_poundage_hint"
|
||||
style="width: 120px;">@if($ecological_services['poundage_type'] == 1) 固定金额 @else
|
||||
手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[ecological_services][poundage_rate]"
|
||||
class="form-control" value="{{ $ecological_services['poundage_rate'] ?? '' }}"
|
||||
placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="ecological_services_poundage_unit">@if($ecological_services['poundage_type'] == 1) 元 @else
|
||||
% @endif</div>
|
||||
<div class="input-group-addon" id="storeManager_poundage_hint" style="width: 120px;">@if($shop_set['poundage_type'] == 1) 固定金额 @else手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[storeManager][poundage_rate]" class="form-control" value="{{ $shop_set['poundage_rate'] ?? '' }}" placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="storeManager_poundage_unit">@if($set['poundage_type'] == 1) 元 @else% @endif</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -149,111 +75,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div class="vue-main-title">
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">{{--生态建设--}}经销商受益设置</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现额度</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="text" name="withdraw[ecological_construction][roll_out_limit]" class="form-control"
|
||||
value="{{$ecological_construction['roll_out_limit']}}"/>
|
||||
<span class="help-block">当{{--生态建设--}}经销商受益达到此额度时才能提现</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现手续费</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="switch">
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_construction][poundage_type]' value='1'
|
||||
@if($ecological_construction['poundage_type'] == 1) checked @endif />
|
||||
固定金额
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_construction][poundage_type]' value='0'
|
||||
@if(empty($ecological_construction['poundage_type'])) checked @endif />
|
||||
手续费比例
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="cost">
|
||||
<label class='radio-inline'>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon" id="ecological_construction_poundage_hint"
|
||||
style="width: 120px;">@if($ecological_construction['poundage_type'] == 1) 固定金额 @else
|
||||
手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[ecological_construction][poundage_rate]"
|
||||
class="form-control" value="{{ $ecological_construction['poundage_rate'] ?? '' }}"
|
||||
placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="ecological_construction_poundage_unit">@if($ecological_construction['poundage_type'] == 1) 元 @else
|
||||
% @endif</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="vue-main-title">
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">生态贡献设置</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现额度</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="text" name="withdraw[ecological_contribution][roll_out_limit]" class="form-control"
|
||||
value="{{$ecological_contribution['roll_out_limit']}}"/>
|
||||
<span class="help-block">当生态贡献达到此额度时才能提现</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label">提现手续费</label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="switch">
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_contribution][poundage_type]' value='1'
|
||||
@if($ecological_contribution['poundage_type'] == 1) checked @endif />
|
||||
固定金额
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='withdraw[ecological_contribution][poundage_type]' value='0'
|
||||
@if(empty($ecological_contribution['poundage_type'])) checked @endif />
|
||||
手续费比例
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<div class="cost">
|
||||
<label class='radio-inline'>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon" id="ecological_contribution_poundage_hint"
|
||||
style="width: 120px;">@if($ecological_contribution['poundage_type'] == 1) 固定金额 @else
|
||||
手续费比例 @endif</div>
|
||||
<input type="text" name="withdraw[ecological_contribution][poundage_rate]"
|
||||
class="form-control" value="{{ $ecological_contribution['poundage_rate'] ?? '' }}"
|
||||
placeholder="请输入提现手续费计算值"/>
|
||||
<div class="input-group-addon" id="ecological_contribution_poundage_unit">@if($ecological_contribution['poundage_type'] == 1) 元 @else
|
||||
% @endif</div>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<script language="javascript">
|
||||
$(function () {
|
||||
|
|
@ -268,52 +89,15 @@
|
|||
}
|
||||
});
|
||||
|
||||
/* $(":radio[name='withdraw[teamDividendCultural][poundage_type]']").click(function () {
|
||||
$(":radio[name='withdraw[storeManager][poundage_type]']").click(function () {
|
||||
if ($(this).val() == 1) {
|
||||
$("#teamDividendCultural_poundage_unit").html('元');
|
||||
$("#teamDividendCultural_poundage_hint").html('固定金额');
|
||||
$("#storeManager_poundage_unit").html('元');
|
||||
$("#storeManager_poundage_hint").html('固定金额');
|
||||
}
|
||||
else {
|
||||
$("#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('手续费比例')
|
||||
$("#storeManager_poundage_unit").html('%');
|
||||
$("#storeManager_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('手续费比例')
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -36,24 +36,21 @@ define({
|
|||
</el-form-item>
|
||||
<el-form-item v-show="has_dividend">
|
||||
<el-row :gutter="20" class="gutter">
|
||||
<el-col :span="4">
|
||||
<el-col :span="6">
|
||||
<div class="grid-content bg-purple">经销商等级</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purple">提成比例/<!--生态建设-->经销商受益比例</div>
|
||||
<el-col :span="12">
|
||||
<div class="grid-content bg-purple">提成比例</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="grid-content bg-purple">生态服务比例</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-col :span="6">
|
||||
<div class="grid-content bg-purple" v-if="teamSet.is_extra_award == 1">额外奖励</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" class="gutter" v-for="(level, index) in levelList" :key="level.id">
|
||||
<el-col :span="4">
|
||||
<el-col :span="6">
|
||||
<div class="grid-content bg-purple">{{level.level_name}}</div>
|
||||
</el-col>
|
||||
<el-col :span="8" class="flex-col">
|
||||
<el-col :span="12" class="flex-col">
|
||||
<el-input placeholder="请输入百分比" v-model="level.has_dividend_rates" maxlength="10" size="small" oninput="if(value<0)value=''" type="number">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
|
|
@ -61,12 +58,7 @@ define({
|
|||
<template slot="append">元 固定</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="8" class="flex-col">
|
||||
<el-input v-if="level.level_type == 1" placeholder="请输入百分比" v-model="level.commission_rates" maxlength="10" size="small" oninput="if(value<0)value=''" type="number">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="4" class="flex-col" v-if="teamSet.is_extra_award == 1">
|
||||
<el-col :span="6" class="flex-col" v-if="teamSet.is_extra_award == 1">
|
||||
<el-input placeholder="请输入金额" v-model="level.has_dividend_extra" maxlength="10" size="small " oninput="if(value<0)value=''" type="number">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
|
|
@ -185,17 +177,15 @@ define({
|
|||
filterList (list=[]) {
|
||||
let ratesList = {};
|
||||
let pricesList = {};
|
||||
let commissionList = {};
|
||||
let extraList = {};
|
||||
let gradeList = {};
|
||||
list.forEach((item, index) => {
|
||||
let key = 'level_' + item.id;
|
||||
let {has_dividend_rates, commission_rates, has_dividend_prices, has_dividend_extra, hierarchy, ratio} = item;
|
||||
let {has_dividend_rates, has_dividend_prices, has_dividend_extra, hierarchy, ratio} = item;
|
||||
// 独立规则
|
||||
if (this.has_dividend) {
|
||||
ratesList[key] = has_dividend_rates;
|
||||
pricesList[key] = has_dividend_prices;
|
||||
commissionList[key] = commission_rates;
|
||||
}
|
||||
// 额外奖励
|
||||
if (this.has_dividend && this.teamSet.is_extra_award == 1) {
|
||||
|
|
@ -209,7 +199,7 @@ define({
|
|||
}
|
||||
}
|
||||
});
|
||||
return {ratesList, commissionList, pricesList, extraList, gradeList}
|
||||
return {ratesList, pricesList, extraList, gradeList}
|
||||
},
|
||||
validate () {
|
||||
let aggregate = this.filterList(this.levelList);
|
||||
|
|
@ -222,7 +212,6 @@ define({
|
|||
// dividendLevel: this.filterList(this.levelList)
|
||||
has_dividend_rates: aggregate.ratesList,
|
||||
has_dividend_prices: aggregate.pricesList,
|
||||
commission_rates: aggregate.commissionList,
|
||||
has_dividend_extra: aggregate.extraList,
|
||||
has_hierarchys: aggregate.gradeList
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ namespace Yunshop\WeightValue;
|
|||
class PluginApplication extends \app\common\services\PluginApplication{
|
||||
|
||||
protected function setMenuConfig(){
|
||||
|
||||
return [];
|
||||
\app\backend\modules\menu\Menu::current()->setPluginMenu('weight-value', [
|
||||
'name' => '权重值管理',
|
||||
'type' => 'marketing',
|
||||
|
|
|
|||
Loading…
Reference in New Issue