From 0cd0069f0f6bc07975914b6aa887b4113b84ea08 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Mon, 16 Oct 2023 17:11:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=9D=83=E9=87=8D?= =?UTF-8?q?=E5=80=BC=20-=20=E7=BB=8F=E9=94=80=E5=95=86=E8=B5=A0=E9=80=81?= =?UTF-8?q?=E6=9D=83=E9=87=8D=E5=80=BC=E8=AE=BE=E7=BD=AE=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/TeamDividendLevelSetController.php | 20 ++ .../views/admin/level-set-add.blade.php | 202 +++++++++++++++--- .../src/models/GoodsWeightValue.php | 18 +- .../src/models/WeightValueLog.php | 1 + 4 files changed, 208 insertions(+), 33 deletions(-) diff --git a/plugins/team-dividend/src/admin/TeamDividendLevelSetController.php b/plugins/team-dividend/src/admin/TeamDividendLevelSetController.php index 64a8d1d5..e151337f 100644 --- a/plugins/team-dividend/src/admin/TeamDividendLevelSetController.php +++ b/plugins/team-dividend/src/admin/TeamDividendLevelSetController.php @@ -10,6 +10,7 @@ use Illuminate\Support\Str; use Yunshop\TeamDividend\admin\models\LevelRedPack; use Yunshop\TeamDividend\models\TeamDividendLevelModel; use Yunshop\TeamDividend\models\TeamDividendLevelUpgrade; +use Yunshop\WeightValue\models\GoodsWeightValue; class TeamDividendLevelSetController extends BaseController { @@ -80,6 +81,13 @@ class TeamDividendLevelSetController extends BaseController $upgrade_modle->save(); + + // 权重值处理 + $wv = request()->wv ?? []; + $wv['is_open'] = 1;// 经销商设置 默认开启 + if($wv) GoodsWeightValue::relationSave($team_dividend_level_model->id, $wv, 'created',true); + + return $this->message('经销商等级操作成功', yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set'), 'success'); } } @@ -236,6 +244,11 @@ class TeamDividendLevelSetController extends BaseController $upgrade_modle->save(); } + // 权重值处理 + $wv = request()->wv ?? []; + $wv['is_open'] = 1;// 经销商设置 默认开启 + if($wv) GoodsWeightValue::relationSave($id, $wv, 'updated',true); + return $this->message('经销商等级操作成功', yzWebUrl('plugin.team-dividend.admin.team-dividend-level-set'), 'success'); } } @@ -245,6 +258,12 @@ class TeamDividendLevelSetController extends BaseController $goldSet = array_pluck(\Setting::getAllByGroup('Love')->toArray(), 'value', 'key'); $goldTitle = $goldSet['name'] ? $goldSet['name'] : '爱心值'; $settingData = \Setting::get('plugin.team_dividend'); + + // 权重值信息 + $wv = (new GoodsWeightValue())->getGoodsSet($id,true)->first(); + $wv = $wv ? $wv->toArray() : []; + + return view('Yunshop\TeamDividend::admin.level-set-add', [ 'dividend' => $dividend_model, 'code_num' => $dividend_model->code_num, @@ -258,6 +277,7 @@ class TeamDividendLevelSetController extends BaseController 'goldTitle' => $goldTitle, 'settingData' => $settingData, 'goods' => $goods, + 'wv' => $wv ])->render(); } diff --git a/plugins/team-dividend/views/admin/level-set-add.blade.php b/plugins/team-dividend/views/admin/level-set-add.blade.php index 8426cfa3..ed47e3fe 100644 --- a/plugins/team-dividend/views/admin/level-set-add.blade.php +++ b/plugins/team-dividend/views/admin/level-set-add.blade.php @@ -5,14 +5,62 @@ .radio-inline + .radio-inline { margin: 0; } - .row { width: 100%; } - #goodsthumb { margin-left: 20px; } + .weight-value-content{} + .weight-value-content .title{ + display: flex; + height: 30px; + line-height: 32px; + font-size: 16px; + color: #333; + font-weight: 600; + } + .weight-value-content .title-left{ + width: 4px; + height: 18px; + margin-top: 6px; + background: #29ba9c; + display: inline-block; + margin-right: 10px; + } + .weight-value-content .title-content{ + font-size: 14px; + flex: 1; + } + .weight-value-content .weight-value-top-content{ + height: 34px; + display: -webkit-inline-box; + } + .weight-value-content .weight-value-top-content .weight-value-lable{ + width: 70px!important; + height: 34px; + line-height: 20px; + } + .weight-value-content .weight-value-top-content .weight-value-radio{ + padding-right: 55px; + height: 34px; + } + .weight-value-content .weight-value-top-content .radio-inline{ + padding: 0px!important; + width: 50%; + margin-left: 10px; + display: inline-flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; + justify-content: flex-start; + } + .weight-value-content .weight-value-top-content .radio-inline:nth-child(2){ + margin-left: 20px!important; + } + .del-ladder-btn{ + cursor: pointer; + }
@@ -34,7 +82,6 @@ 等级权重,数字越大级别越高。
-
@@ -43,7 +90,6 @@ value="{{$dividend->level_name}}"/>
-
@@ -54,7 +100,6 @@ 当前等级总人数达到指定数量后,其他人则不能升级到当前等级。为空或者0则不限制人数
-
@@ -79,7 +124,6 @@ 超过层级限制,无法获得经销商提成,感恩奖也随之无法获得
-
@@ -709,8 +753,6 @@
- -
@@ -727,14 +769,12 @@
-
- @if($settingData['is_activation_code'])
@@ -791,18 +831,73 @@
@endif - + {{-- 升级奖励 start--}}
- +
- +
积分
+
+
+
数藏画
+ +
+
+ 数藏画仅第一次升级到当前等级赠送。如果降级后重新升级到当前等级则不会赠送 + {{-- 权重值 --}} +
+
+
+
权重值设置
+
+
+
赠送方式
+
+ + +
+
+ 普通赠送-赠送指定的权重值;阶梯赠送-根据用户成为经销商的时间顺序排序,获取对应的权重值;超过最大名次则不赠送权重值 +
+
赠送级别
+
+ + +
+
+ 二级-赠送购买人、购买人上级;三级-赠送购买人、购买人上级、购买人上级的上级 + {{--赠送固定值--}} +
+
赠送
+ +
权重值
+
+ {{--阶梯赠送 - 根据成为当前等级经销商的等级排名 进行赠送--}} +
+
+ {{--阶梯内容渲染--}} +
+ 例如:设置小于等于10赠送100权重值;小于等于32赠送120权重值。则第1~10位经销商赠送100权重值,第11~32位经销商赠送120权重值,第33位及之后所有经销商均不赠送权重值 + + + +
+
+ {{-- 权重值 end --}} + 权重值仅第一次升级到当前等级赠送。如果降级后重新升级到当前等级则不会赠送
+ {{-- 升级奖励 end--}} @if($isPluginGold)
@@ -816,7 +911,6 @@
@endif -
@@ -826,7 +920,6 @@
-
@@ -838,7 +931,6 @@
-
@@ -854,7 +946,6 @@
- @if(is_null($settingData['withdraw_type']) || $settingData['withdraw_type'] == 0)
@@ -875,7 +966,6 @@
@endif -
@@ -918,7 +1008,6 @@
-
- -
+ @endsection \ No newline at end of file diff --git a/plugins/weight-value/src/models/GoodsWeightValue.php b/plugins/weight-value/src/models/GoodsWeightValue.php index e5ecdf7c..683ffc72 100644 --- a/plugins/weight-value/src/models/GoodsWeightValue.php +++ b/plugins/weight-value/src/models/GoodsWeightValue.php @@ -10,15 +10,16 @@ class GoodsWeightValue extends BaseModel{ public $table = 'yz_goods_weight_value'; public $timestamps = false; - public static function relationSave($goodsId, $data, $operate){ + public static function relationSave($goodsId, $data, $operate,$isTeamDividend = false){ if (!$goodsId) return false; if (!$data) return false; - $info = self::getModel($goodsId, $operate); + $info = self::getModel($goodsId, $operate, $isTeamDividend); // 判断deleted if ($operate == 'deleted') return $info->delete(); // 其他 $info->uniacid = \YunShop::app()->uniacid; - $info->goods_id = $goodsId; + $info->goods_id = $isTeamDividend ? 0 : $goodsId;// 经销商设置true goods_id = 0;否则为goodsId + $info->team_dividend_level_id = $isTeamDividend ? $goodsId : 0;// 经销商设置true team_dividend_level_id = goodsId;否则为0 $info->is_open = $data['is_open'] ?? 0;// 是否开启购买商品赠送权重值:0=未开启,1=开启 $info->gift_type = $data['gift_type'] ?? 0;// 赠送方式:0=赠送固定值,1=阶梯值赠送 $info->lv_type = $data['lv_type'] ?? 0;// 赠送方式:0=二级,1=三级 @@ -31,16 +32,21 @@ class GoodsWeightValue extends BaseModel{ return $info->save(); } - public static function getModel($goodsId, $operate){ + public static function getModel($goodsId, $operate,$isTeamDividend = false){ $model = false; - if ($operate != 'created') $model = static::where(['goods_id' => $goodsId])->first(); + // 商品设置 + if ($operate != 'created') { + if($isTeamDividend) $model = static::where(['team_dividend_level_id' => $goodsId])->first();// 经销商设置 + else $model = static::where(['goods_id' => $goodsId])->first();// 经销商设置 + } !$model && $model = new static; return $model; } - public function getGoodsSet($goodsId){ + public function getGoodsSet($goodsId,$isTeamDividend = false){ + if($isTeamDividend) return self::where('team_dividend_level_id', $goodsId); return self::where('goods_id', $goodsId); } diff --git a/plugins/weight-value/src/models/WeightValueLog.php b/plugins/weight-value/src/models/WeightValueLog.php index 1241e2bb..52e0f271 100644 --- a/plugins/weight-value/src/models/WeightValueLog.php +++ b/plugins/weight-value/src/models/WeightValueLog.php @@ -25,6 +25,7 @@ class WeightValueLog extends BaseModel{ 'change_after', 'remark', 'created_at', + 'source' ]; /**