From e871b80e329f8ce251f9b5137c10f1a16470e997 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Thu, 12 Oct 2023 09:53:51 +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=E5=95=86=E5=93=81=E7=BC=96=E8=BE=91=20-=20?= =?UTF-8?q?=E6=9D=83=E9=87=8D=E5=80=BC=E8=AE=BE=E7=BD=AE=E9=87=8D=E6=9E=84?= =?UTF-8?q?=EF=BC=88=E7=94=B1=E5=9C=A8=E8=90=A5=E9=94=80=E4=B8=AD=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=9C=A8=E6=9D=83=E9=87=8D?= =?UTF-8?q?=E5=80=BC=E4=B8=AD=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=9D=83=E9=87=8D=E5=80=BC=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/weight-value/README.md | 1 + plugins/weight-value/callbacks.php | 14 + plugins/weight-value/lang/en/locale.js | 8 + plugins/weight-value/lang/en/test.php | 5 + plugins/weight-value/lang/zh-CN/locale.js | 6 + plugins/weight-value/lang/zh-CN/test.php | 5 + plugins/weight-value/package.json | 11 + .../weight-value/src/PluginApplication.php | 137 +++++ .../src/admin/IndexController.php | 26 + .../src/admin/widget/WeightValueWidget.php | 29 + .../weight-value/src/api/IndexController.php | 12 + .../src/models/GoodsWeightValue.php | 50 ++ plugins/weight-value/views/config.tpl | 0 .../weight-value/views/index/index.blade.php | 355 ++++++++++++ .../weight-value/views/index/set.blade.php | 520 ++++++++++++++++++ .../views/widget/marketing/weight_value.js | 124 +++++ .../js/components/marketing/promotion.js | 91 +-- 17 files changed, 1304 insertions(+), 90 deletions(-) create mode 100644 plugins/weight-value/README.md create mode 100644 plugins/weight-value/callbacks.php create mode 100644 plugins/weight-value/lang/en/locale.js create mode 100644 plugins/weight-value/lang/en/test.php create mode 100644 plugins/weight-value/lang/zh-CN/locale.js create mode 100644 plugins/weight-value/lang/zh-CN/test.php create mode 100644 plugins/weight-value/package.json create mode 100644 plugins/weight-value/src/PluginApplication.php create mode 100644 plugins/weight-value/src/admin/IndexController.php create mode 100644 plugins/weight-value/src/admin/widget/WeightValueWidget.php create mode 100644 plugins/weight-value/src/api/IndexController.php create mode 100644 plugins/weight-value/src/models/GoodsWeightValue.php create mode 100644 plugins/weight-value/views/config.tpl create mode 100644 plugins/weight-value/views/index/index.blade.php create mode 100644 plugins/weight-value/views/index/set.blade.php create mode 100644 plugins/weight-value/views/widget/marketing/weight_value.js 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') +
| 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 + | +