修改:订单商品区域代理权重值奖励由全额获取修改为根据每个区域代理设置的权重值奖励比例获取
This commit is contained in:
parent
5d58fb24e9
commit
2fd7085b3c
|
|
@ -45,8 +45,7 @@ class AgentController extends BaseController
|
|||
|
||||
$wq_data = \YunShop::request()->wq;
|
||||
if ($agentData) {
|
||||
$agent = AreaDividendAgent::getAgentByMemberId($agentData['member_id'])->where('status', '<>', -1)
|
||||
->first();
|
||||
$agent = AreaDividendAgent::getAgentByMemberId($agentData['member_id'])->where('status', '<>', -1)->first();
|
||||
$set = Setting::get('plugin.area_dividend');
|
||||
if (!empty($agent)) {
|
||||
if ($agent->status == 0) {
|
||||
|
|
@ -87,8 +86,7 @@ class AgentController extends BaseController
|
|||
if ($hasAgent && in_array($hasAgent->status, [0, 1])) {
|
||||
return $this->errorJson('添加失败,此会员已是该区域代理商');
|
||||
} elseif ($hasAgent && $hasAgent->status == -1) {
|
||||
AreaDividendAgent::uniacid()
|
||||
->where('id', $hasAgent->id)->delete();
|
||||
AreaDividendAgent::uniacid()->where('id', $hasAgent->id)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,19 +169,13 @@ class AgentController extends BaseController
|
|||
{
|
||||
$id = \YunShop::request()->id;
|
||||
$agency = AreaDividendAgent::find($id);
|
||||
if (!$agency) {
|
||||
return $this->message('无此区域代理或已经删除', '', 'error');
|
||||
}
|
||||
|
||||
if (!$agency) return $this->message('无此区域代理或已经删除', '', 'error');
|
||||
if ($agency->user_id) {
|
||||
$user = WeiQingUsers::getUserByUid($agency->user_id)->first();
|
||||
if (!$user) {
|
||||
return $this->message('微擎账号不存在', '', 'error');
|
||||
}
|
||||
if (!$user) return $this->message('微擎账号不存在', '', 'error');
|
||||
}
|
||||
|
||||
if (request()->isMethod('post')) {
|
||||
|
||||
$wq_data = \YunShop::request()->wq;
|
||||
if ($wq_data['password'] && $wq_data['password_again']) {
|
||||
if (trim($wq_data['password_again']) != trim($wq_data['password'])) {
|
||||
|
|
@ -248,6 +240,7 @@ class AgentController extends BaseController
|
|||
|
||||
$agency->manage = request()->order_manage;
|
||||
$agency->ratio = request()->ratio;
|
||||
$agency->weight_value_ratio = request()->weight_value_ratio;
|
||||
$agency->has_ratio = request()->has_ratio;
|
||||
if (intval(request()->input('agent')['investor_uid'])) {
|
||||
$agency->investor_uid = intval(request()->input('agent')['investor_uid']);
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ class OrderCreatedNewService
|
|||
continue;
|
||||
}
|
||||
|
||||
\Log::debug("省公司权重值处理 - 开始处理",['uid'=>$agent['member_id'],'order_id'=>$areaDividendData['order_id']]);
|
||||
(new WeightValue())->areaGiveInit($agent['member_id'],$this->order);
|
||||
\Log::debug("省公司权重值处理 - 开始处理",['uid'=>$agent['member_id'],'order_id'=>$areaDividendData['order_id'],'weight_value_ratio'=>$agent['weight_value_ratio']]);
|
||||
if((float)$agent['weight_value_ratio'] > 0) (new WeightValue())->areaGiveInit($agent['member_id'],$this->order,$agent['weight_value_ratio']);
|
||||
|
||||
|
||||
$exist = AreaDividend::where([
|
||||
|
|
|
|||
|
|
@ -48,6 +48,17 @@
|
|||
</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'>
|
||||
<input type='text' name='weight_value_ratio' class="form-control discounts_value" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" value="{{$agency->weight_value_ratio}}"/>
|
||||
<div class='input-group-addon waytxt'>%</div>
|
||||
</div>
|
||||
<div class="help-block">不填或者为0则无权重值奖励。该比例为订单商品奖励权重值的占比例(例如:商品奖励600权重值,这里填写30则该区域代理获得600*30%=180权重值)</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{--招商专员插件--}}
|
||||
@if(app('plugins')->isEnabled('invest-people'))
|
||||
{!! \Yunshop\InvestPeople\services\InvestMemberView::areaDividend($agency->investor_uid) !!}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,16 @@
|
|||
</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'>
|
||||
<input type='text' name='agent[weight_value_ratio]' class="form-control discounts_value" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" placeholder="0.00"/>
|
||||
<div class='input-group-addon waytxt'>%</div>
|
||||
</div>
|
||||
<div class="help-block">不填或者为0则无权重值奖励。该比例为订单商品奖励权重值的占比例(例如:商品奖励600权重值,这里填写30则该区域代理获得600*30%=180权重值)</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">
|
||||
|
|
|
|||
|
|
@ -103,86 +103,55 @@
|
|||
<table class="table table-hover" style="overflow:visible;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='width:8%;'>ID</th>
|
||||
<th style='width:10%;'>会员Id</th>
|
||||
<th style='width:10%;'>会员</th>
|
||||
<th style='width:10%;'>姓名</br>手机</th>
|
||||
<th style='width:12%;'>成为代理时间</th>
|
||||
<th style='width:15%;'>申请区域</th>
|
||||
<th style='width:10%;'>申请等级</th>
|
||||
<th style='width:10%;'>区域消费总额</th>
|
||||
<th style='width:10%;'>分红比例</th>
|
||||
<th style='width:10%;'>累计结算金额</th>
|
||||
<th style='width:10%;'>已结算分红佣金</th>
|
||||
<th style='width:10%;'>未结算分红佣金</th>
|
||||
<th style='width:10%;'>操作</th>
|
||||
<th style='text-align:center;width:50px;'>ID</th>
|
||||
<th style='text-align:center;width:80px;'>会员ID</th>
|
||||
<th style='text-align:center;width:120px;'>会员</th>
|
||||
<th style='text-align:center;width:120px;'>姓名</br>手机</th>
|
||||
<th style='text-align:center;width:150px;'>成为代理时间</th>
|
||||
<th style='text-align:center;width:300px;'>申请区域</th>
|
||||
<th style='text-align:center;width:90px;'>申请等级</th>
|
||||
<th style='text-align:center;width:120px;'>区域消费总额</th>
|
||||
<th style='text-align:center;width:100px;'>分红比例<br />权重值比例</th>
|
||||
<th style='text-align:center;min-width:120px;'>
|
||||
累计结算金额<br />已结算分红佣金<br />未结算分红佣金
|
||||
</th>
|
||||
<th style='text-align:center;width:200px;'>操作</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($list['data'] as $row)
|
||||
<tr>
|
||||
<td>{{$row['id']}}</td>
|
||||
<td>{{$row['has_one_member']['uid']}}</td>
|
||||
<td>
|
||||
<td style="text-align: center;">{{$row['id']}}</td>
|
||||
<td style="text-align: center;">{{$row['has_one_member']['uid']}}</td>
|
||||
<td style="text-align: center;">
|
||||
<img src="{{tomedia($row['has_one_member']['avatar'])}}"
|
||||
style="width: 30px; height: 30px;border:1px solid #ccc;padding:1px;">
|
||||
</br>
|
||||
{{$row['has_one_member']['nickname']}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{$row['real_name']}} </br>
|
||||
{{$row['has_one_profile']['mobile']}}
|
||||
<td style="text-align: center;">{{$row['real_name']}} </br>{{$row['mobile']}}</td>
|
||||
<td style="text-align: center;">{{date("Y-m-d H:i",$row['agent_at'])}}</td>
|
||||
<td style="text-align: center;" title="" class='tdedit' width="26%">
|
||||
<span class=' fa-edit-item' style='cursor:pointer' data-agentid="{{$row['id']}}">
|
||||
<span class="title">
|
||||
@if($row['province_name']){{$row['province_name']}}@endif
|
||||
@if($row['city_name'])-{{$row['city_name']}}@endif
|
||||
@if($row['district_name'])-{{$row['district_name']}}@endif
|
||||
@if($row['street_name'])-{{$row['street_name']}}@endif
|
||||
</span>
|
||||
<i class='fa fa-pencil' style="display:none"></i>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{{date("Y-m-d H:i",$row['agent_at'])}}
|
||||
</td>
|
||||
<td title="" class='tdedit' width="26%">
|
||||
<span class=' fa-edit-item' style='cursor:pointer'
|
||||
data-agentid="{{$row['id']}}">
|
||||
<span class="title">
|
||||
@if($row['province_name'])
|
||||
{{$row['province_name']}}
|
||||
@endif
|
||||
@if($row['city_name'])
|
||||
-{{$row['city_name']}}
|
||||
@endif
|
||||
@if($row['district_name'])
|
||||
-{{$row['district_name']}}
|
||||
@endif
|
||||
@if($row['street_name'])
|
||||
-{{$row['street_name']}}
|
||||
@endif
|
||||
</span>
|
||||
<i class='fa fa-pencil' style="display:none"></i>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
{{$row['level_name']}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{$row['has_one_dividend']['total_order_amount'] ?: '0.00'}}
|
||||
</td>
|
||||
<td>
|
||||
{{$row['rate']}}%
|
||||
{{--分红比例--}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{$row['has_one_dividend']['total_amount'] ?: '0.00'}}
|
||||
</td>
|
||||
<td>
|
||||
{{$row['has_one_dividend']['settle'] ?: '0.00'}}
|
||||
</td>
|
||||
<td>
|
||||
<td style="text-align: center;">{{$row['level_name']}}</td>
|
||||
<td style="text-align: center;">{{$row['has_one_dividend']['total_order_amount'] ?: '0.00'}}</td>
|
||||
<td style="text-align: center;">{{$row['rate']}}%<br />{{$row['weight_value_ratio']}}%</td>
|
||||
<td style="text-align: center;">
|
||||
{{$row['has_one_dividend']['total_amount'] ?: '0.00'}}<br />
|
||||
{{$row['has_one_dividend']['settle'] ?: '0.00'}}<br />
|
||||
{{$row['has_one_dividend']['unsettled'] ?: '0.00'}}
|
||||
</td>
|
||||
<td style="position:relative; overflow:visible;">
|
||||
<td style="position:relative; overflow:visible;text-align:center;">
|
||||
<a href="{{yzWebUrl('plugin.area-dividend.admin.agent.daletedAgency',['id'=>$row['id']])}}"
|
||||
onclick="return confirm('是否确认删除?');
|
||||
return false;" class="btn btn-default btn-sm"
|
||||
|
|
@ -192,7 +161,6 @@
|
|||
class="btn btn-default btn-sm" title="编辑账号"><i class="fa fa-edit"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -105,11 +105,6 @@ class PluginApplication extends \app\common\services\PluginApplication{
|
|||
]);
|
||||
}
|
||||
|
||||
public function register(){
|
||||
CollectionRoomIdentifierModel::createDefaultData();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function boot(){
|
||||
$events = app('events');
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class CollectionRoomIdentifierModel extends BaseModel{
|
|||
* @return array
|
||||
*/
|
||||
public function getList($search){
|
||||
self::createDefaultData();
|
||||
// 条件生成
|
||||
$where = [];
|
||||
if($search['unique_number'] > 0) $where[] = ['yz_collection_room_identifier.unique_number','=',$search['unique_number']];
|
||||
|
|
|
|||
|
|
@ -380,11 +380,12 @@ class WeightValue extends BaseModel{
|
|||
/**
|
||||
* Common: 区域代理提成 - 开始处理
|
||||
* Author: wu-hui
|
||||
* Time: 2023/10/24 16:57
|
||||
* Time: 2023/10/27 11:25
|
||||
* @param $uid
|
||||
* @param $model
|
||||
* @param $weightValueRatio
|
||||
*/
|
||||
public function areaGiveInit($uid,$model){
|
||||
public function areaGiveInit($uid,$model,$weightValueRatio){
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
// 当前订单全部商品
|
||||
|
|
@ -397,7 +398,15 @@ class WeightValue extends BaseModel{
|
|||
// 循环处理信息
|
||||
foreach($goodsList as $goodsInfo){
|
||||
// 获取当前用户应得的权重值
|
||||
$totalWeightValue = (float)sprintf("%.2f",$this->getAreaGiveWeightValue($goodsInfo,$currentUser));
|
||||
$goodTotalWeightValue = (float)sprintf("%.2f",$this->getAreaGiveWeightValue($goodsInfo,$currentUser));
|
||||
$totalWeightValue = (float)sprintf("%.2f",$goodTotalWeightValue * $weightValueRatio / 100);
|
||||
// \Log::debug('------ 省公司权重值处理 - 计算结果------',[
|
||||
// 'goods_id' => $goodsInfo['goods_id'],
|
||||
// 'order_goods_id' => $goodsInfo['id'],
|
||||
// '商品总产生权重值' => $goodTotalWeightValue,
|
||||
// '占比例' => $weightValueRatio,
|
||||
// '实际获得' => $totalWeightValue
|
||||
// ]);
|
||||
// 应得权重值大于0 记录改变信息并且修改持有权重值
|
||||
if((float)$totalWeightValue > 0){
|
||||
$changeAfter = sprintf("%.2f",($currentAgentHasWeightValue + $totalWeightValue));
|
||||
|
|
|
|||
Loading…
Reference in New Issue