优化:经销商相关佣金计算优化、添加生态服务奖
This commit is contained in:
parent
cef2eaa33a
commit
3f7f511686
|
|
@ -152,12 +152,11 @@ class TeamAgencyController extends BaseController
|
|||
*/
|
||||
public function add()
|
||||
{
|
||||
$level_list = TeamDividendLevelModel::getList()->get();
|
||||
if (\Request::getMethod() == 'POST') {
|
||||
$agentData = \YunShop::request()->team;
|
||||
$agentData['uniacid'] = \YunShop::app()->uniacid;
|
||||
$agentData['upgrade_at'] = time();
|
||||
if((int)$agentData['level'] <= 0) return $this->message('添加失败,请选择代理等级!', '', 'error');
|
||||
if((int)$agentData['level'] <= 0 && (int)$agentData['cultural_level_id'] <= 0) return $this->message('添加失败,请选择代理等级!', '', 'error');
|
||||
|
||||
try{
|
||||
TeamDividendAgencyModel::addTeamAgency($agentData);
|
||||
|
|
@ -170,8 +169,12 @@ class TeamAgencyController extends BaseController
|
|||
|
||||
}
|
||||
|
||||
$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
|
||||
'level' => $level_list,
|
||||
'cultural_level' => $cultural_level
|
||||
])->render();
|
||||
}
|
||||
|
||||
|
|
@ -327,7 +330,7 @@ class TeamAgencyController extends BaseController
|
|||
// $set = \Setting::get('plugin.team_dividend');
|
||||
// (new NewUpgrateJob($model->uid, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle();
|
||||
|
||||
// $order = Order::find(169);
|
||||
// $order = Order::find(3);
|
||||
// $TeamReturnService = ReturnConfig::getClass();
|
||||
// if (app('plugins')->isEnabled('team-sideways')) debug('经销商订单创建终止:team-sideways');
|
||||
// $set = $order->getSetting('plugin.team_dividend');
|
||||
|
|
@ -339,12 +342,7 @@ class TeamAgencyController extends BaseController
|
|||
// $TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents);
|
||||
// $TeamReturnService->handle();
|
||||
// $this->totalDividend += $TeamReturnService->totalDividend;
|
||||
// // 文创津贴(补贴)处理
|
||||
// $TeamReturnService->setData($order, $set, $buyMember, $order_goods, $agents,1);
|
||||
// $TeamReturnService->handle();
|
||||
// $this->totalDividend += $TeamReturnService->totalDividend;
|
||||
// }
|
||||
// debug(['总分红金额(包括津贴和补贴)'=>$this->totalDividend]);
|
||||
|
||||
debug("结束");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,17 @@ 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,
|
||||
'has_dividend_rate' => 0,
|
||||
'commission_rates' => 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)
|
||||
|
|
@ -65,6 +64,7 @@ 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,9 +173,9 @@ class TeamDividendAgencyModel extends BackendModel
|
|||
{
|
||||
return self::uniacid()
|
||||
->with(['hasOneLevel'=>function($query){
|
||||
$query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight']);
|
||||
// $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']);
|
||||
// $query->select(['id','award_gratitude','award_ratio','dividend_ratio','level_weight','level_type','commission_ratio']);
|
||||
}])
|
||||
->where('uid', $uid)
|
||||
->first();
|
||||
|
|
|
|||
|
|
@ -201,10 +201,13 @@ class TeamDividendModel extends BaseModel
|
|||
$this->TypeService = '额外分红';
|
||||
break;
|
||||
case 4:
|
||||
$this->TypeService = '津贴(补贴)';
|
||||
$this->TypeService = '生态建设';
|
||||
break;
|
||||
case 5:
|
||||
$this->TypeService = '津贴(补贴)平级奖';
|
||||
$this->TypeService = '生态贡献';
|
||||
break;
|
||||
case 6:
|
||||
$this->TypeService = '生态服务';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -472,7 +475,7 @@ class TeamDividendModel extends BaseModel
|
|||
* Author: wu-hui
|
||||
* Time: 2023/11/20 15:15
|
||||
* @param int $uid 用户id
|
||||
* @param int $type 4=服务收益,5=贡献收益
|
||||
* @param int $type 4=生态建设,5=生态贡献,6=生态服务
|
||||
* @param string $incomeStatus all=全部收益;undrawn=未提现收益,withdrawn=已提现收益
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class GetAmountService
|
|||
* @param $finish_price
|
||||
* @param $dividendType
|
||||
*/
|
||||
public function __construct($agent, $order, $order_goods, $set, $team_goods, $finish_ratio, $finish_price, $dividendType = 0)
|
||||
public function __construct($agent, $order, $order_goods, $set, $team_goods, $finish_ratio, $finish_price, $dividendType = 0,$finish_ratio_service = 0)
|
||||
{
|
||||
$this->dividendType = $dividendType;
|
||||
$this->agent = $agent;
|
||||
|
|
@ -46,6 +46,7 @@ class GetAmountService
|
|||
$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;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +60,11 @@ class GetAmountService
|
|||
return unserialize($this->team_goods->has_dividend_rates);
|
||||
}
|
||||
|
||||
private function getCommissionRates()
|
||||
{
|
||||
return unserialize($this->team_goods->commission_rates);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name 商品独立设置-固定金额-解序列化
|
||||
* @author
|
||||
|
|
@ -305,7 +311,8 @@ class GetAmountService
|
|||
}
|
||||
|
||||
return $ratio;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// 商城商品设置奖励比例 else 商城商品设置奖励固定金额
|
||||
if ($this->hasDividendRates()) {
|
||||
$dividend_rates = $this->getDividendRates();
|
||||
|
|
@ -314,7 +321,9 @@ class GetAmountService
|
|||
return $ratio;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
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'];
|
||||
|
|
@ -326,11 +335,53 @@ class GetAmountService
|
|||
}
|
||||
}
|
||||
|
||||
// 获取生态服务比例
|
||||
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()) {
|
||||
|
||||
|
|
@ -365,4 +416,13 @@ class GetAmountService
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@ class TeamReturnService
|
|||
private $lower_ratio = 0;
|
||||
// 已获得奖励的比例
|
||||
private $finish_ratio = 0;
|
||||
// 已获得服务奖励的比例
|
||||
private $finish_ratio_service = 0;
|
||||
// 已完成的经销商奖励 用于感恩奖
|
||||
private $finish_team_award_amount = 0;
|
||||
// 已奖励金额 用于计算极差
|
||||
|
|
@ -59,9 +61,9 @@ class TeamReturnService
|
|||
|
||||
protected $flat_prize_limit;
|
||||
|
||||
private $dividendType = 0;// 分红类型:0=普通经销商提成,1=文创经销商津贴(补贴)
|
||||
|
||||
private $dividendType = 0;// 分红类型:0=普通经销商提成,1=文创经销商生态建设
|
||||
|
||||
private $upUserDividendAmount = 0;// 上一位用户的经销商佣金提成金额 只有存在佣金时才会刷新该数据,如果用户为领取佣金则该金额保留 直到某位用户获取佣金为止
|
||||
|
||||
public function setData($order, $set, $buyMember, $order_goods, $agents){
|
||||
$this->order = $order;
|
||||
|
|
@ -93,7 +95,7 @@ class TeamReturnService
|
|||
|
||||
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->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);
|
||||
//商品分红限制 不计入平级奖层级 不算感恩奖
|
||||
if ($agent['is_black'] || $this->getIsRestrict($agent)) {
|
||||
continue;
|
||||
|
|
@ -117,9 +119,9 @@ class TeamReturnService
|
|||
|
||||
private function totalDividend()
|
||||
{
|
||||
$amount_service = new GetAmountService('', $this->order, $this->order_goods, $this->set, $this->team_goods, $this->finish_ratio, $this->finish_price);
|
||||
$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);
|
||||
// 经销商奖励总金额 不包括感恩奖和平级奖
|
||||
$this->totalDividend = $amount_service->getTotalDividend();
|
||||
$this->totalDividend += $amount_service->getTotalDividend();
|
||||
}
|
||||
|
||||
// 感恩奖
|
||||
|
|
@ -205,7 +207,7 @@ class TeamReturnService
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->upUserDividendAmount = $dividend_amount;
|
||||
// 计算基数
|
||||
$amount = $this->amount_service->amount;
|
||||
|
||||
|
|
@ -218,7 +220,6 @@ class TeamReturnService
|
|||
];
|
||||
// 分红
|
||||
$dividend_model = $this->addDividend($agent, $dividendData);
|
||||
|
||||
$member = Member::getMemberByUid($agent['uid'])->with('hasOneFans')->first();
|
||||
$notice = [
|
||||
'lower_level_name' => $this->buyMember->nickname,
|
||||
|
|
@ -243,6 +244,61 @@ class TeamReturnService
|
|||
}
|
||||
// 属性赋值
|
||||
$this->setAttributeTheValue($dividendData['dividend_amount'], $agent);
|
||||
|
||||
// 生态服务
|
||||
if($this->dividendType == 1) $this->dividendAwardService($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;
|
||||
}
|
||||
|
||||
// 平级奖
|
||||
|
|
@ -267,15 +323,17 @@ class TeamReturnService
|
|||
|
||||
// 平级奖奖励比例
|
||||
$award_ratio = $this->amount_service->getAwardHierarchyRatio();
|
||||
if (!isset($award_ratio) || $award_ratio <= 0) {
|
||||
return;
|
||||
}
|
||||
$amount = $this->amount_service->getAwardHierarchyAmount();
|
||||
if ($amount <= 0) {
|
||||
return;
|
||||
if (!isset($award_ratio) || $award_ratio <= 0) return;
|
||||
// 计算结算金额 普通经销商为订单金额,文创经销商为上一位的分红佣金
|
||||
if($this->dividendType == 1){
|
||||
// 文创等级 使用上一位的分红佣金
|
||||
$amount = $this->upUserDividendAmount;
|
||||
}else{
|
||||
// 普通等级 使用订单金额
|
||||
$amount = $this->amount_service->getAwardHierarchyAmount();
|
||||
}
|
||||
if ($amount <= 0) return;
|
||||
$dividend_amount = proportionMath($amount, $award_ratio);
|
||||
|
||||
$dividendData = [
|
||||
'amount' => $amount,
|
||||
'dividend_rate' => $award_ratio,
|
||||
|
|
@ -476,9 +534,8 @@ class TeamReturnService
|
|||
'culate_method' => intval($this->set['culate_method']) ?: 0,
|
||||
'created_at' => time(),
|
||||
];
|
||||
// 判断:如果当前是 文创津贴(补贴) 修改对应的类型值
|
||||
if($this->dividendType == 1) $dividendData['type'] = $dividendData['type'] == 1 ? 5 : 4;
|
||||
|
||||
// 判断:如果当前是 文创生态建设 修改对应的类型值
|
||||
if($this->dividendType == 1 && $dividendData['type'] < 6) $dividendData['type'] = $dividendData['type'] == 1 ? 5 : 4;
|
||||
|
||||
//取小数点后两位数四舍五入 例如设置独立金额0.003元
|
||||
if (round($dividendData['dividend_amount'], 2) <= 0) return;
|
||||
|
|
@ -566,5 +623,9 @@ class TeamReturnService
|
|||
$this->extraCount = 0;
|
||||
// 获得经销商奖励的等级id与金额
|
||||
$this->obtainInfos = [];
|
||||
// 上一位获取的佣金 只有存在新佣金时才会刷新,否则不刷新
|
||||
$this->upUserDividendAmount = 0;
|
||||
// 已获得生态服务奖励的比例
|
||||
$this->finish_ratio_service = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -31,16 +31,17 @@ 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,6 +18,7 @@ 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', [
|
||||
|
|
|
|||
|
|
@ -65,8 +65,9 @@
|
|||
<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='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>
|
||||
|
|
@ -130,33 +131,33 @@
|
|||
<table class="table table-hover" style="overflow:visible;">
|
||||
<thead>
|
||||
<tr>
|
||||
<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:20%;'>经销商等级 <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>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list['data'] as $row)
|
||||
<tr>
|
||||
<td>{{$row['id']}}</td>
|
||||
<td>{{$row['created_at']}}</td>
|
||||
<td>{{$row['member_id']}}</td>
|
||||
<td>
|
||||
<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;'>
|
||||
<a target="_blank"
|
||||
href="{{yzWebUrl('order.detail.vue-index',['id' => $row['has_one_order']['id']])}}">
|
||||
{{$row['order_sn']}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<td style='text-align: center;'>
|
||||
<a target="_blank"
|
||||
href="{{yzWebUrl('member.member.detail',['id'=>$row['has_one_member']['uid']])}}">
|
||||
<img src="{{tomedia($row['has_one_member']['avatar'])}}"
|
||||
|
|
@ -165,16 +166,16 @@
|
|||
{{$row['has_one_member']['nickname']}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<td style='text-align: center;'>
|
||||
{{$row['level_name']}}
|
||||
<br>
|
||||
{{ $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>
|
||||
<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;'>
|
||||
<a class="btn btn-primary" href="{{ yzWebUrl('plugin.team-dividend.admin.team-dividend.details',['id' => $row['id']]) }}">查看详情</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@
|
|||
<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
|
||||
|
|
@ -81,34 +82,38 @@
|
|||
</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>
|
||||
<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>
|
||||
</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>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@
|
|||
|
||||
<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>
|
||||
<div class="col-sm-6 col-xs-6">
|
||||
<div class='input-group'>
|
||||
|
|
@ -176,6 +176,19 @@
|
|||
</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">
|
||||
|
|
@ -1252,7 +1265,13 @@
|
|||
let val = $(this).val();
|
||||
val = parseInt(val) && !isNaN(parseInt(val)) ? parseInt(val) : parseInt(0);
|
||||
// 0=普通等级 1=文创等级
|
||||
$("#dividend_ratio_text").html(val === parseInt(1) ? '补贴(津贴)比例' : '提成比例');
|
||||
if(val === parseInt(1)){
|
||||
$("#dividend_ratio_text").html('生态建设比例');
|
||||
$("#commission_ratio_set_content").removeClass('hide');
|
||||
}else{
|
||||
$("#dividend_ratio_text").html('提成比例');
|
||||
$("#commission_ratio_set_content").addClass('hide');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@
|
|||
<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: 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>
|
||||
|
|
@ -65,6 +66,13 @@
|
|||
-
|
||||
@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>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
<li class="active"><a href="#">添加团队代理</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right-addbox"><!-- 此处是右侧内容新包一层div -->
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
|
@ -39,7 +38,6 @@
|
|||
{{--<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">
|
||||
|
|
@ -47,14 +45,24 @@
|
|||
{{--<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>
|
||||
<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>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
<th width="8.5%">
|
||||
提成比例<br>累计提成
|
||||
<hr style="margin: 5px 0!important;"/>
|
||||
补贴(津贴)比例<br>累计补贴(津贴)
|
||||
生态建设比例<br>累计生态建设
|
||||
</th>
|
||||
<th width="8.5%">已结算提成<br>未结算提成</th>
|
||||
<th width="13%">黑名单<br>变动时间</th>
|
||||
|
|
|
|||
|
|
@ -36,21 +36,24 @@ define({
|
|||
</el-form-item>
|
||||
<el-form-item v-show="has_dividend">
|
||||
<el-row :gutter="20" class="gutter">
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<div class="grid-content bg-purple">经销商等级</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-content bg-purple">提成比例</div>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purple">提成比例/生态建设比例</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-col :span="4">
|
||||
<div class="grid-content bg-purple">生态服务比例</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<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="6">
|
||||
<el-col :span="4">
|
||||
<div class="grid-content bg-purple">{{level.level_name}}</div>
|
||||
</el-col>
|
||||
<el-col :span="12" class="flex-col">
|
||||
<el-col :span="8" 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>
|
||||
|
|
@ -58,7 +61,12 @@ define({
|
|||
<template slot="append">元 固定</template>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="6" class="flex-col" v-if="teamSet.is_extra_award == 1">
|
||||
<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-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>
|
||||
|
|
@ -177,15 +185,17 @@ 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, has_dividend_prices, has_dividend_extra, hierarchy, ratio} = item;
|
||||
let {has_dividend_rates, commission_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) {
|
||||
|
|
@ -199,7 +209,7 @@ define({
|
|||
}
|
||||
}
|
||||
});
|
||||
return {ratesList, pricesList, extraList, gradeList}
|
||||
return {ratesList, commissionList, pricesList, extraList, gradeList}
|
||||
},
|
||||
validate () {
|
||||
let aggregate = this.filterList(this.levelList);
|
||||
|
|
@ -212,6 +222,7 @@ 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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue