diff --git a/plugins/weight-value/README.md b/plugins/weight-value/README.md new file mode 100644 index 00000000..0a4dc37e --- /dev/null +++ b/plugins/weight-value/README.md @@ -0,0 +1 @@ +## 权重值管理 diff --git a/plugins/weight-value/callbacks.php b/plugins/weight-value/callbacks.php new file mode 100644 index 00000000..130cbec6 --- /dev/null +++ b/plugins/weight-value/callbacks.php @@ -0,0 +1,14 @@ + function ($plugins) { + \Artisan::call('migrate',['--path'=>'plugins/weight-value/migrations','--force'=>true]); + }, + app\common\events\PluginWasDisabled::class => function ($plugin) { + + + }, + app\common\events\PluginWasDeleted::class => function () { + \Artisan::call('migrate:rollback',['--path'=>'plugins/weight-value/migrations']); + } +]; diff --git a/plugins/weight-value/lang/en/locale.js b/plugins/weight-value/lang/en/locale.js new file mode 100644 index 00000000..6f5de3aa --- /dev/null +++ b/plugins/weight-value/lang/en/locale.js @@ -0,0 +1,8 @@ + +"use strict"; + +$.extend($.locales['en'], { + 'welfare': { + test: "JavaScript i18n test: English" + } +}); diff --git a/plugins/weight-value/lang/en/test.php b/plugins/weight-value/lang/en/test.php new file mode 100644 index 00000000..8999558a --- /dev/null +++ b/plugins/weight-value/lang/en/test.php @@ -0,0 +1,5 @@ +'this is test title' +]; \ No newline at end of file diff --git a/plugins/weight-value/lang/zh-CN/locale.js b/plugins/weight-value/lang/zh-CN/locale.js new file mode 100644 index 00000000..1be84a97 --- /dev/null +++ b/plugins/weight-value/lang/zh-CN/locale.js @@ -0,0 +1,6 @@ + +$.extend($.locales['zh-CN'], { + 'welfare': { + test: "JavaScript i18n test: 简体中文" + } +}); diff --git a/plugins/weight-value/lang/zh-CN/test.php b/plugins/weight-value/lang/zh-CN/test.php new file mode 100644 index 00000000..14fbcffc --- /dev/null +++ b/plugins/weight-value/lang/zh-CN/test.php @@ -0,0 +1,5 @@ +'测试标题' +]; \ No newline at end of file diff --git a/plugins/weight-value/package.json b/plugins/weight-value/package.json new file mode 100644 index 00000000..bed9e750 --- /dev/null +++ b/plugins/weight-value/package.json @@ -0,0 +1,11 @@ +{ + "name": "weight-value", + "terminal": "wechat|min|wap", + "version": "1.0.1", + "title": "权重值管理", + "description": "权重值管理", + "author": "zzw", + "url": "", + "namespace": "Yunshop\\WeightValue", + "config": "config.tpl" +} \ No newline at end of file diff --git a/plugins/weight-value/src/PluginApplication.php b/plugins/weight-value/src/PluginApplication.php new file mode 100644 index 00000000..1bd2b5ae --- /dev/null +++ b/plugins/weight-value/src/PluginApplication.php @@ -0,0 +1,137 @@ +setPluginMenu('weight-value', [ + 'name' => '权重值管理', + 'type' => 'marketing', + 'url' => 'plugin.weight-value.admin.index.index',// url 可以填写http 也可以直接写路由 + 'url_params' => '',//如果是url填写的是路由则启用参数否则不启用 + 'permit' => 1,//如果不设置则不会做权限检测 + 'menu' => 1,//如果不设置则不显示菜单,子菜单也将不显示 + 'icon' => '',//菜单图标 + 'list_icon' => 'weight-value', + 'parents' => [], + 'top_show' => 0, + 'left_first_show' => 0, + 'left_second_show' => 1, + 'child' => [ + 'plugin_weigh_value_index' => [ + 'name' => '权重值明细', + 'permit' => 1, + 'menu' => 1, + 'icon' => '', + 'url' => 'plugin.weight-value.admin.index.index', + 'url_params' => '', + 'item' => 'plugin_weigh_value_index', + 'parents' => ['weight-value'], + 'child' => [ + // 权限补充 + 'plugin_weigh_value_index_index' => [ + 'name' => '权重值明细', + 'url' => 'plugin.weight-value.admin.index.index', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_weigh_value_index_index', + 'parents' => ['weight-value','plugin_weigh_value_index'] + ], + 'plugin_weigh_value_index_record' => [ + 'name' => '变更记录', + 'url' => 'plugin.weight-value.admin.index.record', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_weigh_value_index_record', + 'parents' => ['weight-value','plugin_weigh_value_index'] + ], + ] + ], + 'plugin_weigh_value_transfer' => [ + 'name' => '转账明细', + 'permit' => 1, + 'menu' => 1, + 'icon' => '', + 'url' => 'plugin.weight-value.admin.transfer.index', + 'url_params' => '', + 'parents' => ['weight-value'], + 'child' => [ + // 权限补充 + 'plugin_weigh_value_transfer_index' => [ + 'name' => '转账明细', + 'url' => 'plugin.weight-value.admin.transfer.index', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_weigh_value_transfer_index', + 'parents' => ['weight-value','plugin_weigh_value_transfer'] + ], + ] + ], + 'plugin_weigh_value_set' => [ + 'name' => '基本设置', + 'permit' => 1, + 'menu' => 1, + 'icon' => '', + 'url' => 'plugin.weight-value.admin.index.set', + 'url_params' => '', + 'parents' => ['weight-value'], + 'child' => [ + // 权限补充 + 'plugin_weigh_value_index_set' => [ + 'name' => '基本设置', + 'url' => 'plugin.weight-value.admin.index.set', + 'url_params' => '', + 'permit' => 1, + 'menu' => 0, + 'icon' => '', + 'item' => 'plugin_weigh_value_index_set', + 'parents' => ['weight-value', 'plugin_weigh_value_set'], + ] + ] + ], + ] + ]); + } + + + public function getWidgetItems() + { + return [ + 'vue-goods.weight_value' => [ + 'title' => '权重值', + 'class' => \Yunshop\WeightValue\admin\widget\WeightValueWidget::class, + ], + ]; + } + + protected function setConfig(){ + \app\common\modules\shop\ShopConfig::current()->set( + 'observer.goods.weight_value', [ + 'class' => 'Yunshop\WeightValue\models\GoodsWeightValue', + // 'function_validator'=>'relationValidator', + 'function_save' => 'relationSave' + ] + ); + } + + public function boot(){ + $events = app('events'); + + + + + + + } + + + +} \ No newline at end of file diff --git a/plugins/weight-value/src/admin/IndexController.php b/plugins/weight-value/src/admin/IndexController.php new file mode 100644 index 00000000..58dc808b --- /dev/null +++ b/plugins/weight-value/src/admin/IndexController.php @@ -0,0 +1,26 @@ +render(); + } + + + + + + + + +} diff --git a/plugins/weight-value/src/admin/widget/WeightValueWidget.php b/plugins/weight-value/src/admin/widget/WeightValueWidget.php new file mode 100644 index 00000000..0d50e08e --- /dev/null +++ b/plugins/weight-value/src/admin/widget/WeightValueWidget.php @@ -0,0 +1,29 @@ +select(['is_open','user_type','gift_type','lv_type','quantity','ladder']) + ->where('goods_id', $this->goods->id) + ->first(); + } + + public function pagePath(){ + return plugin_assets('weight-value','views/widget/'); + // return $this->getPath('resources/views/goods/assets/js/components/'); + } +} \ No newline at end of file diff --git a/plugins/weight-value/src/api/IndexController.php b/plugins/weight-value/src/api/IndexController.php new file mode 100644 index 00000000..c30f9b27 --- /dev/null +++ b/plugins/weight-value/src/api/IndexController.php @@ -0,0 +1,12 @@ +delete(); + // 其他 + $info->uniacid = \YunShop::app()->uniacid; + $info->goods_id = $goodsId; + $info->is_open = $data['is_open'] ?? 0;// 是否开启购买商品赠送权重值:0=未开启,1=开启 + $info->user_type = $data['user_type'] ?? 0;// 受赠用户类型:0=全部用户,1=仅经销商 + $info->gift_type = $data['gift_type'] ?? 0;// 赠送方式:0=赠送固定值,1=阶梯值赠送 + $info->lv_type = $data['lv_type'] ?? 0;// 赠送方式:0=二级,1=三级 + $info->quantity = $data['quantity'] ?? 0;// 固定值赠送数量 + $info->ladder = json_encode($data['ladder'] ?? []);// 阶梯赠送信息 + + 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){ + return self::where('goods_id', $goodsId); + } + + //关联商品信息 + public function belongsToGoods(){ + return $this->belongsTo(Goods::class, 'goods_id', 'id'); + } + +} diff --git a/plugins/weight-value/views/config.tpl b/plugins/weight-value/views/config.tpl new file mode 100644 index 00000000..e69de29b diff --git a/plugins/weight-value/views/index/index.blade.php b/plugins/weight-value/views/index/index.blade.php new file mode 100644 index 00000000..14aba272 --- /dev/null +++ b/plugins/weight-value/views/index/index.blade.php @@ -0,0 +1,355 @@ + +@extends('layouts.base') + +@section('content') +
+ {{--顶部搜索--}} +
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ + + +
+ {!! app\common\helpers\AddressHelper::tplLinkedAddress(['search[province_id]','search[city_id]','search[area_id]'], []) !!} +
+
+
+
+
+
+ + + @if (!$is_apply) + + @endif + +
+
+
+
+
+ {{--信息列表--}} +
+
+ + + + + + + + + + + + + + + + @foreach ($list as $item) + + + + + + + + + + + + @endforeach + +
ID终端商信息引荐人信息注册人信息营业执照门头照片内部照片 + @if($is_apply) + 申请时间 + @else + 审核时间 + @endif + 操作
{{ $item['id'] }} +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ 注册人:{{ $item['contacts'] }}
+ 联系电话:{{ $item['contacts_phone'] }}
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ @if($is_apply) + {{ $item['created_at'] }} + @else + {{ $item['to_examine_time'] }} + @endif + + @if ($is_apply) + {{--审核内容--}} + @if ($item['status'] == 0) + + + @endif + + + + @else + {{--使用中内容--}} + + + + + + @endif +
+ {!! $pager !!} +
+
+ {{--驳回弹框--}} + +
+ + +@endsection + diff --git a/plugins/weight-value/views/index/set.blade.php b/plugins/weight-value/views/index/set.blade.php new file mode 100644 index 00000000..eeeb9b71 --- /dev/null +++ b/plugins/weight-value/views/index/set.blade.php @@ -0,0 +1,520 @@ +@extends('layouts.base') + +@section('content') + +
+
+ {{--设置表单--}} +
+
+ {{--设置内容--}} + + +
+
+ +
+ + +
+
+
+
+ +
+
+ +
+ + +
+
+
+ +
+ + 值必须为0.01-100;为空则无平级奖。 +
+
+
+ +
+ +
+
+
+ +
+
+
+
经销商等级
+
+
商品规格
+
首次返佣
+
每期返佣
+
分期数量
+
+
+ @foreach($level as $levelItem => $levelValue) +
+ {{--经销商等级--}} +
{{$levelValue['level_name']}}
+ {{--规格及佣金设置--}} +
+ @foreach($goods_label as $goodsLabelItem => $goodsLabelValue) +
+
{{$goodsLabelValue}}
+
+ +
+
+ +
+
+ +
+
+ @endforeach +
+
+ @endforeach +
+
+
+
+
+ + {{--计算金额--}} +
+ +
+
+
+
G10
+ +
+
G15
+ +
+
G20
+ +
+
+
+
+
+ {{--默认比例--}} +
+ +
+
+
+
+ +
%
+
+ +
%
+
+ +
%
+
+
+
+
+ {{--独立比例--}} +
+ +
+ {{--添加按钮--}} +
+ 添加地区 +
+ {{--独立规则列表--}} + + + + + + + + + + +
+
+
+
+ {{--提交按钮--}} +
+
+ +
+ +
+
+
+
+ {{--地区选择器--}} + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +@endsection + diff --git a/plugins/weight-value/views/widget/marketing/weight_value.js b/plugins/weight-value/views/widget/marketing/weight_value.js new file mode 100644 index 00000000..b99f306c --- /dev/null +++ b/plugins/weight-value/views/widget/marketing/weight_value.js @@ -0,0 +1,124 @@ +define({ + name:"weight_value", + template:` +
+ +
+
+
权重值设置
+
+
+ + 关闭 + 开启 + + +
+
+
+ `, + 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=开启 + user_type: 0,// 受赠用户类型:0=全部用户,1=仅经销商 + gift_type: 0,// 赠送方式:0=赠送固定值,1=阶梯值赠送 + lv_type: 0,// 赠送方式:0=二级,1=三级 + quantity: 0,// 赠送数量 + ladder: {},// 阶梯赠送信息 + } + } + }, + watch: {}, + mounted() { + console.log(this.form); + if (this.form) { + let weight_value = this.form || {}; + this.json.is_open = weight_value.is_open ? weight_value.is_open : 0; + this.json.user_type = weight_value.user_type ? weight_value.user_type : 0; + this.json.gift_type = weight_value.gift_type ? weight_value.gift_type : 0; + this.json.lv_type = weight_value.lv_type ? weight_value.lv_type : 0; + this.json.quantity = weight_value.quantity ? weight_value.quantity : 0; + this.json.ladder = weight_value.ladder ? JSON.parse(weight_value.ladder) : {}; + } + + console.log(this.json); + + }, + methods:{ + addLadder(){ + this.json.ladder = Object.values(this.json.ladder).concat({where: '', num: ''}); + }, + delLadder(index){ + let ladder = Object.assign({},this.json.ladder); + delete ladder[index]; + + this.json.ladder = Object.values(ladder); + }, + validate(){ + return this.json; + } + } +}) \ No newline at end of file diff --git a/resources/views/goods/assets/js/components/marketing/promotion.js b/resources/views/goods/assets/js/components/marketing/promotion.js index f1557a46..a3cd898c 100644 --- a/resources/views/goods/assets/js/components/marketing/promotion.js +++ b/resources/views/goods/assets/js/components/marketing/promotion.js @@ -48,50 +48,6 @@ define({ 添加不参加包邮的地区 - - -
-
-
权重值设置
-
-
- - 全部用户 - 仅经销商 -
全部用户:普通所有用户购买后都会赠送权重值
-
仅经销商:只有经销商用户会赠送权重值;阶梯赠送必须为仅经销商
-
- - 普通赠送 - 阶梯赠送 -
普通赠送:购买人、购买人上级、购买人上级的上级赠送指定的权重值
-
阶梯赠送:购买人、购买人上级分别获取对应顺序的权重值(顺序为用户成为经销商的先后顺序。如果经销商身份为黑名单则不赠送权重值)
-
- - - - -
如果设置为空或者0则不赠送权重值
-
- -
-
- - - - - - - - - - 删除 - -
- 增加阶梯 -
例如:设置小于等于10赠送100权重值;小于等于32赠送120权重值。则第1~10位经销商赠送100权重值,第11~32位经销商赠送120权重值,第33位及之后所有经销商均不赠送权重值
-
-
@@ -461,18 +417,6 @@ define({ height: 80%; overflow-y: scroll; } - .ladder-content{ - min-width: 550px!important; - - } - .ladder-content .ladder-row{ - margin-bottom: 5px!important;; - } - .ladder-content .ladder-row .ladder-input{ - width: 200px!important;; - } - - `, props: { form: { @@ -549,7 +493,6 @@ define({ all_point_deduct: { validator: floatNum }, max_balance_deduct: { validator: floatNum }, min_balance_deduct: { validator: floatNum }, - weight_value_num: { validator: floatNum }, }, goodsDialog: false, areaDialog: false, @@ -596,25 +539,10 @@ define({ is_push: 0, push_goods_ids: [], is_store:0, - // 权重值设置 - weight_value_user: 1, - weight_value_type: 0, - weight_value_num: 0, - weight_value_ladder: {}, }, }; }, - watch: { - json: { - deep: true,//深度监听 - handler: function () { - // 开启阶梯价的情况下 受赠用户类型必须为仅经销商 - if(this.json.weight_value_type == 1) { - this.json.weight_value_user = 1; - } - } - } - }, + watch: { }, mounted() { if (this.form && this.form.sale) { let sale = this.form.sale; @@ -642,11 +570,6 @@ define({ this.json.min_balance_deduct = sale.min_balance_deduct ? sale.min_balance_deduct : ''; this.json.is_push = sale.is_push ? sale.is_push : 0; this.json.push_goods_ids = sale.push_goods_ids ? sale.push_goods_ids : []; - // 权重值 - this.json.weight_value_user = sale.weight_value_user ? sale.weight_value_user : 1; - this.json.weight_value_type = sale.weight_value_type ? sale.weight_value_type : 0; - this.json.weight_value_num = sale.weight_value_num ? sale.weight_value_num : 0; - this.json.weight_value_ladder = sale.weight_value_ladder ? JSON.parse(sale.weight_value_ladder) : {}; } }, methods: { @@ -783,18 +706,6 @@ define({ } }); }, - // 权重值相关处理 - addLadder(){ - this.json.weight_value_ladder = Object.values(this.json.weight_value_ladder).concat({where: '', num: ''}); - }, - delLadder(index){ - let weightValueLadder = Object.assign({},this.json.weight_value_ladder); - delete weightValueLadder[index]; - - this.json.weight_value_ladder = Object.values(weightValueLadder); - } - -