添加:市场津贴功能
This commit is contained in:
parent
dc71b58de4
commit
e4bb8b7ac5
|
|
@ -208,6 +208,7 @@ class IncomeService
|
|||
const REWARD_POOL_DIVIDEND = 191;//奖金池分红
|
||||
const STORE_MANAGER = 200;// 经销商店长-店补
|
||||
const CULTURAL_SPACE_CONTRIBUTION_BONUS = 201;// 文创空间 - 贡献分享分红
|
||||
const CULTURAL_SPACE_AREA_BONUS = 202;// 文创空间 - 市场津贴
|
||||
|
||||
/**
|
||||
* @param $data 会员id:member_id,分红类型:dividend_code,分红表id:dividend_table_id,金额:amount,订单号:order_sn,详情:detail
|
||||
|
|
@ -679,6 +680,7 @@ class IncomeService
|
|||
self::REWARD_POOL_DIVIDEND => defined('REWARD_POOL_DIVIDEND_DIY_NAME') ? REWARD_POOL_DIVIDEND_DIY_NAME : "奖金池分红",
|
||||
self::STORE_MANAGER => '店补',
|
||||
self::CULTURAL_SPACE_CONTRIBUTION_BONUS => '贡献分享分红',
|
||||
self::CULTURAL_SPACE_AREA_BONUS => '市场津贴',
|
||||
];
|
||||
if (empty($income_config_desc[$code])) {
|
||||
if ($func = app('ShopAsset')->getData('income')[$code]) {
|
||||
|
|
@ -879,7 +881,8 @@ class IncomeService
|
|||
self::QUICKEN_INCOME_REWARD => 'Yunshop\QuickenIncome\models\EquityDetailModel',
|
||||
self::REWARD_POOL_DIVIDEND => 'Yunshop\RewardPoolDividend\common\models\DividendUpgradeRecord',
|
||||
self::STORE_MANAGER => 'Yunshop\TeamDividend\Common\models\StoreManagerRecordModel',
|
||||
self::CULTURAL_SPACE_CONTRIBUTION_BONUS => 'Yunshop\CulturalSpace\models\ContributionBonusLog'
|
||||
self::CULTURAL_SPACE_CONTRIBUTION_BONUS => 'Yunshop\CulturalSpace\models\ContributionBonusLog',
|
||||
self::CULTURAL_SPACE_AREA_BONUS => 'Yunshop\CulturalSpace\models\CulturalSpaceAreaBonus',
|
||||
];
|
||||
if (empty($income_config_class[$code])) {
|
||||
if ($func = app('ShopAsset')->getData('income')[$code]) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ namespace Yunshop\CulturalSpace;
|
|||
|
||||
use Yunshop\CulturalSpace\listener\OrderPaidListener;
|
||||
use Yunshop\CulturalSpace\models\ContributionBonusLog;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaBonus;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaCycle;
|
||||
|
||||
class PluginApplication extends \app\common\services\PluginApplication{
|
||||
|
||||
|
|
@ -92,8 +94,29 @@ class PluginApplication extends \app\common\services\PluginApplication{
|
|||
],
|
||||
]
|
||||
],
|
||||
|
||||
|
||||
'plugin_cultural_space_area_bonus' => [
|
||||
'name' => '市场津贴',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.area_bonus.index',
|
||||
'url_params' => '',
|
||||
'item' => 'plugin_cultural_space_area_bonus',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_area_bonus_index' => [
|
||||
'name' => '市场津贴',
|
||||
'url' => 'plugin.cultural-space.admin.area_bonus.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_area_bonus_index',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_area_bonus']
|
||||
],
|
||||
]
|
||||
],
|
||||
'plugin_cultural_space_set' => [
|
||||
'name' => '基本设置',
|
||||
'permit' => 1,
|
||||
|
|
@ -163,18 +186,32 @@ class PluginApplication extends \app\common\services\PluginApplication{
|
|||
|
||||
public function cronConfig(){
|
||||
\Event::listen('cron.collectJobs', function () {
|
||||
// 每天0点30 执行一次贡献分享分红处理
|
||||
// 每天0点30分 执行一次贡献分享分红处理
|
||||
\Cron::add('cultural-space-contribution-bonus', '30 0 * * *', function () {
|
||||
\Log::debug('--- 文创空间 - 贡献分享分红 - 开始 ----');
|
||||
(new ContributionBonusLog())->bonusInit();
|
||||
return;
|
||||
});
|
||||
// 每天1点30 执行一次贡献分享分红结算
|
||||
// 每天1点30分 执行一次贡献分享分红结算
|
||||
\Cron::add('cultural-space-contribution-bonus-settlement', '30 1 * * *', function () {
|
||||
\Log::debug('--- 文创空间 - 贡献分享分红 - 结算开始 ----');
|
||||
(new ContributionBonusLog())->contributionBonusSettlement();
|
||||
return;
|
||||
});
|
||||
// 每天0点5分 执行一次市场津贴
|
||||
\Cron::add('cultural-space-area-cycle', '5 0 * * *', function () {
|
||||
\Log::debug('--- 文创空间 - 市场津贴 - 开启处理 ----');
|
||||
(new CulturalSpaceAreaCycle())->bonusInit();
|
||||
return;
|
||||
});
|
||||
// 每天1点30分 执行一次市场津贴结算 todo:不结算到提现
|
||||
/*\Cron::add('cultural-space-area-bonus', '30 1 * * *', function () {
|
||||
\Log::debug('--- 文创空间 - 市场津贴 - 开启结算 ----');
|
||||
(new CulturalSpaceAreaBonus())->bonusSettlement();
|
||||
return;
|
||||
});*/
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\admin;
|
||||
|
||||
use app\common\components\BaseController;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaBonus;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaCycle;
|
||||
|
||||
class AreaBonusController extends BaseController{
|
||||
/**
|
||||
* Common: 获取市场津贴信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:52
|
||||
* @return array|\Illuminate\Http\JsonResponse|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function index(){
|
||||
if(request()->isMethod('post')){
|
||||
// 参数获取
|
||||
$search = request()->input('search');
|
||||
$tabsActive = request()->input('tabs_active');
|
||||
// 获取变更记录
|
||||
switch($tabsActive){
|
||||
case 'show_cycle':$result = CulturalSpaceAreaCycle::getList();break;// 周期信息
|
||||
case 'show_bonus':$result = CulturalSpaceAreaBonus::getList($search);break;// 分红明细
|
||||
case 'show_hold':$result = CulturalSpaceAreaBonus::getHoldList($search);break;// 用户持有
|
||||
}
|
||||
|
||||
return $this->successJson('success',[
|
||||
'current_page' => $result['current_page'],
|
||||
'data' => $result['data'],
|
||||
'last_page' => $result['last_page'],
|
||||
]);
|
||||
}
|
||||
|
||||
return view('Yunshop\CulturalSpace::area_bonus.index')->render();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ use app\common\facades\Setting;
|
|||
use app\common\models\Order;
|
||||
use Yunshop\CulturalSpace\models\ContributionBonusLog;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpace;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaBonus;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceAreaCycle;
|
||||
use Yunshop\NewPoster\models\Poster;
|
||||
|
||||
class IndexController extends BaseController{
|
||||
|
|
@ -69,6 +71,11 @@ class IndexController extends BaseController{
|
|||
// } while ($endTime <= time());
|
||||
|
||||
|
||||
|
||||
// 市场津贴处理 模拟
|
||||
// (new CulturalSpaceAreaCycle())->bonusInit();
|
||||
// (new CulturalSpaceAreaBonus())->bonusSettlement();
|
||||
|
||||
debug(["结束,," => time()]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\common\models\Member;
|
||||
use app\common\models\UniAccount;
|
||||
use app\common\services\income\IncomeService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CulturalSpaceAreaBonus extends BaseModel
|
||||
{
|
||||
public $table = 'yz_cultural_space_area_bonus';
|
||||
public $timestamps = true;
|
||||
public $casts = [
|
||||
'created_at' => 'datetime:Y-m-d H:i:s',
|
||||
'updated_at' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'cycle_id',
|
||||
'area_amount',
|
||||
'area_rate',
|
||||
'get_amount',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* Common: 获取信息列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:52
|
||||
* @param $search
|
||||
* @return mixed
|
||||
*/
|
||||
public function getList($search){
|
||||
// 条件生成
|
||||
$where = [];
|
||||
if ($search['uid'] > 0) $where[] = ['uid', '=', $search['uid']];
|
||||
if ($search['cycle_id'] > 0) $where[] = ['cycle_id', '=', $search['cycle_id']];
|
||||
if($search['status'] >= 0 && $search['status'] != '') $where[] = ['status','=',(int)$search['status']];
|
||||
// 查询model
|
||||
return self::uniacid()
|
||||
->where($where)
|
||||
->with([
|
||||
'member' => function ($query) {
|
||||
$query->select(['uid', 'nickname', 'realname', 'avatar']);
|
||||
},
|
||||
'cycle' => function ($query) {
|
||||
$query->select(['id', 'total_price', 'allocation_price', 'total_amount']);
|
||||
}
|
||||
])
|
||||
->orderBy('id', 'DESC')
|
||||
->paginate(10)
|
||||
->toArray();
|
||||
}
|
||||
/**
|
||||
* Common: 用户持有统计
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 17:20
|
||||
* @param $search
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHoldList($search){
|
||||
// 条件生成
|
||||
$where = [];
|
||||
if ($search['uid'] > 0) $where[] = ['uid', '=', $search['uid']];
|
||||
// 查询model
|
||||
return self::uniacid()
|
||||
->select([
|
||||
'uid',
|
||||
DB::raw('sum(get_amount) as total_get_amount'),
|
||||
])
|
||||
->where($where)
|
||||
->with([
|
||||
'member' => function ($query) {
|
||||
$query->select(['uid', 'nickname', 'realname', 'avatar']);
|
||||
}
|
||||
])
|
||||
->orderBy('uid', 'DESC')
|
||||
->paginate(10)
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common: 市场津贴结算
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 17:11
|
||||
*/
|
||||
public function bonusSettlement(){
|
||||
set_time_limit(0);
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
// 循环平台 进行处理
|
||||
$uniAccount = UniAccount::getEnable() ?: [];
|
||||
foreach ($uniAccount as $u) {
|
||||
Setting::$uniqueAccountId = \YunShop::app()->uniacid = $u->uniacid;
|
||||
// 获取未结算列表
|
||||
$list = self::uniacid()
|
||||
->select(['id','uid','get_amount'])
|
||||
->where('status',0)
|
||||
->get()
|
||||
->toArray();
|
||||
if($list){
|
||||
// 循环处理数据
|
||||
$incomeData = [];
|
||||
foreach($list as $item){
|
||||
$incomeData[] = [
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'member_id' => $item['uid'],
|
||||
'amount' => $item['get_amount'],
|
||||
'detail' => '',
|
||||
'dividend_table_id' => $item['id'],
|
||||
'dividend_code' => IncomeService::CULTURAL_SPACE_AREA_BONUS,
|
||||
'order_sn' => '',
|
||||
];
|
||||
}
|
||||
IncomeService::insertIncome($incomeData);
|
||||
// 修改为已经结算
|
||||
$ids = array_column($list,'id');
|
||||
self::whereIn('id',$ids)->update([
|
||||
'status' => 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
}catch(\Exception $e){
|
||||
\Log::debug('--- 文创空间 - 市场津贴结算 - 错误:'.$e->getMessage());
|
||||
DB::rollBack();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 一对一关联 用户信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:49
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function member(){
|
||||
return $this->hasOne(Member::class, 'uid', 'uid');
|
||||
}
|
||||
/**
|
||||
* Common: 一对一关联 周期信息
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:51
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function cycle(){
|
||||
return $this->hasOne(CulturalSpaceAreaCycle::class, 'id', 'cycle_id');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\common\models\OrderGoods;
|
||||
use app\common\models\UniAccount;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
use Yunshop\TeamDividend\models\TeamDividendLevelModel;
|
||||
|
||||
class CulturalSpaceAreaCycle extends BaseModel
|
||||
{
|
||||
public $table = 'yz_cultural_space_area_cycle';
|
||||
public $timestamps = false;
|
||||
public $casts = [
|
||||
'start_time' => 'datetime:Y-m-d H:i:s',
|
||||
'end_time' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'total_price',
|
||||
'allocation_price',
|
||||
'total_amount',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'created_at',
|
||||
];
|
||||
private $startTime,$endTime,$set,$orderTotalMoney,$bonusTotalMoney;
|
||||
/**
|
||||
* Common: 获取列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:47
|
||||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getList(){
|
||||
$list = self::uniacid()
|
||||
->orderBy('created_at','DESC')
|
||||
->orderBy('id','DESC')
|
||||
->paginate(10);
|
||||
|
||||
return $list ? $list->toArray() : [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 分红处理开始
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:22
|
||||
*/
|
||||
public function bonusInit(){
|
||||
set_time_limit(0);
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
[$this->startTime,$this->endTime] = getTimeStamp('yesterday');// yesterday 计算前一天信息
|
||||
// 循环平台 进行处理
|
||||
$uniAccount = UniAccount::getEnable() ?: [];
|
||||
foreach ($uniAccount as $u) {
|
||||
Setting::$uniqueAccountId = \YunShop::app()->uniacid = $u->uniacid;
|
||||
$this->set = Setting::get('plugin.cultural_space_set');
|
||||
// 判断:是否符合执行条件
|
||||
$isRun = (boolean)$this->isRun();
|
||||
// 判断:允许下一步
|
||||
if ($isRun) $this->bonusHandle();
|
||||
}
|
||||
|
||||
\Log::debug('--- 文创空间 - 市场津贴 - 结束 end----');
|
||||
DB::commit();
|
||||
}catch(\Exception $e){
|
||||
\Log::debug('--- 文创空间 - 市场津贴 - 错误:'.$e->getMessage());
|
||||
DB::rollBack();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Common: 判断是否允许继续执行
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:24
|
||||
* @return bool
|
||||
*/
|
||||
private function isRun(){
|
||||
$time = time();
|
||||
// 判断:设置是否开启市场津贴
|
||||
if((int)$this->set['area_bonus_switch'] != 1 || (float)$this->set['area_bonus_ratio'] <= 0) {
|
||||
\Log::debug("未开启市场津贴 || 总业绩比例为0或未设置",\YunShop::app()->uniacid);
|
||||
return false;
|
||||
}
|
||||
// 判断:时间上是否允许继续执行(上一个周期结束时间存在 & 当前时间小于下一个周期开始时间 禁止继续执行)
|
||||
$upCycleEndTime = self::uniacid()->max('end_time');
|
||||
$lastRunTime = strtotime(date("Y-m-d H:i:s",$upCycleEndTime)." +1 day");// 下一个周期结束时间
|
||||
if($upCycleEndTime > 0 && $time < $lastRunTime) {
|
||||
\Log::debug("执行时间错误(上一个周期结束时间{$upCycleEndTime},下一个周期结束时间{$lastRunTime})",\YunShop::app()->uniacid);
|
||||
return false;
|
||||
}
|
||||
// 判断:是否存在分红总金额 分红总金额,仅计算参与文创空间的商品的销售额
|
||||
$this->orderTotalMoney = (float)OrderGoods::uniacid()
|
||||
->leftjoin('yz_order','yz_order.id','=','yz_order_goods.order_id')
|
||||
->leftjoin('yz_goods_cultural_space','yz_goods_cultural_space.goods_id','=','yz_order_goods.goods_id')
|
||||
->where('yz_goods_cultural_space.is_open',1)
|
||||
->where('yz_order.pay_time','>=',$this->startTime)
|
||||
->where('yz_order.pay_time','<',$this->endTime)
|
||||
->where('yz_order.price','>',0)
|
||||
->where('yz_order.status','>',0)
|
||||
->sum('yz_order_goods.payment_amount');
|
||||
|
||||
$this->bonusTotalMoney = (float)sprintf("%.2f",$this->orderTotalMoney * (float)$this->set['area_bonus_ratio'] / 100);
|
||||
if($this->bonusTotalMoney <= 0) {
|
||||
\Log::debug("分红总金额为0",\YunShop::app()->uniacid);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Common: 处理每个站点所有用户的分红
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/05 16:24
|
||||
* @return bool|void
|
||||
*/
|
||||
private function bonusHandle(){
|
||||
// 获取当前站点参与分红的经销商等级id
|
||||
$teamLevelIds = TeamDividendLevelModel::uniacid()->where('is_join_bonus',1)->pluck('id')->toArray();
|
||||
if(count($teamLevelIds) <= 0) return true;
|
||||
// 获取参与的经销商列表
|
||||
$teamAgentIds = TeamDividendAgencyModel::uniacid()
|
||||
->where(function($query) use ($teamLevelIds){
|
||||
$query->whereIn('level',$teamLevelIds)
|
||||
->orWhereIn('cultural_level_id',$teamLevelIds);
|
||||
})
|
||||
->pluck('uid')
|
||||
->toArray();
|
||||
if(count($teamAgentIds) <= 0) return true;
|
||||
// 获取全部团队的小区业绩总和
|
||||
$minAreaSumAmount = (float)TeamDividendAgencyModel::teamMinAreaSumAmount();
|
||||
if($minAreaSumAmount <= 0) return true;
|
||||
// 记录周期分红信息
|
||||
$cycleId = self::insertGetId([
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'total_price' => $this->orderTotalMoney,
|
||||
'allocation_price' => $this->bonusTotalMoney,
|
||||
'total_amount' => $minAreaSumAmount,
|
||||
'start_time' => $this->startTime,
|
||||
'end_time' => $this->endTime,
|
||||
'created_at' => time(),
|
||||
]);
|
||||
// 循环处理信息
|
||||
$logInsertData = [];// 明细记录
|
||||
$uniacid = \YunShop::app()->uniacid;
|
||||
foreach($teamAgentIds as $currentUid){
|
||||
// 获取当前用户小区业绩
|
||||
$teamPerformance = (new CulturalSpace())->getTeamOrderAmount($currentUid);
|
||||
if($teamPerformance['area_amount'] <= 0) continue;
|
||||
// 添加市场津贴信息记录 这里必须进行100的偏移计算
|
||||
$radio = (float)sprintf("%.2f",$teamPerformance['area_amount'] / $minAreaSumAmount * 100);// 佣金比例
|
||||
$money = (float)sprintf("%.2f",$this->bonusTotalMoney * $radio / 100);// 实际获得佣金
|
||||
if($money > 0){
|
||||
$logInsertData[] = [
|
||||
'uniacid' => $uniacid,
|
||||
'uid' => $currentUid,
|
||||
'cycle_id' => $cycleId,
|
||||
'area_amount' => $teamPerformance['area_amount'],
|
||||
'area_rate' => $radio,
|
||||
'get_amount' => $money,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
CulturalSpaceAreaBonus::insert($logInsertData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
@extends('layouts.base')
|
||||
<style>
|
||||
.user{
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
overflow: hidden;
|
||||
height: 80px;
|
||||
}
|
||||
.user .user-avatar{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin-right: 5px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.user .user-avatar .avatar-image{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
.user .user-info{
|
||||
height: 50px;
|
||||
text-align: left;
|
||||
}
|
||||
.user .user-info .user-nickname{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.user .user-info .user-status{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.panel-body .label{
|
||||
display: inline-block;
|
||||
margin-bottom: 2px;
|
||||
border-radius: 2px;
|
||||
font-size: 14px!important;
|
||||
padding: 5px !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
.el-pagination{
|
||||
text-align: right!important;
|
||||
margin-top: 20px!important;
|
||||
}
|
||||
.panel-body{
|
||||
padding-top: 0;
|
||||
margin-bottom: 30px;
|
||||
overflow: auto;
|
||||
padding-right: 30px;
|
||||
}
|
||||
</style>
|
||||
@section('content')
|
||||
<div class="w1200 m0a" id="areaBonusIndexContent">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<el-tabs v-model="tabs_active" @tab-click="changeTabs">
|
||||
<el-tab-pane label="周期信息" name="show_cycle">
|
||||
<el-table :data="list" style="width: 100%" v-if="tabs_active == 'show_cycle'">
|
||||
<el-table-column align="center" prop="id" label="ID" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="total_price" label="周期总销售额"></el-table-column>
|
||||
<el-table-column align="center" prop="allocation_price" label="总分配金额"></el-table-column>
|
||||
<el-table-column align="center" prop="total_amount" label="周期总小区业绩"></el-table-column>>
|
||||
<el-table-column align="center" label="统计时间段" width="350">
|
||||
<template slot-scope="scope">
|
||||
[[scope.row.start_time]] ~ [[scope.row.end_time]]
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="seeChangeRecord(scope.row.id)">查看明细</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="分红明细" name="show_bonus">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_info">
|
||||
{{--<el-form-item label="是否结算">--}}
|
||||
{{-- <el-select v-model="search_info.status" placeholder="全部">--}}
|
||||
{{-- <el-option label="全部" value=""></el-option>--}}
|
||||
{{-- <el-option label="未结算" value="0"></el-option>--}}
|
||||
{{-- <el-option label="已结算" value="1"></el-option>--}}
|
||||
{{-- </el-select>--}}
|
||||
{{--</el-form-item>--}}
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_info.uid" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="clickSearch">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{--表单--}}
|
||||
<el-table :data="list" style="width: 100%" v-if="tabs_active == 'show_bonus'">
|
||||
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
|
||||
<el-table-column align="center" label="用户信息" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div class="user">
|
||||
<div class="user-avatar">
|
||||
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
|
||||
<div class="user-status">ID:[[scope.row.member.uid || '']]</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="area_amount" label="用户持有小区业绩"></el-table-column>
|
||||
<el-table-column align="center" label="小区业绩占比">
|
||||
<template slot-scope="scope">
|
||||
[[scope.row.area_rate]]%
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="get_amount" label="实际获得分红"></el-table-column>
|
||||
{{--<el-table-column align="center" prop="status" label="是否结算">--}}
|
||||
{{-- <template slot-scope="scope">--}}
|
||||
{{-- <el-tag :type="scope.row.status == 0 ? 'danger' : 'success'" disable-transitions>--}}
|
||||
{{-- [[scope.row.status == 0 ? '未结算' : '已结算']]--}}
|
||||
{{-- </el-tag>--}}
|
||||
{{-- </template>--}}
|
||||
{{--</el-table-column>--}}
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="用户持有" name="show_hold">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_info">
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_info.uid" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="clickSearch">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{--表单--}}
|
||||
<el-table :data="list" style="width: 100%" v-if="tabs_active == 'show_hold'">
|
||||
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
|
||||
<el-table-column align="center" label="用户信息" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div class="user">
|
||||
<div class="user-avatar">
|
||||
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
|
||||
<div class="user-status">ID:[[scope.row.member.uid || '']]</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="total_get_amount" label="实际获得分红总计"></el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
{{--分页--}}
|
||||
<el-pagination
|
||||
v-if="total_page > 1"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-count="total_page"
|
||||
:current-page="page"
|
||||
@current-change="changePage">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
new Vue({
|
||||
el: '#areaBonusIndexContent',
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'cultural_space_index_content',
|
||||
data() {
|
||||
return {
|
||||
tabs_active: 'show_cycle',
|
||||
// 分页信息
|
||||
page: 1,
|
||||
total_page: 1,
|
||||
list: [],
|
||||
search_info: {
|
||||
uid: '',
|
||||
cycle_id: '',
|
||||
status: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
watch:{},
|
||||
mounted () {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据 根据当前选项卡获取对应的信息
|
||||
getData(){
|
||||
let _this = this;
|
||||
let loading = _this.showLoading();
|
||||
// 请求获取数据
|
||||
$.ajax({
|
||||
url: "{!! yzWebUrl('plugin.cultural-space.admin.areaBonus.index') !!}",
|
||||
type: "post",
|
||||
data: {
|
||||
page: _this.page,
|
||||
search: _this.search_info,
|
||||
tabs_active: _this.tabs_active,
|
||||
},
|
||||
success: function(result) {
|
||||
let data = result.data;
|
||||
if(parseInt(result.result) === 1){
|
||||
// 处理数据
|
||||
_this.list = data.data;
|
||||
_this.total_page = data.last_page;
|
||||
}
|
||||
loading.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切换选项卡
|
||||
changeTabs(){
|
||||
this.page = 1;
|
||||
this.total_page = 1;
|
||||
this.list = [];
|
||||
this.search_info = Object.assign({},this.$options.data().search_info);
|
||||
this.getData();
|
||||
},
|
||||
// 数据分页
|
||||
changePage(val){
|
||||
this.page = val;
|
||||
this.getData();
|
||||
},
|
||||
// 相关搜索
|
||||
clickSearch(){
|
||||
this.page = 1;
|
||||
this.getData()
|
||||
},
|
||||
// 显示加载动画
|
||||
showLoading(){
|
||||
return this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 用户持有统计中查看某个用户的贡献值变更记录
|
||||
seeChangeRecord(id){
|
||||
this.page = 1;
|
||||
this.total_page = 1;
|
||||
this.list = [];
|
||||
this.search_info = Object.assign({},this.$options.data().search_info);
|
||||
this.search_info.cycle_id = id;
|
||||
this.tabs_active = 'show_bonus';
|
||||
this.getData()
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
@ -91,7 +91,6 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="基金设置" name="set_fund">
|
||||
<div class="vue-main-title">
|
||||
|
|
@ -206,8 +205,30 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
|
||||
<el-tab-pane label="市场津贴设置" name="set_area_bonus">
|
||||
<div class="vue-main-title" >
|
||||
<div class="vue-main-title-left"></div>
|
||||
<div class="vue-main-title-content">市场津贴设置</div>
|
||||
</div>
|
||||
<div class="vue-main-form">
|
||||
<div class="vue-main-form">
|
||||
<el-form-item label="是否开启市场津贴" prop="area_bonus_switch">
|
||||
<div style="line-height:40px">
|
||||
<el-radio v-model.number="set.area_bonus_switch" :label="0">不开启</el-radio>
|
||||
<el-radio v-model.number="set.area_bonus_switch" :label="1">开启</el-radio>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div v-if="set.area_bonus_switch == 1">
|
||||
<el-form-item label="分红比例" prop="area_bonus_ratio">
|
||||
<el-input type="number" placeholder="贡献值奖励比例" v-model.number="set.area_bonus_ratio" step="0.01">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
<div class="form-item_tips">前一天订单实际支付的N%;按照小区业绩比例奖励奖励给指定等级的经销商作为市场津贴</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
{{--保存按钮--}}
|
||||
<el-form-item>
|
||||
|
|
@ -240,6 +261,7 @@
|
|||
set: JSON.parse('{!! json_encode($set) !!}') || {
|
||||
is_give_contribution: 0,
|
||||
is_open_contribution_bonus: 0,
|
||||
area_bonus_switch: 0,
|
||||
},
|
||||
poster_list: JSON.parse('{!! json_encode($poster_list) !!}') || {},
|
||||
home_link_list: [
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@
|
|||
</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>--}}
|
||||
|
|
@ -177,8 +176,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">
|
||||
|
|
@ -188,8 +185,6 @@
|
|||
</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">
|
||||
|
|
@ -202,6 +197,20 @@
|
|||
<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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue