parent
fce9fb8252
commit
e776d98a33
|
|
@ -42,9 +42,19 @@ class MemberParent extends BaseModel
|
|||
->get()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common: 获取用户直推上级用户ID
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/02 16:13
|
||||
* @param $uid
|
||||
* @return int
|
||||
*/
|
||||
public static function getParentId($uid){
|
||||
return (int)self::uniacid()
|
||||
->where('member_id', $uid)
|
||||
->where('level',1)// 只获取直推间推
|
||||
->value('parent_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
## 文创空间
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
app\common\events\PluginWasEnabled::class => function ($plugins) {
|
||||
\Artisan::call('migrate',['--path'=>'plugins/cultural-space/migrations','--force'=>true]);
|
||||
},
|
||||
app\common\events\PluginWasDisabled::class => function ($plugin) {
|
||||
|
||||
|
||||
},
|
||||
app\common\events\PluginWasDeleted::class => function () {
|
||||
\Artisan::call('migrate:rollback',['--path'=>'plugins/cultural-space/migrations']);
|
||||
}
|
||||
];
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
$.extend($.locales['en'], {
|
||||
'welfare': {
|
||||
test: "JavaScript i18n test: English"
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'title'=>'this is test title'
|
||||
];
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
$.extend($.locales['zh-CN'], {
|
||||
'welfare': {
|
||||
test: "JavaScript i18n test: 简体中文"
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'title'=>'测试标题'
|
||||
];
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "cultural-space",
|
||||
"terminal": "wechat|min|wap",
|
||||
"version": "1.0.1",
|
||||
"title": "文创空间",
|
||||
"description": "文创空间",
|
||||
"author": "zzw",
|
||||
"url": "",
|
||||
"namespace": "Yunshop\\CulturalSpace",
|
||||
"config": "config.tpl"
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace;
|
||||
|
||||
|
||||
|
||||
use Yunshop\CulturalSpace\listener\OrderPaidListener;
|
||||
|
||||
class PluginApplication extends \app\common\services\PluginApplication{
|
||||
|
||||
protected function setMenuConfig(){
|
||||
\app\backend\modules\menu\Menu::current()->setPluginMenu('cultural-space', [
|
||||
'name' => '文创空间',
|
||||
'type' => 'marketing',
|
||||
'url' => 'plugin.cultural-space.admin.index.index',// url 可以填写http 也可以直接写路由
|
||||
'url_params' => '',//如果是url填写的是路由则启用参数否则不启用
|
||||
'permit' => 1,//如果不设置则不会做权限检测
|
||||
'menu' => 1,//如果不设置则不显示菜单,子菜单也将不显示
|
||||
'icon' => '',//菜单图标
|
||||
'list_icon' => 'cultural-space',
|
||||
'parents' => [],
|
||||
'top_show' => 0,
|
||||
'left_first_show' => 0,
|
||||
'left_second_show' => 1,
|
||||
'child' => [
|
||||
/* 'plugin_cultural_space_index' => [
|
||||
'name' => '文创空间',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.index.index',
|
||||
'url_params' => '',
|
||||
'item' => 'plugin_cultural_space_index',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_index_index' => [
|
||||
'name' => '权重值明细',
|
||||
'url' => 'plugin.cultural-space.admin.index.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_index_index',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_index']
|
||||
],
|
||||
'plugin_cultural_space_index_record' => [
|
||||
'name' => '变更记录',
|
||||
'url' => 'plugin.cultural-space.admin.index.record',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_index_record',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_index']
|
||||
],
|
||||
]
|
||||
],*/
|
||||
|
||||
|
||||
'plugin_cultural_space_contribution' => [
|
||||
'name' => '贡献值管理',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.contribution.index',
|
||||
'url_params' => '',
|
||||
'item' => 'plugin_cultural_space_contribution',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_contribution_index' => [
|
||||
'name' => '变更明细',
|
||||
'url' => 'plugin.cultural-space.admin.contribution.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_contribution_index',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_contribution']
|
||||
],
|
||||
'plugin_cultural_space_contribution_hold' => [
|
||||
'name' => '用户持有统计',
|
||||
'url' => 'plugin.cultural-space.admin.contribution.hold',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_contribution_hold',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_contribution']
|
||||
],
|
||||
'plugin_cultural_space_contribution_bonus' => [
|
||||
'name' => '分红记录',
|
||||
'url' => 'plugin.cultural-space.admin.contribution.bonus',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_contribution_bonus',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_contribution']
|
||||
],
|
||||
]
|
||||
],
|
||||
'plugin_cultural_space_set' => [
|
||||
'name' => '基本设置',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.index.set',
|
||||
'url_params' => '',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_index_set' => [
|
||||
'name' => '基本设置',
|
||||
'url' => 'plugin.cultural-space.admin.index.set',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_index_set',
|
||||
'parents' => ['cultural-space', 'plugin_cultural_space_set'],
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getWidgetItems()
|
||||
{
|
||||
return [
|
||||
'vue-goods.cultural_space' => [
|
||||
'title' => '文创空间',
|
||||
'class' => \Yunshop\CulturalSpace\admin\widget\CulturalSpaceWidget::class,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
protected function setConfig(){
|
||||
\app\common\modules\shop\ShopConfig::current()->set(
|
||||
'observer.goods.cultural_space', [
|
||||
'class' => 'Yunshop\CulturalSpace\models\GoodsCulturalSpace',
|
||||
'function_save' => 'relationSave'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function boot(){
|
||||
$events = app('events');
|
||||
|
||||
// 订单支付成功
|
||||
$events->subscribe(OrderPaidListener::class);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\admin;
|
||||
|
||||
use app\common\components\BaseController;
|
||||
|
||||
|
||||
class ContributionController extends BaseController{
|
||||
|
||||
// 列表
|
||||
public function index(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return view('Yunshop\CulturalSpace::contribution.index')->render();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\admin;
|
||||
|
||||
use app\common\components\BaseController;
|
||||
use app\common\facades\Setting;
|
||||
|
||||
class IndexController extends BaseController{
|
||||
|
||||
// 列表
|
||||
public function index(){
|
||||
|
||||
|
||||
return view('Yunshop\CulturalSpace::index.index')->render();
|
||||
}
|
||||
/**
|
||||
* Common: 设置信息编辑
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/02 13:50
|
||||
* @return array|mixed|string|void
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function set(){
|
||||
// 获取设置信息 判断是否为设置
|
||||
$setInfo = request()->input('cultural_space_set');
|
||||
if ($setInfo) {
|
||||
// 设置信息
|
||||
if (Setting::set('plugin.cultural_space_set', $setInfo)) return $this->successJson('编辑成功');
|
||||
else return $this->errorJson('设置失败');
|
||||
}else{
|
||||
// 获取信息
|
||||
$set = Setting::get('plugin.cultural_space_set');
|
||||
|
||||
return view('Yunshop\CulturalSpace::index.set',[
|
||||
'set' => $set,
|
||||
])->render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function test(){
|
||||
|
||||
// (new CulturalSpace())->buyGoodsGiveContribution(19,76);// 订单支付成功奖励贡献值
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Yunshop\CulturalSpace\admin\widget;
|
||||
|
||||
use app\backend\modules\goods\widget\BaseGoodsWidget;
|
||||
use Yunshop\CulturalSpace\models\GoodsCulturalSpace;
|
||||
|
||||
class CulturalSpaceWidget extends BaseGoodsWidget{
|
||||
public $group = 'marketing';
|
||||
public $widget_key = 'cultural_space';
|
||||
public $code = 'cultural_space';
|
||||
|
||||
|
||||
public function pluginFileName(){
|
||||
return 'goods';
|
||||
}
|
||||
|
||||
public function getData(){
|
||||
return GoodsCulturalSpace::uniacid()
|
||||
->where('goods_id', $this->goods->id)
|
||||
->first();
|
||||
}
|
||||
|
||||
public function pagePath(){
|
||||
return plugin_assets('cultural-space','views/widget');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace Yunshop\CulturalSpace\listener;
|
||||
|
||||
use app\common\events\order\AfterOrderPaidEvent;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpace;
|
||||
|
||||
class OrderPaidListener{
|
||||
|
||||
use DispatchesJobs;
|
||||
|
||||
public function subscribe(Dispatcher $events){
|
||||
$events->listen(AfterOrderPaidEvent::class, self::class . '@handle');
|
||||
}
|
||||
|
||||
public function handle(AfterOrderPaidEvent $event){
|
||||
date_default_timezone_set("PRC");
|
||||
$model = $event->getOrderModel();
|
||||
// 订单支付成功奖励贡献值
|
||||
(new CulturalSpace())->buyGoodsGiveContribution($model->uid,$model->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\models\BaseModel;
|
||||
|
||||
class ContributionLog extends BaseModel{
|
||||
|
||||
public $table = 'yz_cultural_space_contribution_log';
|
||||
public $timestamps = false;
|
||||
public $casts = [
|
||||
'created_at' => 'datetime:Y-m-d h:i:s'
|
||||
];
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'goods_id',
|
||||
'order_id',
|
||||
'order_goods_id',
|
||||
'change_type',
|
||||
'change_quantity',
|
||||
'change_front',
|
||||
'change_after',
|
||||
'remark',
|
||||
'created_at',
|
||||
'source'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\common\models\Member;
|
||||
use app\common\models\member\MemberParent;
|
||||
use app\common\models\OrderGoods;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CulturalSpace extends BaseModel{
|
||||
|
||||
public $table = 'yz_cultural_space';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'contribution'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Common: 购买商品奖励贡献值
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/02 17:59
|
||||
* @param $uid
|
||||
* @param $orderId
|
||||
*/
|
||||
public function buyGoodsGiveContribution($uid,$orderId){
|
||||
\Log::debug('文创空间 - 购买商品奖励贡献值',['uid' => $uid,'order_id' => $orderId]);
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
$set = Setting::get('plugin.cultural_space_set');
|
||||
if($set['is_give_contribution'] != 1 || (float)$set['contribution_ratio'] <= 0) throw new \Exception('文创空间 - 购买商品奖励贡献值 - 未开启贡献值奖励或者奖励比例为0');
|
||||
// 获取直推上级id && 获取订单商品信息
|
||||
$parentUid = (int)MemberParent::getParentId($uid);
|
||||
$orderGoodsList = (array)$this->getGoodsModel($orderId)
|
||||
->where('yz_goods_cultural_space.is_give_contribution',1)
|
||||
->get()
|
||||
->makeHidden(['buttons','after_sales','order'])
|
||||
->toArray();
|
||||
if(count($orderGoodsList) <= 0) throw new \Exception('文创空间 - 购买商品奖励贡献值 - 无奖励商品信息');
|
||||
// 获取文创空间用户信息
|
||||
$memberList = $parentUid <= 0 ? $this->getCulturalSpace([$uid]) : $this->getCulturalSpace([$uid,$parentUid]);
|
||||
$userName = Member::getMemberById($uid,['realname','nickname'])->username ?? '';
|
||||
// 循环商品处理奖励贡献值
|
||||
$changeList = [];
|
||||
foreach($orderGoodsList as $goodsInfo){
|
||||
// 计算奖励贡献值
|
||||
$contribution = (float)sprintf('%.2f',$goodsInfo['payment_amount'] * (float)$set['contribution_ratio'] / 100);
|
||||
if($contribution > 0){
|
||||
foreach($memberList as $memberInfo){
|
||||
// 用户当前持有数量
|
||||
$changeFront = (float)$memberList[$memberInfo['uid']]['contribution'];
|
||||
// 变更后的数量
|
||||
$changeAfter = (float)sprintf("%.2f",$changeFront + $contribution);
|
||||
// 记录变更信息
|
||||
$changeList[] = [
|
||||
'uniacid' => $goodsInfo['uniacid'],
|
||||
'uid' => $memberInfo['uid'],
|
||||
'goods_id' => $goodsInfo['goods_id'],
|
||||
'order_id' => $orderId,
|
||||
'order_goods_id' => $goodsInfo['id'],
|
||||
'change_type' => 1,
|
||||
'change_quantity' => $contribution,
|
||||
'change_front' => $changeFront,
|
||||
'change_after' => $changeAfter,
|
||||
'remark' => ($memberInfo['uid'] == $uid ? '' : "【{$userName}】") . "购买商品【{$goodsInfo['title']}】赠送",
|
||||
'created_at' => time(),
|
||||
];
|
||||
// 刷新持有处理
|
||||
$memberList[$memberInfo['uid']]['contribution'] = $changeAfter;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据操作
|
||||
if(count($changeList) > 0) {
|
||||
$this->batchUpdate($memberList,'uid','uid');
|
||||
ContributionLog::insert($changeList);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
}catch(\Exception $e){
|
||||
\Log::debug('文创空间 - 购买商品奖励贡献值 - 错误抛出',$e->getMessage());
|
||||
DB::rollBack();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Common: 获取订单商品查询model
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/02 16:26
|
||||
* @param $orderId
|
||||
* @return mixed
|
||||
*/
|
||||
private function getGoodsModel($orderId){
|
||||
return OrderGoods::uniacid()
|
||||
->select([
|
||||
'yz_order_goods.id',
|
||||
'yz_order_goods.uniacid',
|
||||
'yz_order_goods.goods_id',
|
||||
'yz_order_goods.total',
|
||||
'yz_order_goods.title',
|
||||
'yz_order_goods.payment_amount',
|
||||
])
|
||||
->leftJoin('yz_goods_cultural_space', 'yz_goods_cultural_space.goods_id', 'yz_order_goods.goods_id')
|
||||
->where('yz_order_goods.order_id',$orderId)
|
||||
->where('yz_goods_cultural_space.is_open',1);
|
||||
}
|
||||
/**
|
||||
* Common: 根据用户ids获取用户文创空间相关信息(如果不存在则添加默认信息并且返回默认信息)
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/02 17:36
|
||||
* @param $ids
|
||||
* @return array
|
||||
*/
|
||||
private function getCulturalSpace($ids){
|
||||
// 获取已经存在的信息
|
||||
$list = self::uniacid()
|
||||
->select(['id','uid','contribution'])
|
||||
->whereIn('uid',$ids)
|
||||
->get()
|
||||
->keyBy('uid')
|
||||
->toArray();
|
||||
// 循环处理:不存在则添加,并且赋值默认值;存在则使用已经存在的信息
|
||||
$memberList = [];
|
||||
$insertData = [];
|
||||
foreach($ids as $userId){
|
||||
if($list[$userId]){
|
||||
// 存在
|
||||
$memberList[$userId] = $list[$userId];
|
||||
}else{
|
||||
// 不存在
|
||||
$insertData[] = [
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $userId,
|
||||
];
|
||||
$memberList[$userId] = [
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $userId,
|
||||
'contribution' => 0
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if($insertData) self::insert($insertData);
|
||||
|
||||
return $memberList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\models\BaseModel;
|
||||
use app\frontend\models\Goods;
|
||||
|
||||
class GoodsCulturalSpace extends BaseModel{
|
||||
|
||||
public $table = 'yz_goods_cultural_space';
|
||||
public $timestamps = false;
|
||||
|
||||
public static function relationSave($goodsId, $data, $operate){
|
||||
if (!$goodsId) return false;
|
||||
if (!$data) return false;
|
||||
|
||||
$info = self::getModel($goodsId, $operate);
|
||||
// 判断deleted
|
||||
if ($operate == 'deleted') return $info->delete();
|
||||
// 公共
|
||||
$info->uniacid = \YunShop::app()->uniacid;
|
||||
$info->goods_id = $goodsId;// 商品ID
|
||||
$info->is_open = $data['is_open'] ?? 0;// 当前商品是否参与文创空间:0=未开启,1=开启
|
||||
$info->is_give_contribution = $data['is_give_contribution'] ?? 0;// 是否赠送贡献值:0=不赠送,1=赠送
|
||||
|
||||
|
||||
|
||||
return $info->save();
|
||||
}
|
||||
|
||||
public static function getModel($goodsId, $operate){
|
||||
$model = false;
|
||||
// 商品设置
|
||||
if ($operate != 'created') $model = static::where(['goods_id' => $goodsId])->first();
|
||||
|
||||
!$model && $model = new static;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function getGoodsSet($goodsId){
|
||||
self::where('goods_id', $goodsId);
|
||||
}
|
||||
|
||||
//关联商品信息
|
||||
public function belongsToGoods(){
|
||||
return $this->belongsTo(Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,305 @@
|
|||
@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;
|
||||
}
|
||||
.level_0{
|
||||
background-color: #5bc0de!important;
|
||||
}
|
||||
.level_1{
|
||||
background-color: #f0ad4e!important;
|
||||
}
|
||||
.level_2{
|
||||
background-color: #5cb85c!important;
|
||||
}
|
||||
.level_3{
|
||||
background-color: #337ab7!important;
|
||||
}
|
||||
.level_4{
|
||||
background-color: #d9534f!important;
|
||||
}
|
||||
.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="contributionIndexContent">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<el-tabs v-model="tabs_active" @tab-click="changeTabs">
|
||||
<el-tab-pane label="变更明细" name="show_detail">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="变更类型">
|
||||
<el-select v-model="search_list.change_type" 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_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</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%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="member" label="用户信息" width="230">
|
||||
<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="change_front" label="变更前持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_type" label="变更类型" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.change_type == 0 ? 'danger' : 'success'" disable-transitions>
|
||||
[[scope.row.change_type == 0 ? '减少' : '增加']]
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="变更数量" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_after" label="变更后持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="权重值类型" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="remark" label="变更原因"></el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="变更时间" width="200"></el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="统计明细" name="show_group">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</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%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
|
||||
<el-table-column align="center" prop="member" 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="change_quantity" label="权重值类型">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_front">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span class="label label-default">平台总数</span>
|
||||
<span class="label label-info">用户持有</span>
|
||||
<span class="label label-warning">占比(%)</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<span class="label label-default">[[scope.row.total_quantity || '0.00' ]]</span>
|
||||
<span class="label label-info">[[scope.row.quantity || '0.00' ]]</span>
|
||||
<span class="label label-warning">[[scope.row.ratio ? scope.row.ratio + '%' : '0.00' ]]</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="seeDetail(scope.row.member_id,scope.row.team_dividend_agency_level_id)">变更明细</el-button>
|
||||
</template>
|
||||
</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: '#contributionIndexContent',
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'cultural_space_index_content',
|
||||
data: {
|
||||
tabs_active: 'show_detail',
|
||||
level_list: JSON.parse('{!! json_encode($level_list) !!}'),
|
||||
// 分页信息
|
||||
page: 1,
|
||||
total_page: 1,
|
||||
list: [],
|
||||
search_list: {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
}
|
||||
},
|
||||
watch:{},
|
||||
mounted () {
|
||||
// this.getData();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据 根据当前选项卡获取对应的信息
|
||||
getData(){
|
||||
let _this = this;
|
||||
let loading = _this.showLoading();
|
||||
let link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeRecord') !!}";
|
||||
if(_this.tabs_active === 'show_group') link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeGroupRecord') !!}";
|
||||
$.ajax({
|
||||
url: link,
|
||||
type: "post",
|
||||
data: {
|
||||
page: _this.page,
|
||||
search: _this.search_list,
|
||||
is_get: 1
|
||||
},
|
||||
success: function(result) {
|
||||
loading.close(0);
|
||||
let data = result.data;
|
||||
if(parseInt(result.result) === 1){
|
||||
// 处理数据
|
||||
_this.list = data.data;
|
||||
_this.total_page = data.last_page;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切换选项卡
|
||||
changeTabs(){
|
||||
this.page = 1;
|
||||
this.search_list = {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
};
|
||||
this.total_page = 1;
|
||||
this.list = [];
|
||||
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)'
|
||||
});
|
||||
},
|
||||
// 查看分组的变更明细
|
||||
seeDetail(member_id,level_id){
|
||||
let link = "{{yzWebUrl('plugin.cultural-space.admin.index.changeRecord')}}" + `&member_id=${member_id}&level_id=${level_id}`;
|
||||
let popup = util.ajaxshow(link,'权重值变更明细',{
|
||||
width: $(window).width() * 0.8 > 1200 ? $(window).width() * 0.8 : 1200,
|
||||
height: $(window).height() * 0.8 > 1200 ? $(window).height() * 0.8 : 1200,
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
@ -0,0 +1,305 @@
|
|||
@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;
|
||||
}
|
||||
.level_0{
|
||||
background-color: #5bc0de!important;
|
||||
}
|
||||
.level_1{
|
||||
background-color: #f0ad4e!important;
|
||||
}
|
||||
.level_2{
|
||||
background-color: #5cb85c!important;
|
||||
}
|
||||
.level_3{
|
||||
background-color: #337ab7!important;
|
||||
}
|
||||
.level_4{
|
||||
background-color: #d9534f!important;
|
||||
}
|
||||
.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="weightValueIndexContent">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<el-tabs v-model="tabs_active" @tab-click="changeTabs">
|
||||
<el-tab-pane label="变更明细" name="show_detail">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="变更类型">
|
||||
<el-select v-model="search_list.change_type" 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_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</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%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="member" label="用户信息" width="230">
|
||||
<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="change_front" label="变更前持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_type" label="变更类型" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.change_type == 0 ? 'danger' : 'success'" disable-transitions>
|
||||
[[scope.row.change_type == 0 ? '减少' : '增加']]
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="变更数量" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_after" label="变更后持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="权重值类型" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="remark" label="变更原因"></el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="变更时间" width="200"></el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="统计明细" name="show_group">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</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%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
|
||||
<el-table-column align="center" prop="member" 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="change_quantity" label="权重值类型">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_front">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span class="label label-default">平台总数</span>
|
||||
<span class="label label-info">用户持有</span>
|
||||
<span class="label label-warning">占比(%)</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<span class="label label-default">[[scope.row.total_quantity || '0.00' ]]</span>
|
||||
<span class="label label-info">[[scope.row.quantity || '0.00' ]]</span>
|
||||
<span class="label label-warning">[[scope.row.ratio ? scope.row.ratio + '%' : '0.00' ]]</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="seeDetail(scope.row.member_id,scope.row.team_dividend_agency_level_id)">变更明细</el-button>
|
||||
</template>
|
||||
</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: '#weightValueIndexContent',
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'cultural_space_index_content',
|
||||
data: {
|
||||
tabs_active: 'show_detail',
|
||||
level_list: JSON.parse('{!! json_encode($level_list) !!}'),
|
||||
// 分页信息
|
||||
page: 1,
|
||||
total_page: 1,
|
||||
list: [],
|
||||
search_list: {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
}
|
||||
},
|
||||
watch:{},
|
||||
mounted () {
|
||||
// this.getData();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据 根据当前选项卡获取对应的信息
|
||||
getData(){
|
||||
let _this = this;
|
||||
let loading = _this.showLoading();
|
||||
let link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeRecord') !!}";
|
||||
if(_this.tabs_active === 'show_group') link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeGroupRecord') !!}";
|
||||
$.ajax({
|
||||
url: link,
|
||||
type: "post",
|
||||
data: {
|
||||
page: _this.page,
|
||||
search: _this.search_list,
|
||||
is_get: 1
|
||||
},
|
||||
success: function(result) {
|
||||
loading.close(0);
|
||||
let data = result.data;
|
||||
if(parseInt(result.result) === 1){
|
||||
// 处理数据
|
||||
_this.list = data.data;
|
||||
_this.total_page = data.last_page;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切换选项卡
|
||||
changeTabs(){
|
||||
this.page = 1;
|
||||
this.search_list = {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
};
|
||||
this.total_page = 1;
|
||||
this.list = [];
|
||||
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)'
|
||||
});
|
||||
},
|
||||
// 查看分组的变更明细
|
||||
seeDetail(member_id,level_id){
|
||||
let link = "{{yzWebUrl('plugin.cultural-space.admin.index.changeRecord')}}" + `&member_id=${member_id}&level_id=${level_id}`;
|
||||
let popup = util.ajaxshow(link,'权重值变更明细',{
|
||||
width: $(window).width() * 0.8 > 1200 ? $(window).width() * 0.8 : 1200,
|
||||
height: $(window).height() * 0.8 > 1200 ? $(window).height() * 0.8 : 1200,
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
@extends('layouts.base')
|
||||
@section('title', '基本设置')
|
||||
@section('content')
|
||||
<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
|
||||
<link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
|
||||
<style>
|
||||
.vue-head{
|
||||
max-width: 900px!important;
|
||||
}
|
||||
.form-item_tips {
|
||||
margin-top:8px;
|
||||
line-height:26px;
|
||||
color: #b5b5b5;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
<div class="all" id="app">
|
||||
<el-form :model="set" label-width="170px">
|
||||
<div class="vue-head">
|
||||
<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">
|
||||
<el-form-item label="是否开启奖励" prop="is_give_contribution">
|
||||
<div style="line-height:40px">
|
||||
<el-radio v-model.number="set.is_give_contribution" :label="0">不开启</el-radio>
|
||||
<el-radio v-model.number="set.is_give_contribution" :label="1">开启</el-radio>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div v-if="set.is_give_contribution == 1">
|
||||
<el-form-item label="奖励比例" prop="contribution_ratio">
|
||||
<el-input type="number" placeholder="贡献值奖励比例" v-model.number="set.contribution_ratio" step="0.01">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
<div class="form-item_tips">订单实际支付的N%奖励给用户及直推上级,作为贡献值。0或者空则无贡献值奖励</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="分红比例" prop="contribution_bonus_ratio">
|
||||
<el-input type="number" placeholder="贡献值分红比例" v-model.number="set.contribution_bonus_ratio" step="0.01">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
<div class="form-item_tips">周期销售额的N%用作分红总金额,根据每个人当前贡献值比例进行分红;0或者空则无贡献值奖励</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
{{--保存按钮--}}
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" @click="onSubmit">保存</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el:"#app",
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'test',
|
||||
data() {
|
||||
return{
|
||||
set: JSON.parse('{!! json_encode($set) !!}') || {
|
||||
is_give_contribution: 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
// 提交
|
||||
onSubmit() {
|
||||
let _this = this;
|
||||
_this.$http.post('{!! yzWebFullUrl('plugin.cultural-space.admin.index.set') !!}', {
|
||||
cultural_space_set: _this.set
|
||||
}).then(function (response) {
|
||||
let res = response.body;
|
||||
_this.$message({
|
||||
message: res.msg,
|
||||
type: res.result == 1 ? 'success' : 'error'
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
define({
|
||||
name:"cultural_space",
|
||||
template:`
|
||||
<div class="cultural_space">
|
||||
<el-form>
|
||||
<div style="margin:0 auto;width:80%;">
|
||||
<el-form-item label="是否开启" label-width="155px">
|
||||
<el-radio v-model="json.is_open" :label="0">关闭</el-radio>
|
||||
<el-radio v-model="json.is_open" :label="1">开启</el-radio>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<template v-if="json.is_open == 1">
|
||||
<div style="margin:0 auto;width:80%;">
|
||||
<el-form-item label="是否赠送贡献值" label-width="155px">
|
||||
<el-radio v-model="json.is_give_contribution" :label="0">不开启</el-radio>
|
||||
<el-radio v-model="json.is_give_contribution" :label="1">开启</el-radio>
|
||||
<div class="form-item_tips">赠送贡献值比例在文创空间基本设置中同意设置</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</el-form>
|
||||
</div>
|
||||
`,
|
||||
style:`
|
||||
.ladder-content{
|
||||
min-width: 550px!important;
|
||||
}
|
||||
.ladder-content .ladder-row{
|
||||
margin-bottom: 5px!important;
|
||||
}
|
||||
.ladder-content .ladder-row .ladder-input{
|
||||
width: 230px!important;
|
||||
}
|
||||
`,
|
||||
props: {
|
||||
form: {
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
json: {
|
||||
is_open: 0,// 当前商品是否参与文创空间:0=未开启,1=开启
|
||||
is_give_contribution: 0,// 是否赠送贡献值:0=不赠送,1=赠送
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: { },
|
||||
mounted() {
|
||||
if (this.form) {
|
||||
let cultural_space = this.form || {};
|
||||
console.log('商品权重值设置信息');
|
||||
console.log(cultural_space);
|
||||
this.json.is_open = cultural_space.is_open ? cultural_space.is_open : 0;
|
||||
this.json.is_give_contribution = cultural_space.is_give_contribution ? cultural_space.is_give_contribution : 0;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
validate(){
|
||||
|
||||
return this.json;
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Reference in New Issue