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 + | +