yangkangwei 1 rok temu
rodzic
commit
afb7c1af91
100 zmienionych plików z 11583 dodań i 2 usunięć
  1. 0 2
      plugins/.gitignore
  2. 1 0
      plugins/activity-apply/README.md
  3. 10 0
      plugins/activity-apply/callbacks.php
  4. 8 0
      plugins/activity-apply/lang/en/locale.js
  5. 5 0
      plugins/activity-apply/lang/en/test.php
  6. 9 0
      plugins/activity-apply/lang/zh-CN/index.php
  7. 6 0
      plugins/activity-apply/lang/zh-CN/locale.js
  8. 6 0
      plugins/activity-apply/lang/zh-CN/test.php
  9. 43 0
      plugins/activity-apply/migrations/2019_08_21_164037_create_ims_yz_activity_apply_calssify_table.php
  10. 68 0
      plugins/activity-apply/migrations/2019_08_21_164044_create_ims_yz_activity_apply_activity_table.php
  11. 44 0
      plugins/activity-apply/migrations/2019_08_21_164048_create_ims_yz_activity_apply_lantern_slide_table.php
  12. 50 0
      plugins/activity-apply/migrations/2019_08_21_164051_create_ims_yz_activity_apply_order_table.php
  13. 40 0
      plugins/activity-apply/migrations/2019_09_05_123923_create_ims_yz_activity_apply_attention_table.php
  14. 44 0
      plugins/activity-apply/migrations/2019_11_22_170657_create_ims_yz_activity_apply_goods_table.php
  15. 43 0
      plugins/activity-apply/migrations/2019_11_23_180732_create_ims_yz_activity_apply_give_coupon_table.php
  16. 45 0
      plugins/activity-apply/migrations/2019_11_23_180732_create_ims_yz_activity_apply_relation_table.php
  17. 38 0
      plugins/activity-apply/migrations/2020_06_15_164500_add_app_link_to_ims_yz_activity_apply_lantern_slide_table.php
  18. 42 0
      plugins/activity-apply/migrations/2020_06_15_164500_add_longitude_to_ims_yz_activity_apply_activity_table.php
  19. 37 0
      plugins/activity-apply/migrations/2020_06_15_164500_add_status_to_ims_yz_activity_apply_order_table.php
  20. 45 0
      plugins/activity-apply/migrations/2020_08_21_164500_add_share_title_to_ims_yz_activity_apply_activity_table.php
  21. 45 0
      plugins/activity-apply/migrations/2020_11_03_160732_create_ims_yz_activity_apply_order_log_table.php
  22. 45 0
      plugins/activity-apply/migrations/2021_03_19_184050_alter_activity_apply_activity_table.php
  23. 26 0
      plugins/activity-apply/migrations/2021_07_02_140105_change_ims_yz_activity_apply_order_table.php
  24. 37 0
      plugins/activity-apply/migrations/2022_05_23_100021_add_member_power_ims_yz_activity_apply_activity_table.php
  25. 11 0
      plugins/activity-apply/package.json
  26. 43 0
      plugins/activity-apply/src/Listener/OrderCanceledListener.php
  27. 69 0
      plugins/activity-apply/src/Listener/OrderCreatedListener.php
  28. 53 0
      plugins/activity-apply/src/Listener/OrderPaidListener.php
  29. 150 0
      plugins/activity-apply/src/Listener/OrderReceiveListener.php
  30. 430 0
      plugins/activity-apply/src/PluginApplication.php
  31. 585 0
      plugins/activity-apply/src/admin/ActivityApplyActivityController.php
  32. 132 0
      plugins/activity-apply/src/admin/ActivityApplyCalssifyController.php
  33. 107 0
      plugins/activity-apply/src/admin/ActivityApplyLantetnSlideController.php
  34. 187 0
      plugins/activity-apply/src/admin/ActivityApplyOrderController.php
  35. 40 0
      plugins/activity-apply/src/admin/ActivityApplySetController.php
  36. 358 0
      plugins/activity-apply/src/api/ActivityController.php
  37. 89 0
      plugins/activity-apply/src/api/CreateController.php
  38. 32 0
      plugins/activity-apply/src/api/GoodsBuyController.php
  39. 287 0
      plugins/activity-apply/src/api/IndexController.php
  40. 164 0
      plugins/activity-apply/src/api/LecturerController.php
  41. 81 0
      plugins/activity-apply/src/api/OrderController.php
  42. 26 0
      plugins/activity-apply/src/api/models/Goods.php
  43. 42 0
      plugins/activity-apply/src/api/models/PreOrder.php
  44. 48 0
      plugins/activity-apply/src/api/models/PrePayOrderModel.php
  45. 181 0
      plugins/activity-apply/src/common/models/ActivityApplyGoods.php
  46. 23 0
      plugins/activity-apply/src/common/models/GiveCoupon.php
  47. 183 0
      plugins/activity-apply/src/common/models/Goods.php
  48. 64 0
      plugins/activity-apply/src/common/models/Order.php
  49. 123 0
      plugins/activity-apply/src/config/Payment.php
  50. 348 0
      plugins/activity-apply/src/models/ActivityModel.php
  51. 48 0
      plugins/activity-apply/src/models/AttentionModel.php
  52. 72 0
      plugins/activity-apply/src/models/CalssifyModel.php
  53. 63 0
      plugins/activity-apply/src/models/LantetnSlideModel.php
  54. 26 0
      plugins/activity-apply/src/models/LecturerModel.php
  55. 21 0
      plugins/activity-apply/src/models/MemberModel.php
  56. 55 0
      plugins/activity-apply/src/models/MemberParent.php
  57. 85 0
      plugins/activity-apply/src/models/PayOrderModel.php
  58. 59 0
      plugins/activity-apply/src/models/RelationModel.php
  59. 31 0
      plugins/activity-apply/src/models/SetModel.php
  60. 15 0
      plugins/activity-apply/src/models/TeamDividendAgencyModel.php
  61. 15 0
      plugins/activity-apply/src/models/TeamDividendLevelModel.php
  62. 135 0
      plugins/activity-apply/src/services/EnrolService.php
  63. 25 0
      plugins/activity-apply/src/services/MemberCenterService.php
  64. 89 0
      plugins/activity-apply/src/services/MessageService.php
  65. 198 0
      plugins/activity-apply/src/services/PinYinService.php
  66. 69 0
      plugins/activity-apply/src/services/TimedTaskServices.php
  67. 664 0
      plugins/activity-apply/views/admin/activity.blade.php
  68. 957 0
      plugins/activity-apply/views/admin/activity_edit.blade.php
  69. 230 0
      plugins/activity-apply/views/admin/activity_from.blade.php
  70. 270 0
      plugins/activity-apply/views/admin/activity_info.blade.php
  71. 93 0
      plugins/activity-apply/views/admin/calssify.blade.php
  72. 112 0
      plugins/activity-apply/views/admin/calssify_add.blade.php
  73. 81 0
      plugins/activity-apply/views/admin/cash.blade.php
  74. 19 0
      plugins/activity-apply/views/admin/coupon.blade.php
  75. 165 0
      plugins/activity-apply/views/admin/fenrun.blade.php
  76. 68 0
      plugins/activity-apply/views/admin/lantetn.blade.php
  77. 114 0
      plugins/activity-apply/views/admin/lantetn_info.blade.php
  78. 324 0
      plugins/activity-apply/views/admin/marketing.blade.php
  79. 9 0
      plugins/activity-apply/views/admin/member_power.blade.php
  80. 438 0
      plugins/activity-apply/views/admin/order.blade.php
  81. 277 0
      plugins/activity-apply/views/admin/order/basicDetail.blade.php
  82. 123 0
      plugins/activity-apply/views/admin/order/detail.blade.php
  83. 209 0
      plugins/activity-apply/views/admin/order_enrol.blade.php
  84. 59 0
      plugins/activity-apply/views/admin/order_enrol_details.blade.php
  85. 168 0
      plugins/activity-apply/views/admin/set.blade.php
  86. 25 0
      plugins/activity-apply/views/admin/share.blade.php
  87. 910 0
      plugins/activity-apply/views/admin/small.blade.php
  88. 12 0
      plugins/activity-apply/views/admin/tabs.blade.php
  89. 12 0
      plugins/activity-apply/views/admin/tpl/activity.php
  90. 1 0
      plugins/address-mgmt/README.md
  91. 0 0
      plugins/address-mgmt/asset/address.json
  92. 0 0
      plugins/address-mgmt/asset/address.txt
  93. 0 0
      plugins/address-mgmt/asset/street.json
  94. 0 0
      plugins/address-mgmt/asset/street.txt
  95. 11 0
      plugins/address-mgmt/callbacks.php
  96. 42 0
      plugins/address-mgmt/migrations/2020_03_24_100756_create_yz_address_mgmt_log_table.php
  97. 11 0
      plugins/address-mgmt/package.json
  98. 134 0
      plugins/address-mgmt/src/PluginApplication.php
  99. 397 0
      plugins/address-mgmt/src/admin/ManageController.php
  100. 49 0
      plugins/address-mgmt/src/admin/SelectController.php

+ 0 - 2
plugins/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore

+ 1 - 0
plugins/activity-apply/README.md

@@ -0,0 +1 @@
+init

+ 10 - 0
plugins/activity-apply/callbacks.php

@@ -0,0 +1,10 @@
+<?php
+
+return [
+    app\common\events\PluginWasEnabled::class => function ($plugins) {
+        \Artisan::call('migrate', ['--path' => 'plugins/activity-apply/migrations', '--force' => true]);
+    },
+    app\common\events\PluginWasDeleted::class => function ($plugins) {
+        \Artisan::call('migrate:rollback', ['--path' => 'plugins/activity-apply/migrations']);
+    },
+];

+ 8 - 0
plugins/activity-apply/lang/en/locale.js

@@ -0,0 +1,8 @@
+
+"use strict";
+
+$.extend($.locales['en'], {
+    'examplePlugin': {
+        test: "JavaScript i18n test: English"
+    }
+});

+ 5 - 0
plugins/activity-apply/lang/en/test.php

@@ -0,0 +1,5 @@
+<?php
+
+return [
+    'title'=>'this is test title'
+];

+ 9 - 0
plugins/activity-apply/lang/zh-CN/index.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/7/10
+ * Time: 下午2:38
+ */
+return [
+    'title'=>'区域分红',
+];

+ 6 - 0
plugins/activity-apply/lang/zh-CN/locale.js

@@ -0,0 +1,6 @@
+
+$.extend($.locales['zh-CN'], {
+    'examplePlugin': {
+        test: "JavaScript i18n test: 简体中文"
+    }
+});

+ 6 - 0
plugins/activity-apply/lang/zh-CN/test.php

@@ -0,0 +1,6 @@
+<?php
+
+return [
+    'title'=>'测试标题',
+    'name'=>'测试名字'
+];

+ 43 - 0
plugins/activity-apply/migrations/2019_08_21_164037_create_ims_yz_activity_apply_calssify_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateImsYzActivityApplyCalssifyTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+
+        if (!Schema::hasTable('yz_activity_apply_calssify')) {
+            Schema::create('yz_activity_apply_calssify', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->nullable()->comment('公众号ID');
+                $table->string('calssify_title')->nullable()->comment('分类名称');
+                $table->integer('sort')->nullable()->comment('分类排序');
+                $table->string('thumb')->nullable()->comment('分类图片');
+                $table->boolean('is_open')->nullable()->defalut(1)->comment('是否使用分类0禁用,1启动');
+                $table->integer('create_time')->comment('创建的时间');
+                $table->integer('created_at')->nullable();
+                $table->integer('updated_at')->nullable();
+                $table->integer('deleted_at')->nullable();
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_calssify comment '活动报名--分类表'");//表注释
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropI('yz_activity_apply_calssify');
+    }
+}

+ 68 - 0
plugins/activity-apply/migrations/2019_08_21_164044_create_ims_yz_activity_apply_activity_table.php

@@ -0,0 +1,68 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateImsYzActivityApplyActivityTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+
+        if(!Schema::hasTable('yz_activity_apply_activity')){
+            Schema::create('yz_activity_apply_activity', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->nullable()->comment('公众号ID');
+                $table->integer('calssify_id')->nullable()->comment('分类ID');
+                $table->integer('lecturer_id')->nullable()->comment('讲师ID');
+                $table->integer('goods_id')->nullable()->comment('商品ID');
+                $table->integer('form_id')->nullable()->comment('表单ID');
+                $table->string('title')->nullable()->comment('活动名称');
+                $table->integer('limit')->nullable()->comment('报名人数');
+                $table->decimal('cash',14)->nullable()->comment('活动费用');
+                $table->integer('registration_time')->nullable()->comment('开始报名时间');
+                $table->integer('registration_end_time')->nullable()->comment('结束报名时间');
+                $table->integer('start_time')->nullable()->comment('开始时间');
+                $table->integer('end_time')->nullable()->comment('结束时间');
+                $table->string('thumb')->nullable()->comment('活动图片');
+                $table->string('banner')->bullable()->comment('banner图片');
+                $table->text('content', 65535)->nullable()->comment('活动详情');
+                $table->integer('province_id')->nullable()->comment('省级ID');
+                $table->string('province_name', 60)->nullable()->default('')->comment('省级名称');
+                $table->integer('city_id')->nullable()->default(0)->comment('市级ID');
+                $table->string('city_name', 60)->nullable()->default('')->comment('市级名称');
+                $table->integer('district_id')->nullable()->default(0)->comment('区级ID');
+                $table->string('district_name', 60)->nullable()->default('')->comment('区级名称');
+                $table->integer('street_id')->nullable()->default(0)->comment('街道级ID');
+                $table->string('street_name', 60)->nullable()->comment('街道级名称');
+                $table->text('address',65535)->nullable()->comment('地址');
+                $table->tinyInteger('status')->nullable()->default(0)->comment('0活动未开始','1活动进行中','2活动结束');
+                $table->boolean('is_premium')->nullable()->comment('免费0,收费1');
+                $table->boolean('is_open')->nullable()->defalut(1)->comment('0关闭,1开启');
+                $table->boolean('is_recommand')->nullable()->defalut(0)->comment('0不推荐,1推荐');
+                $table->boolean('is_hot')->nullable()->defalut(0)->comment('0不热门,1热门');
+                $table->boolean('is_discount')->nullable()->defalut(0)->comment('0不精选,1精选');
+                $table->integer('created_at')->comment('加入购物车时间');
+                $table->integer('updated_at')->comment('最后一次修改时间');
+                $table->integer('deleted_at')->nullable()->comment('移除购物车时间');
+
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_activity comment '活动报名-活动详情表'");//表注释
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::drop('yz_activity_apply_activity');
+    }
+}

+ 44 - 0
plugins/activity-apply/migrations/2019_08_21_164048_create_ims_yz_activity_apply_lantern_slide_table.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateImsYzActivityApplyLanternSlideTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+
+        if(!Schema::hasTable('yz_activity_apply_lantern_slide')){
+            Schema::create('yz_activity_apply_lantern_slide', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->nullable();
+                $table->string('title')->comment('幻灯片名称');
+                $table->string('link')->nullable()->comment('链接');
+                $table->string('thumb')->comment('幻灯片地址');
+                $table->integer('display_order')->nullable()->comment('排序');
+                $table->integer('is_open')->defalut(1)->comment('不显示0,显示1');
+                $table->integer('created_at')->nullable();
+                $table->integer('updated_at')->nullable();
+                $table->integer('deleted_at')->nullable();
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_lantern_slide comment '活动报名-幻灯片表'");//表注释
+
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::drop('yz_activity_apply_lantern_slide');
+    }
+}

+ 50 - 0
plugins/activity-apply/migrations/2019_08_21_164051_create_ims_yz_activity_apply_order_table.php

@@ -0,0 +1,50 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateImsYzActivityApplyOrderTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if(!Schema::hasTable('yz_activity_apply_order')){
+            Schema::create('yz_activity_apply_order', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->nullable()->comment('公众号ID');
+                $table->integer('order_id')->nullable()->comment('订单ID');
+                $table->integer('activity_id')->nullable()->comment('活动ID');
+                $table->integer('calssify_id')->nullable()->comment('分类ID');
+                $table->integer('lecturer_id')->nullable()->comment('讲师ID');
+                $table->integer('member_id')->nullable()->comment('用户ID');
+                $table->integer('form_id')->nullable()->comment('表单ID');
+                $table->string('activity_title')->nullable()->comment('活动名称');
+                $table->string('order_sn')->nullable()->comment('订单编号');
+                $table->string('number')->nullable()->comment('报名人数');
+                $table->float('cash',2)->nullable()->comment('金额');
+                $table->tinyInteger('attention')->nullable()->comment('0没关注,1关注');
+                $table->tinyInteger('sign')->nullable()->comment('0没签到,1签到');
+                $table->string('sign_time')->nullable()->comment('签到时间');
+                $table->integer('created_at')->comment('加入购物车时间');
+                $table->integer('updated_at')->comment('最后一次修改时间');
+                $table->integer('deleted_at')->nullable()->comment('移除购物车时间');
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_order comment '活动报名-活动关联订单表'");//表注释
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::drop('yz_activity_apply_order');
+    }
+}

+ 40 - 0
plugins/activity-apply/migrations/2019_09_05_123923_create_ims_yz_activity_apply_attention_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateImsYzActivityApplyAttentionTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (!Schema::hasTable('yz_activity_apply_attention')) {
+            Schema::create('yz_activity_apply_attention', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->nullable()->comment('公众号ID');
+                $table->integer('activity_id')->nullable()->comment('活动ID');
+                $table->integer('member_id')->nullable()->comment('会员ID');
+                $table->tinyInteger('is_attention')->nullable()->comment('0取消,1关注');
+                $table->integer('created_at')->nullable();
+                $table->integer('updated_at')->nullable();
+                $table->integer('deleted_at')->nullable();
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_attention comment '活动报名-活动关注表'");//表注释
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::drop('yz_activity_apply_attention');
+    }
+}

+ 44 - 0
plugins/activity-apply/migrations/2019_11_22_170657_create_ims_yz_activity_apply_goods_table.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateImsYzActivityApplyGoodsTable extends Migration {
+
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+        if (!Schema::hasTable('yz_activity_apply_goods')) {
+            Schema::create('yz_activity_apply_goods', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('goods_id')->default(0)->comment('商品ID');
+                $table->integer('activity_id')->nullable()->comment('活动ID');
+                $table->tinyInteger('is_open')->nullable()->comment('是否开启');
+                $table->text('coupon', 65535)->nullable()->comment('优惠券信息');
+                $table->text('plugins', 65535)->nullable()->comment('插件设置');
+                $table->text('profit', 65535)->nullable()->comment('插件分红结算比例');
+                $table->integer('created_at')->nullable();
+                $table->integer('updated_at')->nullable();
+                $table->integer('deleted_at')->nullable();
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_goods comment '活动报名-活动商品表'");//表注释
+        }
+	}
+
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('yz_activity_apply_goods');
+	}
+
+}

+ 43 - 0
plugins/activity-apply/migrations/2019_11_23_180732_create_ims_yz_activity_apply_give_coupon_table.php

@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateImsYzActivityApplyGiveCouponTable extends Migration {
+
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+        if (!Schema::hasTable('yz_activity_apply_give_coupon')) {
+            Schema::create('yz_activity_apply_give_coupon',
+                function (Blueprint $table) {
+                    $table->increments('id');
+                    $table->integer('order_id')->default(0)->comment('订单ID');
+                    $table->integer('uid')->default(0)->comment('会员ID');
+                    $table->integer('coupon_id')->default(0)->comment('优惠券ID');
+                    $table->string('coupon_name')->default('')->comment('优惠券名称');
+                    $table->integer('created_at')->nullable();
+                    $table->integer('updated_at')->nullable();
+                    $table->integer('deleted_at')->nullable();
+            });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_give_coupon comment '活动报名-活动优惠券订单表'");//表注释
+        }
+	}
+
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('yz_activity_apply_give_coupon');
+	}
+
+}

+ 45 - 0
plugins/activity-apply/migrations/2019_11_23_180732_create_ims_yz_activity_apply_relation_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateImsYzActivityApplyRelationTable extends Migration {
+
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+        if (!Schema::hasTable('yz_activity_apply_relation')) {
+            Schema::create('yz_activity_apply_relation',
+                function (Blueprint $table) {
+                    $table->increments('id');
+                    $table->integer('uniacid')->nullable()->comment('公众号ID');
+                    $table->integer('activity_id')->nullable()->comment('活动ID');;
+                    $table->integer('member_id')->nullable()->comment('会员id');;
+                    $table->integer('form_id')->nullable()->comment('表单id');;
+                    $table->integer('form_data_id')->nullable()->comment('表单数据id');;
+                    $table->integer('created_at')->nullable();
+                    $table->integer('updated_at')->nullable();
+                    $table->integer('deleted_at')->nullable();
+                });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_give_coupon comment '活动报名-活动优惠券订单表'");//表注释
+
+        }
+	}
+
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('yz_activity_apply_relation');
+	}
+
+}

+ 38 - 0
plugins/activity-apply/migrations/2020_06_15_164500_add_app_link_to_ims_yz_activity_apply_lantern_slide_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+
+class AddAppLinkToImsYzActivityApplyLanternSlideTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_lantern_slide')) {
+            Schema::table('yz_activity_apply_lantern_slide',
+                function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_lantern_slide', 'app_link')) {
+                        $table->string('app_link')->nullable()->comment('小程序链接');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('yz_activity_apply_lantern_slide', function (Blueprint $table) {
+            $table->dropColumn('app_link');
+        });
+    }
+}

+ 42 - 0
plugins/activity-apply/migrations/2020_06_15_164500_add_longitude_to_ims_yz_activity_apply_activity_table.php

@@ -0,0 +1,42 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+
+class AddLongitudeToImsYzActivityApplyActivityTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_activity')) {
+            Schema::table('yz_activity_apply_activity',
+                function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'longitude')) {
+                        $table->string('longitude')->nullable()->comment('起点经纬度');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'latitude')) {
+                        $table->string('latitude')->nullable()->comment('终点经纬度');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'initials')) {
+                        $table->string('initials')->nullable()->comment('国标');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+
+    }
+}

+ 37 - 0
plugins/activity-apply/migrations/2020_06_15_164500_add_status_to_ims_yz_activity_apply_order_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+class AddStatusToImsYzActivityApplyOrderTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_order')) {
+            Schema::table('yz_activity_apply_order',
+                function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_order', 'status')) {
+                        $table->string('status')->nullable()->comment('支付状态');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('yz_activity_apply_order', function (Blueprint $table) {
+            $table->dropColumn('status');
+        });
+    }
+}

+ 45 - 0
plugins/activity-apply/migrations/2020_08_21_164500_add_share_title_to_ims_yz_activity_apply_activity_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
+
+
+class AddShareTitleToImsYzActivityApplyActivityTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_activity')) {
+            Schema::table('yz_activity_apply_activity',function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'share_title')) {
+                        $table->string('share_title')->nullable()->comment('分享标题');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'share_thumb')) {
+                        $table->string('share_thumb')->nullable()->comment('分享图片');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'share_describe')) {
+                        $table->text('share_describe')->nullable()->comment('分享描述');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('yz_activity_apply_activity', function (Blueprint $table) {
+            $table->dropColumn('share_title');
+            $table->dropColumn('share_thumb');
+            $table->dropColumn('share_describe');
+        });
+    }
+}

+ 45 - 0
plugins/activity-apply/migrations/2020_11_03_160732_create_ims_yz_activity_apply_order_log_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+
+class CreateImsYzActivityApplyOrderLogTable extends Migration {
+
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up()
+	{
+        if (!Schema::hasTable('yz_activity_apply_order_log')) {
+            Schema::create('yz_activity_apply_order_log',
+                function (Blueprint $table) {
+                    $table->increments('id');
+                    $table->integer('uniacid')->nullable()->comment('公众号ID');
+                    $table->integer('activity_id')->nullable()->comment('活动id');
+                    $table->integer('member_id')->nullable()->comment('会员id');
+                    $table->integer('pay_status')->nullable()->comment('驳回支付状态');
+                    $table->text('rejection_details')->nullable()->comment('驳回信息');
+                    $table->integer('created_at')->nullable();
+                    $table->integer('updated_at')->nullable();
+                    $table->integer('deleted_at')->nullable();
+                });
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE " . app('db')->getTablePrefix() . "yz_activity_apply_order_log comment '活动报名-订单日志'");//表注释
+        }
+	}
+
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down()
+	{
+		Schema::drop('yz_activity_apply_order_log');
+	}
+
+}

+ 45 - 0
plugins/activity-apply/migrations/2021_03_19_184050_alter_activity_apply_activity_table.php

@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AlterActivityApplyActivityTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_activity')) {
+            Schema::table('yz_activity_apply_activity',
+                function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'longitude')) {
+                        $table->string('longitude')->nullable()->comment('起点经纬度');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'latitude')) {
+                        $table->string('latitude')->nullable()->comment('终点经纬度');
+                    }
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'initials')) {
+                        $table->string('initials')->nullable()->comment('国标');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('yz_activity_apply_activity', function (Blueprint $table) {
+            $table->dropColumn('longitude');
+            $table->dropColumn('latitude');
+            $table->dropColumn('initials');
+        });
+    }
+}

+ 26 - 0
plugins/activity-apply/migrations/2021_07_02_140105_change_ims_yz_activity_apply_order_table.php

@@ -0,0 +1,26 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangeImsYzActivityApplyOrderTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_order')) {
+            Schema::table('yz_activity_apply_order', function (Blueprint $table) {
+                if (Schema::hasColumn('yz_activity_apply_order', 'cash')) {
+                    $table->decimal('cash', 14,2)->nullable()->change()->comment('现金金额');
+                }
+            });
+        }
+    }
+
+
+}

+ 37 - 0
plugins/activity-apply/migrations/2022_05_23_100021_add_member_power_ims_yz_activity_apply_activity_table.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddMemberPowerImsYzActivityApplyActivityTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (Schema::hasTable('yz_activity_apply_activity')) {
+            Schema::table('yz_activity_apply_activity',
+                function (Blueprint $table) {
+                    if (!Schema::hasColumn('yz_activity_apply_activity', 'member_power')) {
+                        $table->string('member_power')->nullable()->comment('可参加活动会员id集合');
+                    }
+                });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('yz_activity_apply_activity', function (Blueprint $table) {
+            $table->dropColumn('member_power');
+        });
+    }
+}

+ 11 - 0
plugins/activity-apply/package.json

@@ -0,0 +1,11 @@
+{
+    "name": "activity-apply",
+    "terminal": "wechat|min|wap",
+    "version": "1.0.69",
+    "title": "活动报名",
+    "description": "线上报名缴纳费用,付费金额营销设置。",
+    "author": "",
+    "url": "",
+    "namespace": "Yunshop\\ActivityApply",
+    "config": "config.tpl"
+}

+ 43 - 0
plugins/activity-apply/src/Listener/OrderCanceledListener.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/5/5
+ * Time: 14:43
+ */
+
+namespace Yunshop\ActivityApply\Listener;
+use app\common\events\order\AfterOrderCanceledEvent;
+use app\common\models\Order;
+use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use Yunshop\ActivityApply\models\PayOrderModel as PayOrder;
+use Yunshop\ActivityApply\models\RelationModel;
+
+class OrderCanceledListener
+{
+    use DispatchesJobs;
+
+    private $order;
+
+    public function subscribe(Dispatcher $events)
+    {
+        $events->listen(AfterOrderCanceledEvent::class, self::class . '@handle');
+    }
+
+    public function handle(AfterOrderCanceledEvent $event)
+    {
+        $this->order =  Order::find($event->getOrderModel()->id);
+
+        if ($this->order->plugin_id == PayOrder::PLUGIN_ID) {
+            $this->payOder($this->order);
+        }
+    }
+    public function payOder($order){
+        \Log::debug('刪除对应活动报名订单',$order->id);
+        $pay_order = PayOrder::uniacid()->where('order_id', $order->id)->first();
+        RelationModel::uniacid()->where('form_data_id',$pay_order['form_id'])->delete();
+        PayOrder::uniacid()->where('order_id', $order->id)->delete();
+        //return PayOrder::uniacid()->where('order_id', $order->id)->delete();
+    }
+}

+ 69 - 0
plugins/activity-apply/src/Listener/OrderCreatedListener.php

@@ -0,0 +1,69 @@
+<?php
+
+
+namespace Yunshop\ActivityApply\Listener;
+
+use app\common\events\order\AfterOrderCreatedEvent;
+use app\common\models\Member;
+use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use app\frontend\modules\order\services\OrderService;
+use app\common\models\Order;
+use Yunshop\ActivityApply\models\ActivityModel;
+use Yunshop\ActivityApply\models\PayOrderModel;
+use Yunshop\ActivityApply\models\PayOrderModel as PayOrder;
+use app\common\models\PayType;
+use Yunshop\ActivityApply\services\MessageService;
+
+
+class OrderCreatedListener
+{
+
+    use DispatchesJobs;
+
+    protected $event;
+    protected $order;
+
+    public function subscribe(Dispatcher $events)
+    {
+        $events->listen(AfterOrderCreatedEvent::class, self::class . '@handle');
+    }
+
+    public function handle(AfterOrderCreatedEvent $event)
+    {
+        $this->event = $event->getOrderModel();
+        $this->order = Order::find($event->getOrderModel()->id);
+
+//        if ($this->order->plugin_id == PayOrder::PLUGIN_ID) {
+//            $this->setPayOrder();
+//        }
+        if ($this->order->plugin_id == PayOrderModel::PLUGIN_ID) {
+            self::getNotice($this->order->id);
+        }
+
+    }
+
+    public function setPayOrder()
+    {
+
+        $listPayOder = PayOrder::where('order_id', $this->order->id)->first()->toArray();
+
+        if($listPayOder['cash'] == 0){
+            $this->params['order_id'] =$listPayOder['order_id'];
+            $this->params['pay_type_id'] = PayType::BACKEND;
+            OrderService::orderPay( $this->params);
+        }
+    }
+
+    private function getNotice($order_id){
+
+        $member_id = $this->order->uid;
+        $pay_activity = PayOrder::where('order_id',$order_id)->first();
+        $activity = ActivityModel::select('id','title')->where('id',$pay_activity['activity_id'])->first();
+        $content = [
+            'price' => $this->order->price,
+            'title' => $activity['title'],
+        ];
+        MessageService::enrol($member_id,$content);
+    }
+}

+ 53 - 0
plugins/activity-apply/src/Listener/OrderPaidListener.php

@@ -0,0 +1,53 @@
+<?php
+
+
+namespace Yunshop\ActivityApply\Listener;
+
+use app\common\events\order\AfterOrderPaidEvent;
+use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use app\common\models\Order;
+use Illuminate\Support\Facades\DB;
+use Yunshop\ActivityApply\models\PayOrderModel;
+
+
+class OrderPaidListener
+{
+    use DispatchesJobs;
+
+    /**
+     *
+     * @param  Dispatcher $events
+     * @return mixed
+     */
+    public $all_order_goods;
+    public $goods_id;
+
+    public function subscribe(Dispatcher $events)
+    {
+        $events->listen(\app\common\events\order\AfterOrderPaidEvent::class, self::class . '@handle');
+    }
+
+    public function handle(AfterOrderPaidEvent $event)
+    {
+        date_default_timezone_set("PRC");
+        $this->event = $event->getOrderModel();
+        $this->order = Order::find($event->getOrderModel()->id);
+
+        if ($this->order->plugin_id == PayOrderModel::PLUGIN_ID) {
+            $this->updatePreOrder($this->order->id);
+        }
+
+    }
+
+    protected function updatePreOrder($order_id)
+    {
+        \Log::info('订单已支付id',$order_id);
+        $preOrder = PayOrderModel::uniacid()->where('order_id',$order_id)->first();
+        \Log::info('订单id',$preOrder);
+            $data =['status' => 1];
+            PayOrderModel::where('id',$preOrder['id'])->update($data);
+
+    }
+
+}

+ 150 - 0
plugins/activity-apply/src/Listener/OrderReceiveListener.php

@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/8/10
+ * Time: 下午3:16
+ */
+namespace Yunshop\ActivityApply\Listener;
+
+use app\common\events\order\AfterOrderReceivedEvent;
+use app\common\models\Coupon;
+use app\common\models\MemberCoupon;
+use app\common\models\Order;
+use app\Jobs\addSendCouponJob;
+use app\Jobs\addSendCouponLogJob;
+use app\Jobs\OrderBonusJob;
+use Illuminate\Contracts\Events\Dispatcher;
+use Illuminate\Foundation\Bus\DispatchesJobs;
+use Yunshop\ActivityApply\common\models\ActivityApplyGoods;
+use Yunshop\ActivityApply\common\models\GiveCoupon;
+use Yunshop\ActivityApply\services\MessageService;
+use Yunshop\ActivityApply\models\PayOrderModel as PayOrder;
+use app\common\models\Member;
+
+class OrderReceiveListener
+{
+    use DispatchesJobs;
+
+    public $event;
+    public $order;
+    private $goods_id;
+    private $cashier_goods;
+    private $rewardStorePointByCashier = 1;
+    private $rewardStorePointBystore = 1;
+    private $rewardStoreLoveByCashier = 1;
+    private $rewardStoreLoveByStore = 1;
+    private $store_point_set;
+    private $store_love_set;
+
+    public function subscribe(Dispatcher $events)
+    {
+        $events->listen(AfterOrderReceivedEvent::class, self::class . '@handle');
+    }
+
+    public function handle(AfterOrderReceivedEvent $event)
+    {
+        $this->event = $event;
+        $this->order = Order::find($event->getOrderModel()->id);
+
+        // 如果不是活动报名订单,返回
+        if (!in_array($this->order->plugin_id, [PayOrder::PLUGIN_ID])) {
+            return;
+        }
+//        if ($this->order->price == 0) {
+//            return;
+//        }
+        $this->goods_id = $this->order->hasManyOrderGoods->first()->goods_id;
+
+        //赠送购买者优惠券并写入赠送奖励表
+        $this->giveBuyerCoupons($this->goods_id);
+
+        // 订单插件分红记录
+        (new OrderBonusJob('yz_love', 'love', 'operator_id', 'id', 'change_value', $this->order))->handle();
+        (new OrderBonusJob('yz_point_log', 'point', 'order_id', 'id', 'point', $this->order))->handle();
+
+    }
+
+
+    private function giveBuyerCoupons()
+    {
+        $coupon = ActivityApplyGoods::select('coupon')->where('goods_id',$this->goods_id)->first();
+        if (!$coupon) {
+            return;
+        }
+        $coupon_set = unserialize($coupon->coupon);
+        if (!$coupon_set) {
+            return;
+        }
+        foreach ($coupon_set as $coupon) {
+            if (!$coupon['id']) {
+                continue;
+            }
+            $verify_coupon_res = $this->verifyCouponTotal($coupon['id']);
+            if (!$verify_coupon_res) {
+                continue;
+            }
+            // todo 优惠券发送给用户
+            $this->dispatch((new addSendCouponJob($this->getCouponData($coupon['id']))));
+            // todo 发送优惠券记录
+            $this->dispatch((new addSendCouponLogJob($this->getSendCouponData($coupon['id']))));
+            // todo 存入奖励优惠券表
+            GiveCoupon::create([
+                'order_id'      => $this->order->id,
+                'uid'           => $this->order->uid,
+                'coupon_id'     => $coupon['id'],
+                'coupon_name'   => $coupon['name']
+            ]);
+        }
+    }
+
+    private function verifyCouponTotal($couponId)
+    {
+        //验证状态
+        $couponModel = Coupon::getCouponById($couponId);
+
+        $getTotal = MemberCoupon::uniacid()->where("coupon_id", $couponId)->count();
+        $lastTotal = $couponModel->total - $getTotal;
+        if (($couponModel->total != -1) && ($lastTotal < 1)) {
+            // 优惠券有限,并且发放数量超过限制
+            return false;
+        }
+
+        if (!$couponModel->status) {
+            //throw new ShopException('优惠券已下架,请先上架改优惠券');
+            return false;
+        }
+        return true;
+    }
+
+    private function getCouponData($coupon_id)
+    {
+        return [
+            'uniacid' => \YunShop::app()->uniacid,
+            'uid' => $this->order->uid,
+            'coupon_id' => $coupon_id,
+            'get_type' => 0,
+            'used' => 0,
+            'get_time' => strtotime('now'),
+        ];
+    }
+
+    private function getSendCouponData($coupon_id)
+    {
+        $logno = '购买活动发放优惠券成功: 商品( ID 为 ' . $this->goods_id . ' )成功发放 1 张优惠券( ID为 ' . $coupon_id . ' )给用户( Member ID 为 ' . $this->order->uid . ' )';
+        return [
+            'uniacid' => \YunShop::app()->uniacid,
+            'logno' => $logno,
+            'member_id' => $this->order->uid,
+            'couponid' => $coupon_id,
+            'paystatus' => 0,
+            'creditstatus' => 0,
+            'paytype' => 0,
+            'getfrom' => 0,
+            'status' => 0,
+            'createtime' => time(),
+        ];
+    }
+
+
+}

+ 430 - 0
plugins/activity-apply/src/PluginApplication.php

@@ -0,0 +1,430 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: shenyang
+ * Date: 2018/12/24
+ * Time: 3:38 PM
+ */
+
+namespace Yunshop\ActivityApply;
+
+
+use Config;
+use Yunshop\ActivityApply\services\MemberCenterService;
+use Yunshop\Integral\Common\CommonService;
+use Yunshop\Integral\Common\Config\MenuHook;
+use Yunshop\InterestsDividend\listeners\OrderPaidListener;
+
+class PluginApplication extends \app\common\services\PluginApplication
+{
+    protected function setConfig()
+    {
+        \app\common\modules\shop\ShopConfig::current()->set('observer.goods.activity-apply', [
+            'class' => \Yunshop\ActivityApply\common\models\ActivityApplyGoods::class,
+            'function_save' => 'relationSave'
+        ]);
+
+        // 设置插件ID
+        \app\common\modules\shop\ShopConfig::current()->set('plugins.activity-apply.id', ACTIVITY_APPLY_PLUGIN_ID);
+
+        \app\common\modules\shop\ShopConfig::current()->set('shop-foundation.order.activity_apply_order_operations',
+            [
+                'waitPay' => [
+                    \Yunshop\SnatchRegiment\api\order\operations\Pay::class,
+                    \Yunshop\SnatchRegiment\api\order\operations\Close::class,
+                ],
+                'complete' => [
+                    \Yunshop\SnatchRegiment\api\order\operations\Refund::class,
+                ]
+            ]
+        );
+
+    }
+
+    public function getTemplateItems()
+    {
+        return ['activity_enrol' => [
+            'title' => '活动报名(活动报名消息通知)',
+            'subtitle' => '活动报名消息通知',
+            'value' => 'activity_enrol',
+            'param' => [
+                '昵称','活动金额','活动名称','时间'
+            ]
+        ], 'activity_sign' => [
+            'title' => '活动报名(活动签到消息通知)',
+            'subtitle' => '活动签到消息通知',
+            'value' => 'activity_sign',
+            'param' => [
+                '昵称','活动名称','手机号码','时间'
+            ]
+        ]];
+    }
+
+    protected function setMenuConfig()
+    {
+
+        /**
+         * 菜单、权限、路由
+         */
+        \app\backend\modules\menu\Menu::current()->setPluginMenu('activity-apply',  [
+            'name' => '活动报名',
+            'type' => 'industry',
+            'url' => 'plugin.activity-apply.admin.activity-apply-calssify.index',// url 可以填写http 也可以直接写路由
+            'url_params' => '',//如果是url填写的是路由则启用参数否则不启用
+            'permit' => 1,//如果不设置则不会做权限检测
+            'menu' => 1,//如果不设置则不显示菜单,子菜单也将不显示
+            'top_show'    => 0,
+            'left_first_show'   => 0,
+            'left_second_show'   => 1,
+            'icon' => 'fa-link',//菜单图标
+            'list_icon' => 'activity-apply',//菜单图标
+            'parents' => [],
+            'child'=>[
+                'plugin.activity-apply.admin.activity-apply-calssify'=> [
+                    'name' => '活动分类',
+                    'permit' => 1,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.activity-apply.admin.activity-apply-calssify.index',
+                    'url_params' => [],
+                    'parents' => ['activity-apply'],
+                    'child' =>[
+                        'plugin.activity-apply.admin.activity-apply-calssify-add' => [
+                            'name' => '添加分类',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-calssify.add',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-calssify']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-calssify-edit' => [
+                            'name' => '编辑分类',
+                            'perimt' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-calssify.edit',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-calssify']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-calssify-is_open' => [
+                            'name' => '删除分类',
+                            'perimt' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-calssify.is_open',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-calssify']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-calssify-change-is-open' => [
+                            'name' => '启用/禁用',
+                            'permit' => 0,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-calssify.change-is-open',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-calssify']
+                        ],
+                    ]
+                ],
+                'plugin.activity-apply.admin.activity-apply-activity' => [
+                    'name' => '报名活动',
+                    'permit' => 1,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.activity-apply.admin.activity-apply-activity.index',
+                    'url_params' => [],
+                    'parents' => ['activity-apply'],
+                    'child' => [
+                        'plugin.activity-apply.admin.activity-apply-activity' => [
+                            'name' => '报名活动管理',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.index',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity'],
+                            'child' => []
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-add' => [
+                            'name' => '添加活动',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.add',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-search-coupon' => [
+                            'name' => '搜索商品',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.search-coupon',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-edit' => [
+                            'name' => '编辑活动',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.edit',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-delete' => [
+                            'name' => '删除活动',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.delete',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-export' => [
+                            'name' => '活动导出',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.export',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-enrol' => [
+                            'name' => '活动报名数据',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.enrol',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-enrolExport' => [
+                            'name' => '活动报名数据导出',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.enrolExport',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-enrol-details' => [
+                            'name' => '活动报名数据表单详情',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.enrol-details',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-setPutaway' => [
+                            'name' => '启用/禁用',
+                            'permit' => 0,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.setPutaway',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-activity-setProperty' => [
+                            'name' => '推荐/精选/热门',
+                            'permit' => 0,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.setProperty',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.set.index' => [
+                            'name' => '活动信息',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.set.index',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+
+                        'plugin.activity-apply.admin.marketing' => [
+                            'name' => '营销设置',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.set.marketing',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.fenrun' => [
+                            'name' => '分润设置',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.set.fenrun',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.cash' => [
+                            'name' => '返现设置',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.set.cash',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ],
+                        'plugin.activity-apply.admin.code' => [
+                            'name' => '活动二维码',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-activity.get-codes',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-activity']
+                        ]
+
+                    ]
+                ],
+                'plugin.activity-apply.admin.activity-apply-order'=> [
+                    'name' => '付费订单',
+                    'permit'=> 1,
+                    'menu' =>1,
+                    'icon' =>'',
+                    'url' => 'plugin.activity-apply.admin.activity-apply-order.index',
+                    'url_parmas'=>[],
+                    'parents' => ['activity-apply'],
+                    'child'=> [
+                        'plugin.activity-apply.admin.activity-apply-order-export' => [
+                            'name' => '订单导出',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-order.export',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-order']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-order-index' => [
+                            'name' => '订单搜索',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-order.index',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-order']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-order-detail' => [
+                            'name' => '订单详情',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-order.detail',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-order']
+                        ],
+
+
+                    ]
+                ],
+                'plugin.activity-apply.admin.activity-apply-lantetn-slide'=> [
+                    'name' => '幻灯片',
+                    'permit' => 1,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.activity-apply.admin.activity-apply-lantetn-slide.index',
+                    'url_parmas' => [],
+                    'parents' => ['activity-apply'],
+                    'child' => [
+                        'plugin.activity-apply.admin.activity-apply-lantetn-slide-add' => [
+                            'name' => '添加幻灯片',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-lantetn-slide.add',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-lantetn-slide']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-lantetn-slide-edit' => [
+                            'name' => '编辑幻灯片',
+                            'perimt' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-lantetn-slide.edit',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-lantetn-slide']
+                        ],
+                        'plugin.activity-apply.admin.activity-apply-lantetn-slide-deleted' => [
+                            'name' => '删除幻灯片',
+                            'perimt' => 1,
+                            'menu' => 0,
+                            'icon' => '',
+                            'url' => 'plugin.activity-apply.admin.activity-apply-lantetn-slide.deleted',
+                            'url_params' => [],
+                            'parents' => ['activity-apply', 'plugin.activity-apply.admin.activity-apply-lantetn-slide']
+                        ],
+                    ]
+                ],
+                'plugin.activity-apply.admin.activity-apply-set' => [
+                    'name' => ' 基础设置',
+                    'permit' => 1,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.activity-apply.admin.activity-apply-set.index',
+                    'url_params' => [],
+                    'parents' => ['activity-apply']
+                ]
+            ]
+        ]);
+    }
+
+    public function getFrontendWidgetConfig(): array
+    {
+        return [
+            'member_center.activity-apply' => MemberCenterService::class,
+        ];
+    }
+
+    public function boot()
+    {
+        $events = app('events');
+        /**
+         * 创建订单
+         * OrderCreatedListener
+         */
+        $events->subscribe(\Yunshop\ActivityApply\Listener\OrderCreatedListener::class);
+
+        /**
+         * 支付完成
+         */
+        $events->subscribe(\Yunshop\ActivityApply\Listener\OrderPaidListener::class);
+
+        /**
+         * 订单完成
+         *
+         */
+        //分润,积分,爱心值
+        $events->subscribe(\Yunshop\ActivityApply\Listener\OrderReceiveListener::class);
+
+        /**
+         * 订单取消
+         * OrderCanceledListener
+         */
+        $events->subscribe(\Yunshop\ActivityApply\Listener\OrderCanceledListener::class);
+
+
+        /**
+         * 定时任务
+         */
+        \Event::listen('cron.collectJobs', function () {
+            \Cron::add('ActivityApply', '*/10 * * * *', function () {
+                (new \Yunshop\ActivityApply\services\TimedTaskServices)->handle();
+            });
+
+        });
+    }
+
+    public function register()
+    {
+        // 活动报名插件的ID
+        define('ACTIVITY_APPLY_PLUGIN_ID', 46);
+    }
+}

+ 585 - 0
plugins/activity-apply/src/admin/ActivityApplyActivityController.php

@@ -0,0 +1,585 @@
+<?php
+
+namespace Yunshop\ActivityApply\admin;
+
+use app\backend\modules\member\models\MemberShopInfo;
+use app\backend\modules\uploadVerificate\UploadVerificationBaseController;
+use app\common\exceptions\ShopException;
+use app\common\helpers\PaginationHelper;
+use app\common\helpers\Url;
+use app\common\models\Coupon;
+use app\common\models\goods\Share;
+use app\common\services\SmallQrCode;
+use Yunshop\ActivityApply\models\ActivityModel as Activity;
+use Yunshop\ActivityApply\models\CalssifyModel as Calssify;
+use Yunshop\ActivityApply\models\TeamDividendLevelModel;
+use Yunshop\Commission\models\AgentLevel;
+use Yunshop\Diyform\models\DiyformDataModel;
+use Yunshop\Diyform\models\DiyformTypeModel;
+use app\common\helpers\Cache;
+use Yunshop\ActivityApply\common\models\Goods;
+use Yunshop\SingleReturn\models\SingleReturnGoodsModel;
+use Yunshop\Commission\models\Commission;
+use Yunshop\ActivityApply\models\PayOrderModel as Order;
+use Illuminate\Support\Facades\DB;
+use app\backend\modules\member\models\MemberLevel;
+use Yunshop\Love\Common\Models\GoodsLove;
+use app\common\models\Sale;
+use app\backend\modules\goods\models\Discount;
+use Yunshop\TeamDividend\models\GoodsTeamDividend;
+use Yunshop\ActivityApply\common\models\ActivityApplyGoods;
+
+class ActivityApplyActivityController extends UploadVerificationBaseController
+{
+
+    const STORE_BASE_VIEW           = 'Yunshop\ActivityApply::admin.activity_info';
+    const CASHIER_SALE_VIEW         = 'Yunshop\ActivityApply::admin.marketing';
+    const CASHIER_PROFIT_VIEW       = 'Yunshop\ActivityApply::admin.fenrun';
+    const CASHIER_RETURN_VIEW       = 'Yunshop\ActivityApply::admin.cash';
+    const SHARE                     = 'Yunshop\ActivityApply::admin.share';
+    const MEMBER_POWER              = 'Yunshop\ActivityApply::admin.member_power';
+    /**
+     *活动分类
+     *
+     */
+    public function index()
+    {
+        $pageSize =  10;
+        $search = \YunShop::request()->get('search');
+        $list = Activity::getActivity($search)->orderBy('id','DESC')->paginate($pageSize);
+        $pager = PaginationHelper::show($list->total(), $list->currentPage(), $list->perPage());
+        // $list = $this->getActivity($list);
+        return view('Yunshop\ActivityApply::admin.activity',[
+            'list' => $list->toArray(),
+            'pager' => $pager,
+            'search' => $search,
+            'total' => $list->total(),
+        ]);
+    }
+
+    /**
+     * @param $list
+     * @return mixed
+     */
+    public function getActivity($list)
+    {
+        foreach ($list as &$item) {
+            $item->download_url = $this->getQrCodeUrl($item->id);
+            $item->copy_download_url = yzAppFullUrl('/signIn/'.$item->id);
+
+            $item->small_qr_url = $this->getSmallQrCode($item->id);
+            $item->copy_small_qr_url = '/packageC/Myshaky/sign_in/sign_in?id='.$item->id;
+
+            $item->activity_url = $this->getQrCodeUrl($item->id,'enrollEnter/'.$item->id);
+            $item->copy_activity_url = yzAppFullUrl('enrollEnter/'.$item->id);
+
+            $item->small_activity_url = $this->getSmallQrCode($item->id,'packageC/Myshaky/enrollEnter/enrollEnter');
+            $item->copy_small_activity_url = '/packageC/Myshaky/enrollEnter/enrollEnter?id='.$item->id;
+        }
+        return $list;
+    }
+
+    public function getCodes()
+    {
+        $id = \YunShop::request()->get('id');
+
+        $data = [];
+        $data['download_url'] = $this->getQrCodeUrl($id);
+        $data['copy_download_url'] = yzAppFullUrl('/signIn/'.$id);
+
+        $data['small_qr_url'] = $this->getSmallQrCode($id);
+        $data["copy_small_qr_url"] = "/packageC/Myshaky/sign_in/sign_in?id=".$id;
+
+        $data['activity_url'] = $this->getQrCodeUrl($id,'enrollEnter/'.$id);
+        $data['copy_activity_url'] = yzAppFullUrl('enrollEnter/'.$id);
+
+        $data['small_activity_url'] = $this->getSmallQrCode($id,'packageC/Myshaky/enrollEnter/enrollEnter');
+        $data['copy_small_activity_url'] = '/packageC/Myshaky/enrollEnter/enrollEnter?id='.$id;
+
+        return $this->successJson("ok",$data);
+    }
+
+    public function enrol()
+    {
+        $pageSize =  20;
+        $activity_id = \YunShop::request()->id;
+        $argument =   request()->input();
+
+        $count = Order::where('activity_id',$activity_id)->where('sign','1')->count();
+        $list = Order::getEnrol($activity_id,$argument['search']);
+        if(app('plugins')->isEnabled('video-demand')){
+            $data=$list->with([
+                'hasOneLecturer'=>function($q){
+                     return $q->select('member_id','real_name');
+                },
+             ])
+            ->where('status',1)
+            ->orderBy('id','DESC')
+            ->paginate($pageSize);
+        }else{
+            $data=$list->where('status',1)
+                ->orderBy('id','DESC')
+                ->paginate($pageSize);
+        }
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+        return view('Yunshop\ActivityApply::admin.order_enrol',[
+            'list' => $data->toArray(),
+            'pager'=>$pager,
+            'total'=> $data->total(),
+            'count'=>$count,
+            'activity_id' =>$activity_id
+        ])->render();
+    }
+
+    public function enrolDetails()
+    {
+        $member_id = \YunShop::request()->member_id;
+        $form_id =    \YunShop::request()->id;
+        $act_id = \YunShop::request()->act_id;
+        $data = DiyformDataModel::uniacid()->where('member_id',$member_id)->where('form_id',$form_id)->first();
+        if ($data) {
+            $this->forms = DiyformTypeModel::find($form_id);
+            $fields = iunserializer($this->forms->fields);
+            return view('Yunshop\ActivityApply::admin.order_enrol_details', [
+                'item' => $data->toArray(),
+                'fields' => $fields,
+                'formId' => $this->forms->id,
+                'act_id'=>$act_id
+            ])->render();
+        }else{
+            return $this->message('表单不存在', '', 'error');
+        }
+    }
+
+    public function enrolExport()
+    {
+        $activity_id = \YunShop::request()->id;
+        $argument =   request()->input();
+        if($activity_id == ''){
+            $activity_id = $argument->activity_id;
+        }
+        $list = Order::where('activity_id',$activity_id)->first();
+        if(!$list){
+            return $this->message('活动还没有会员报名', '', 'error');
+        }
+        $data = Order::getEnrol($activity_id,$argument['search'])
+            ->where('status',1)
+            ->orderBy('id','Asc')
+            ->get();
+        if($data){
+            $data = $data  ->toArray();
+        }else{
+            return $this->message('活动还没有会员报名', '', 'error');
+        }
+
+        $file_name = date('Ymdhis', time()) . '会务活动报名导出';
+        $export_data[0] = [
+            'ID', '活动名称','讲师','会员','手机号码','报名时间','是否签到'
+        ];
+        $no_sign = '未签到';
+        $sign = '已签到';
+        foreach ($data as $key => $item) {
+
+            if($item['sign'] == 0){
+                $export_data[$key + 1] = [
+                    $item['id'],
+                    $item['has_one_activity']['title'],
+                    $item['has_one_lecturer']['real_name']?$item['has_one_lecturer']['real_name']:'',
+                    $item['has_one_member']['realname']? $item['has_one_member']['realname']: $item['has_one_member']['nickname'],
+                    $item['has_one_member']['mobile'],
+                    $item['created_at'],
+                    $no_sign
+                ];
+            }
+            if($item['sign'] == 1){
+                $export_data[$key + 1] = [
+                    $item['id'],
+                    $item['has_one_activity']['title'],
+                    $item['has_one_lecturer']['real_name']?$item['has_one_lecturer']['real_name']:'',
+                    $item['has_one_member']['realname']? $item['has_one_member']['realname']: $item['has_one_member']['nickname'],
+                    $item['has_one_member']['mobile'],
+                    $item['created_at'],
+                    $sign
+                ];
+            }
+
+        }
+        return \app\exports\ExcelService::fromArrayExport($export_data, $file_name);
+
+//        \Excel::create($file_name, function ($excel) use ($export_data) {
+//            $excel->setTitle('Office 2005 XLSX Document');
+//
+//            $excel->setCreator('芸众商城')
+//                ->setLastModifiedBy("芸众商城")
+//                ->setSubject("Office 2005 XLSX Test Document")
+//                ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
+//                ->setKeywords("office 2005 openxml php")
+//                ->setCategory("report file");
+//
+//            $excel->sheet('info', function ($sheet) use ($export_data) {
+//                $sheet->rows($export_data);
+//            });
+//        })->export('xls');
+
+    }
+
+    /**
+     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+     * 添加商品活动信息
+     */
+    public function add()
+    {
+        $post_data = request()->except('c','a','m','do','route');
+        $store_data = $post_data['data'];
+        $widgets_data = $post_data['widgets'];
+
+        if ($store_data) {
+            try{
+                DB::transaction(function () use ($store_data, $widgets_data) {
+                    $goods_model = Goods::saveGoods($store_data+['type'=>2], $widgets_data);
+                    $verify_res = Activity::verifyStore(Goods::getActivity($goods_model, $store_data));
+                    $this->saveStore($verify_res);
+                });
+            }catch (\Exception $e){
+                return $this->errorJson("后端数据插入异常",$e->getMessage());
+            }
+            return $this->successJson("活动添加成功");
+        }
+        $write = true;
+        return $this->returnView(null, $write);
+    }
+
+    public function edit()
+    {
+        $id = intval(request()->id);
+        $store_model = Activity::find($id);
+        if(empty($store_model)){
+            return $this->errorJson("无此活动或已经删除");
+        }
+        $goods_model = Goods::find($store_model->goods_id);
+        $post_data = request()->except('c','a','m','do','route');
+        $store_data = $post_data['data'];
+        $widgets_data = $post_data['widgets'];
+        if ($store_data) {
+            $store_data['member_power'] = implode(',',$store_data['member_power']);
+            $goods_model = Goods::saveGoods($store_data+['type'=>2], $widgets_data, $goods_model);
+            $verify_res = Activity::verifyStore((Goods::getActivity($goods_model, $store_data)),$store_model);
+            $this->saveStore($verify_res);
+            return $this->successJson("活动保存成功");
+        }
+        $write = false;
+        return $this->returnView($store_model, $write,$id);
+
+    }
+
+    private function returnView($store_model = null, $write = true ,$id=0,$search = '')
+    {
+        $calssify = Calssify::uniacid()->get();
+
+        //关联自定义插件必须开启
+        if (app('plugins')->isEnabled('diyform')) {
+            $diyForm = DiyformTypeModel::uniacid()->get();
+        } else {
+            return $this->message('自定义表单未安装', '', 'error');
+        }
+
+        //会员等级
+        $levels = MemberLevel::getMemberLevelList();
+
+        //视频点播
+        if (app('plugins')->isEnabled('video-demand')) {
+            $lecturer = DB::table('yz_video_lecturer')->where('uniacid',\YunShop::app()->uniacid)->get();
+        } else {
+            $lecturer='';
+        }
+
+        //编辑返回数据
+        if ($store_model!=null) {
+
+            //处理时间
+            $time =[];
+            $time['registration_time'] =  date("Y-m-d H:i:s",$store_model['registration_time']);
+            $time['registration_end_time'] =  date("Y-m-d H:i:s",$store_model['registration_end_time']);
+            $time['start_time'] = date("Y-m-d H:i:s",$store_model['start_time']);
+            $time['end_time'] =  date("Y-m-d H:i:s",$store_model['end_time']);
+
+            //商品列表
+            $discountValue = [];
+            if ($store_model->goods_id && Discount::getList($store_model->goods_id)) {
+                $discounts = Discount::getList($store_model->goods_id);
+                foreach ($discounts as $key => $discount) {
+                    $discountValue[$discount['level_id']] =   $discount['discount_value'];
+                }
+            }
+            $list = ActivityApplyGoods::select('profit','coupon')->where('goods_id',$store_model->goods_id)->first();
+        }
+        $member_power_list = explode(',',$store_model['member_power']);
+        $selectLevels = $levels;
+        $selectLevels[] = [
+            'id'=>0,
+            'level_name'=>\Setting::get('shop.member.level_name') ?:'普通会员',
+        ];
+        $data = [
+            'calssify' => $calssify,
+            'diyForm'  => $diyForm,
+            'selectLevels'=>$selectLevels,
+            'levels' =>$levels,
+            'exist_plugins' => $this->getPlugins($store_model->goods_id),
+            'time' => $time,
+            'item' => $store_model,
+            'lecturer' =>$lecturer,
+            'member_power_list' =>$member_power_list
+        ];
+
+        $data['sale'] = Sale::where('goods_id',$store_model->goods_id)->first();
+        $data['discountValue'] = $discountValue;
+        $data['write'] = $write;
+        $data['love_name'] = '爱心值';
+        $data['profit'] = unserialize($list['profit']);
+        $data['coupon'] = unserialize($list['coupon']);
+        $data['id'] = $id;
+
+        //爱心值插件
+        $exist_love = app('plugins')->isEnabled('love');
+        if ($exist_love) {
+            $love_set = array_pluck(\Setting::getAllByGroup('Love')->toArray(), 'value', 'key');
+            if ($love_set['name']) {
+                $data['love_name'] = $love_set['name'];
+            }
+        }
+
+        //添加活动返回页面数据
+        if ($store_model==null) {
+            $widgets = '';
+            $setting = '';
+
+            //活动分类
+            $calssify = Calssify::getSearch('id', 'calssify_title')->get();
+
+            //自定义表单
+            $diyForm = DiyformTypeModel::getDiyformList()->get();
+
+            //视频点播,讲师
+            if (app('plugins')->isEnabled('video-demand')) {
+                $lecturer = DB::table('yz_video_lecturer')->where('uniacid',\YunShop::app()->uniacid)->get();
+            } else {
+                $lecturer='';
+            }
+
+            $return_plugins = [
+                'single-return',//消费赠送
+                'full-return',//满额赠送
+                'consume-return',//消费返现
+            ];
+
+            $return_plugin_count = count($return_plugins);
+            $num = 0;
+            foreach ($return_plugins as $item) {
+                if (!app('plugins')->isEnabled($item)) {
+                    $num++;
+                }
+            }
+
+            $return_show = $num == $return_plugin_count ? false : true;
+
+            return view('Yunshop\ActivityApply::admin.activity_from', [
+                'title' => '活动信息',
+                'data'    =>     $data,
+                'exist_plugins' => $this->getPlugins(),
+                'widgets' =>     $widgets,
+                'setting' =>     $setting,
+                'write'   =>     $write,
+                'calssify'=>  $calssify,
+                'diyForm' => $diyForm,
+                'lecturer' => $lecturer,
+                'return_show' => $return_show
+            ])->render();
+
+        } else {
+            //编辑返回页面
+            return view('Yunshop\ActivityApply::admin.activity_edit', $data);
+        }
+    }
+
+    private function saveStore($verify_res)
+    {
+        if ($verify_res['validator']->fails()) {
+            echo $this->errorJson($verify_res['validator']->errors()->first());
+            exit;
+        } else {
+            $verify_res['store_model']->save();
+        }
+
+    }
+
+    /**
+     * 删除
+     */
+
+    public function delete()
+    {
+        $id = \YunShop::request()->id;
+        $calssify = Activity::find($id);
+        if (!$calssify) {
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+
+        $result =  Activity::where('id',$id)->delete();
+        if ($result) {
+            return $this->message('删除分类成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-activity.index'));
+        } else {
+            return $this->message('删除分类失败', '', 'error');
+        }
+
+    }
+
+
+    /**
+     * @param $id
+     * @return string
+     * @throws ShopException
+     */
+    public function getQrCodeUrl($id,$url='')
+    {
+        /**
+         * todo
+         */
+        if (!$url) {
+            $url = yzAppFullUrl('/signIn/' . $id);
+        } else {
+            $url = yzAppFullUrl($url);
+        }
+
+        $name = md5($url);
+        if (!is_dir(storage_path("app/public/qr/cashier"))) {
+            $this->Directory(storage_path("app/public/qr/cashier"));
+            mkdir(storage_path("app/public/qr/cashier"), 0777);
+        }
+        if (!is_dir(storage_path("app/public/qr/cashier"))) {
+            throw new ShopException('生成会务报名签到二维码目录失败');
+        }
+        if (!file_exists(storage_path("app/public/qr/cashier/{$name}.png")) || request()->input('new')) {
+            unlink(storage_path("app/public/qr/cashier/{$name}.png"));
+            // 注意:format方法必须先调用,否则后续方法不生效
+            \QrCode::format('png')->size(240)->generate($url, storage_path("app/public/qr/cashier/{$name}.png"));
+        }
+        if (!file_exists(storage_path("app/public/qr/cashier/{$name}.png"))) {
+            throw new ShopException('生成会务报名签到二维码目录失败');
+        }
+        return request()->getSchemeAndHttpHost() . config('app.webPath') . \Storage::url("app/public/qr/cashier/{$name}.png");
+    }
+    //文件权限
+    public function Directory($dir)
+    {
+        return is_dir($dir) or self::Directory(dirname($dir)) and mkdir($dir, 0777);
+    }
+
+
+    public function setPutaway()
+    {
+        return $this->setProperty();
+    }
+
+    public function setProperty()
+    {
+        $id = \YunShop::request()->id;
+        $field = \YunShop::request()->type;
+        $data = (\YunShop::request()->data == 1 ? '0' : '1');
+        $Activity = Activity::find($id);
+        $Activity->$field = $data;
+        $Activity->save();
+        Cache::flush();
+        echo json_encode(["data" => $data, "result" => 1]);
+    }
+
+    private function getPlugins($goods_id = '')
+    {
+        $exist_plugins = [];
+        // todo 分销
+        $exist_commission = app('plugins')->isEnabled('commission');
+
+        if ($exist_commission) {
+            $commission_levels = AgentLevel::getLevels()->get();
+            $exist_plugins['commission'] = [
+                'commission'    => true,
+                'commission_levels' => $commission_levels
+            ];
+            if ($goods_id) {
+                $item = Commission::getModel($goods_id, '');
+                $item->rule = unserialize($item->rule);
+                $exist_plugins['commission']['commission_goods'] = $item;
+            }
+        }
+
+        // todo 订单返现
+        $exist_single_return = app('plugins')->isEnabled('single-return');
+
+        if ($exist_single_return) {
+            $exist_plugins['single-return']['single_return_goods'] = '';
+            if ($goods_id) {
+                $item = SingleReturnGoodsModel::getModel($goods_id, '');
+                $exist_plugins['single-return']['single_return_goods'] = $item;
+            }
+        }
+        // todo 经销商等级
+        $exist_team_dividend = app('plugins')->isEnabled('team-dividend');
+        if ($exist_team_dividend) {
+            $team_dividend_levels = TeamDividendLevelModel::getList('id')->get();
+
+            $exist_plugins['dividend'] = [
+                'dividend'    => true,
+                'dividend_levels' => $team_dividend_levels
+            ];
+            if ($goods_id) {
+                $item = GoodsTeamDividend::getModel($goods_id,'');
+                $item->has_dividend_rates = unserialize($item->has_dividend_rates);
+                $exist_plugins['dividend']['team_dividend_levels'] = $item;
+            }
+        }
+        // todo 爱心值
+        $exist_love = app('plugins')->isEnabled('love');
+        if ($exist_love) {
+            $exist_plugins['love']['love_goods'] = '';
+            if ($goods_id) {
+                $item = GoodsLove::ofGoodsId($goods_id)->first();
+                $exist_plugins['love']['love_goods'] = $item;
+            }
+        }
+        //todo 分享
+        if($goods_id){
+            $exist_plugins['share'] = '';
+            $item = Share::getGoodsShareInfo($goods_id);
+            $exist_plugins['share'] =$item;
+        }
+        return $exist_plugins;
+    }
+
+    public function getSmallQrCode($id,$url='')
+    {
+        $small_qr_name = "activity_apply_small_qr_code".$id;
+        $data['scene'] = 'id='.$id;
+        $data['page'] = 'packageC/Myshaky/sign_in/sign_in';
+
+        if ($url) {
+            $small_qr_name = "activity_apply_small_qr_code_".$id;
+            $data['page'] = $url;
+        }
+
+        $small_qr = new SmallQrCode();
+        $small_qr_data = $small_qr->getSmallQrCode($small_qr_name,$data);
+        return  $small_qr_data['file_path'];
+    }
+
+    public function searchCoupon()
+    {
+        $keyword = \YunShop::request()->keyword;
+        $coupons = Coupon::uniacid()->select('id', 'name')
+            ->where('name', 'like', '%' . $keyword . '%')
+            ->get();
+        return view('Yunshop\ActivityApply::admin.coupon', [
+            'coupons' => $coupons
+        ])->render();
+    }
+}
+
+?>

+ 132 - 0
plugins/activity-apply/src/admin/ActivityApplyCalssifyController.php

@@ -0,0 +1,132 @@
+<?php
+
+namespace Yunshop\ActivityApply\admin;
+
+use app\backend\modules\uploadVerificate\UploadVerificationBaseController;
+use app\common\components\BaseController;
+use app\common\helpers\PaginationHelper;
+use app\common\helpers\Url;
+use Yunshop\ActivityApply\models\CalssifyModel as Calssify;
+
+class ActivityApplyCalssifyController extends UploadVerificationBaseController
+{
+
+
+    /**
+     *活动分类
+     *
+     */
+    public function index()
+    {
+        $pageSize =  10;
+        $search = \YunShop::request()->get('search');
+        $list = Calssify::getSearch($search)->orderBy('sort','DESC')->paginate($pageSize);
+        $pager = PaginationHelper::show($list->total(), $list->currentPage(), $list->perPage());
+        $total = $list->count();
+
+        return view('Yunshop\ActivityApply::admin.calssify',[
+                'list' => $list,
+                'pager' => $pager,
+                'search' => $search,
+                'total' => $total,
+            ]);
+    }
+
+    /**
+     * 活动分类添加
+     */
+    public function add()
+    {
+        $addClassify = \YunShop::request()->get('data');
+
+         if($addClassify){
+             $row = Calssify::addClassify($addClassify);
+             if($row){
+                 return $this->message('添加分类成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-calssify.index'));
+             }else{
+                 return $this->message('添加分类失败', '', 'error');
+             }
+         }
+
+        return view('Yunshop\ActivityApply::admin.calssify_add', [
+            'title' => '创建新分类',
+        ])->render();
+    }
+
+    /**
+     * 活动分类编辑
+     */
+    public function edit()
+    {
+        $id = \YunShop::request()->id;
+        $calssifyData = \YunShop::request()->get('data');
+        $calssify = Calssify::find($id);
+        $calssify['thumb'] = yz_tomedia($calssify['thumb']);
+
+        //默认追加分类路径
+        if ($id) {
+            $calssify['is_link'] = 1;
+            $calssify['link'] = yzAppFullUrl('/Sort?id=/'.$id);
+        }
+        if (!$calssify) {
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+        if ($calssifyData) {
+            $row = Calssify::addClassify($calssifyData,$id);
+            if ($row) {
+                return $this->message('分类保存成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-calssify.index'));
+            } else {
+                return $this->message('分类保存失败', '', 'error');
+            }
+        }
+
+        return view('Yunshop\ActivityApply::admin.calssify_add', [
+            'title' => '创建新分类',
+            'item' => $calssify->toArray(),
+        ])->render();
+
+    }
+
+    /**
+     * 隐藏
+     */
+    public function changeIsOpen()
+    {
+        $id = \YunShop::request()->id;
+        $is_open = in_array(\YunShop::request()->is_open,[0,1]) ? \YunShop::request()->is_open : 0;
+        $calssify = Calssify::find($id);
+
+        if(!$calssify){
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+        $calssify->is_open =$is_open;
+        if($calssify->save()){
+         return $this->successJson('修改成功');
+        }else{
+            return $this->successJson('修改失败');
+        }
+    }
+
+    /**
+     * 软删除
+     */
+    public function is_open()
+    {
+        $id = \YunShop::request()->id;
+        $calssify = Calssify::find($id);
+
+        if(!$calssify){
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+
+        $result =  Calssify::where('id',$id)->delete();
+        if ($result) {
+            return $this->message('删除分类成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-calssify.index'));
+        } else {
+            return $this->message('删除分类失败', '', 'error');
+        }
+    }
+
+}
+
+?>

+ 107 - 0
plugins/activity-apply/src/admin/ActivityApplyLantetnSlideController.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace Yunshop\ActivityApply\admin;
+
+use app\backend\modules\uploadVerificate\UploadVerificationBaseController;
+use app\common\helpers\PaginationHelper;
+use app\common\helpers\Url;
+use Yunshop\ActivityApply\models\LantetnSlideModel as Lantetn;
+
+
+class ActivityApplyLantetnSlideController extends UploadVerificationBaseController
+{
+
+    /**
+     *幻灯片
+     *
+     */
+    public function index()
+    {
+        $pageSize =  10;
+        $search = \YunShop::request()->get('search');
+        $list = Lantetn::getSearch($search)->orderBy('display_order','DESC')->paginate($pageSize);
+        $pager = PaginationHelper::show($list->total(), $list->currentPage(), $list->perPage());
+
+        return view('Yunshop\ActivityApply::admin.lantetn',[
+            'list' => $list,
+            'pager' => $pager,
+            'search' => $search,
+            'total' => $list->total(),
+        ]);
+    }
+
+
+    /**
+     * 活动分类添加
+     */
+    public function add()
+    {
+        $addLantetn = \YunShop::request()->get('data');
+
+        if($addLantetn){
+            $row =  Lantetn::addLantern($addLantetn);
+            if ($row) {
+                return $this->message('保存成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-lantetn-slide.index'));
+            }else{
+                return $this->message('保存失败', '', 'error');
+            }
+        }
+
+        return view('Yunshop\ActivityApply::admin.lantetn_info', [
+            'title' => '创建新分类',
+        ])->render();
+    }
+
+    /**
+     * 活动分类编辑
+     */
+    public function edit()
+    {
+        $id = \YunShop::request()->id;
+        $lantetn = Lantetn::uniacid()->find($id);
+        $lantetn['thumb'] = yz_tomedia( $lantetn['thumb'] );
+
+        if (!$lantetn) {
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+        $lantetnData = \YunShop::request()->get('data');
+
+        if($lantetnData){
+
+            $row =  Lantetn::addLantern($lantetnData,$id);
+            if ($row) {
+                return $this->message('保存成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-lantetn-slide.index'));
+            }else{
+                return $this->message('保存失败', '', 'error');
+            }
+        }
+        return view('Yunshop\ActivityApply::admin.lantetn_info', [
+            'title' => '创建新分类',
+            'item' => $lantetn,
+        ])->render();
+
+    }
+
+    /**
+     * 软删除
+     */
+    public function deleted()
+    {
+        $id = \YunShop::request()->id;
+        $lantetn = Lantetn::find($id);
+
+        if(!$lantetn){
+            return $this->message('无此活动分类或已经删除', '', 'error');
+        }
+
+        $result =  Lantetn::where('id',$id)->delete();
+        if ($result) {
+            return $this->message('删除分类成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-lantetn-slide.index'));
+        } else {
+            return $this->message('删除分类失败', '', 'error');
+        }
+
+    }
+}
+
+?>

+ 187 - 0
plugins/activity-apply/src/admin/ActivityApplyOrderController.php

@@ -0,0 +1,187 @@
+<?php
+
+namespace Yunshop\ActivityApply\admin;
+
+use app\common\components\BaseController;
+use app\common\exceptions\ShopException;
+use app\common\helpers\PaginationHelper;
+use Yunshop\ActivityApply\common\models\Order;
+use app\common\services\ExportService;
+
+
+class ActivityApplyOrderController extends BaseController
+{
+    const LIST_VIEW = 'Yunshop\ActivityApply::admin.order';
+
+    /**
+     * 页码
+     */
+    const PAGE_SIZE = 15;
+    /**
+     * @var Order
+     */
+    protected $orderModel;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $search = request()->search;
+        $this->orderModel = Order::getOrderList($search);
+    }
+
+    public function index()
+    {
+        $this->export($this->orderModel);
+        return view('Yunshop\ActivityApply::admin.order', $this->getData())->render();
+    }
+
+    protected function getData()
+    {
+        $Search = \Yunshop::request()->get('search');
+        if ($Search) {
+            $Search = array_filter($Search, function ($item) {
+                return !empty($item);
+            });
+        }
+
+        $list['total_price'] = $this->orderModel->sum('price');
+        $list += $this->orderModel->orderBy('id', 'desc')
+            ->paginate($this->page_size)
+            ->appends(['builder_model'])
+            ->toArray();
+        $pager = PaginationHelper::show($list['total'], $list['current_page'], $list['per_page']);
+        $data = [
+            'list' => $list,
+            'total_price' => $list['total_price'],
+            'pager' => $pager,
+            'Search' => $Search,
+            'var' => \YunShop::app()->get(),
+            'url' => \Request::query('route'),
+            'include_ops' => 'order.ops',
+            'detail_url' => 'plugin.activity-apply.admin.activity-apply-order.detail',
+        ];
+        return $data;
+    }
+
+    public function detail()
+    {
+        $orderId = request()->id;
+        $order = Order::getOrderDetailById($orderId);
+        if (!$order) {
+            throw new ShopException('未找到该订单');
+        }
+        if (!empty($order->express)) {
+            $express = $order->express->getExpress($order->express->express_code, $order->express->express_sn);
+
+            $dispatch['express_sn'] = $order->express->express_sn;
+            $dispatch['company_name'] = $order->express->express_company_name;
+            $dispatch['data'] = $express['data'];
+            $dispatch['thumb'] = $order->hasManyOrderGoods[0]->thumb;
+            $dispatch['tel'] = '95533';
+            $dispatch['status_name'] = $express['status_name'];
+        }
+        $order = $this->getOrderGoods($order);
+        return view('Yunshop\ActivityApply::admin.order.detail', [
+            'order' => $order ? $order->toArray() : [],
+            'dispatch' => $dispatch,
+            'var' => \YunShop::app()->get(),
+            'ops' => 'order.ops',
+        ])->render();
+    }
+
+    private function getOrderGoods($order)
+    {
+        $order->hasManyOrderGoods->map(function ($orderGoods) {
+            return $orderGoods->hasOneActivityApply;
+        });
+
+        return $order;
+    }
+
+
+    /**
+     * 导出列表
+     */
+
+    public function export($orders)
+    {
+        if ( request()->export != 1) return;
+        $export_page = request()->export_page ? request()->export_page : 1;
+        $export_model = new ExportService($orders, $export_page);
+        if ($export_model->builder_model->isEmpty()) {
+            throw new ShopException('没有可导出订单');
+        }
+        if (!$export_model->builder_model->isEmpty()) {
+            $file_name = date('Ymdhis', time()).'订单导出';
+            $export_data[0] = $this->getColumns();
+            foreach ($export_model->builder_model->toArray() as $key => $item) {
+                $export_data[$key + 1] = [
+                    $item['order_sn'],
+                    $item['has_one_order_pay']['pay_sn'],
+                    $this->getNickname($item['belongs_to_member']['uid']),
+                    $this->getNickname($item['belongs_to_member']['nickname']),
+                    $item['address']['realname'],
+                    $item['address']['mobile'],
+                    $item['address']['address'],
+                    $this->getGoods($item, 'goods_title'),
+                    $this->getGoods($item, 'goods_sn'),
+                    $this->getGoods($item, 'total'),
+                    $item['pay_type_name'],
+                    $item['goods_price'],
+                    $item['dispatch_price'],
+                    $item['lease_toy']['deposit_total'],
+                    $item['price'],
+                    $item['status_name'],
+                    $item['create_time'],
+                    !empty(strtotime($item['pay_time']))?$item['pay_time']:'',
+                    !empty(strtotime($item['finish_time']))?$item['finish_time']:'',
+
+                ];
+            }
+            $export_model->export($file_name, $export_data, 'order.list.index');
+
+        }
+    }
+
+    private function getColumns()
+    {
+        return ["订单编号", "支付单号", "粉丝ID", "粉丝昵称", "会员姓名", "联系电话", "收货地址", "商品名称", "商品编码", "商品数量", "支付方式", "商品小计", "运费", "押金", "应收款",  "状态", "下单时间", "付款时间",  "完成时间"];
+    }
+
+    private function getGoods($order, $key)
+    {
+        $goods_title = '';
+        $goods_sn = '';
+        $total = '';
+        $cost_price = 0;
+        foreach ($order['has_many_order_goods'] as $goods) {
+            $res_title = $goods['title'];
+            $res_title = str_replace('-', ',', $res_title);
+            $res_title = str_replace('+', ',', $res_title);
+            $res_title = str_replace('/', ',', $res_title);
+            $res_title = str_replace('*', ',', $res_title);
+            $res_title = str_replace('=', ',', $res_title);
+
+            $goods_sn .= '【' . $goods['goods_sn'].'】';
+            $goods_title .= '【' . $res_title . '*' . $goods['total'] . '】';
+            $total .= '【' . $goods['total'].'】';
+            $cost_price += $goods['goods_cost_price'];
+        }
+        $res = [
+            'goods_title' => $goods_title,
+            'goods_sn' => $goods_sn,
+            'total' => $total,
+        ];
+        return $res[$key];
+    }
+
+    private function getNickname($nickname)
+    {
+        if (substr($nickname, 0, strlen('=')) === '=') {
+            $nickname = ',' . $nickname;
+        }
+        return $nickname;
+    }
+}
+
+?>

+ 40 - 0
plugins/activity-apply/src/admin/ActivityApplySetController.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace Yunshop\ActivityApply\admin;
+
+use app\common\components\BaseController;
+use app\common\helpers\Url;
+use app\common\models\notice\MessageTemp;
+
+class ActivityApplySetController extends BaseController
+{
+
+    /**
+     *广告位设置
+     *
+     */
+    public function index()
+    {
+        $set = \Setting::get('plugin.activity-apply');
+        $request = \YunShop::request()->setdata;
+
+        if ($request) {
+            if (\Setting::set('plugin.activity-apply', $request)) {
+                return $this->message('设置成功', Url::absoluteWeb('plugin.activity-apply.admin.activity-apply-set.index'));
+            } else {
+                return $this->error('设置失败');
+            }
+        }
+        $temp_list = MessageTemp::getList();
+        $set['is_hot'] = !isset($set['is_hot']) ? 1 : $set['is_hot'];
+        $set['is_discount'] = !isset($set['is_discount']) ? 1 : $set['is_discount'];
+        $set['is_recommand'] = !isset($set['is_recommand']) ? 1 : $set['is_recommand'];
+        return view('Yunshop\ActivityApply::admin.set', [
+            'title' => '基础设置',
+             'set'  => $set,
+             'temp_list' => $temp_list
+        ])->render();
+    }
+}
+
+?>

+ 358 - 0
plugins/activity-apply/src/api/ActivityController.php

@@ -0,0 +1,358 @@
+<?php
+
+
+namespace Yunshop\ActivityApply\api;
+
+use app\common\facades\Setting;
+use app\common\helpers\PaginationHelper;
+use app\common\components\ApiController;
+use app\common\models\Sale;
+use Yunshop\ActivityApply\models\ActivityModel as Activity;
+use Yunshop\ActivityApply\models\AttentionModel;
+use Yunshop\ActivityApply\models\PayOrderModel;
+use Yunshop\ActivityApply\models\RelationModel;
+use Yunshop\ActivityApply\services\MessageService;
+use app\backend\modules\member\models\MemberShopInfo;
+use \app\common\models\Member;
+use Illuminate\Support\Facades\DB;
+use Yunshop\Diyform\models\DiyformDataModel;
+use Yunshop\Love\Common\Models\GoodsLove;
+
+class  ActivityController extends ApiController
+{
+
+    /**
+     * 活动详情
+     */
+    public function getActivity()
+    {
+        $id = \YunShop::request()->get('activity_id');
+        $uid = \YunShop::app()->getMemberId();
+
+        //开启视频点播插件
+        $data = Activity::uniacid();
+        if(app('plugins')->isEnabled('video-demand') && Setting::get('plugin.video_demand.is_video_demand') == 1) {
+              $data = $data->with([
+                'hasOneLecturer' => function($lecturer) {
+                    return $lecturer->where('uniacid', \YunShop::app()->uniacid);
+                },
+              ]);
+        }
+        $data = $data->with([
+              'hasManyPayOrder' => function ($q) {
+                return $q->select(['activity_id', 'id', DB::raw('count("activity_id") as count'),
+                    'attention', 'order_id', 'status'])->where('status',1);
+              },
+            'PayOrder' => function ($q) {
+                $q->select(['id', 'activity_id', 'sign']);
+            },
+              'hasOneShare',
+              'hasOneMember'=>function($q){
+                return $q->select('uid','mobile','nickname','avatar');
+              }])
+              ->where('is_open',1)->find($id);
+
+        if (!$data){
+            return $this->errorJson('未检测到数据!', $data);
+        }
+
+        //自定义表单信息
+        $data['form_data_id'] = RelationModel::uniacid()
+                ->select('form_data_id')
+                ->where('member_id',$uid)
+                ->where('activity_id',$id)
+                ->where('form_id',$data['form_id'])
+                ->first();
+
+        //获取会员积分抵扣
+        $data['goods_sale'] = Sale::select('goods_id','min_point_deduct','max_point_deduct','point')
+            ->where('goods_id',$data['goods_id'])->first();
+
+        //爱心值
+        $data['love'] = '';
+        if (app('plugins')->isEnabled('love')) {
+            $data['love'] = GoodsLove::uniacid()
+                ->select(
+                    'goods_id','award','deduction','award_proportion',
+                    'deduction_proportion','parent_award','parent_award_proportion',
+                    'second_award_proportion'
+                )
+                ->where('goods_id',$data['goods_id'])
+                ->first();
+        }
+
+        //会员信息
+        $data['member'] = Member::select('uid','realname','nickname','mobile','avatar','credit1')->where('uid',$uid)->first();
+        $data->hasOneShare['share_thumb']= yz_tomedia($data->hasOneShare['share_thumb']);
+
+        //验证讲师是
+        $data['is_lecturer'] = 0;
+        if (app('plugins')->isEnabled('video-demand') && Setting::get('plugin.video_demand.is_video_demand') == 1 && $data['hasOneLecturer']) {
+            $data['is_lecturer'] = 1;
+        }
+        $get = \Setting::get('plugin.activity-apply');
+        $data['set'] = [
+            'share_title' => !empty($get['share_title']) ? $get['share_title'] : \Setting::get('shop.share.title'),
+            'share_thumb' => !empty($get['share_thumb']) ? yz_tomedia($get['share_thumb']) :  yz_tomedia(\Setting::get('shop.share.icon')),
+            'share_desc' => !empty($get['share_desc']) ? $get['share_desc'] : \Setting::get('shop.share.desc'),
+            'share_url' =>  yzAppFullUrl('activity_home',['mid' => \YunShop::app()->getMemberId()]),
+        ];
+        if ($data) {
+            return $this->successJson('成功',$data);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * 检测用户是否参加活动
+     */
+    public function getActivityEnrol()
+    {
+        $id = \YunShop::request()->get('activity_id');
+        $uid = \YunShop::app()->getMemberId();
+        $data = PayOrderModel::uniacid()
+              ->with(['hasOneOrder'])
+              ->where('activity_id',$id)
+              ->where('member_id',$uid)
+              ->first();
+        //判断该会员的会员等级是否够满足参加活动
+        $activity = Activity::uniacid()->where('id',$id)->first();
+        if(!empty($activity->member_power))
+        {
+            $member_level = MemberShopInfo::uniacid()->where('member_id',$uid)->first();
+            $member_power_list = explode(',',$activity->member_power);
+            if(!in_array($member_level->level_id,$member_power_list)){
+                return $this->errorJson('该会员没有参加此活动的权限',['enrol' =>2]);
+            }
+        }
+
+        if ($data) {
+            return $this->successJson('已参加此活动报名',['enrol' =>1,'status'=>$data['status']?$data['status']:0]);
+        } else {
+            return $this->errorJson('未检测到报名信息',['enrol' =>0]);
+        }
+    }
+
+    /**
+     * 活动报名人数
+     */
+    public function getDetails()
+    {
+        $id = \YunShop::request()->get('activity_id');
+        $pageSize =  20;
+
+        $data = PayOrderModel::uniacid()
+            ->with([
+                'hasOneMember'=>function($q){
+                    return $q->select('uid','email','realname','avatar','nickname');
+                },
+                'hasOneOrder'=>function($q){
+                    return $q->select('id','status')->where('status','>=','1');
+            }])
+            ->where('activity_id',$id )
+            ->where('status',1)
+            ->paginate($pageSize);
+
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+
+        if ($data) {
+            return $this->successJson('成功',$data,$pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * 是否关注
+     */
+
+    public function isAttention()
+    {
+        $activity_id = \YunShop::request()->get('activity_id');
+        $member_id   = \YunShop::app()->getMemberId();
+        $attention = AttentionModel::uniacid()
+                   ->where('activity_id',$activity_id)
+                   ->where('member_id',$member_id)
+                   ->first();
+
+        if ($attention) {
+            return $this->successJson('已成功',$attention);
+        } else {
+            return $this->successJson('未关注',$attention);
+        }
+    }
+
+    /**
+     * 点击关注
+     */
+    public function attention()
+    {
+        $activity_id = \YunShop::request()->get('activity_id');
+        $member_id   = \YunShop::app()->getMemberId();
+        $attention = AttentionModel::uniacid()
+                   ->where('activity_id',$activity_id)
+                   ->where('member_id',$member_id)
+                   ->first();
+
+        if (empty($attention)) {
+            $datas =array(
+                'uniacid' => \YunShop::app()->uniacid,
+                'member_id' => $member_id,
+                'activity_id' => $activity_id,
+                'is_attention' => 1,
+                'created_at' =>time()
+            );
+            AttentionModel::uniacid()->insert($datas);
+            return $this->successJson('关注成功');
+        }
+
+        if ($attention['is_attention'] == '0') {
+            AttentionModel::uniacid()->where('activity_id',$activity_id)->where('member_id',$member_id)
+                    ->update(['is_attention'=>'1']);
+                return $this->successJson('关注成功');
+        } else {
+            AttentionModel::uniacid()->where('activity_id',$activity_id)->where('member_id',$member_id)
+                ->update(['is_attention'=>'0']);
+            return $this->successJson('取消关注');
+        }
+    }
+
+
+
+    /**
+     * 会员
+     */
+    public function getMember()
+    {
+        $id = \YunShop::app()->getMemberId();
+        $data['member'] = Member::where('uid',$id)->first();
+        $data['level'] = MemberShopInfo::getMemberLevel($id);
+
+        if ($data) {
+            return $this->successJson('成功',$data);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * @return \Illuminate\Http\JsonResponse
+     * 签到
+     */
+    public function saveSign()
+    {
+        $activityId = \YunShop::request()->get('activity_id');
+        $memberId = \YunShop::app()->getMemberId();
+
+        $activityModel = PayOrderModel::uniacid()
+              ->with([
+                   'hasOneActivity'=>function($q){
+                        return $q->select('id','title','cash');
+                   },
+                    'hasOneMember'=>function($q){
+                         return $q->select('uid','mobile','realname');
+              }])
+              ->where('activity_id', $activityId)
+              ->where('member_id', $memberId)
+              ->first();
+
+        if (!$activityModel) {
+            return $this->successJson('签到失败,您未报名', ['result' => '-2']);
+        }
+        if ($activityModel->sign == 1) {
+            return $this->errorJson('签到失败,您已签到', ['result' => '-1']);
+        }
+        $activityModel->sign = 1;
+
+        $content = array(
+            'title' => $activityModel['hasOneActivity']['title'],
+            'mobile' => $activityModel['hasOneMember']['mobile']
+        );
+
+        if ($activityModel->save()) {
+
+            MessageService::sign($memberId, $content);
+            return $this->successJson('签到成功', ['result' => '1']);
+        }
+        return $this->errorJson('签到失败', ['result' => '0']);
+
+    }
+
+    /**
+     * 自定义表单修改
+     */
+    public function updateDiyForm()
+    {
+
+        $form_data_id = \YunShop::request()->form_data_id;
+        $form_data = \YunShop::request()->form_data;
+        if ($form_data_id == '') {
+            return $this->errorJson('暂无自定义表单', ['result' => '0']);
+        }
+        $list = DiyformDataModel::uniacid()->find($form_data_id);
+        foreach ($form_data[0] as &$row) {
+            if (is_array($row)) {
+                foreach ($row as &$v) {
+                    if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $v, $result)) {
+                        $img_name = 'supplier' . str_random(16) . '.'.$result[2];
+                        $img_file = storage_path('app/public/avatar').'/' . $img_name;
+                        file_put_contents($img_file, base64_decode(str_replace($result[1], '', $v)));
+                        $v = config('app.webPath') . '/storage/app/public/avatar/' . $img_name;
+                    }
+                }
+            }
+        }
+        unset($v);
+        unset($row);
+
+        if ($list) {
+            $formDate =[
+                'data' => iserializer($form_data[0]),
+            ];
+            $list->fill($formDate);
+            $list->save();
+            return $this->successJson('修改成功',$formDate);
+        } else {
+            return $this->errorJson('修改失败,自定义表单不存在');
+        }
+    }
+
+    /**
+     *活动关联自定义表单
+     */
+    public function getDiyForm()
+    {
+        $member_id = \YunShop::app()->getMemberId();
+        $activity_id = \YunShop::request()->activity_id;
+        $form_id = \YunShop::request()->form_id;
+        $form_data_id = \YunShop::request()->form_data_id;
+        $uniacid =\YunShop::app()->uniacid;
+
+        $list = RelationModel::uniacid()
+            ->where('member_id',$member_id)
+            ->where('activity_id',$activity_id)
+            ->where('form_id',$form_id)
+            ->where('form_data_id',$form_data_id)
+            ->first();
+        if (!empty($list)) {
+            return $this->successJson('表单已提交',$list);
+        } else {
+            $data = [
+                'member_id'=>$member_id,
+                'activity_id'=>$activity_id,
+                'form_id'=>$form_id,
+                'form_data_id'=>$form_data_id,
+                'uniacid'=>$uniacid
+            ];
+
+           if ( RelationModel::insert($data)) {
+               return $this->successJson('数据添加成功',$data);
+           } else {
+               return $this->errorJson('数据添加失败',$data);
+           }
+        }
+    }
+
+}
+?>

+ 89 - 0
plugins/activity-apply/src/api/CreateController.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/2
+ * Time: 10:02
+ */
+
+namespace Yunshop\ActivityApply\api;
+
+use app\common\models\Member;
+use app\framework\Http\Request;
+use Yunshop\ActivityApply\api\models\PreOrder;
+use Yunshop\ActivityApply\api\models\Goods;
+use Yunshop\ActivityApply\models\ActivityModel;
+use Yunshop\ActivityApply\models\PayOrderModel;
+use Yunshop\Diyform\models\DiyformDataModel;
+use Yunshop\Diyform\models\DiyformTypeModel;
+
+class CreateController extends \app\frontend\modules\order\controllers\CreateController
+{
+    public function preAction()
+    {
+        app('OrderManager')->bind('PreOrder', function ($orderManager, $attributes) {
+            return new PreOrder($attributes);
+        });
+        app('GoodsManager')->bind('Goods', function ($goodsManager, $attributes) {
+            return new Goods($attributes);
+        });
+
+        parent::preAction();
+
+    }
+
+    public function index()
+    {
+        //下单前先判断活动是否已结束或者报名人数已满
+        $time=time();
+        $activity = ActivityModel::uniacid()
+            ->select('registration_end_time','id','limit')
+            ->where('id',request()->input('activity_id'))
+            ->first();
+
+        if ($time >= $activity['registration_end_time']) {
+            return $this->errorJson('活动报名已结束!');
+        }
+
+        $order_count = PayOrderModel::uniacid()
+            ->where('activity_id',request()->input('activity_id'))
+            ->where('status',1)
+            ->count();
+
+        if ($order_count >= $activity['limit']) {
+            return $this->errorJson('活动报名人数已满!');
+        }
+
+        \Log::info('用户下单', request()->input());
+        $this->validateParam();
+
+        //订单组
+        $trade = $this->getMemberCarts()->getTrade(Member::current());
+        $trade->generate();
+        $orderIds = $trade->orders->pluck('id')->implode(',');
+
+        //生成订单,触发事件
+        return $this->successJson('成功', ['order_ids' => $orderIds]);
+
+    }
+
+    public function validateParam()
+    {
+        $form_id = request()->form_id;
+
+        if (app('plugins')->isEnabled('diyform')) {
+            $diy_data = DiyformDataModel::where('id', $form_id)->first();
+            $type_data = DiyformTypeModel::find($diy_data['form_id']);
+            $fields = iunserializer($type_data->fields);
+            $data = unserialize($diy_data['data']);
+
+            foreach ($fields as $key => $value) {
+                if ($value['tp_must'] == 1 && empty($data)) {
+                    return $this->errorJson('请填写自定义表单的必填项');
+                }
+            }
+        }
+        return true;
+    }
+
+}

+ 32 - 0
plugins/activity-apply/src/api/GoodsBuyController.php

@@ -0,0 +1,32 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/2
+ * Time: 9:23
+ */
+
+namespace Yunshop\ActivityApply\api;
+
+
+use Yunshop\ActivityApply\api\models\PreOrder;
+
+class GoodsBuyController extends \app\frontend\modules\order\controllers\GoodsBuyController
+{
+    public function __construct()
+    {
+        app('OrderManager')->bind('PreOrder', function ($orderManager, $attributes) {
+            return new PreOrder($attributes);
+        });
+        parent::__construct();
+    }
+
+    protected function validateParam()
+    {
+        $this->validate([
+            'activity_id' => 'required|integer|min:0',
+        ]);
+        // 验证商品属活动报名,商品插件id   插件id
+        parent::validateParam();
+    }
+}

+ 287 - 0
plugins/activity-apply/src/api/IndexController.php

@@ -0,0 +1,287 @@
+<?php
+
+
+namespace Yunshop\ActivityApply\api;
+
+
+use app\common\components\ApiController;
+use Illuminate\Support\Facades\DB;
+use Yunshop\ActivityApply\models\CalssifyModel as Calssify;
+use Yunshop\ActivityApply\models\ActivityModel as Activity;
+use Yunshop\ActivityApply\models\LantetnSlideModel as Lantetn;
+use app\common\helpers\PaginationHelper;
+
+class  IndexController extends ApiController
+{
+
+    /**
+     *幻灯片
+     */
+    public function getLantetnSlide()
+    {
+        $list = Lantetn::uniacid()->orderBy('display_order', 'DESC')->get();
+        if ($list) {
+            foreach($list as &$v){
+                $v['thumb'] = yz_tomedia($v['thumb']);
+            }
+            unset($v);
+            return $this->successJson('成功', $list);
+        } else {
+            return $this->errorJson('未检测到数据!', $list);
+        }
+    }
+
+    /**
+     * 活动分类
+     */
+    public function getCalssify()
+    {
+        $calssify = Calssify::uniacid()->where('is_open', 1)->orderBy('sort', 'DESC')->get();
+
+        if ($calssify) {
+            foreach($calssify as &$v){
+                $v['thumb'] = yz_tomedia($v['thumb']);
+            }
+            unset($v);
+            return $this->successJson('获取分类成功', $calssify);
+        } else {
+            return $this->errorJson('未检测到数据!', $calssify);
+        }
+    }
+
+    /**
+     * 全部活动与分类
+     */
+    public function getAll()
+    {
+        $city_name = \YunShop::request()->get('city_name');
+        $calssify_id = \YunShop::request()->get('calssify_id');
+        $pageSize = 10;
+
+        if ($calssify_id) {
+            $data = Activity::uniacid()
+                ->where([
+                    ['city_name', 'like', '%' . $city_name . '%'],
+                    ['calssify_id', '=', $calssify_id],
+                    ['is_open', '=', 1]
+                ])
+                ->paginate($pageSize);
+        } else {
+            $data = Activity::uniacid()
+                ->where('city_name', 'like', '%' . $city_name . '%')
+                ->where('is_open', 1)
+                ->paginate($pageSize);
+        }
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+        if ($data) {
+            return $this->successJson('成功', $data, $pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * 首页活动
+     */
+
+    public function getActivity()
+    {
+        $city_name = \YunShop::request()->get('city_name');
+        //热门活动
+        $hot = Activity::uniacid()
+            ->where([['is_hot', '=', '1'], ['is_open', '=', 1], ['city_name', 'like', '%' . $city_name . '%']])
+            ->orderBy('id', 'DESC')->limit(4)->get();
+        //精选活动
+        $discount = Activity::uniacid()
+            ->where([['is_discount', '=', '1'], ['is_open', '=', 1], ['city_name', 'like', '%' . $city_name . '%']])
+            ->orderBy('id', 'DESC')->limit(7)->get();
+        //推荐活动
+        $recommand = Activity::uniacid()
+            ->where([['is_recommand', '=', '1'], ['is_open', '=', 1], ['city_name', 'like', '%' . $city_name . '%']])
+            ->orderBy('id', 'DESC')->limit(4)->get();
+        $set = \Setting::get('plugin.activity-apply');
+        $data = [
+            'hot' => $hot,
+            'discount' => $discount,
+            '$recommand' => $recommand
+        ];
+        $data['set'] = [
+            'share_title' => !empty($get['share_title']) ? $get['share_title'] : \Setting::get('shop.share.title'),
+            'share_thumb' => !empty($get['share_thumb']) ? yz_tomedia($get['share_thumb']) :  yz_tomedia(\Setting::get('shop.share.icon')),
+            'share_desc' => !empty($get['share_desc']) ? $get['share_desc'] : \Setting::get('shop.share.desc'),
+            'share_url' =>  yzAppFullUrl('activity_home',['mid' => \YunShop::app()->getMemberId()]),
+            'is_hot' => !isset($set['is_hot']) ? 1 : $set['is_hot'],
+            'is_discount' => !isset($set['is_discount']) ? 1 : $set['is_discount'],
+            'is_recommand' => !isset($set['is_recommand']) ? 1 : $set['is_recommand']
+        ];
+        if ($data) {
+            return $this->successJson('获取活动成功', $data);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     *热门全部活动
+     */
+
+    public function getCount()
+    {
+        $city_name = \YunShop::request()->get('city_name');
+        $calssify_id = \YunShop::request()->get('calssify_id');
+        $hot = \YunShop::request()->get('is_hot') ? 1:0;
+        $discount = \YunShop::request()->get('is_discount') ? 1:0;
+
+        $pageSize = 10;
+
+        $data = Activity::uniacid()->select([
+            'id', 'calssify_id', 'title', 'thumb', 'city_name',
+            'district_name', 'address', 'start_time', 'end_time',
+            'cash', 'registration_time', 'registration_end_time'
+        ]);
+
+        if ($hot) {
+            //热门活动
+            $data = $this->hotCount($data,$calssify_id,$city_name,$pageSize);
+        } elseif ($discount) {
+            //精选活动
+            $data = $this->discountCount($data,$calssify_id,$city_name,$pageSize);
+        } else {
+            //推荐活动
+            $data = $this->recommandCount($data,$calssify_id,$city_name,$pageSize);
+        }
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+        if ($data) {
+            return $this->successJson('成功', $data, $pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    //热门活动
+    public function hotCount($data,$class,$city_name,$pageSize)
+    {
+        $row = $data->where('is_hot', '1');
+        $row = $this->activityInformation($row,$class,$city_name,$pageSize);
+
+        return $row;
+    }
+
+    //精选活动
+    public function discountCount($data,$class,$city_name,$pageSize)
+    {
+        $row = $data->where('is_discount', '1');
+        $row = $this->activityInformation($row,$class,$city_name,$pageSize);
+        return $row;
+    }
+
+    //推荐活动
+    public function recommandCount($data,$class,$city_name,$pageSize)
+    {
+        $row = $data->where('is_recommand', '1');
+        $row = $this->activityInformation($row,$class,$city_name,$pageSize);
+        return $row;
+    }
+
+    //读取活动信息
+    public function activityInformation($row,$class,$city_name,$pageSize)
+    {
+        if ($class) {
+            return $row->where('city_name', 'like', '%' . $city_name . '%')
+                        ->where('calssify_id', $class)
+                        ->where('is_open', 1)
+                        ->orderBy('id', 'DESC')
+                        ->paginate($pageSize);
+        }
+        return $row->where('city_name', 'like', '%' . $city_name . '%')
+                    ->where('is_open', 1)
+                    ->orderBy('id', 'DESC')
+                    ->paginate($pageSize);
+    }
+
+
+    /**
+     *搜索活动
+     */
+    public function getSearch()
+    {
+        $request = \YunShop::request()->get();
+        $pageSize =  10;
+
+        $activity = Activity::uniacid();
+
+        if ($request['city_name'] && !$request['keywords']) {
+
+            $activity->where('city_name', 'like', '%'.$request['city_name'].'%');
+
+        } else if ($request['keywords'] && !$request['city_name']){
+
+            $activity->where('title', 'like', '%'.$request['keywords'].'%');
+
+        } else if ($request['city_name'] && $request['keywords']){
+
+            $activity->where('city_name', 'like', '%'.$request['city_name'].'%')
+                      ->where('title', 'like', '%'.$request['keywords'].'%');
+        }
+
+        $activity = $activity->where('is_open',1)->paginate($pageSize);
+
+        $pager = PaginationHelper::show($activity->total(), $activity->currentPage(), $activity->perPage());
+
+        if ($activity) {
+            return $this->successJson('搜索城市活法成功',$activity,$pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $activity);
+        }
+    }
+
+    /**
+     * @name 活动分组
+     * @author
+     * @return \Illuminate\Http\JsonResponse
+     */
+    public function getCityInitials()
+    {
+        $activity = Activity::uniacid()->where('is_open',1)->select('initials', 'city_id','city_name as full_address')
+            ->distinct()
+            ->get();
+        /**
+         * @var Collection $stores
+         */
+        $initials = $activity->groupBy('initials')->toArray();
+        ksort($initials);
+
+        // 前端需要的格式
+        $ret = [];
+        foreach ($initials as $initial => $val) {
+            $ret[] = [
+                'item' => $initials[$initial],
+                'title' => $initial
+            ];
+        }
+        return $this->successJson('成功', [
+            'initials' => $ret
+        ]);
+    }
+
+
+    /**
+     * @name 获取活动数量最多的6个城市
+     * @author
+     * @return \Illuminate\Http\JsonResponse
+     */
+    public function getHotCitys()
+    {
+        $citys = Activity::uniacid()->select('city_id', 'city_name as full_address',DB::raw('count(id) as activity_count'))
+            ->groupBy('city_id')
+            ->orderBy('activity_count', 'desc')
+            ->limit(20)
+            ->get();
+        return $this->successJson('成功', [
+            'citys' => $citys
+        ]);
+    }
+
+
+}
+?>

+ 164 - 0
plugins/activity-apply/src/api/LecturerController.php

@@ -0,0 +1,164 @@
+<?php
+
+namespace Yunshop\ActivityApply\api;
+
+use app\common\facades\Setting;
+use app\common\helpers\PaginationHelper;
+use app\common\components\ApiController;
+use Illuminate\Support\Facades\DB;
+use Yunshop\ActivityApply\models\ActivityModel;
+use Yunshop\ActivityApply\models\AttentionModel as Attention;
+use app\common\models\Order;
+
+class LecturerController extends ApiController
+{
+
+    /**
+     * 活动关联讲师
+     */
+    public  function  getRelevance()
+    {
+        $id = request()->input('member_id');
+        $pageSize =  10;
+
+        //开启视频点播插件
+        if (app('plugins')->isEnabled('video-demand')) {
+            $lecturer = DB::table('yz_video_lecturer')
+                ->join('mc_members' ,function($join) {
+                    $join->on('mc_members.uid', '=', 'yz_video_lecturer.member_id');
+                })
+                ->where('mc_members.uid',$id)
+                ->first();
+            $lecturer['t_image'] = yz_tomedia($lecturer['avatar']);
+            $lecturer['lecturer_title'] = Setting::get('shop.lang.zh_cn.activity_apply.lecturer') ?: '讲师';
+        } else {
+            $lecturer = '';
+        }
+
+        $list = ActivityModel::uniacid()->where('lecturer_id',$id)->paginate($pageSize);
+        $pager = PaginationHelper::show($list->total(), $list->currentPage(), $list->perPage());
+        $list = $list->toArray();
+
+        foreach ($list['data'] as $key => $value) {
+            $list['data'][$key]['thumb'] = yz_tomedia($value['thumb']);
+        }
+        $data = array(
+            'list'  => $list,
+            'lecturer'=>$lecturer
+        );
+        if($data){
+            return $this->successJson('成功',$data,$pager );
+        }else{
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * 课程关联讲师
+     */
+    public  function getCourse()
+    {
+        $id = \YunShop::request()->get('id');
+        $pageSize =  10;
+
+        $course = [];
+        if (app('plugins')->isEnabled('video-demand')) {
+            $course = DB::table('yz_video_course_goods')
+                ->join('yz_goods', function ($join) {
+                    $join->on('yz_goods.id', '=', 'yz_video_course_goods.goods_id')
+                        ->select('yz_goods.id', 'yz_goods.title', 'yz_goods.thumb', 'yz_goods.price', 'yz_goods.market_price');
+                })
+                ->select('yz_video_course_goods.*', 'yz_goods.*')
+                ->where('yz_video_course_goods.uniacid', \YunShop::app()->uniacid)
+                ->where('yz_video_course_goods.lecturer_id', $id)
+                ->paginate($pageSize);
+
+            $pager = PaginationHelper::show($course->total(), $course->currentPage(), $course->perPage());
+            $course = $course ? $course->toArray() : '';
+            foreach ($course['data'] as $key => $value) {
+                $course['data'][$key]['thumb'] = yz_tomedia($value['thumb']);
+            }
+        }
+
+        $data = [
+            'couser'  => $course
+        ];
+        if ($data) {
+            return $this->successJson('成功',$data,$pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**
+     * 我的关注
+     */
+    public function getMyActivity()
+    {
+        $id = \YunShop::request()->get('member_id');
+        $pageSize =  10;
+
+        $data = Attention::uniacid()
+            ->with([
+            'hasManyActivity'=> function($q){
+                    return $q->select([
+                        'id','title','start_time','end_time','cash','registration_time',
+                        'registration_end_time','province_name','city_name','district_name',
+                        'street_name','address','is_premium','thumb']);
+            }])
+            ->where('member_id',$id)
+            ->where('is_attention',1)
+            ->paginate($pageSize);
+
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+
+        if ($data) {
+            return $this->successJson('成功',$data,$pager);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+    /**\
+     * 我的报名
+     */
+    public function getOrder()
+    {
+        $id = \YunShop::app()->getMemberId();
+        $status = \YunShop::request()->get('status');
+
+        $data = Order::uniacid();
+        $pageSize =  10;
+        if($status == 1){
+            $data =$data ->where('yz_order.status','=','0');
+        }else if($status == 2){
+            $data =$data ->where('yz_order.status','=','3');
+        }
+        $data = $data->join('yz_activity_apply_order as ao', 'ao.order_id', '=', 'yz_order.id')
+            ->join('yz_activity_apply_activity as at', 'at.id', '=', 'ao.activity_id')
+            ->select('yz_order.*','at.title','at.start_time','at.end_time','at.thumb','at.id as activity_id','ao.sign')
+            ->where('member_id',$id)
+            ->where('plugin_id','46')
+            ->where('yz_order.is_member_deleted',0)
+            ->orderBy('id','DESC')
+            ->paginate($pageSize);
+
+        $pager = PaginationHelper::show($data->total(), $data->currentPage(), $data->perPage());
+        $time = time();
+        foreach ($data as $key => $value) {
+            if ($time >= strtotime($value['end_time']) || $value['sign'] == 1 || $value['status'] == 0 ) {
+                $data[$key]['is_open_refund'] = 0;
+            }else{
+                $data[$key]['is_open_refund'] = 1;
+            }
+            $data[$key]['is_open_cancel'] = in_array($value['status'],[ORDER::WAIT_PAY]) ? 1 : 0;
+        }
+        if($data){
+            return $this->successJson('返回报名订单成功',$data,$pager);
+        }else{
+            return $this->errorJson('未检测到数据!', $data);
+        }
+    }
+
+}
+?>

+ 81 - 0
plugins/activity-apply/src/api/OrderController.php

@@ -0,0 +1,81 @@
+<?php
+
+
+namespace Yunshop\ActivityApply\api;
+
+use app\common\components\ApiController;
+use Yunshop\ActivityApply\models\ActivityModel;
+use Yunshop\ActivityApply\models\PayOrderModel as PayOrder;
+use Yunshop\ActivityApply\models\PayOrderModel;
+use Yunshop\ActivityApply\models\RelationModel;
+
+
+class  OrderController extends ApiController
+{
+
+    /**
+     * @return mixed
+     * 我的报名详情
+     */
+
+    public function getMyEnrol()
+    {
+        $order_id = \YunShop::request()->get('order_id');
+        $member_id = \YunShop::app()->getMemberId();
+
+        $data = PayOrder::uniacid()
+              ->select('id','order_id','activity_id','created_at','updated_at','number')
+              ->with([
+                 'hasOneActivity'=>function($q) {
+                    return $q->select(['id','title','thumb','form_id','start_time','end_time','city_name','address']);
+                 },
+                'hasOneOrder'=>function($q) {
+                    return $q->select('id','status','price','plugin_id');
+                }])
+              ->where('order_id', $order_id)->first();
+
+        $data['form_data_id'] = RelationModel::uniacid()
+                            ->where('member_id',$member_id)
+                            ->where('activity_id',$data['hasOneActivity']['id'])
+                            ->where('form_id',$data['hasOneActivity']['form_id'])
+                            ->first();
+
+        if ($data) {
+            return $this->successJson('成功',$data);
+        } else {
+            return $this->errorJson('未检测到数据!', $data);
+        }
+
+    }
+
+    /**
+     * 检测改活动报名人数是否已满,已支付人数
+     * 检查活动是否还在进行中
+     */
+    public function getOrder()
+    {
+        $activity_id = request()->input('activity_id');
+        $time = time();
+
+        $activity = ActivityModel::uniacid()
+            ->select('registration_end_time','id','limit')
+            ->where('id',$activity_id)
+            ->first();
+
+        if ($time >= $activity['registration_end_time']) {
+            return $this->errorJson('活动报名已结束!');
+        }
+
+        $order_count = PayOrderModel::uniacid()
+            ->where('activity_id',$activity_id)
+            ->where('status',1)
+            ->count();
+
+        if ($order_count >= $activity['limit']) {
+            return $this->errorJson('活动报名人数已满!');
+        }
+        return $this->successJson('成功');
+    }
+
+}
+?>

+ 26 - 0
plugins/activity-apply/src/api/models/Goods.php

@@ -0,0 +1,26 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: shenyang
+ * Date: 2017/7/27
+ * Time: 下午2:23
+ */
+
+namespace Yunshop\ActivityApply\api\models;
+
+
+use Yunshop\ActivityApply\common\models\ActivityApplyGoods;
+use Yunshop\ActivityApply\models\ActivityModel;
+
+class Goods extends \app\frontend\models\Goods
+{
+    public function scopePluginId($query, $pluginId = 0)
+    {
+        return parent::scopePluginId($query, ActivityModel::PLUGIN_ID); // TODO: Change the autogenerated stub
+    }
+
+    public function hasActivityApplyGoods()
+    {
+        return $this->hasOne(ActivityApplyGoods::class, 'goods_id', 'id');
+    }
+}

+ 42 - 0
plugins/activity-apply/src/api/models/PreOrder.php

@@ -0,0 +1,42 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/2
+ * Time: 9:28
+ */
+
+namespace Yunshop\ActivityApply\api\models;
+
+use Yunshop\ActivityApply\models\PayOrderModel as Order;
+
+class PreOrder extends \app\frontend\modules\order\models\PreOrder
+{
+
+    protected $attributes = [ 'plugin_id' => Order::PLUGIN_ID];
+
+    public function beforeCreating()
+    {
+        parent::beforeCreating();
+        $payOrderModel = new PrePayOrderModel();
+        $order = $payOrderModel::getData();
+        $payOrderModel->fill($order);
+        $this->setRelation('hasOnePayOrderModel', $payOrderModel);
+
+    }
+
+    public function initAttributes()
+    {
+        parent::initAttributes();
+        $this->hasOnePayOrderModel->testOrder($this);
+
+    }
+    protected function getShopName(){
+
+        $name = $this->hasOnePayOrderModel->title;
+        return '活动报名:'.$name;
+    }
+
+
+
+}

+ 48 - 0
plugins/activity-apply/src/api/models/PrePayOrderModel.php

@@ -0,0 +1,48 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/2
+ * Time: 9:59
+ */
+
+namespace Yunshop\ActivityApply\api\models;
+
+
+use http\Env\Request;
+use Yunshop\ActivityApply\models\PayOrderModel;
+
+class   PrePayOrderModel extends PayOrderModel
+{
+
+
+    public function testOrder($order)
+    {
+        $attributes = [
+            'order_sn' => $order->order_sn,
+            'order_id' => $order->order_id,
+            'cash'     =>$order->price,
+        ];
+        $attributes = array_merge($this->getAttributes(), $attributes);
+        $this->setRawAttributes($attributes);
+    }
+    public function getData(){
+
+        $data =\YunShop::request()->get();
+        $goods = json_decode($data['goods'],true);
+
+        return[
+              'uniacid'        => \YunShop::app()->uniacid,
+              'member_id'      => \YunShop::app()->getMemberId(),
+              'activity_id'    => $data['activity_id'],
+              'calssify_id'    => $data['calssify_id'],
+              'lecturer_id'    => $data['lecturer_id'],
+              'activity_title' => $data['activity_title'],
+              'form_id'        => $data['form_id']?$data['form_id']:0,
+              'cash'           => $data['cash'],
+              'number'         => $goods[0]['total'],
+              'sign'  =>0,
+        ];
+    }
+
+}

+ 181 - 0
plugins/activity-apply/src/common/models/ActivityApplyGoods.php

@@ -0,0 +1,181 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/8/2
+ * Time: 下午2:33
+ */
+
+namespace Yunshop\ActivityApply\common\models;
+
+
+use app\common\models\BaseModel;
+
+class ActivityApplyGoods extends BaseModel
+{
+    public $table = 'yz_activity_apply_goods';
+    public $timestamps = true;
+    protected $guarded = [''];
+    static protected $needLog = true;
+    protected $casts = [
+        'payment_types' => 'json'
+    ];
+
+    public function scopeByGoodsId($query, $goods_id)
+    {
+        return $query->where('goods_id', $goods_id);
+    }
+
+    public $attributes = [
+        'is_open' => 0,
+        'plugins' => [
+            'love' => [
+                'deduction_proportion' => 0,
+                "award_proportion" => 0,
+                "award_shop" => 0
+            ]
+        ],
+        'profit' => [
+            'commission' => [
+                'amount' => 0
+            ],
+            'team-dividend' => [
+                'amount' => 0
+            ],
+            'area-dividend' => [
+                'amount' => 0
+            ],
+            'merchant-staff' => [
+                'amount' => 0
+            ],
+            'merchant-center' => [
+                'amount' => 0
+            ],
+            'single-return' => [
+                'amount' => 0
+            ],
+            'full-return' => [
+                'is_open' => 0
+            ],
+            'consume-return' => [
+                'is_open' => 0
+            ]
+        ]
+    ];
+
+    public static function relationSave($goodsId, $data, $operate)
+    {
+        if (!$goodsId) {
+            return false;
+        }
+        if (!$data) {
+            return false;
+        }
+        $saleModel = self::getModel($goodsId, $operate);
+        //判断deleted
+        if ($operate == 'deleted') {
+            return $saleModel->delete();
+        }
+
+        foreach ($data['coupon_ids'] as $key_id => $id) {
+            $data['coupon'][] = [
+                'id' => $id,
+                'name' => $data['coupon_names'][$key_id]
+            ];
+        }
+
+        $data['goods_id'] = $goodsId;
+        $data['plugins'] = serialize($data['plugins']);
+        $data['profit'] = serialize($data['profit']);
+        $data['coupon'] = serialize($data['coupon']);
+
+        unset($data['coupon_ids']);
+        unset($data['coupon_names']);
+
+        $saleModel->fill($data);
+        return $saleModel->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 getDeductWidgets($widgets)
+    {
+        //积分
+        $point = trim($widgets['sale']['point']);
+        if (!$point) {
+            $point = 0;
+        }
+        $widgets['sale']['point'] = $point .'%';
+        $widgets['sale']['award_balance'] = $widgets['sale']['award_balance']?:0;
+        $max_point_deduct = trim($widgets['sale']['max_point_deduct']);
+        if (!$max_point_deduct) {
+            $max_point_deduct = 0;
+        }
+        $widgets['sale']['max_point_deduct'] = $max_point_deduct .'%';
+        $min_point_deduct = trim($widgets['sale']['min_point_deduct']);
+        if (!$min_point_deduct) {
+            $min_point_deduct = 0;
+        }
+        $widgets['sale']['min_point_deduct'] = $min_point_deduct .'%';
+
+        //分享描述
+        $widgets['share']['share_title'] = $widgets['share']['share_title'];
+        $widgets['share']['share_thumb'] = $widgets['share']['share_thumb'];
+        $widgets['share']['share_desc'] = $widgets['share']['share_desc'];
+
+        //爱心值
+        $exist_love = app('plugins')->isEnabled('love');
+        if ($exist_love) {
+            $widgets['love']['award'] = trim($widgets['love']['award']) ? trim($widgets['love']['award']) : 0;//爱心值奖励是否开启
+            $widgets['love']['deduction'] = trim($widgets['love']['deduction']) ? trim($widgets['love']['deduction']) : 0;//爱心值抵扣是否开启
+            $widgets['love']['parent_award'] = trim($widgets['love']['parent_award']) ? trim($widgets['love']['parent_award']) : 0;//爱心值上级奖励是否开启
+
+            $widgets['love']['deduction_proportion'] = trim($widgets['love']['deduction_proportion']) ? trim($widgets['love']['deduction_proportion']) : 0;//爱心值最高抵扣
+            $widgets['love']['award_proportion'] = trim($widgets['love']['award_proportion']) ? trim($widgets['love']['award_proportion']) : 0;//爱心值奖励
+            if($widgets['love']['deduction_proportion'] == 0){
+                $widgets['love']['deduction'] = 0;
+            }
+            if($widgets['love']['award_proportion'] == 0){
+                $widgets['love']['award'] = 0;
+            }
+
+
+            $widgets['love']['parent_award_proportion'] = trim($widgets['love']['parent_award_proportion']) ? trim($widgets['love']['parent_award_proportion']) : 0;//爱心值上级第一级奖励
+            $widgets['love']['second_award_proportion'] = trim($widgets['love']['second_award_proportion']) ? trim($widgets['love']['second_award_proportion']) : 0;//爱心值上级第二级奖励
+
+        }
+        //经销商
+        $exist_team_dividend = app('plugins')->isEnabled('team-dividend');
+        if ($exist_team_dividend) {
+            $widgets['team_dividend']['is_dividend'] = trim($widgets['team_dividend']['is_dividend']) ? trim($widgets['team_dividend']['is_dividend']) : 0;
+            if($widgets['team_dividend']['is_dividend'] == 1){
+                $widgets['team_dividend']['has_dividend'] = 1;
+            }else{
+                $widgets['team_dividend']['has_dividend'] = 0;
+            }
+            $widgets['team_dividend']['has_dividend_rate'] = trim($widgets['team_dividend']['has_dividend_rate']) ? trim($widgets['team_dividend']['has_dividend_rate']) : 0;
+        }
+
+        //消费赠送
+        $exist_single_return = app('plugins')->isEnabled('single-return');
+        if ($exist_single_return) {
+            $widgets['single_return']['return_rate'] = trim($widgets['single_return']['return_rate']) ? trim($widgets['single_return']['return_rate']) : 0;
+            if( $widgets['single_return']['return_rate'] == 0){
+                $widgets['single_return']['is_single_return'] = 0;
+            }else{
+                $widgets['single_return']['is_single_return'] = 1;
+            }
+        }
+
+        return $widgets;
+    }
+}

+ 23 - 0
plugins/activity-apply/src/common/models/GiveCoupon.php

@@ -0,0 +1,23 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/8/11
+ * Time: 下午5:32
+ */
+
+namespace Yunshop\ActivityAPply\common\models;
+
+
+use app\common\models\BaseModel;
+
+class GiveCoupon extends BaseModel
+{
+    public $table = 'yz_activity_apply_give_coupon';
+    public $timestamps = true;
+    protected $guarded = [''];
+
+    public static function getCoupons()
+    {
+        return self::select();
+    }
+}

+ 183 - 0
plugins/activity-apply/src/common/models/Goods.php

@@ -0,0 +1,183 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/8/2
+ * Time: 下午2:11
+ */
+
+namespace Yunshop\ActivityApply\common\models;
+
+
+class Goods extends \app\backend\modules\goods\models\Goods
+{
+
+    public function hasOneCashierGoods()
+    {
+        return $this->hasOne(CashierGoods::class, 'goods_id', 'id');
+    }
+
+    public static function getGoodsByName($keyword)
+    {
+        return static::uniacid()->select('id', 'title', 'thumb', 'market_price', 'price', 'real_sales', 'sku', 'plugin_id', 'stock')
+            ->where('title', 'like', '%' . $keyword . '%')
+            ->where('status', 1)
+            //->where('is_plugin', 0)
+            ->where('plugin_id', 0)
+            ->get();
+    }
+
+    public static function saveGoods($store_data, $widgets_data, $goods_model = '')
+    {
+        $goods_id = $goods_model->id;
+
+        if (!$goods_model) {
+            $goods_model = new self();
+        }
+
+        $goods_model->fill(self::getGoodsData($store_data));
+        $goods_model->widgets = (new ActivityApplyGoods())->getDeductWidgets($widgets_data);
+        $goods_model->save();
+
+        if ($goods_id) {
+            return Goods::find($goods_id);
+        }
+
+        return $goods_model;
+
+    }
+
+    public static function getGoodsData($store_data){
+        return[
+            'uniacid'       => \YunShop::app()->uniacid,
+            'type'          => $store_data['type']?:1,
+            'status'        => 1,
+            'display_order' => 0,
+            'title'         => $store_data['title']?$store_data['title']:0,
+            'thumb'         => yz_tomedia($store_data['thumb'])?yz_tomedia($store_data['thumb']):0,
+            'price'  =>  sprintf("%.2f",  $store_data['cash']) ? sprintf("%.2f",  $store_data['cash']):0,
+            'cost_price'    =>  sprintf("%.2f",  $store_data['cash']) ? sprintf("%.2f",  $store_data['cash']):0,
+            'market_price' => sprintf("%.2f",  $store_data['cash']) ? sprintf("%.2f",  $store_data['cash']):0,
+            'stock'         => '99999',
+            'weight'        => 0,
+            'is_plugin'     => 0,
+            'brand_id'      => 0,
+            'plugin_id'     => 46,
+            'reduce_stock_method' => 1,
+            'need_address' =>1
+        ];
+    }
+
+
+    public static function getActivity($store_data,$goods_model)
+    {
+        $data= [
+            'uniacid'       => \YunShop::app()->uniacid,
+            'goods_id'      => $store_data['id'],
+            'title'         => $goods_model['title'],
+            'thumb'         => yz_tomedia($goods_model['thumb']),
+            'calssify_id'   => $goods_model['calssify_id'],
+            'form_id'       => $goods_model['form_id']?$goods_model['form_id']:0,
+            'lecturer_id'   => $goods_model['member_id']?$goods_model['member_id']:0,
+            'cash'          => $store_data['price'],
+            'limit'         => $goods_model['limit'],
+            'content'       => $goods_model['content'],
+            'address'       => $goods_model['address'],
+            'registration_time'    => strtotime($goods_model['registration']['start']),
+            'registration_end_time'    => strtotime($goods_model['registration']['end']),
+            'start_time'    => strtotime($goods_model['time_range']['start']),
+            'end_time'    => strtotime($goods_model['time_range']['end']),
+            'is_open'    =>$goods_model['is_open']?$goods_model['is_open']:0,
+            'is_recommand' => $goods_model['is_recommand']?$goods_model['is_recommand']:0,
+            'is_hot' => $goods_model['is_hot']?$goods_model['is_hot']:0,
+            'is_discount' => $goods_model['is_discount']?$goods_model['is_discount']:0,
+            'status'     => 1,
+            'province_id'   => $goods_model['province_id']?$goods_model['province_id']:0,
+            'city_id'       => $goods_model['city_id']?$goods_model['city_id']:0,
+            'district_id'   => $goods_model['district_id']?$goods_model['district_id']:0,
+            'street_id'     => $goods_model['street_id']?$goods_model['street_id']:0,
+            'longitude'     =>trim($goods_model['lng']),
+            'latitude'      =>trim($goods_model['lat']),
+            'share_title'         => $goods_model['share_title'],
+            'share_thumb'       => yz_tomedia($goods_model['share_thumb']),
+            'share_describe'       => $goods_model['share_describe'],
+            'member_power'      => $goods_model['member_power']
+
+         ];
+        if($store_data['price'] != 0){
+            $data['is_premium']  = 1;
+        }else{
+        $data['is_premium'] = 0;
+       }
+       return $data;
+    }
+
+    public static function getWidgets()
+    {
+        $widgets_data = \Setting::get('plugin.store_widgets');
+        if(!empty($widgets_data)){
+            return $widgets_data;
+        }
+        return [
+            'cashier' => [
+                'is_open' => 0,
+                'is_write_information' => 0,
+                'shop_commission' => 0,
+                'settlement_day' => 0,
+                'is_cash_pay' => 0,
+                'shop_award_point' => 0,
+                'profit' => [
+                    'full-return' => [
+                        'is_open' => 0
+                    ]
+                ],
+                'plugins' => [
+                    'love' => [
+                        'award_shop' => 0
+                    ]
+                ]
+            ],
+            'sale' => [
+                'max_point_deduct' => 0,
+                'min_point_deduct' => 0,
+                'point' => 0
+            ],
+            'discount' => [
+                'discount_method' => 1,
+                'discount_value' => []
+            ],
+            'team_dividend' => [
+                'is_dividend' => 1,
+                'has_dividend' => 1,
+                'has_dividend_rate' => 0
+            ],
+            'single_return' => [
+                'is_single_return' => 1,
+                'return_rate' => 0
+            ],
+            'full-return' =>[
+                'is_open' => 0
+            ],
+            'consume-return'=>[
+                'is_open' => 0
+            ],
+            'love' => [
+                'deduction' => 1,
+                'deduction_proportion' => 0,
+                'award' => 1,
+                'award_proportion' => 0
+            ],
+            'commission' => [
+                'is_commission' => 1,
+                'show_commission_button' => 1,
+                'has_commission' => 1,
+                'rule' => [
+                    'level_0' => [
+                        'first_level_rate' => 0,
+                        'second_level_rate' => 0,
+                        'third_level_rate' => 0,
+                    ]
+                ]
+            ],
+        ];
+    }
+}

+ 64 - 0
plugins/activity-apply/src/common/models/Order.php

@@ -0,0 +1,64 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/17
+ * Time: 17:01
+ */
+
+namespace Yunshop\ActivityApply\common\models;
+
+use Yunshop\ActivityApply\models\PayOrderModel;
+
+class Order extends \app\backend\modules\order\models\Order
+{
+
+    static public function getOrderList($search)
+    {
+        return self::orders($search);
+    }
+
+    public function scopeOrders($order_builder = '', $search = '')
+    {
+        $order = parent::scopeOrders($order_builder, $search)
+            ->pluginId()
+            ->with([
+                'hasOnePayOrder' => self::payOrderReturnBuilder(),
+            ]);
+
+        if ($search['activity_id'] || $search['activity_title']) {
+            $order->whereHas('hasOnePayOrder', function ($query) use ($search) {
+                if ($search['activity_id']) {
+                    $query->where('activity_id', $search['activity_id']);
+                }
+                if ($search['activity_title']) {
+                    $query->where('activity_title', 'like', '%' . $search['activity_title'] . '%');
+                }
+            });
+        }
+
+        return $order;
+    }
+
+    static protected function payOrderReturnBuilder()
+    {
+        return function ($query) {
+            return $query->with(['hasOneMember', 'hasOneMember']);
+        };
+    }
+
+
+    public function hasOnePayOrder()
+    {
+         //        return $this->hasOne(PayOrderModel::class, 'order_id', 'id');PayOrderModel没有order_id这个字段
+        return $this->hasOne(PayOrderModel::class, 'order_sn', 'order_sn');
+    }
+
+    public function scopePluginId($query, $pluginId = 46)
+    {
+        return $query->where('plugin_id', PayOrderModel::PLUGIN_ID);
+    }
+
+
+
+}

+ 123 - 0
plugins/activity-apply/src/config/Payment.php

@@ -0,0 +1,123 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/8/16
+ * Time: 下午3:14
+ */
+
+namespace Yunshop\ActivityApply\config;
+
+use app\frontend\modules\payment\managers\OrderPaymentTypeManager;
+use app\frontend\modules\payment\managers\PaymentManager;
+
+class Payment
+{
+    public function handle()
+    {
+        //$this->payment();
+        $this->orderPayment();
+    }
+
+    private function orderPayment()
+    {
+        if (!app()->bound('PaymentManager')) {
+            return;
+        }
+
+        /**
+         * @var OrderPaymentTypeManager $OrderPaymentTypeManager
+         */
+        $OrderPaymentTypeManager = app('PaymentManager')->make('OrderPaymentTypeManager');
+        $OrderPaymentTypeManager->addPaymentConfig($this->getBasePaymentConfig());
+        // 订单支付
+        $OrderPaymentTypeManager->addPaymentConfig($this->getStorePaymentConfig());
+
+
+    }
+
+    /**
+     * @return array
+     */
+    private function getStorePaymentConfig(){
+        // 门店
+        return [
+            'store' => [
+                'payment' => function ($payType, $order, $settings) {
+                    return new \app\frontend\modules\payment\orderPayments\NormalPayment($payType, $order, $settings);
+                },
+                'settings' => [
+                    'store' => function ($order) {
+                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\StorePaySetting($order, 'cashPay');
+                    },
+                ],
+            ]
+        ];
+    }
+
+    /**
+     * @return array|mixed
+     */
+    private function getBasePaymentConfig(){
+        // 余额,支付宝,微信
+        $paymentCodes = collect(['balance', 'alipay', 'wechatPay']);
+        $paymentConfigs = $paymentCodes->reduce(function ($result, $paymentCode) {
+            $result[$paymentCode] = [
+                'settings' => [
+                    'store' => function (\app\common\models\OrderPay $orderPay) use ($paymentCode) {
+                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\BaseSetting($orderPay, $paymentCode);
+                    },
+                    'cashier' => function (\app\common\models\OrderPay $orderPay) use ($paymentCode) {
+                        return new \Yunshop\StoreCashier\cashier\payment\orderPaymentSettings\BaseSetting($orderPay, $paymentCode);
+                    }
+
+                ],
+            ];
+            return $result;
+        }, []);
+
+        // 支付宝app,微信app
+        $paymentConfigs = array_merge([
+            'alipayApp' => [
+                'settings' => [
+                    'store' => function (\app\common\models\OrderPay $orderPay) {
+                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\AlipayApp($orderPay, 'alipayApp');
+                    },
+                    'cashier' => function (\app\common\models\OrderPay $orderPay) {
+                        return new \Yunshop\StoreCashier\cashier\payment\orderPaymentSettings\AlipayApp($orderPay, 'alipayApp');
+                    }
+                ]
+            ],
+            'wechatAppPay' => [
+                'settings' => [
+                    'store' => function (\app\common\models\OrderPay $orderPay) {
+                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\WechatAppPay($orderPay, 'wechatAppPay');
+                    },
+                    'cashier' => function (\app\common\models\OrderPay $orderPay) {
+                        return new \Yunshop\StoreCashier\cashier\payment\orderPaymentSettings\WechatAppPay($orderPay, 'wechatAppPay');
+                    }
+                ]
+            ],
+//            'COD' => [
+//                'settings' => [
+//                    'store' => function (\app\common\models\Order $order) {
+//                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\CODSetting($order, 'COD');
+//                    },
+//                    'cashier' => function (\app\common\models\Order $order) {
+//                        return new \Yunshop\StoreCashier\cashier\payment\orderPaymentSettings\CODSetting($order, 'COD');
+//                    }
+//                ]
+//            ],
+//            'remittance' => [
+//                'settings' => [
+//                    'store' => function (\app\common\models\Order $order) {
+//                        return new \Yunshop\StoreCashier\store\payment\orderPaymentSettings\RemittanceSetting($order, 'remittance');
+//                    },
+//                    'cashier' => function (\app\common\models\Order $order) {
+//                        return new \Yunshop\StoreCashier\cashier\payment\orderPaymentSettings\RemittanceSetting($order, 'remittance');
+//                    }
+//                ]
+//            ]
+        ], $paymentConfigs);
+        return $paymentConfigs;
+    }
+}

+ 348 - 0
plugins/activity-apply/src/models/ActivityModel.php

@@ -0,0 +1,348 @@
+<?php
+
+namespace Yunshop\ActivityApply\models;
+
+use app\common\facades\Setting;
+use app\common\models\BaseModel;
+use app\common\models\goods\Share;
+use Illuminate\Database\Eloquent\SoftDeletes;
+use app\common\models\Address;
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2019/8/19
+ * Time: 下午14:30
+ */
+class ActivityModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_activity';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+    const PLUGIN_ID = 46;
+
+    public static function getActivity($search){
+        $model = self::uniacid();
+        if($search['id']){
+            $model->where('id',$search['id']);
+        }
+        if($search['title']){
+            $model->where('title','like', '%'.$search['title'].'%');
+        }
+        if (!empty($search['calssify_title'])) {
+            $model->whereHas('hasOneCalssify', function ($query) use($search) {
+                return $query->where('calssify_title', 'like', '%' . $search['calssify_title'] . '%');
+            });
+        }
+        if ($search['is_time']) {
+            if ($search['time_range']) {
+                $range = [strtotime($search['time_range']['start']), strtotime($search['time_range']['end'])];
+                $model->whereBetween('created_at', $range);
+            }
+        }
+        $model->with(['hasOneCalssify']);
+        $model->withCount([
+            'hasManyPayOrder' =>function($q){
+                $q->where('status',1);
+            },
+            'PayOrder as sign'=>function($q){
+                $q->where('sign',1);
+            }
+        ]);
+
+        return $model;
+    }
+
+
+    public static function exportActivity(){
+        $result = self::uniacid();
+        $result->with([
+            'hasOneMember' => function($query){
+                return $query->select(['uid','realname','nickname']);
+            },
+        ])->orderBy('id', 'desc');
+
+        return $result;
+    }
+
+    public function hasOneShare(){
+        return $this->hasOne(Share::class,'goods_id','goods_id');
+    }
+
+    public function hasOneMember()
+    {
+        return $this->hasOne('app\common\models\Member', 'uid', 'lecturer_id');
+    }
+
+    public function hasOneCalssify(){
+            return $this->hasOne('Yunshop\ActivityApply\models\CalssifyModel','id','calssify_id');
+    }
+    public function  hasManyPayOrder(){
+            return $this->hasMany('Yunshop\ActivityApply\models\PayOrderModel','activity_id','id');
+    }
+    public function PayOrder(){
+           return $this->belongsTo('Yunshop\ActivityApply\models\PayOrderModel','id','activity_id');
+    }
+
+    public function hasOneAgentLevel(){
+        return $this->hasOne('Yunshop\Commission\models\AgentLevel','id');
+    }
+
+    /**
+     *关联讲师
+     */
+
+    public function hasOneLecturer()
+    {
+        if(app('plugins')->isEnabled('video-demand')){
+            return $this->hasOne('Yunshop\VideoDemand\models\LecturerModel', 'member_id', 'lecturer_id');
+        }else{
+            return '';
+        }
+    }
+
+    public function hasManyCourseGoods()
+    {
+        return $this->hasMany('Yunshop\VideoDemand\models\CourseGoodsModel', 'lecturer_id', 'lecturer_id');
+    }
+
+
+    public function hasManyAttention(){
+        return $this->hasMany('Yunshop\ActivityApply\models\AttentionModel','activity_id','id');
+    }
+
+    public function province()
+    {
+        return $this->belongsTo(Address::class, 'province_id', 'id');
+    }
+
+    public function city()
+    {
+        return $this->belongsTo(Address::class, 'city_id', 'id');
+    }
+
+    public function district()
+    {
+        return $this->belongsTo(Address::class, 'district_id', 'id');
+    }
+
+    public static function verifyStore($store_data, $store_model = '')
+    {
+
+        if (!$store_model) {
+            $store_model = new self();
+        }
+        $city = [];
+
+        if ($store_data['province_id'] > 0) {
+            $city['province_name'] =  Address::where('id', $store_data['province_id'])->first();
+            $store_model['province_name'] =$city['province_name']['areaname'];
+        }
+        if ($store_data['city_id'] > 0) {
+            $city['city_name'] = Address::where('id', $store_data['city_id'])->first();
+            $store_model['city_name'] =$city['city_name']['areaname'];
+        }
+        if ($store_data['district_id'] > 0) {
+            $city['district_name'] = Address::where('id', $store_data['district_id'])->first();
+            $store_model['district_name'] =$city['district_name']['areaname'];
+        }
+        if ($store_data['street_id'] > 0) {
+            $city['street_name'] = Address::where('id', $store_data['street_id'])->first();
+            $store_model['street_name'] =$city['street_name']['areaname'];
+        }
+
+        if ($store_model['city_name']) {
+            $store_model->initials = self::getFirstCharter( $store_model['city_name']);
+        }
+
+        $store_model->fill($store_data);
+
+        $validator = $store_model->validator();
+
+        return [
+            'validator' => $validator,
+            'store_model' => $store_model
+        ];
+    }
+
+
+
+    public static function getFirstCharter($str)
+    {
+        if (empty($str)) {
+            return '';
+        }
+
+        $fchar = ord($str{0});
+
+        if ($fchar >= ord('A') && $fchar <= ord('z')) {
+            return strtoupper($str{0});
+        }
+
+        $s1 = iconv('UTF-8', 'gb2312', $str);
+
+        $s2 = iconv('gb2312', 'UTF-8', $s1);
+
+        $s = $s2 == $str ? $s1 : $str;
+
+        $asc = ord($s{0}) * 256 + ord($s{1}) - 65536;
+
+        if ($asc >= -20319 && $asc <= -20284) {
+            return 'A';
+        }
+
+        if ($asc >= -20283 && $asc <= -19776) {
+            return 'B';
+        }
+
+        if ($asc >= -19775 && $asc <= -19219) {
+            return 'C';
+        }
+
+        if ($asc >= -19218 && $asc <= -18711) {
+            return 'D';
+        }
+
+        if ($asc >= -18710 && $asc <= -18527) {
+            return 'E';
+        }
+
+        if ($asc >= -18526 && $asc <= -18240) {
+            return 'F';
+        }
+
+        if ($asc >= -18239 && $asc <= -17923) {
+            return 'G';
+        }
+
+        if ($asc >= -17922 && $asc <= -17418) {
+            return 'H';
+        }
+
+        if ($asc >= -17417 && $asc <= -16475) {
+            return 'J';
+        }
+
+        if ($asc >= -16474 && $asc <= -16213) {
+            return 'K';
+        }
+
+        if ($asc >= -16212 && $asc <= -15641) {
+            return 'L';
+        }
+
+        if ($asc >= -15640 && $asc <= -15166) {
+            return 'M';
+        }
+
+        if ($asc >= -15165 && $asc <= -14923) {
+            return 'N';
+        }
+
+        if ($asc >= -14922 && $asc <= -14915) {
+            return 'O';
+        }
+
+        if ($asc >= -14914 && $asc <= -14631) {
+            return 'P';
+        }
+
+        if ($asc >= -14630 && $asc <= -14150) {
+            return 'Q';
+        }
+
+        if ($asc >= -14149 && $asc <= -14091) {
+            return 'R';
+        }
+
+        if ($asc >= -14090 && $asc <= -13319) {
+            return 'S';
+        }
+
+        if ($asc >= -13318 && $asc <= -12839) {
+            return 'T';
+        }
+
+        if ($asc >= -12838 && $asc <= -12557) {
+            return 'W';
+        }
+
+        if ($asc >= -12556 && $asc <= -11848) {
+            return 'X';
+        }
+
+        if ($asc >= -11847 && $asc <= -11056) {
+            return 'Y';
+        }
+
+        if ($asc >= -11055 && $asc <= -10247) {
+            return 'Z';
+        }
+        if ('衢州市' === $str) {
+            return 'Q';
+        }
+        return 0;
+    }
+
+
+    /**
+     * 字段规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            'title' => 'required',
+            'limit' => 'required|integer|min:1',
+            'thumb' => 'required',
+            'form_id' => 'required|integer|min:1',
+            'calssify_id' => 'required|integer|min:1',
+            'province_id' => 'required|integer|min:1',
+            'city_id' => 'required|integer|min:1',
+            'district_id' => 'required|integer|min:1',
+        ];
+    }
+
+    public function validationMessages()
+    {
+        return [
+            'title.required' => ':attribute 为必填项',
+            'limit.integer'  => ':attribute 必须为数字',
+            'limit.min'  => ':attribute 必须大于等于1',
+            'thumb.required'  => ':attribute 不能为空',
+            'form_id.min'  => ':attribute 不能为空',
+            'calssify_id.min'  => ':attribute 不能为空',
+            'province_id' => ':attribute 不能为空',
+            'city_id' => ':attribute 不能为空',
+            'district_id' => ':attribute 不能为空',
+            'province_id.min' => ':attribute 不能为空',
+            'city_id.min' => ':attribute 不能为空',
+            'district_id.min' => ':attribute 不能为空',
+        ];
+    }
+
+    /**
+     * 定义字段名
+     *
+     * @return array
+     */
+    public function atributeNames()
+    {
+        return [
+            'title' => '活动名称',
+            'limit' => '限制名额',
+            'thumb' => '活动图片',
+            'form_id' => '表单',
+            'calssify_id' => '分类',
+            'province_id' => '省份/直辖市',
+            'city_id' => '城市',
+            'district_id' => '地区',
+        ];
+    }
+
+}
+
+
+?>

+ 48 - 0
plugins/activity-apply/src/models/AttentionModel.php

@@ -0,0 +1,48 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/9/5
+ * Time: 12:45
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+use app\common\models\BaseModel;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class AttentionModel extends BaseModel
+{
+
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_attention';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+    public $statusName;
+    public $parentName;
+
+    public static function getSearch($search){
+        $model = self::uniacid()->where('is_attention','1');
+        return $model;
+    }
+
+    public static function  getAttention($member_id,$activity_id){
+        $model = self::uniacid()
+               ->where('member_id',$member_id)
+               ->where('activity_id',$activity_id)
+               ->where('is_attention','1');
+        return $model;
+    }
+
+    public function hasManyActivity(){
+        return $this->hasMany('Yunshop\ActivityApply\models\ActivityModel','id','activity_id');
+    }
+
+    public function hasOneMember()
+    {
+        return $this->hasMany('app\common\models\Member', 'uid', 'member_id');
+    }
+
+}

+ 72 - 0
plugins/activity-apply/src/models/CalssifyModel.php

@@ -0,0 +1,72 @@
+<?php
+
+namespace Yunshop\ActivityApply\models;
+
+use app\common\exceptions\ShopException;
+use app\common\models\BaseModel;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2019/8/19
+ * Time: 下午14:30
+ */
+class CalssifyModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_calssify';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+
+    public function getSearch(){
+        return self::uniacid();
+    }
+
+    public function hasManyActivity(){
+        return $this->hasMany('Yunshop\ActivityApply\models\ActivityModel','calssify_id','id');
+    }
+
+    //添加分类
+    public function addClassify($resources,$id = '')
+    {
+        $data = [
+            'uniacid' => \YunShop::app()->uniacid,
+            'sort' =>  $resources['sort'] ? $resources['sort'] : 0,
+            'calssify_title' => $resources['calssify_title'],
+            'thumb' => $resources['thumb'],
+            'is_open' => $resources['is_open'] ? $resources['is_open'] : 0,
+            'create_time'=>time()
+        ];
+
+        if ($id) {
+            $class =  CalssifyModel::uniacid()->find($id);
+        } else {
+            $class = new CalssifyModel();
+        }
+
+        $class->fill($data);
+        $class->atributeNames($class);
+        if ($class->save()) {
+            return true;
+        }
+    }
+
+    //验证字段
+    public function atributeNames($class)
+    {
+        if ($class['sort'] == '') {
+            throw new ShopException('分类排序不能为空');
+        }
+        if ($class['calssify_title'] == '') {
+            throw new ShopException('分类名称不能为空');
+        }
+        if ($class['thumb'] == '') {
+            throw new ShopException('分类图片不能为空');
+        }
+    }
+
+}
+
+
+?>

+ 63 - 0
plugins/activity-apply/src/models/LantetnSlideModel.php

@@ -0,0 +1,63 @@
+<?php
+
+namespace Yunshop\ActivityApply\models;
+
+use app\common\exceptions\ShopException;
+use app\common\models\BaseModel;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2019/8/19
+ * Time: 下午14:30
+ */
+class LantetnSlideModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_lantern_slide';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+
+    public static function getSearch($search){
+        $model = self::uniacid();
+        return $model;
+    }
+
+
+    //添加分类
+    public function addLantern($resources,$id = '')
+    {
+         $data = [
+             'uniacid' => \YunShop::app()->uniacid,
+             'display_order' =>  $resources['display_order'] ? $resources['display_order'] : 0,
+             'title' => $resources['title'],
+             'thumb' => $resources['thumb'],
+             'link' => $resources['link'],
+             'app_link' => $resources['app_link'],
+             'is_open' => $resources['is_open'] ? $resources['is_open'] : 0,
+             'created_at' => time()
+         ];
+        if ($id) {
+            $lantetn =  LantetnSlideModel::uniacid()->find($id);
+        } else {
+            $lantetn = new LantetnSlideModel();
+        }
+        $lantetn->fill($data);
+        $lantetn->atributeNames($lantetn);
+        if ($lantetn->save()) {
+            return true;
+        }
+    }
+    //验证字段
+    public function atributeNames($lantetn)
+    {
+        if ($lantetn['title'] == '') {
+            throw new ShopException('幻灯片名称不能为空');
+        }
+    }
+
+}
+
+
+?>

+ 26 - 0
plugins/activity-apply/src/models/LecturerModel.php

@@ -0,0 +1,26 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2018/11/22
+ * Time: 9:37
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+class LecturerModel extends \Yunshop\VideoDemand\models\LecturerModel
+{
+
+    public function hasManyActivity()
+    {
+        return $this->hasMany('Yunshop\ActivityApply\models\ActivityModel','lecturer_id','member_id');
+    }
+
+    public function hasManyCourseGoods()
+    {
+        return $this->hasMany( 'Yunshop\VideoDemand\models\CourseGoodsModel','lecturer_id','member_id');
+    }
+
+
+}

+ 21 - 0
plugins/activity-apply/src/models/MemberModel.php

@@ -0,0 +1,21 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2018/11/22
+ * Time: 9:37
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+class MemberModel extends \app\common\models\member
+{
+
+    public function hasOneEnrol()
+    {
+        return $this->hasOne(EnrolModel::class,'member_id', 'id');
+    }
+
+
+}

+ 55 - 0
plugins/activity-apply/src/models/MemberParent.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2018/11/8
+ * Time: 15:32
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+class MemberParent extends \app\common\models\member\MemberParent
+{
+
+    public static function getTeamId($member_id)
+    {
+        $parent = self::uniacid()
+            ->where('member_id', $member_id)
+            ->whereHas('hasOneTeamDividend')
+            ->with('hasOneTeamDividend')
+            ->orderBy('level','asc')
+            ->get();
+
+        return $parent;
+    }
+
+
+    public function hasOneTeamDividend()
+    {
+        return self::hasOne('Yunshop\TeamDividend\models\TeamDividendAgencyModel', 'uid', 'parent_id');
+    }
+
+
+    public function hasOneMember()
+    {
+        return self::hasOne(\app\backend\modules\member\models\Member::class, 'uid', 'parent_id');
+    }
+
+    public function hasOneChildMember()
+    {
+        return self::hasOne(\app\backend\modules\member\models\Member::class, 'uid', 'member_id');
+    }
+    
+    public function hasOneEnrol()
+    {
+        return $this->hasOne(ConferenceEnrolModel::class,'member_id', 'member_id');
+
+    }
+
+    public function hasOneChildTeam()
+    {
+        return $this->hasOne('Yunshop\TeamDividend\models\TeamDividendAgencyModel', 'uid', 'member_id');
+    }
+
+}

+ 85 - 0
plugins/activity-apply/src/models/PayOrderModel.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace Yunshop\ActivityApply\models;
+
+use app\common\models\BaseModel;
+use app\common\models\Order;
+use Illuminate\Database\Eloquent\SoftDeletes;
+use app\common\facades\Setting;
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2019/8/19
+ * Time: 下午14:30
+ */
+class PayOrderModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_order';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+    const PLUGIN_ID = '46';
+
+
+    public static function getOrderByActivityId($activityId, $memberId)
+    {
+        return self::uniacid()
+            ->where('activity_id', $activityId)
+            ->where('member_id', $memberId);
+    }
+
+    public static function getEnrol($activity_id,$search){
+        $model = self::uniacid()->where('activity_id',$activity_id);
+
+        if ($search['member_id']) {
+            $model->where('member_id',$search['member_id']);
+        }
+
+        if ($search['mobile']) {
+            $model->whereHas('hasOneMember', function ($query) use($search) {
+               return  $query->where('mobile', $search['mobile']);
+            });
+        }
+
+        if ($search['is_sign']) {
+            $model->where('sign',$search['is_sign']['sign']);
+        }
+        $with=[
+            'hasOneMember'=>function($q){
+                return $q->select(['uid','realname','mobile','nickname','avatar']);
+            },
+            'hasOneActivity'=>function($q){
+                return $q->select('id','form_id','title');
+            },
+            'hasOneOrder'
+        ];
+        if (app('plugins')->isEnabled('video-demand') && Setting::get('plugin.video_demand.is_video_demand') == 1) {
+            $with['hasOneLecturer'] = function ($q) {
+                return $q->select(['member_id', 'real_name']);
+            };
+        }
+        $model->with($with);
+
+        return $model;
+
+    }
+
+    public function hasOneLecturer(){
+        return $this->hasOne('Yunshop\ActivityApply\models\LecturerModel', 'member_id', 'lecturer_id');
+    }
+    public function hasOneOrder()
+    {
+        return $this->hasOne(Order::class, 'id', 'order_id');
+    }
+
+    public function hasOneMember()
+    {
+        return $this->hasOne('app\common\models\Member', 'uid', 'member_id');
+    }
+
+    public function hasOneActivity(){
+        return $this->hasOne('Yunshop\ActivityApply\models\ActivityModel','id','activity_id');
+    }
+
+}

+ 59 - 0
plugins/activity-apply/src/models/RelationModel.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2018/11/22
+ * Time: 9:37
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+use app\common\models\BaseModel;
+use app\common\models\Member;
+use Illuminate\Database\Eloquent\SoftDeletes;
+use Yunshop\Diyform\models\DiyformDataModel;
+
+class RelationModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_relation';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+    public $statusName;
+    public $parentName;
+
+
+    /**
+     * @param string $member_id
+     * @param string $activity_id
+     * @param string $form_id
+     * @param string $form_data_id
+     */
+    public function  getRelation($member_id = '', $activity_id = '', $form_id = '', $form_data_id =''){
+         $query = self::uniacid()
+                ->where('member_id',$member_id)
+                ->where('activity_id',$activity_id)
+                ->where('form_id',$form_id)
+                ->where('form_data_id',$form_data_id);
+
+         return $query;
+    }
+
+    public function hasOneActivity()
+    {
+        return $this->hasOne(ActivityModel::class,'id', 'activity_id');
+    }
+
+
+    public function hasOneFormData()
+    {
+        return $this->hasOne(DiyformDataModel::class,'id', 'form_data_id');
+    }
+
+    public function hasOneMember(){
+        return $this->hasOne(Member::class,'uid', 'member_id');
+    }
+
+}

+ 31 - 0
plugins/activity-apply/src/models/SetModel.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace Yunshop\ActivityApply\models;
+
+use app\common\models\BaseModel;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2019/8/19
+ * Time: 下午14:30
+ */
+class SetModel extends BaseModel
+{
+    use SoftDeletes;
+    public $table = 'yz_activity_apply_ad_positionid';
+    public $timestamps = true;
+    protected $guarded = [''];
+    protected $search_fields = ['title'];
+
+    public static function getSearch($search){
+        $model = self::uniacid();
+        return $model;
+    }
+
+
+
+}
+
+
+?>

+ 15 - 0
plugins/activity-apply/src/models/TeamDividendAgencyModel.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: BC
+ * Date: 2018/11/16
+ * Time: 7:00
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+class TeamDividendAgencyModel extends \Yunshop\TeamDividend\models\TeamDividendAgencyModel
+{
+
+}

+ 15 - 0
plugins/activity-apply/src/models/TeamDividendLevelModel.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: BC
+ * Date: 2018/11/16
+ * Time: 7:02
+ */
+
+namespace Yunshop\ActivityApply\models;
+
+
+class TeamDividendLevelModel extends \Yunshop\TeamDividend\models\TeamDividendLevelModel
+{
+
+}

+ 135 - 0
plugins/activity-apply/src/services/EnrolService.php

@@ -0,0 +1,135 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2018/11/8
+ * Time: 15:22
+ */
+
+namespace Yunshop\ActivityApply\services;
+
+use Yunshop\ActivityApply\models\TeamDividendAgencyModel;
+use Yunshop\ActivityApply\models\TeamDividendLevelModel;
+use Yunshop\Diyform\models\DiyformDataModel;
+use Yunshop\Diyform\models\DiyformTypeModel;
+
+class EnrolService
+{
+    public $team_level = 0;
+    public $member_level = 0;
+
+    public function teamNotice($memberId, $formId, $formDataId)
+    {
+        $teams = MemberParent::getTeamId($memberId);
+        $member = Member::getMemberByUid($memberId)->first();
+        $content = $this->enrolData($formId, $formDataId);
+
+        if (!is_null($member)) {
+            foreach ($teams as $parent) {
+                $team_level = $parent->hasOneTeamDividend->hasOneLevel->level_weight;
+                if ($team_level >= $this->team_level) {
+                    $parentMember = Member::getMemberByUid($parent->parent_id)->first();
+
+                    if (!is_null($parentMember)) {
+                        MessageService::lowerEnrol($member, $parentMember, $content);
+                    }
+                    $this->team_level = $team_level;
+                } else {
+                    break;
+                }
+            }
+        }
+    }
+
+    public function signTeamNotice($memberId, $content)
+    {
+        $teams = MemberParent::getTeamId($memberId);
+        $member = Member::getMemberByUid($memberId)->first();
+
+        if (!is_null($member)) {
+            foreach ($teams as $parent) {
+                $team_level = $parent->hasOneTeamDividend->hasOneLevel->level_weight;
+                if ($team_level >= $this->team_level) {
+                    $parentMember = Member::getMemberByUid($parent->parent_id)->first();
+
+                    if (!is_null($parentMember)) {
+                        MessageService::lowerSign($member, $parentMember, $content);
+                    }
+                    $this->team_level = $team_level;
+                } else {
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * 报名信息
+     * @param $formId
+     * @param $formDataId
+     * @return string
+     */
+    public function enrolData($formId, $formDataId)
+    {
+        $content = '';
+        $form = DiyformTypeModel::uniacid()->find($formId);
+        $formData = DiyformDataModel::uniacid()->find($formDataId);
+        $datas = iunserializer($formData->data);
+
+        $fields = iunserializer($form->fields);
+        foreach ($fields as $fname =>  $field)
+        {
+            foreach ($datas as $key => $data)
+            {
+                if ($fname == $key) {
+                    if (is_array($data)) {
+                        continue;
+                    }
+                    $content .= $field['tp_name'].":".$data."\r\n";
+                    continue;
+                }
+            }
+
+        }
+        return $content;
+    }
+
+    public function superior($memberId)
+    {
+        if (!$memberId) {
+            return $this->AgentData;
+        }
+
+        $this->recursion_filter[] = $memberId;
+
+        $request = YzMemberModel::getSuperiorById($memberId)->first();
+        if ($request->hasOneMember) {
+            $data = $request->hasOneMember;
+
+            if (in_array($data->member_id, $this->recursion_filter)) {
+                \Log::debug('------会员关系链递归存在重复的上线------', [$memberId]);
+                return $this->AgentData;
+            }
+
+            $agency = TeamDividendAgencyModel::getAgencyInfoByUid($data->member_id);
+            $this->process($agency, $data->member_id);
+
+            self::superior($data->member_id);
+        }
+        return $this->AgentData;
+
+    }
+
+    public function process($agency, $memberId)
+    {
+        if ($agency) {
+            if ($agency->hasOneLevel->hierarchy_limit > $this->hierarchy_num || empty($agency->hasOneLevel->hierarchy_limit)) {
+                $this->hierarchy_num++;
+                $this->AgentData[$memberId] = $agency->toArray();
+                $this->AgentData[$memberId]['rate'] = $this->Rate ? $this->Rate : 0;
+                $this->Rate = $agency->hasOneLevel->dividend_ratio;
+            }
+        }
+    }
+
+}

+ 25 - 0
plugins/activity-apply/src/services/MemberCenterService.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace Yunshop\ActivityApply\services;
+
+use app\common\services\member\center\BaseMemberCenterService;
+
+class MemberCenterService extends BaseMemberCenterService
+{
+    public function getData(): array
+    {
+        $data[] = [
+            'name'     => 'activity-apply',
+            'title'    => '活动报名',
+            'class'    => 'icon-member_meeting_active',
+            'url'      => 'activityHome',
+            'image'    => 'member_a(88).png',
+            'mini_url' => '/packageC/Myshaky/activityHome/activityHome',
+            'type_1' => 'interactive',
+            'type_2' => 'merchant',
+            'weight_1' => 5300,
+            'weight_2' => 5200,
+        ];
+        return $data;
+    }
+}

+ 89 - 0
plugins/activity-apply/src/services/MessageService.php

@@ -0,0 +1,89 @@
+<?php
+/**
+ * Author: 芸众商城 www.yunzshop.com
+ * Date: 2017/9/23
+ * Time: 上午9:59
+ */
+
+namespace Yunshop\ActivityApply\services;
+
+
+use app\common\facades\Setting;
+use app\common\models\notice\MessageTemp;
+use app\backend\modules\member\models\Member;
+
+class MessageService extends \app\common\services\MessageService
+{
+
+    /**
+     * @param $member
+     * 报名通知
+     * @param $uid
+     * @param $content
+     */
+    public static function enrol($uid = '', $content = '')
+    {
+        $activity = Setting::get('plugin.activity-apply');
+        $ret = self::getMember($uid);
+        $temp_id = $activity['enrol'];
+        $uniacid =\YunShop::app()->uniacid;
+        if (!$temp_id) {
+            return;
+        }
+
+        $params = [
+            ['name' => '昵称', 'value' => $ret['member']->nickname],
+            ['name' => '活动金额', 'value' => $content['price']],
+            ['name' => '活动名称', 'value' => $content['title']],
+            ['name' => '时间', 'value' => date('Y-m-d H:i:s', time())],
+        ];
+        \Log::debug('报名消息发送',$params);
+        $msg = MessageTemp::getSendMsg($temp_id, $params);
+        if (!$msg) {
+            return;
+        }
+        $news_link = MessageTemp::find($temp_id);
+        $news_link = $news_link ? $news_link->news_link:'';
+        MessageService::notice(MessageTemp::$template_id, $msg, $uid, $uniacid,$news_link);
+    }
+
+    /**
+     * 签到通知
+     * @param $uid
+     * @param $content
+     */
+    public static function sign($uid = '', $content = '')
+    {
+        $activity = Setting::get('plugin.activity-apply');
+        $ret = self::getMember($uid);
+        $temp_id = $activity['sign'];
+        $uniacid =\YunShop::app()->uniacid;
+        if (!$temp_id) {
+            return;
+        }
+        $params = [
+            ['name' => '昵称', 'value' => $ret['member']->nickname],
+            ['name' => '手机号码', 'value' => $content['mobile']],
+            ['name' => '活动名称', 'value' => $content['title']],
+            ['name' => '时间', 'value' => date('Y-m-d H:i:s', time())],
+        ];
+        $msg = MessageTemp::getSendMsg($temp_id, $params);
+        if (!$msg) {
+            return;
+        }
+        \Log::debug('签到消息发送',$params);
+        MessageService::notice(MessageTemp::$template_id, $msg, $uid, $uniacid);
+    }
+
+    private static function getMember($uid)
+    {
+        $noticeMember = Member::getMemberByUid($uid)->with('hasOneFans')->first();
+        $member = $noticeMember->hasOneFans;
+        $openid = Member::getOpenId($uid);
+        return [
+            'member'    => $member,
+            'openid'    => $openid
+        ];
+    }
+
+}

Plik diff jest za duży
+ 198 - 0
plugins/activity-apply/src/services/PinYinService.php


+ 69 - 0
plugins/activity-apply/src/services/TimedTaskServices.php

@@ -0,0 +1,69 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yunzhong
+ * Date: 2019/11/4
+ * Time: 11:36
+ */
+
+namespace Yunshop\ActivityApply\services;
+
+use app\common\models\Order;
+use app\common\models\UniAccount;
+use app\common\facades\Setting;
+use Yunshop\ActivityApply\models\ActivityModel;
+use Yunshop\ActivityApply\models\PayOrderModel;
+
+
+class TimedTaskServices
+{
+    public function handle(){
+        date_default_timezone_set('PRC');
+        $uniAccount = UniAccount::getEnable();
+        foreach ($uniAccount as $u){
+            \YunShop::app()->uniacid = $u->uniacid;
+            Setting::$uniqueAccountId = $u->uniacid;
+            self::getOverActivity();
+        }
+    }
+
+    //活动报名时间结束,关闭改活动未支付订单
+    private function getOverActivity(){
+        $time =time();
+        ActivityModel::uniacid()
+            ->chunk(100,function ($activity_list) use($time){
+                foreach($activity_list as $key => $value){
+                    if($time >= $value['registration_end_time']){
+                        self::getOrder($value['id']);
+                    }else{
+                      $PayOrder =  PayOrderModel::uniacid()
+                            ->where('activity_id',$value['id'])
+                            ->where('status',1)->count();
+                       if($PayOrder >= $value['limit']){
+                           self::getOrder($value['id']);
+                       }
+                    }
+                }
+            });
+
+    }
+
+    private function getOrder($activity_id){
+        PayOrderModel::uniacid()
+            ->where('activity_id',$activity_id)
+            ->where('status',0)
+            ->chunk(100,function ($payOrder){
+                foreach($payOrder as $k => $v){
+                    $data = [
+                        'status'=>-1
+                    ];
+                    PayOrderModel::uniacid()->where('id',$v['id'])->update($data);
+                    $order = Order::uniacid()->find($v['order_id']);
+                    if (!empty($order)) {
+                        $order->close();
+                    }
+                }
+            });
+    }
+
+}

+ 664 - 0
plugins/activity-apply/views/admin/activity.blade.php

@@ -0,0 +1,664 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('活动列表'))
+
+<style>
+    .umphp {
+        display:inline-block;
+        color:#2093b4;
+        cursor: pointer;
+    }
+    .qrcode-popup {
+        text-align: center;
+    }
+
+    .tabar {
+        display:flex;
+    }
+    .tabar-item {
+        flex-shrink: 0;
+        flex-grow:1;
+        color:#999;
+    }
+    .tabar-item.active {
+        color:#2093b4;
+    }
+    .tab-item {
+        display:inline-block;
+    }
+
+
+    .dig-title{
+        display: flex;
+    }
+    .el-dialog__header{
+        padding: 25px 0 !important;
+        margin:  0 25px !important;
+        border-bottom: 1px solid #ccc !important;
+    }
+    .isChecked {
+        width: 110px;
+        height: 40px;
+        background-color: #29BA9C;
+        text-align: center;
+        line-height: 40px;
+        color: #fff;
+        border-radius:5px;
+        cursor: pointer;
+    }
+    .noCheck {
+        width: 110px;
+        height: 40px;
+        text-align: center;
+        line-height: 40px;
+        cursor: pointer;
+    }
+    .QRCode {
+        display: flex;
+        justify-content: center;
+    }
+    .QRCode .code-title {
+        color: #888;
+        text-align: center;
+        cursor: pointer;
+        text-decoration: none;
+    }
+    .QRCode-item {
+        text-align: center;
+    }
+    .codeImg {
+        width: 100px;
+        height: 100px;
+        margin: 20px;
+    }
+    .codeImg img {
+        width: 100%;
+        height: 100%;
+    }
+    .input-item {
+        display: flex;
+        align-items: center;
+        margin: 30px 0 10px 0;
+    }
+    .input-item .item-title {
+        margin-right: 20px;
+        flex:2;
+        text-align: right;
+    }
+    .input-item .item-input {
+        flex:5;
+    }
+    .input-item .copy {
+        width: 50px;
+        height: 40px;
+        line-height: 40px;
+        text-align: center;
+        margin-right: 160px;
+        /* flex:3; */
+        border: 1px solid #ccc;
+        border-radius:5px;
+        cursor: pointer;
+        background-color: #fff;
+    }
+
+</style>
+
+<link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
+<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/goods.css')}}"/>
+<div class="right-titpos">
+    <ul class="add-snav">
+        <a class='btn btn-primary' href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.add')}}"
+           style="margin-bottom:5px;"><i class='fa fa-plus'></i> 创建新活动</a>
+    </ul>
+</div>
+<div class='panel panel-default'>
+    <form action="" method="post" class="form-horizontal" id="form1">
+        <div class="panel panel-info">
+            <div class="panel-body">
+
+                <div class="form-group col-xs-12 col-sm-3">
+                    <input class="form-control" name="search[id]" type="text"
+                           value="{{$search['id']}}" placeholder="活动ID">
+                </div>
+
+                <div class="form-group col-xs-12 col-sm-3">
+                    <input class="form-control" name="search[title]" type="text"
+                           value="{{$search['title']}}" placeholder="请输入活动名称进行搜索">
+                </div>
+                <div class="form-group col-xs-12 col-sm-3">
+                    <input class="form-control" name="search[calssify_title]" type="text"
+                           value="{{$search['calssify_title']}}" placeholder="请输入分类名称进行搜索">
+
+                </div>
+
+
+                <div class="form-group col-xs-12 col-sm-6">
+                    <div class="col-sm-4">
+                        <label class='radio-inline'>
+                            <input type='radio' value='0' name='search[is_time]'
+                                   @if($search['is_time'] == '0') checked @endif>不按时间
+                        </label>
+                        <label class='radio-inline'>
+                            <input type='radio' value='1' name='search[is_time]'
+                                   @if($search['is_time'] == '1') checked @endif>创建时间
+                        </label>
+                    </div>
+                    {!! app\common\helpers\DateRange::tplFormFieldDateRange('search[time_range]', [
+                                       'starttime'=>array_get($requestSearch,'time_range.start',0),
+                                       'endtime'=>array_get($requestSearch,'time_range.end',0),
+                                       'start'=>0,
+                                       'end'=>0
+                                       ], true)!!}
+                </div>
+                <div class="form-group col-xs-12 col-sm-2">
+                    <input type="button" class="btn btn-success pull-right" style="width:80px" id="search" value="搜索">
+
+                </div>
+
+            </div>
+        </div>
+    </form>
+</div>
+
+<div class='panel panel-default'>
+    <div class="panel-heading">活动列表:{{$total}}个</div>
+    <div class='panel-body'>
+        <table class="table table-hover" style="overflow:visible;">
+            <thead>
+            <tr>
+                <th style='width:5%;'>ID</th>
+                <th style='width:5%;'>商品ID</th>
+                <th style='width:10%;'>活动名称</th>
+                <th style='width:10%;'>分类</th>
+                <th style='width:10%;'>活动费用(元)</th>
+                <th style='width:10%;'>已报名人数<br/>活动名额</th>
+                <th style='width:10%;'>已签到人数<br/>未签到人数</th>
+                <th style='width:8%;'>启用</th>
+                <th style='width:8%;'>活动数据</th>
+                <th style='width:30%; text-align: center'>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($list['data'] as $row)
+                <tr>
+                    <td>{{$row['id']}}</td>
+                    <td>{{$row['goods_id']}}</td>
+                    <td>{{$row['title']}}</td>
+                    <td>
+                       {{$row['has_one_calssify']['calssify_title']}}
+                    </td>
+                    @if($row['cash']== 0)
+                    <td>0(元)</td>
+                    @else
+                        <td> {{$row['cash']}}(元)</td>
+                    @endif
+
+                    <td>
+                        @if($row['has_many_pay_order_count'] == 0)
+                           0
+                        @else
+                            {{$row['has_many_pay_order_count']}}
+                        @endif
+                            <br/>
+                            {{$row['limit']}}
+
+                    </td>
+                    <td>
+                        @if($row['sign'] == 0)
+                            0
+                        @else
+                            {{$row['sign']}}
+                        @endif
+                        <br/>
+                       {{$row['has_many_pay_order_count'] - $row['sign']}}
+                    </td>
+                    <td>
+                        <label data='{{$row['is_open']}}'
+                               class='@if($row['is_open']==1) btn btn-info @else  btn btn-default  @endif'
+                               onclick="setPutaway(this, {{$row['id']}},'is_open')">
+                            @if($row['is_open']==1)
+                               启用
+                            @else
+                                禁用
+                            @endif
+                        </label>
+                    </td>
+                    <td>
+                        <a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.enrol',['id' => $row['id']])}}"
+                           class="btn btn-sm btn-default" title="查看数据" style="font-size: 13px;"><i
+                                    class="fa fa-article"></i></a>
+                    </td>
+
+                     <td style="position:relative; overflow:visible;" width="25%;">
+                        <div class="btn-group">
+                                <div class="umphp" title="商品二维码"
+                                   data-url="{{yzAppFullUrl('activity/' . $row['id'])}}"
+                                   data-goodsid="{{$row['id']}}">
+                                    <!-- <div class="img qrcode-popup" data-id="{{$row['id']}}">
+                                        <ul class="tabar">
+                                            <li class="tabar-item active" data-id="{{$row['id']}}" data-key="qrcode" >二维码</li>
+                                            <li class="tabar-item" data-id="{{$row['id']}}" data-key="minicode">小程序码</li>
+                                        </ul>
+                                        <ul class="tab-content">
+                                            <li class="tab-item" >
+                                                <div>{!! QrCode::size(120)->generate(yzAppFullUrl('signIn/'.$row['id'])) !!}</div>
+                                                <a download="{{$row['download_url']}}" href="{{$row['download_url']}}" title="下载二维码" class="js-clip">下载二维码</a>
+                                            </li>
+                                            <li class="tab-item" style="display:none;">
+                                                <div><img src="{{$row['small_qr_url']}}" width="80px"/></div>
+                                                <a download="{{$row['small_qr_url']}}" href="{{$row['small_qr_url']}}" title="下载小程序码" class="js-clip">下载小程序码</a>
+                                            </li>
+                                        </ul>
+                                    </div> -->
+                                    <!-- <span onclick="openDig('{{$row['activity_url']}}','{{$row['small_activity_url']}}','{{$row['download_url']}}','{{$row['small_qr_url']}}',
+                                    '{{$row['copy_activity_url']}}','{{$row['copy_small_activity_url']}}','{{$row['copy_download_url']}}','{{$row['copy_small_qr_url']}}')">签到二维码</span> -->
+                                    <span onclick="openDig('{{$row['id']}}')">签到二维码</span>
+                                </div>
+
+
+
+                            <a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.edit',['id' => $row['id']])}}"
+                               class="" title="编辑">编辑</a>
+
+                            <a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.delete',['id' => $row['id']])}}"
+                               onclick="return confirm('{{$delete_msg}}');
+                                       return false;" class="" title="删除">删除</a>
+
+                                <!-- <a href="javascript:;"
+                                   data-clipboard-text="{{yzAppFullUrl('enrollEnter/'.$row['id'])}}"
+                                   data-url="{{yzAppFullUrl('enrollEnter/'.$row['id'])}}"
+                                   title="复制连接" class="js-clip">网页链接</a>
+                            <a href="javascript:;"
+                               data-clipboard-text="{{'/packageC/Myshaky/enrollEnter/enrollEnter?id='.$row['id']}}"
+                               data-url="{{'/packageC/Myshaky/enrollEnter/enrollEnter?id='.$row['id']}}"
+                               title="复制连接" class="js-clip">小程序链接</a> -->
+                        </div>
+                         <div>
+                             <label data='{{$row['is_recommand']}}'
+                                    class='btn btn-sm @if($row['is_recommand']==1) btn-info @else btn-default @endif'
+                                    onclick="setProperty(this,{{$row['id']}},'is_recommand')">推荐</label>
+
+                             <label data='{{$row['is_discount']}}'
+                                    class='btn btn-sm @if($row['is_discount']==1) btn-info @else btn-default @endif'
+                                    onclick="setProperty(this,{{$row['id']}},'is_discount')">精选</label>
+                             <label data='{{$row['is_hot']}}'
+                                    class='btn btn-sm @if($row['is_hot']==1) btn-info @else btn-default @endif'
+                                    onclick="setProperty(this,{{$row['id']}},'is_hot')">热门</label>
+                         </div>
+
+                    </td>
+                </tr>
+
+            @endforeach
+            </tbody>
+        </table>
+
+        {!! $pager !!}
+    </div>
+</div>
+<div style="width:100%;height:150px;"></div>
+<div id="diglog">
+    <el-dialog
+        :visible.sync="dialogVisible"
+        width="40%"
+        @close="handleClose">
+        <div slot="title" class="dig-title">
+            <div :class="[showAct ? 'isChecked' : 'noCheck']" @click="handleChange(1)">活动二维码</div>
+            <div :class="[showSign ? 'isChecked' : 'noCheck']" @click="handleChange(2)">签到二维码</div>
+        </div>
+        <!-- 活动 -->
+        <div class="actCode" v-show="showAct">
+            <div class="QRCode" >
+                <div class="QRCode-item">
+
+                <div class="codeImg">
+                    <img :src="activity_url" alt="">
+
+                </div>
+                <a class="code-title"  :href="activity_url" :download='activity_url'>下载二维码图片</a>
+                </div>
+
+                <div class="QRCode-item" v-if="actMiniCode">
+                <div class="codeImg">
+                    <img :src="activity_url1" alt="">
+                </div>
+                <!-- <div class="code-title">下载小程序码图片</div> -->
+                <a class="code-title"  :href="activity_url1" :download='activity_url1'>下载小程序码图片</a>
+                </div>
+            </div>
+            <div class="input-item" >
+                <div class="item-title">H5页面链接</div>
+                <div class="item-input">
+                <el-col :span="22">
+                    <el-input
+                    placeholder="请输入链接"
+                    v-model="copy_activity_url"
+                    >
+                    </el-input>
+                </el-col>
+                </div>
+                <div class="copy" @click="handleCopy(copy_activity_url)">复制</div>
+            </div>
+            <div class="input-item" >
+                <div class="item-title">小程序页面链接</div>
+                <div class="item-input">
+                <el-col :span="22">
+                    <el-input
+                    placeholder="请输入链接"
+                    v-model="copy_activity_url1"
+                    >
+                    </el-input>
+                </el-col>
+                </div>
+                <div class="copy" @click="handleCopy(copy_activity_url1)">复制</div>
+
+            </div>
+        </div>
+        <!-- 签到 -->
+        <div class="signCode" v-show="showSign">
+            <div class="QRCode" >
+                    <div class="QRCode-item">
+                    <div class="codeImg">
+                        <img :src="download_url" alt="">
+                    </div>
+                    <a class="code-title"  :href="download_url" :download='download_url'>下载二维码图片</a>
+                    </div>
+
+                    <div class="QRCode-item" v-if="downMiniCode">
+                    <div class="codeImg">
+                        <img :src="download_url1" alt="">
+                    </div>
+                    <a class="code-title"  :href="download_url1" download='download_url1'>下载小程序码图片</a>
+                    </div>
+            </div>
+            <div class="input-item" >
+                <div class="item-title">H5页面链接</div>
+                <div class="item-input">
+                <el-col :span="22">
+                    <el-input
+                    placeholder="请输入链接"
+                    v-model="copy_download_url"
+                    >
+                    </el-input>
+                </el-col>
+                </div>
+                <div class="copy" @click="handleCopy(copy_download_url)">复制</div>
+            </div>
+            <div class="input-item" >
+                <div class="item-title">小程序页面链接</div>
+                <div class="item-input">
+                <el-col :span="22">
+                    <el-input
+                    placeholder="请输入链接"
+                    v-model="copy_small_qr_url"
+                    >
+                    </el-input>
+                </el-col>
+                </div>
+                <div class="copy" @click="handleCopy(copy_small_qr_url)">复制</div>
+
+            </div>
+        </div>
+
+    </el-dialog>
+</div>
+<script language='javascript'>
+    //鼠标划过显示商品链接二维码
+    $('.umphp').hover(function () {
+            var url = $(this).attr('data-url');
+            $(this).addClass("selected");
+        },
+        function () {
+            $(this).removeClass("selected");
+        });
+        $(".tabar-item").hover(function(){
+            const id=this.dataset.id;
+            const key=this.dataset.key;
+            const elSort=key=='qrcode'?1:2;
+            const hideElSort=key=='qrcode'?2:1;
+            console.log(elSort,hideElSort);
+            $(".qrcode-popup[data-id='"+id+"'] .tab-item:nth-child("+hideElSort+")").hide();
+            $(".qrcode-popup[data-id='"+id+"'] .tabar-item:nth-child("+hideElSort+")").removeClass("active");
+            $(".qrcode-popup[data-id='"+id+"'] .tab-item:nth-child("+elSort+")").show();
+            $(".qrcode-popup[data-id='"+id+"'] .tabar-item:nth-child("+elSort+")").addClass("active");
+        })
+
+
+    $(function () {
+        $('#export').click(function () {
+            $('#form1').attr('action', '{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.export') !!}');
+            $('#form1').submit();
+        });
+        $('#search').click(function () {
+            $('#form1').attr('action', '{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.index') !!}');
+            $('#form1').submit();
+        });
+    });
+
+
+    function setPutaway(obj, id, type) {
+
+        $(obj).html($(obj).html() + "...");
+        $.post("{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.setPutaway') !!}",
+            {id: id, type: type, data: obj.getAttribute("data")}
+            , function (d) {
+                console.log(d);
+                $(obj).html($(obj).html().replace("...", ""));
+                $(obj).html(d.data == '1' ? '启用' : '禁用');
+                $(obj).attr("data", d.data);
+                if (d.result == 1) {
+                    $(obj).toggleClass("btn-info btn-default");
+                }
+            }
+            , "json"
+        );
+    }
+
+    function setProperty(obj, id, type) {
+        $(obj).html($(obj).html() + "...");
+        $.post("{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.setProperty') !!}", {id: id, type: type, data: obj.getAttribute("data")}
+            , function (d) {
+                console.log(d);
+                $(obj).html($(obj).html().replace("...", ""));
+                if (type == 'type') {
+                    $(obj).html(d.data == '1' ? '实体物品' : '虚拟物品');
+                }
+                if (type == 'status') {
+                    $(obj).html(d.data == '1' ? '' : '');
+                }
+                $(obj).attr("data", d.data);
+                if (d.result == 1) {
+                    $(obj).toggleClass("btn-info btn-default");
+                }
+            }
+            , "json"
+        );
+    }
+
+    var vm = new Vue({
+        el:"#diglog",
+        delimiters: ['[[', ']]'],
+        data() {
+            return {
+                dialogVisible: false,
+                showAct:true,//显示活动二维码
+                showSign:false,//显示签到二维码
+                actMiniCode:true,
+                downMiniCode:true,
+                activity_url:'',//活动二维码
+                activity_url1:'',//活动小程序二维码
+                download_url:'',//签到二维码
+                download_url1:'',//签到小程序二维码
+                copy_activity_url:'',//活动H5链接
+                copy_activity_url1:'',//活动小程序链接
+                copy_download_url:'',//签到H5链接
+                copy_small_qr_url:'',//签到小程序链接
+            }
+        },
+        methods: {
+            handleClose() {
+                this.dialogVisible = false;
+            },
+            handleChange(item){
+                if(item == 1){
+                    this.showAct = true;
+                    this.showSign = false;
+                }
+                if(item == 2){
+                    this.showAct = false;
+                    this.showSign = true;
+                }
+            },
+            handleCopy(data){
+                if(data == ''){
+                    this.$message({
+                        message: '暂无连接',
+                        type: 'error'
+                    });
+                    return
+                }
+                //创建一个input元素
+                let input = document.createElement('input')
+                //给input的内容复制
+                input.value = data
+                // 在body里面插入这个元素
+                document.body.appendChild(input)
+                // 选中input里面内容
+                input.select()
+                //执行document里面的复制方法
+                document.execCommand("Copy")
+                // 复制之后移除这个元素
+                document.body.removeChild(input);
+                this.$message({
+                    message: '复制成功',
+                    type: 'success'
+                });
+            },
+            async getCodes(id){
+               let res = (await this.$http.post("{!! yzWebFullUrl('plugin.activity-apply.admin.activity-apply-activity.get-codes') !!}", {id:id})).body
+
+                console.log(res);
+               this.activity_url = res.data.activity_url;
+                this.download_url = res.data.download_url;
+               if(res.data.small_activity_url == ""){
+                   this.actMiniCode = false;
+               }else{
+                this.activity_url1 = res.data.small_activity_url
+                this.actMiniCode = true;
+               }
+
+               if(res.data.small_qr_url == ""){
+                    this.downMiniCode = false;
+               }else{
+                    this.download_url1 = res.data.small_qr_url;
+                    this.downMiniCode = true;
+               }
+
+                this.copy_activity_url = res.data.copy_activity_url;
+                this.copy_activity_url1 = res.data.copy_small_activity_url;
+                this.copy_download_url = res.data.copy_download_url;
+                this.copy_small_qr_url = res.data.copy_small_qr_url
+            }
+        }
+    })
+    function openDig(id){
+        vm.dialogVisible = true;
+        vm.getCodes(id)
+    }
+    // function openDig(actQrCodeImg,actMiniCodeImg,signQrCodeImg,signMiniCodeImg,actH5Url,actMiniUrl,signH5Url,signMiniUrl) {
+    //     vm.dialogVisible = true;
+    //     //二维码
+    //     //H5二维码
+    //     vm.activity_url = actQrCodeImg;
+    //     vm.download_url = signQrCodeImg;
+    //     //小程序二维码
+    //     if(actMiniCodeImg == ''){
+    //         vm.actMiniCode = false;
+    //     }else{
+    //         vm.activity_url1 = actMiniCodeImg
+    //         vm.actMiniCode = true;
+    //     }
+    //     if(signMiniCodeImg == ''){
+    //         vm.downMiniCode = false;
+    //     }else{
+    //         vm.download_url1 = signMiniCodeImg;
+    //         vm.downMiniCode = true;
+    //     }
+    //     //链接
+    //     vm.copy_activity_url = actH5Url;
+    //     vm.copy_activity_url1 = actMiniUrl;
+    //     vm.copy_download_url = signH5Url;
+    //     vm.copy_small_qr_url = signMiniUrl
+    // }
+
+</script>
+<script>
+    $(function () {
+        $(".checkall").click(function () {
+            //全选
+            if ($(this).html() == '全选') {
+                $(this).html('全不选');
+                $('[name=check1]:checkbox').prop('checked', true);
+            } else {
+                $(this).html('全选');
+                $('[name=check1]:checkbox').prop('checked', false);
+            }
+        });
+        $(".checkrev").click(function () {
+            //反选
+            $('[name=check1]:checkbox').each(function () {
+                this.checked = !this.checked;
+            });
+        });
+
+        var arr = new Array();
+        var url = "{!! yzWebUrl('goods.goods.batchSetProperty') !!}"
+
+        $(".batchenable").click(function () {
+            $(this).html('上架中...');
+            $("[name=check1]:checkbox:checked").each(function (i) {
+                arr[i] = $(this).val();
+            });
+            $.post(url, {ids: arr, data: 1}
+                , function (d) {
+                    if (d.result) {
+                        $(".batchenable").html('上架成功');
+                        setTimeout(location.reload(), 3000);
+                    }
+                }, "json"
+            );
+        });
+        $(".batchdisable").click(function () {
+            $(this).html('下架中...');
+            $("[name=check1]:checkbox:checked").each(function (i) {
+                arr[i] = $(this).val();
+            });
+            $.post(url, {ids: arr, data: 0}
+                , function (d) {
+                    if (d.result) {
+                        $(".batchdisable").html('下架成功');
+                        setTimeout(location.reload(), 3000);
+                    }
+                }, "json"
+            );
+        });
+
+        $(".batchdel").click(function () {
+            $(this).html('删除中...');
+            $("input[type='checkbox']:checked").each(function (i) {
+                arr[i] = $(this).val();
+            });
+            $.post("{!! yzWebUrl('goods.goods.batchDestroy') !!}", {ids: arr}
+                , function (d) {
+                    if (d.result) {
+                        $(".batchdel").html('删除成功');
+                        setTimeout(location.reload(), 3000);
+                    }
+                }, "json"
+            );
+        })
+
+    });
+</script>
+@endsection

+ 957 - 0
plugins/activity-apply/views/admin/activity_edit.blade.php

@@ -0,0 +1,957 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('报名活动'))
+<script type="text/javascript">
+    require(['bootstrap'], function () {
+        $('#myTab a').click(function (e) {
+            e.preventDefault();
+            $(this).tab('show');
+        })
+    });
+</script>
+<div class="w1200 ">
+    <div class=" rightlist ">
+        <div class="right-titpos">
+            <ul class="add-snav">
+                <li class="active"><a href="#">活动信息</a></li>
+            </ul>
+        </div>
+        <div class="right-addbox"><!-- 此处是右侧内容新包一层div -->
+            <div class="panel panel-default">
+                <div class="panel-body">
+                    <form  id="activity_form" name="activity_form" action="" method="post" class="form-horizontal form">
+                        <input type="hidden" name="id" value="{{$id}}">
+                        <input type="hidden" name="$activity_id" class="form-control"
+                               value="{{$activity_id}}"/>
+                        <div class="top">
+                            <ul class="add-shopnav" id="myTab">
+                                <li class="active"><a href="#tab_store_basic">活动信息</a></li>
+                                <li><a href="#tab_cashier_sale">营销设置</a></li>
+                                <li><a href="#tab_cashier_porfit">分润设置</a></li>
+                                @if($return_show)
+                                    <li><a href="#tab_cashier_rentun">返现设置</a></li>
+                                @endif
+                                <li><a href="#tab_share">分享设置</a></li>
+                                <li><a href="#tab_member_power">会员权限</a></li>
+                            </ul>
+                        </div>
+
+                        <div class="info">
+                            <div class="panel-body">
+
+                                <div class="tab-content">
+                                    <div class="tab-pane  active" id="tab_store_basic">
+                                        <div class='panel panel-default'>
+                                            <div class='panel-body'>
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                                                style='color:red'>*</span>活动名称</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        <input class="form-control" type="text" value="{{$item['title']}}"
+                                                               name="data[title]">
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label" ><span
+                                                                style="color: red;">*</span>活动图片</label>
+                                                    <div class="col-sm-9 col-xs-12 detail-logo">
+                                                        {!! app\common\helpers\ImageHelper::tplFormFieldImage('data[thumb]', $item['thumb']) !!}
+                                                        <span class="help-block">建议尺寸: 640*400 </span>
+                                                    </div>
+                                                </div>
+
+                                                {{--<div class="form-group">--}}
+                                                    {{--<label class="col-xs-12 col-sm-3 col-md-2 control-label" ><span--}}
+                                                                {{--style="color: red;">*</span>详细页banner图片</label>--}}
+                                                    {{--<div class="col-sm-9 col-xs-12 detail-logo">--}}
+                                                        {{--{!! app\common\helpers\ImageHelper::tplFormFieldImage('data[banner]', $item['banner']) !!}--}}
+                                                        {{--<span class="help-block">建议尺寸: 363 * 100 </span>--}}
+                                                    {{--</div>--}}
+                                                {{--</div>--}}
+
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+                                                    ><span
+                                                                style="color: red;">*</span>分类</label>
+                                                    <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+                                                        <select class="form-control tpl-category-parent" id="level" name="data[calssify_id]">
+                                                            <option value="0">分类</option>
+                                                            @foreach($calssify as $form)
+                                                                <option value="{{$form->id}}"
+                                                                        @if($item['calssify_id']==$form->id)
+                                                                        selected
+                                                                        @endif
+                                                                >[ID:{{$form->id}}]{{$form->calssify_title}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+                                                    ><span
+                                                                style="color: red;">*</span>选择表单</label>
+                                                    <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+                                                        <select class="form-control tpl-category-parent" id="level" name="data[form_id]">
+                                                            <option value="0">选择表单</option>
+                                                            @foreach( $diyForm as $form)
+                                                                <option value="{{$form->id}}"
+                                                                        @if($item['form_id']==$form->id)
+                                                                        selected
+                                                                        @endif
+                                                                >[ID:{{$form->id}}]{{$form->title}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                                                style="color: red;">*</span>报名日期</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        {!! app\common\helpers\DateRange::tplFormFieldDateRange('data[registration]', [
+                                                          'starttime'=>array_get($time,'registration_time',0),
+                                                          'endtime'=>array_get($time,'registration_end_time',0),
+                                                          'start'=>0,
+                                                          'end'=>0
+                                                          ], true)!!}
+
+
+                                                    </div>
+
+
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                                                style="color: red;">*</span>活动日期</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        {!! app\common\helpers\DateRange::tplFormFieldDateRange('data[time_range]', [
+                                                          'starttime'=>array_get($time,'start_time',0),
+                                                          'endtime'=>array_get($time,'end_time',0),
+                                                          'start'=>0,
+                                                          'end'=>0
+                                                          ], true)!!}
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动费用</label>
+                                                    <div class="col-sm-6 col-xs-6">
+                                                        <div class='input-group'>
+                                                            <input type='text' name='data[cash]' class="form-control discounts_value"
+                                                                   value="{{$item['cash']}}"/>
+                                                            <div class='input-group-addon waytxt'>元</div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                                                style="color: red;">*</span>限制名额</label>
+                                                    <div class="col-sm-6 col-xs-6">
+                                                        <div class='input-group'>
+                                                            <input type='text' name='data[limit]' class="form-control discounts_value"
+                                                                   value="{{$item['limit']}}"/>
+                                                            <div class='input-group-addon waytxt'>人</div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+                                                    ><span
+                                                                style="color: red;"></span>关联讲师</label>
+                                                    <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+                                                        <select class="form-control tpl-category-parent" id="level" name="data[member_id]">
+                                                            <option value="0">选择关联讲师</option>
+                                                            @foreach( $lecturer as $form)
+                                                                <option value="{{$form['member_id']}}"
+                                                                        @if($item['lecturer_id']==$form['member_id'])
+                                                                        selected
+                                                                        @endif
+                                                                >[ID:{{$form['member_id']}}]{{$form['real_name']}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span>活动地址</label>
+                                                    <div class="col-xs-6">
+                                                        <input type="hidden" id="province_id" value="{{$item['province_id']?$item['province_id']:0}}"/>
+                                                        <input type="hidden" id="city_id" value="{{$item['city_id']?$item['city_id']:0}}"/>
+                                                        <input type="hidden" id="district_id" value="{{$item['district_id']?$item['district_id']:0}}"/>
+                                                        <input type="hidden" id="street_id" value="{{$item['street_id']?$item['street_id']:0}}"/>
+                                                        {!! app\common\helpers\AddressHelper::tplLinkedAddress(['data[province_id]','data[city_id]','data[district_id]','data[street_id]'], [])!!}
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">详细地址</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        <input class="form-control" type="text" value="{{$item['address']}}"
+                                                               name="data[address]">
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 定位</label>
+                                                    <div class="col-sm-8 col-xs-12" id="map" style="margin-top:0px;width: 70%;">
+                                                        <script type="text/javascript">
+                                                            function showCoordinate(elm) {
+                                                                require(["util"], function(util){
+                                                                    var val = {};
+                                                                    val.lng = parseFloat($(elm).parent().prev().prev().find(":text").val());
+                                                                    val.lat = parseFloat($(elm).parent().prev().find(":text").val());
+                                                                    util.map(val, function(r){
+                                                                        $(elm).parent().prev().prev().find(":text").val(r.lng);
+                                                                        $(elm).parent().prev().find(":text").val(r.lat);
+                                                                    });
+
+                                                                });
+                                                            }
+
+                                                        </script>
+                                                        <div class="row row-fix">
+                                                            <div class="col-xs-4 col-sm-4">
+                                                                <input type="text" name="data[lng]" value="{{$item['longitude']}}" placeholder="地理经度" class="form-control">
+                                                            </div>
+                                                            <div class="col-xs-4 col-sm-4">
+                                                                <input type="text" name="data[lat]" value="{{$item['latitude']}}" placeholder="地理纬度" class="form-control">
+                                                            </div>
+                                                            <div class="col-xs-4 col-sm-4">
+                                                                <button onclick="showCoordinate(this);" class="btn btn-default" type="button">选择坐标</button>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"
+                                                    >活动介绍</label>
+                                                    <div class="col-sm-8 col-xs-12 col-md-9">
+                                                        {!! yz_tpl_ueditor('data[content]', $item['content']) !!}
+
+                                                    </div>
+                                                </div>
+
+
+                                                <div class="panel-body">
+                                                    <div class="form-group">
+                                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
+                                                        <div class="col-sm-9 col-xs-12">
+                                                            <label class="radio-inline"><input type="radio"  name="data[is_open]" value="1" @if($item['is_open'] ==1)
+                                                                checked="checked"
+                                                                        @endif/> 开启</label>
+                                                            <label class="radio-inline"><input type="radio"  name="data[is_open]" value="0" @if($item['is_open'] ==0)
+                                                                checked="checked"
+                                                                        @endif/> 关闭</label>
+                                                        </div>
+
+                                                    </div>
+                                                </div>
+                                                <div class="panel-body">
+                                                    <div class="form-group">
+                                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">热门类别</label>
+                                                        <div class="col-sm-9 col-xs-12">
+                                                            <label class="radio-inline"><input type="checkbox"  name="data[is_recommand]" value="1" @if($item['is_recommand'] ==1)
+                                                                checked="checked"
+                                                                        @endif/> 推荐</label>
+                                                            <label class="radio-inline"><input type="checkbox"  name="data[is_discount]" value="1" @if($item['is_discount'] ==1)
+                                                                checked="checked"
+                                                                        @endif/> 精选</label>
+                                                            <label class="radio-inline"><input type="checkbox"  name="data[is_hot]" value="1" @if($item['is_hot'] ==1)
+                                                                checked="checked"
+                                                                        @endif/> 热门</label>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <div class="form-group"></div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="tab-pane" id="tab_cashier_sale">
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分最高抵扣</label>
+                                            <div class="col-sm-6 col-xs-6">
+                                                <div class='input-group'>
+                                                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][max_point_deduct]' class="form-control discounts_value"
+                                                           value="{{$sale['max_point_deduct']?str_replace('%', '', $sale['max_point_deduct']):0}}"/>
+                                                    <div class='input-group-addon waytxt'>%</div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分最少抵扣</label>
+                                            <div class="col-sm-6 col-xs-6">
+                                                <div class='input-group'>
+                                                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][min_point_deduct]' class="form-control discounts_value"
+                                                           value="{{$sale['min_point_deduct']?str_replace('%', '', $sale['min_point_deduct']):0}}"/>
+                                                    <div class='input-group-addon waytxt'>%</div>
+                                                </div>
+                                            </div>
+                                        </div>
+
+                                        @if(array_key_exists('love', $exist_plugins))
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启{{$love_name}}抵扣</label>
+                                                <div class="col-sm-9 col-xs-12">
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][deduction]' value='1'
+                                                               @if($exist_plugins['love']['love_goods']['deduction'] == 1) checked @endif
+                                                        /> 是
+                                                    </label>
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][deduction]' value='0'
+                                                               @if($exist_plugins['love']['love_goods']['deduction']== 0) checked @endif
+                                                        /> 否
+                                                    </label>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">{{$love_name}}最高抵扣</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class='input-group'>
+                                                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][deduction_proportion]' class="form-control discounts_value"
+                                                               value="{{$exist_plugins['love']['love_goods']['deduction_proportion']?$exist_plugins['love']['love_goods']['deduction_proportion']:0}}"/>
+                                                        <div class='input-group-addon waytxt'>%</div>
+                                                    </div>
+                                                    <div style="padding-top:5px;"><span style="font-size: 10px;">{{$love_name}}最高抵扣, 设置0则不开启爱心值抵扣</span></div>
+                                                </div>
+                                            </div>
+                                        @endif
+
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员奖励积分</label>
+                                            <div class="col-sm-6 col-xs-6">
+                                                <div class='input-group'>
+                                                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][point]' class="form-control discounts_value"
+                                                           value="{{str_replace('%', '', $sale['point'])?str_replace('%', '', $sale['point']):0}}"/>
+                                                    <div class='input-group-addon waytxt'>%</div>
+                                                </div>
+                                            </div>
+                                        </div>
+
+                                        @if(array_key_exists('love', $exist_plugins))
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启{{$love_name}}奖励</label>
+                                                <div class="col-sm-9 col-xs-12">
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][award]' value='1'
+                                                               @if($exist_plugins['love']['love_goods']['award'] == 1) checked @endif
+                                                        /> 是
+                                                    </label>
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][award]' value='0'
+                                                               @if($exist_plugins['love']['love_goods']['award'] == 0) checked @endif
+                                                        /> 否
+                                                    </label>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员奖励{{$love_name}}</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class='input-group'>
+                                                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][award_proportion]' class="form-control discounts_value"
+                                                               value="{{$exist_plugins['love']['love_goods']['award_proportion']?$exist_plugins['love']['love_goods']['award_proportion']:0}}"/>
+                                                        <div class='input-group-addon waytxt'>%</div>
+
+                                                    </div>
+                                                    <div style="padding-top:5px;"><span style="font-size: 10px;">会员奖励{{$love_name}}, 设置0则不开启会员奖励{{$love_name}}</span></div>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启上级{{$love_name}}奖励</label>
+                                                <div class="col-sm-9 col-xs-12">
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][parent_award]' value='1'
+                                                               @if($exist_plugins['love']['love_goods']['parent_award'] == 1) checked @endif
+                                                        /> 是
+                                                    </label>
+                                                    <label class='radio-inline'>
+                                                        <input type='radio' name='widgets[love][parent_award]' value='0'
+                                                               @if($exist_plugins['love']['love_goods']['parent_award'] == 0) checked @endif
+                                                        /> 否
+                                                    </label>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">一级会员奖励{{$love_name}}</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class='input-group'>
+                                                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][parent_award_proportion]' class="form-control discounts_value"
+                                                               value="{{$exist_plugins['love']['love_goods']['parent_award_proportion']?:0}}"/>
+                                                        <div class='input-group-addon waytxt'>%</div>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">二级会员奖励{{$love_name}}</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class='input-group'>
+                                                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][second_award_proportion]' class="form-control discounts_value"
+                                                               value="{{$exist_plugins['love']['love_goods']['second_award_proportion']?:0}}"/>
+                                                        <div class='input-group-addon waytxt'>%</div>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        @endif
+
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">赠送优惠券</label>
+                                            <div class="col-sm-6 col-xs-6">
+                                                <div class='input-group'>
+                                                    <div id="category" >
+                                                        <table class="table">
+                                                            <tbody id="param-itemscategory">
+
+                                                                @foreach($coupon as $k=>$v)
+                                                                    <tr>
+                                                                        <td>
+                                                                            <a href="javascript:;" onclick="deleteParam(this)" style="margin-top:10px;"  title="删除"><i class='fa fa-times'></i></a>
+                                                                        </td>
+                                                                        <td  colspan="2">
+                                                                            <input id="categoryid" type="hidden" class="form-control" name="widgets[activity-apply][coupon_ids][]" data-id="{{$v['id']}}" data-name="coupon_ids"  value="{{$v['id']}}" style="width:200px;float:left"  />
+                                                                            <input id="categoryname" class="form-control" type="text" name="widgets[activity-apply][coupon_names][]" data-id="{{$v['name']}}" data-name="coupon_names" value="{{$v['name']}}
+                                                                                    " style="width:200px;float:left" readonly="true">
+                                                                            <span class="input-group-btn">
+                                    <button class="btn btn-default nav-link" type="button" data-id="{{$v['id']}}" onclick="$('#modal-module-menus-categorys').modal();$(this).parent().parent().addClass('focuscategory')" >选择优惠券</button>
+                                </span>
+                                                                        </td>
+                                                                    </tr>
+                                                                @endforeach
+
+                                                            </tbody>
+                                                            <tbody>
+                                                            <tr>
+                                                                <td colspan="3">
+                                                                    <a href="javascript:;" id='add-param_category' onclick="addParam('category')"
+                                                                       style="margin-top:10px;" class="btn btn-primary"  title="添加优惠券"><i class='fa fa-plus'></i> 添加优惠券</a>
+                                                                </td>
+                                                            </tr>
+                                                            </tbody>
+                                                        </table>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+
+                                        <div id="modal-module-menus-categorys" class="modal fade" tabindex="-1"> {{--搜索优惠券的弹窗--}}
+                                            <div class="modal-dialog" style='width: 920px;'>
+                                                <div class="modal-content">
+                                                    <div class="modal-header">
+                                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">
+                                                            ×
+                                                        </button>
+                                                        <h3>选择优惠券</h3>
+                                                    </div>
+                                                    <div class="modal-body">
+                                                        <div class="row">
+                                                            <div class="input-group">
+                                                                <input type="text" class="form-control" name="keyword" value=""
+                                                                       id="search-kwd-categorys" placeholder="请输入优惠券名称"/>
+                                                                <span class='input-group-btn'>
+                            <button type="button" class="btn btn-default" onclick="search_categorys();">搜索
+                            </button>
+                        </span>
+                                                            </div>
+                                                        </div>
+                                                        <div id="module-menus-categorys" style="padding-top:5px;"></div>
+                                                    </div>
+                                                    <div class="modal-footer"><a href="#" class="btn btn-default"
+                                                                                 data-dismiss="modal" aria-hidden="true">关闭</a>
+                                                    </div>
+                                                </div>
+
+                                            </div>
+                                        </div>
+
+                                        <div class="tab-pane active" id="tab_discount">
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">折扣类型</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <label class="radio-inline">
+                                                        <input type="radio" name="widgets[discount][level_discount_type]" value="1" checked="">
+                                                        会员等级
+                                                    </label>
+                                                </div>
+                                            </div>
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">折扣方式</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class="input-group">
+                                                        <label class="radio-inline">
+                                                            <input type="radio" name="widgets[discount][discount_method]" value="1"> 折扣
+                                                        </label>
+                                                        <label class="radio-inline">
+                                                            <input type="radio" name="widgets[discount][discount_method]" value="2" checked="">
+                                                            固定金额
+                                                        </label>
+                                                    </div>
+                                                </div>
+                                            </div>
+
+                                            <div id="ismember">
+                                                @foreach ($levels as $level)
+                                                    <div class="form-group">
+                                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                                                        <div class="col-sm-6 col-xs-6">
+                                                            <div class='input-group'>
+                                                                <div class='input-group-addon'>{{$level['level_name']}}</div>
+
+                                                                <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[discount][discount_value][{{$level["id"] }}]'
+                                                                       class="form-control discounts_value"
+                                                                       value="@if (!empty($discountValue)){{ $discountValue[$level["id"]] }}@endif"/>
+                                                                <div class='input-group-addon waytxt'>折</div>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                @endforeach
+                                            </div>
+
+                                            <script language="javascript">
+                                                $('input[name="widgets[discount][level_discount_type]"]').click(function () {
+                                                    var discounttype = $('input:radio[name="widgets[discount][level_discount_type]"]:checked').val();
+                                                    if (discounttype == 1) {
+                                                        $('#ismember').show();
+                                                    } else {
+                                                        $('#ismember').hide();
+                                                    }
+                                                });
+                                                $('input[name="widgets[discount][discount_method]"]').click(function () {
+                                                    var discountway = $('input:radio[name="widgets[discount][discount_method]"]:checked').val();
+                                                    if (discountway == 1) {
+                                                        $('.waytxt').html('折');
+                                                    }
+                                                    else {
+                                                        $('.waytxt').html('元');
+                                                    }
+                                                });
+
+
+
+                                                $('.chkall').click(function () {
+                                                    var checked = $(this).get(0).checked;
+                                                    if (checked) {
+                                                        $(this).closest('div').find(':checkbox[class!="chkall"]').removeAttr('checked');
+                                                    }
+                                                });
+                                                $('.chksingle').click(function () {
+                                                    $(this).closest('div').find(':checkbox[class="chkall"]').removeAttr('checked');
+                                                })
+
+                                            </script>
+                                        </div>
+                                        <script language='javascript'>
+                                            function deleteParam(o) {
+                                                $(o).parent().parent().remove();
+                                            }
+                                        </script>
+                                    </div>
+                                    @if(count($exist_plugins) != 0)
+                                        <div class="tab-pane" id="tab_cashier_porfit">
+                                            @if(array_key_exists('commission', $exist_plugins))
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启分销</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        <label class='radio-inline'>
+                                                            <input type='radio' name='widgets[commission][is_commission]' value='1'
+                                                                   @if($exist_plugins['commission']['commission_goods']['is_commission'] == 1) checked @endif
+                                                            /> 是
+                                                        </label>
+                                                        <label class='radio-inline'>
+                                                            <input type='radio' name='widgets[commission][is_commission]' value='0'
+                                                                   @if($exist_plugins['commission']['commission_goods']['is_commission'] == 0) checked @endif
+                                                            /> 否
+                                                        </label>
+                                                    </div>
+                                                </div>
+                                                {{--  <input type="hidden" name="widgets[commission][is_commission]" value="1">  --}}
+                                                <input type="hidden" name="widgets[commission][show_commission_button]" value="1">
+                                                <input type="hidden" name="widgets[commission][has_commission]" value="1">
+
+                                                <div class="form-group">
+                                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分销</label>
+                                                    <div class="col-sm-9 col-xs-12">
+                                                        <div class='panel-body'>
+                                                            <div class="table-responsive ">
+                                                                <table class="table table-hover">
+                                                                    <thead>
+                                                                    <tr>
+                                                                        <th style="width: 10%">等级名称</th>
+                                                                        <th style="text-align: center;">一级分销</th>
+                                                                        <th style="text-align: center;">二级分销</th>
+
+                                                                    </tr>
+                                                                    </thead>
+                                                                    <tbody>
+                                                                    <tr>
+                                                                        <td>默认等级</td>
+                                                                        <td>
+                                                                            <div class="input-group">
+                                                                                <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_0][first_level_rate]"
+                                                                                       class="form-control"
+                                                                                       value="{{$exist_plugins['commission']['commission_goods']->rule['level_0']['first_level_rate']}}"/>
+                                                                                <div class="input-group-addon">%</div>
+                                                                            </div>
+                                                                        </td>
+                                                                        <td>
+                                                                            <div class="input-group">
+                                                                                <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_0][second_level_rate]"
+                                                                                       class="form-control"
+                                                                                       value="{{$exist_plugins['commission']['commission_goods']->rule['level_0']['second_level_rate']}}"/>
+                                                                                <div class="input-group-addon">%</div>
+                                                                            </div>
+                                                                        </td>
+
+                                                                    </tr>
+
+
+                                                                    @foreach($exist_plugins['commission']['commission_levels'] as $level)
+                                                                        <tr>
+                                                                            <td>{{$level->name}}</td>
+                                                                            <td>
+                                                                                <div class="input-group">
+                                                                                    <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_{{$level->id}}][first_level_rate]"
+                                                                                           class="form-control"
+                                                                                           value="{{$exist_plugins['commission']['commission_goods']->rule['level_'.$level->id]['first_level_rate']}}"/>
+                                                                                    <div class="input-group-addon">%</div>
+                                                                                </div>
+                                                                            </td>
+                                                                            <td>
+                                                                                <div class="input-group">
+                                                                                    <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_{{$level->id}}][second_level_rate]"
+                                                                                           class="form-control"
+                                                                                           value="{{$exist_plugins['commission']['commission_goods']->rule['level_'.$level->id]['second_level_rate']}}"/>
+                                                                                    <div class="input-group-addon">%</div>
+                                                                                </div>
+                                                                            </td>
+
+                                                                        </tr>
+                                                                    @endforeach
+                                                                    </tbody>
+                                                                </table>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            @endif
+
+                                            @if(array_key_exists('dividend', $exist_plugins))
+                                                    <div class="form-group">
+                                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启经销商</label>
+                                                        <div class="col-sm-9 col-xs-12">
+                                                            <label class='radio-inline'>
+                                                                <input type='radio' name='widgets[team_dividend][is_dividend]' value='1'
+                                                                       @if($exist_plugins['dividend']['team_dividend_levels']['is_dividend']== 1) checked @endif
+                                                                /> 是
+                                                            </label>
+                                                            <label class='radio-inline'>
+                                                                <input type='radio' name='widgets[team_dividend][is_dividend]' value='0'
+                                                                       @if($exist_plugins['dividend']['team_dividend_levels']['is_dividend'] == 0) checked @endif
+                                                                /> 否
+                                                            </label>
+                                                        </div>
+                                                    </div>
+                                                    <div class="form-group">
+                                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                                                            <div class="col-sm-6 col-xs-6">
+                                                                <table class="table">
+                                                                    <thead >
+                                                                    <tr>
+                                                                        <th class="col-sm-2 col-xs-2">经销商等级</th>
+                                                                        <th class="col-sm-4 col-xs-4">提成比例</th>
+                                                                    </tr>
+                                                                    </thead>
+                                                                    <tbody >
+                                                                    @foreach($exist_plugins['dividend']['dividend_levels'] as $level)
+                                                                        <tr>
+                                                                            <td>
+                                                                                {{$level->level_name}}
+                                                                            </td>
+                                                                            <td>
+                                                                                <div class="input-group">
+                                                                                    <input type="text" name="widgets[team_dividend][has_dividend_rates][level_{{$level['id']}}]"
+                                                                                           class="form-control" value="{{$exist_plugins['dividend']['team_dividend_levels']->has_dividend_rates['level_'.$level->id]}}"/>
+                                                                                    <div class="input-group-addon">%</div>
+                                                                                </div>
+                                                                            </td>
+                                                                        </tr>
+                                                                    @endforeach
+                                                                    </tbody>
+                                                                </table>
+                                                            </div>
+                                                        </div>
+                                            @endif
+                                        </div>
+                                    @endif
+                                    <div class="tab-pane" id="tab_cashier_rentun">
+                                        @if(array_key_exists('single-return', $exist_plugins))
+                                            <div class="form-group">
+                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费赠送</label>
+                                                <div class="col-sm-6 col-xs-6">
+                                                    <div class='input-group'>
+                                                        <input type="hidden" name="widgets[single_return][is_single_return]" value="1">
+                                                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[single_return][return_rate]' class="form-control discounts_value"
+                                                               value="{{$exist_plugins['single-return']['single_return_goods']['return_rate']?$exist_plugins['single-return']['single_return_goods']['return_rate']:0}}"/>
+                                                        <div class='input-group-addon waytxt'>%</div>
+                                                    </div>
+                                                    <div style="padding-top:5px;"><span style="font-size: 10px;">消费赠送, 设置0则不开启消费赠送</span></div>
+                                                </div>
+                                            </div>
+                                        @endif
+                                            @if(app('plugins')->isEnabled('full-return'))
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费满额赠送</label>
+                                            <div class="col-sm-6 col-xs-6">
+                                                <label class="radio-inline">
+                                                    <input type="radio" name="widgets[activity-apply][profit][full_return][is_open]" value="1"
+                                                           @if($profit['full_return']['is_open'] == 1) checked="checked" @endif /> 开启</label>
+                                                <label class="radio-inline">
+                                                    <input type="radio" name="widgets[activity-apply][profit][full_return][is_open]" value="0"
+                                                           @if($profit['full_return']['is_open'] == 0) checked="checked" @endif /> 关闭</label>
+                                            </div>
+                                        </div>
+                                        @endif
+                                            @if(app('plugins')->isEnabled('consume-return'))
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费返现</label>
+                                            <div class="col-sm-9 col-xs-12">
+                                                <label class='radio-inline'>
+                                                    <input type='radio' name='widgets[activity-apply][profit][consume-return][is_open]' value='1'
+                                                           @if($profit['consume-return']['is_open'] == 1) checked @endif
+                                                    /> 开启
+                                                </label>
+                                                <label class='radio-inline'>
+                                                    <input type='radio' name='widgets[activity-apply][profit][consume-return][is_open]' value='0'
+                                                           @if($profit['consume-return']['is_open'] == 0) checked @endif
+                                                    /> 关闭
+                                                </label>
+                                            </div>
+                                        </div>
+                                                @endif
+                                    </div>
+
+                                    <div class="tab-pane" id="tab_share">
+
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题</label>
+                                            <div class="col-sm-9 col-xs-12">
+                                                <input type="text" name="widgets[share][share_title]" id="share[share_title]" class="form-control"
+                                                       value="{{ $exist_plugins['share']['share_title'] }}"/>
+                                                <span class='help-block'>如果不填写,默认为活动名称</span>
+                                            </div>
+                                        </div>
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享图标</label>
+                                            <div class="col-sm-9 col-xs-12">
+                                                {!! app\common\helpers\ImageHelper::tplFormFieldImage('widgets[share][share_thumb]', $exist_plugins['share']['share_thumb']) !!}
+
+                                            </div>
+                                        </div>
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享描述</label>
+                                            <div class="col-sm-9 col-xs-12">
+                                                <textarea name="widgets[share][share_desc]" class="form-control">{{ $exist_plugins['share']['share_desc']}}</textarea>
+                                            </div>
+                                        </div>
+
+                                    </div>
+                                    <div class="tab-pane" id="tab_member_power">
+                                        <div class="form-group">
+                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">可参加会员</label>
+                                            <div class="col-sm-9 col-xs-12">
+                                                @foreach($selectLevels as $item)
+                                                    <label class="radio-inline"><input type="checkbox"  name="data[member_power][{{ $item['id'] }}]" value="{{ $item['id'] }}" @if(in_array($item['id'],$member_power_list))
+                                                        checked="checked"
+                                                                @endif/> {{ $item['level_name'] }}</label>
+                                                @endforeach
+                                                    <span class='help-block'>都不勾选则全部会员都可参与,勾选后只有勾选了的等级会员可参与</span>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <div class="form-group">
+                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                                    <div class="col-xs-6">
+                                        <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-2"
+                                               onclick='return sub()'/>
+                                        <input type="button" name="back" onclick='history.back()' style=''
+                                               value="返回列表"
+                                               class="btn btn-default back"/>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                    </form>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+
+
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+<script language='javascript'>
+    var province_id = $('#province_id').val();
+    var city_id = $('#city_id').val();
+    var district_id = $('#district_id').val();
+    var street_id = $('#street_id').val();
+    cascdeInit(province_id, city_id, district_id, street_id);
+
+    function search_members() {
+        if ($('#search-kwd-notice').val() == '') {
+            Tip.focus('#search-kwd-notice', '请输入关键词');
+            return;
+        }
+        $("#module-menus-notice").html("正在搜索....");
+        $.get("{!! yzWebUrl('member.member.get-search-member') !!}", {
+            keyword: $.trim($('#search-kwd-notice').val())
+        }, function (dat) {
+            $('#module-menus-notice').html(dat);
+        });
+    }
+    function select_member(o) {
+        $("#uid").val(o.uid);
+        $("#saleravatar").show();
+        $("#saleravatar").find('img').attr('src', o.avatar);
+        $("#saler").val(o.nickname + "/" + o.realname + "/" + o.mobile);
+        $("#modal-module-menus-notice .close").click();
+    }
+
+    function formcheck() {
+        if($('#saler').val() == ''){
+            Tip.focus($('#saler'),'请选择微信角色!');
+            return false;
+        }
+        return true;
+    }
+
+    function remove_member(obj) {
+        $(obj).parent().remove();
+        refresh_members();
+    }
+    function refresh_members() {
+        var nickname = "";
+        $('.multi-item').each(function () {
+            var ret = $(this).find('.img-nickname-store').html();
+            if (ret === undefined) {
+                nickname += " ";
+            } else {
+                nickname += " " + $(this).find('.img-nickname-store').html() + "; ";
+            }
+        });
+        $('#salers').val(nickname);
+    }
+
+    function addParam(type) {
+        var html = `<tr>
+                        <td>
+                            <a href="javascript:;" onclick="deleteParam(this)" style="margin-top:10px;"  title="删除"><i class='fa fa-times'></i></a>
+                        </td>
+                        <td  colspan="2">
+                            <input id="categoryid" type="hidden" class="form-control" name="widgets[activity-apply][coupon_ids][]" data-id="{{$profit['coupon_id']}}" data-name="coupon_ids"  value="{{$profit['coupon_id']}}" style="width:200px;float:left"  />
+                            <input id="categoryname" class="form-control" type="text" name="widgets[activity-apply][coupon_names][]" data-id="{{$profit['name']}}" data-name="coupon_names" value="{{$profit['name']}}" style="width:200px;float:left" readonly="true">
+                            <span class="input-group-btn">
+        <button class="btn btn-default nav-link" type="button" data-id="{{$v['id']}}" onclick="$('#modal-module-menus-categorys').modal();$(this).parent().parent().addClass('focuscategory')" >选择优惠券</NOtton>
+    </span>
+                        </td>
+                    </tr>`;
+
+        $('#param-itemscategory').append(html);
+    }
+
+    function search_categorys() {
+        if ($.trim($('#search-kwd-categorys').val()) == '') {
+            Tip.focus('#search-kwd-categorys', '请输入关键词');
+            return;
+        }
+        $("#module-menus-categorys").html("正在搜索....");
+        $.get('{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.search-coupon') !!}', {
+                keyword: $.trim($('#search-kwd-categorys').val())
+            }, function (dat) {
+                $('#module-menus-categorys').html(dat);
+            }
+        );
+    }
+    function select_category(o) {
+        $(".focuscategory:last input[data-name=coupon_ids]").val(o.id);
+        $(".focuscategory:last input[data-name=coupon_names]").val(o.name);
+        $(".focuscategory").removeClass("focuscategory");
+        $("#modal-module-menus-categorys .close").click();
+    }
+
+    function sub()
+    {
+        document.activity_form.submit.disabled=true;
+
+        var form_data = $($('#activity_form')[0]).serialize();
+
+        if(activity_form['data[title]'].value==""){
+            alert("活动名称必填");
+            document.activity_form.submit.disabled=false;
+            return false;
+        }
+        if(activity_form['data[limit]'].value==""){
+            alert("限制名额必填");
+            document.activity_form.submit.disabled=false;
+            return false;
+        }
+        if(activity_form['data[thumb]'].value==""){
+            alert("活动图片必填");
+            document.activity_form.submit.disabled=false;
+            return false; ;
+        }
+        if(activity_form['data[form_id]'].value == "0"){
+            alert("表单必选");
+            document.activity_form.submit.disabled=false;
+            return false;;
+        }
+        if(activity_form['data[calssify_id]'].value == "0"){
+            alert("分类必选");
+            document.activity_form.submit.disabled=false;
+            return false;;
+        }
+        
+        var html = '';
+        var url = "{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.edit') !!}";
+        var urls = "{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.index') !!}";
+        $.post
+        ({
+            url: url,
+            dataType: "json",
+            data: form_data,
+            success: function (strValue) {
+                console.log(strValue)
+                if (strValue.result == "0") {
+                    confirm(strValue.msg);
+
+                    document.activity_form.submit.disabled=false;
+                } else if (strValue.result == "1") {
+                    confirm(strValue.msg);
+                    window.location.href = urls;
+                } else if (strValue.status == "-1") {
+                    confirm(strValue.result.msg);
+                    document.activity_form.submit.disabled=false;
+                }
+            },
+            fail:function (err) {
+                console.log("错误")
+                console.log(err)
+            }
+        })
+    }
+
+
+
+
+
+</script>
+@endsection

+ 230 - 0
plugins/activity-apply/views/admin/activity_from.blade.php

@@ -0,0 +1,230 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('报名活动'))
+<script type="text/javascript">
+    require(['bootstrap'], function () {
+        $('#myTab a').click(function (e) {
+            e.preventDefault();
+            $(this).tab('show');
+        })
+    });
+</script>
+<div class="w1200 ">
+    <div class=" rightlist ">
+        <div class="right-titpos">
+            <ul class="add-snav">
+                <li class="active"><a href="#">活动信息</a></li>
+            </ul>
+        </div>
+        <div class="right-addbox"><!-- 此处是右侧内容新包一层div -->
+            <div class="panel panel-default">
+                <div class="panel-body">
+                    <form  id="activity_form" name="activity_form" action="" method="post" class="form-horizontal form">
+                        <input type="hidden" name="$activity_id" class="form-control"
+                               value="{{$activity_id}}"/>
+                        <div class="top">
+                            <ul class="add-shopnav" id="myTab">
+                                <li class="active"><a href="#tab_store_basic">活动信息</a></li>
+                                <li><a href="#tab_cashier_sale">营销设置</a></li>
+                                <li><a href="#tab_cashier_porfit">分润设置</a></li>
+                                @if($return_show)
+                                    <li><a href="#tab_cashier_rentun">返现设置</a></li>
+                                @endif
+                                <li><a href="#tab_share">分享设置</a></li>
+                                <li><a href="#tab_member_power">会员权限</a></li>
+                            </ul>
+                        </div>
+
+                        <div class="info">
+                            <div class="panel-body">
+
+                                <div class="tab-content">
+                                    <div class="tab-pane  active" id="tab_store_basic">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::STORE_BASE_VIEW)</div>
+                                    <div class="tab-pane" id="tab_cashier_sale">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::CASHIER_SALE_VIEW)</div>
+                                    <div class="tab-pane" id="tab_cashier_porfit">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::CASHIER_PROFIT_VIEW)</div>
+                                    <div class="tab-pane" id="tab_cashier_rentun">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::CASHIER_RETURN_VIEW)</div>
+                                    <div class="tab-pane" id="tab_share">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::SHARE)</div>
+                                    <div class="tab-pane" id="tab_member_power">@include(\Yunshop\ActivityApply\admin\ActivityApplyActivityController::MEMBER_POWER)</div>
+                                </div>
+                                <div class="form-group">
+                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                                    <div class="col-xs-6">
+                                        <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-2"
+                                               onclick='return sub()'/>
+                                        <input type="button" name="back" onclick='history.back()' style=''
+                                               value="返回列表"
+                                               class="btn btn-default back"/>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                    </form>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+
+
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+<script language='javascript'>
+    function deleteParam(o) {
+        $(o).parent().parent().remove();
+    }
+
+    var province_id = $('#province_id').val();
+    var city_id = $('#city_id').val();
+    var district_id = $('#district_id').val();
+    var street_id = $('#street_id').val();
+    cascdeInit(province_id, city_id, district_id, street_id);
+
+
+
+    function store_select_member(o) {
+        console.log(o);
+        if ($('.multi-item[openid="' + o.has_one_fans.openid + '"]').length > 0) {
+            return;
+        }
+        var html = '<div class="multi-item" openid="' + o.has_one_fans.openid + '">';
+        html += '<img class="img-responsive img-thumbnail" src="' + o.avatar + '" onerror="this.src=\'{{static_url('resource/images/nopic.jpg')}}\'; this.title=\'图片未找到.\'">';
+        html += '<div class="img-nickname-store">' + o.nickname + '</div>';
+        html += '<input type="hidden" value="' + o.has_one_fans.openid + '" name="store[salers][' + o.uid + '][openid]">';
+        html += '<input type="hidden" value="' + o.nickname + '" name="store[salers][' + o.uid + '][nickname]">';
+        html += '<input type="hidden" value="' + o.avatar + '" name="store[salers][' + o.uid + '][avatar]">';
+        html += '<input type="hidden" value="' + o.uid + '" name="store[salers][' + o.uid + '][uid]">';
+        html += '<em onclick="remove_member(this)"  class="close">×</em>';
+        html += '</div>';
+        $("#saler_container").append(html);
+        refresh_members();
+    }
+
+    function remove_member(obj) {
+        $(obj).parent().remove();
+        refresh_members();
+    }
+    function refresh_members() {
+        var nickname = "";
+        $('.multi-item').each(function () {
+            var ret = $(this).find('.img-nickname-store').html();
+            if (ret === undefined) {
+                nickname += " ";
+            } else {
+                nickname += " " + $(this).find('.img-nickname-store').html() + "; ";
+            }
+        });
+        $('#salers').val(nickname);
+    }
+
+    function addParam(type) {
+        var html = `<tr>
+                        <td>
+                            <a href="javascript:;" onclick="deleteParam(this)" style="margin-top:10px;"  title="删除">
+                            <i class='fa fa-times'></i></a>
+                        </td>
+                        <td  colspan="2">
+                            <input id="categoryid" type="hidden" class="form-control" name="widgets[activity-apply][coupon_ids][]" data-id="{{$profit['coupon_id']}}" data-name="coupon_ids"  value="{{$profit['coupon_id']}}" style="width:200px;float:left"  />
+                            <input id="categoryname" class="form-control" type="text" name="widgets[activity-apply][coupon_names][]" data-id="{{$profit['name']}}" data-name="coupon_names" value="{{$profit['name']}}" style="width:200px;float:left" readonly="true">
+                            <span class="input-group-btn">
+        <button class="btn btn-default nav-link" type="button" data-id="{{$v['id']}}" onclick="$('#modal-module-menus-categorys').modal();$(this).parent().parent().addClass('focuscategory')" >选择优惠券</NOtton> </span>
+                        </td>
+                    </tr>`;
+
+        $('#param-itemscategory').append(html);
+    }
+
+    function search_categorys() {
+        if ($.trim($('#search-kwd-categorys').val()) == '') {
+            Tip.focus('#search-kwd-categorys', '请输入关键词');
+            return;
+        }
+        $("#module-menus-categorys").html("正在搜索....");
+        $.get('{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.search-coupon') !!}', {
+                keyword: $.trim($('#search-kwd-categorys').val())
+            }, function (dat) {
+                $('#module-menus-categorys').html(dat);
+            }
+        );
+    }
+    function select_category(o) {
+        $(".focuscategory:last input[data-name=coupon_ids]").val(o.id);
+        $(".focuscategory:last input[data-name=coupon_names]").val(o.name);
+        $(".focuscategory").removeClass("focuscategory");
+        $("#modal-module-menus-categorys .close").click();
+    }
+
+    function sub()
+    {
+        document.activity_form.submit.disabled=true;
+
+        var form_data = $($('#activity_form')[0]).serialize();
+
+        if(activity_form['data[title]'].value==""){
+            alert("活动名称必填");
+            document.activity_form.submit.disabled=false;
+            return false;
+        }
+        if(activity_form['data[thumb]'].value==""){
+            alert("活动图片必填");
+            document.activity_form.submit.disabled=false;
+            return false; ;
+        }
+        if(activity_form['data[limit]'].value==""){
+            alert("限制名额必填");
+            document.activity_form.submit.disabled=false;
+            return false;
+        }
+        if(activity_form['data[form_id]'].value == "0"){
+            alert("表单必选");
+            document.activity_form.submit.disabled=false;
+            return false;;
+        }
+        if(activity_form['data[calssify_id]'].value == "0"){            alert("分类必选");
+            document.activity_form.submit.disabled=false;
+            return false;;
+        }
+
+        var html = '';
+        var url = "{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.add') !!}";
+        var urls = "{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.index') !!}";
+
+        $.post
+        ({
+            url: url,
+            dataType: "json",
+            data: form_data,
+            success: function (strValue) {
+                console.log(strValue)
+                if (strValue.result == "0") {
+                    confirm(strValue.msg);
+                    document.activity_form.submit.disabled=false;
+                } else if (strValue.result == "1") {
+                    confirm(strValue.msg);
+                    window.location.href = urls;
+                } else if (strValue.status == "-1") {
+                    confirm(strValue.result.msg);
+                    document.activity_form.submit.disabled=false;
+                }
+            },
+            fail:function (err) {
+               console.log("错误")
+                console.log(err)
+            }
+        })
+    }
+
+    require(['util', 'clockpicker'], function(u, $){
+        $('.clockpicker :text').clockpicker({autoclose: true});
+
+        u.editor($('.richtext')[0]);
+
+        $('#add-time').click(function(){
+            $('#time-list').append($('#time-form-html').html());
+            $('.clockpicker :text').clockpicker({autoclose: true});
+        });
+    });
+
+</script>
+@endsection

+ 270 - 0
plugins/activity-apply/views/admin/activity_info.blade.php

@@ -0,0 +1,270 @@
+
+
+<div class='panel panel-default'>
+<div class='panel-body'>
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                    style='color:red'>*</span>活动名称</label>
+        <div class="col-sm-9 col-xs-12">
+            <input class="form-control" type="text" value="{{$item['title']}}"
+                   name="data[title]" id="title">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label" ><span
+                    style="color: red;">*</span>活动图片</label>
+        <div class="col-sm-9 col-xs-12 detail-logo">
+            {!! app\common\helpers\ImageHelper::tplFormFieldImage('data[thumb]', $item['thumb']) !!}
+            <span class="help-block">建议尺寸: 640*400 </span>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+        ><span
+                    style="color: red;">*</span>分类</label>
+        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+            <select class="form-control tpl-category-parent" id="level" name="data[calssify_id]">
+                <option value="0">分类</option>
+                @foreach($calssify as $form)
+                    <option value="{{$form->id}}"
+                            @if($item['id']==$form->id)
+                            selected
+                            @endif
+                    >[ID:{{$form->id}}]{{$form->calssify_title}}</option>
+                @endforeach
+            </select>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+        ><span
+                    style="color: red;">*</span>选择表单</label>
+        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+            <select class="form-control tpl-category-parent" id="level" name="data[form_id]">
+                <option value="0">选择表单</option>
+                @foreach($diyForm as $form)
+                    <option value="{{$form->id}}"
+                            @if($item['form_id']==$form->id)
+                            selected
+                            @endif
+                    >[ID:{{$form->id}}]{{$form->title}}</option>
+                @endforeach
+            </select>
+        </div>
+    </div>
+
+
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                    style="color: red;">*</span>报名日期</label>
+        <div class="col-sm-9 col-xs-12">
+            {!! app\common\helpers\DateRange::tplFormFieldDateRange('data[registration]', [
+                                      'starttime'=>array_get($requestSearch,'registration_time',0),
+                                      'endtime'=>array_get($requestSearch,'registration_end_time',0),
+                                      'start'=>0,
+                                      'end'=>0
+                                      ], true)!!}
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                    style="color: red;">*</span>活动日期</label>
+        <div class="col-sm-9 col-xs-12">
+
+            {!! app\common\helpers\DateRange::tplFormFieldDateRange('data[time_range]', [
+                                      'starttime'=>array_get($requestSearch,'start_time',0),
+                                      'endtime'=>array_get($requestSearch,'end_time',0),
+                                      'start'=>0,
+                                      'end'=>0
+                                      ], true)!!}
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动费用</label>
+        <div class="col-sm-6 col-xs-6">
+            <div class='input-group'>
+                <input type='text' name='data[cash]' class="form-control discounts_value"
+                       value="{{$item['cash']}}"/>
+                <div class='input-group-addon waytxt'>元</div>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                    style="color: red;">*</span>限制名额</label>
+        <div class="col-sm-6 col-xs-6">
+            <div class='input-group'>
+                <input type='text' name='data[limit]' class="form-control discounts_value"
+                       value="{{$item['limit']}}"/>
+                <div class='input-group-addon waytxt'>人</div>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label "
+        ><span style="color: red;"></span>关联讲师</label>
+        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
+            <select class="form-control tpl-category-parent" id="level" name="data[member_id]">
+                <option value="0">关联讲师</option>
+                @foreach( $lecturer as $form)
+                    <option value="{{$form['member_id']}}"
+                            @if($item['id']==$form['id'])
+                            selected
+                            @endif
+                    >[ID:{{$form['member_id']}}]{{$form['real_name']}}</option>
+                @endforeach
+            </select>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span>活动地址</label>
+        <div class="col-xs-6">
+            <input type="hidden" id="province_id" value="{{$item->province_id?$item->province_id:0}}"/>
+            <input type="hidden" id="city_id" value="{{$item->city_id?$item->city_id:0}}"/>
+            <input type="hidden" id="district_id" value="{{$item->district_id?$item->district_id:0}}"/>
+            <input type="hidden" id="street_id" value="{{$item->street_id?$item->street_id:0}}"/>
+            {!! app\common\helpers\AddressHelper::tplLinkedAddress(['data[province_id]','data[city_id]','data[district_id]','data[street_id]'], [])!!}
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">详细地址</label>
+        <div class="col-sm-9 col-xs-12">
+            <input class="form-control" type="text" value="{{$item['address']}}"
+                   name="data[address]">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 定位</label>
+        <div class="col-sm-8 col-xs-12" id="map" style="margin-top:0px;width: 70%;">
+            <script type="text/javascript">
+                function showCoordinate(elm) {
+                    require(["util"], function(util){
+                        var val = {};
+                        val.lng = parseFloat($(elm).parent().prev().prev().find(":text").val());
+                        val.lat = parseFloat($(elm).parent().prev().find(":text").val());
+                        util.map(val, function(r){
+                            $(elm).parent().prev().prev().find(":text").val(r.lng);
+                            $(elm).parent().prev().find(":text").val(r.lat);
+                        });
+
+                    });
+                }
+
+            </script>
+            <div class="row row-fix">
+                <div class="col-xs-4 col-sm-4">
+                    <input type="text" name="data[lng]" value="120.438828" placeholder="地理经度" class="form-control">
+                </div>
+                <div class="col-xs-4 col-sm-4">
+                    <input type="text" name="data[lat]" value="31.519399" placeholder="地理纬度" class="form-control">
+                </div>
+                <div class="col-xs-4 col-sm-4">
+                    <button onclick="showCoordinate(this);" class="btn btn-default" type="button">选择坐标</button>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label"
+        >活动介绍</label>
+        <div class="col-sm-8 col-xs-12 col-md-9">
+            {!! yz_tpl_ueditor('data[content]', $item['content']) !!}
+
+        </div>
+    </div>
+
+
+    <div class="panel-body">
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
+            <div class="col-sm-9 col-xs-12">
+                <label class="radio-inline"><input type="radio"  name="data[is_open]" value="1" @if($item['is_open'] ==1)
+                    checked="checked"
+                            @endif/> 开启</label>
+                <label class="radio-inline"><input type="radio"  name="data[is_open]" value="0" @if($item['is_open'] ==0)
+                    checked="checked"
+                            @endif/> 关闭</label>
+            </div>
+
+        </div>
+    </div>
+    <div class="panel-body">
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">热门类别</label>
+            <div class="col-sm-9 col-xs-12">
+                <label class="radio-inline"><input type="checkbox"  name="data[is_recommand]" value="1" @if($item['is_recommand'] ==1)
+                    checked="checked"
+                            @endif/> 推荐</label>
+                <label class="radio-inline"><input type="checkbox"  name="data[is_discount]" value="1" @if($item['is_discount'] ==1)
+                    checked="checked"
+                            @endif/> 精选</label>
+                <label class="radio-inline"><input type="checkbox"  name="data[is_hot]" value="1" @if($item['is_hot'] ==1)
+                    checked="checked"
+                            @endif/> 热门</label>
+            </div>
+        </div>
+    </div>
+
+
+    <div class="form-group"></div>
+</div>
+</div>
+
+
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+<script language='javascript'>
+    cascdeInit();
+    function search_members() {
+        if ($('#search-kwd-notice').val() == '') {
+            Tip.focus('#search-kwd-notice', '请输入关键词');
+            return;
+        }
+        $("#module-menus-notice").html("正在搜索....");
+        $.get("{!! yzWebUrl('member.member.get-search-member') !!}", {
+            keyword: $.trim($('#search-kwd-notice').val())
+        }, function (dat) {
+            $('#module-menus-notice').html(dat);
+        });
+    }
+    function select_member(o) {
+        $("#uid").val(o.uid);
+        $("#saleravatar").show();
+        $("#saleravatar").find('img').attr('src', o.avatar);
+        $("#saler").val(o.nickname + "/" + o.realname + "/" + o.mobile);
+        $("#modal-module-menus-notice .close").click();
+    }
+
+    function formcheck() {
+        if($('#saler').val() == ''){
+            Tip.focus($('#saler'),'请选择微信角色!');
+            return false;
+        }
+        // if($('#username').val() == ''){
+        //     Tip.focus($('#username'),'请输入账号!');
+        //     return false;
+        // }
+        // if($('#password').val() == ''){
+        //     Tip.focus($('#password'),'请输入密码!');
+        //     return false;
+        // }
+        // if($('#password_again').val() == ''){
+        //     Tip.focus($('#password_again'),'请输入密码!');
+        //     return false;
+        // }
+
+        return true;
+    }
+
+</script>

+ 93 - 0
plugins/activity-apply/views/admin/calssify.blade.php

@@ -0,0 +1,93 @@
+@extends('layouts.base')
+
+@section('content')
+    <div class="w1200 m0a">
+
+        <div class="panel panel-default">
+            <div class="panel-heading"> 分类列表 (总数: <span id="categorynum">{{ $total }}</span>)</div>
+            <div class="panel-body">
+                <table class="table" style="" id="cal_table">
+                    <thead>
+                    <tr>
+                        <th style="width:10%; text-align:center;">分类排序</th>
+                        <th style="width:10%;text-align:center;">分类名称</th>
+                        <th style="width:10%;text-align:center;">分类ID</th>
+                        <th style="width:10%;text-align:center;">是否启用</th>
+                        <th style="width:10%;text-align:center;">操作</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @if (empty($list))
+                        <tr class="noarticle">
+                            <td style="text-align: center; line-height: 100px;" colspan="8"><a class="nav-add" href="javascript:;">添加新分类</a></td>
+                        </tr>
+                    @else
+                        @foreach ($list as $item)
+                            <tr cid="{{ $item['id'] }}" cname="{{ $item['calssify_title'] }}">
+                                <td style="text-align:center;">{{ $item['sort'] }}</td>
+                                <td style="text-align:center;">{{ $item['calssify_title'] }}</td>
+                                <td style="text-align:center;">{{ $item['id'] }}</td>
+                                <td style="text-align:center;"> <a data='{{$item['is_open']}}' ca_id="{{$item['id']}}"
+                                            class='is_open_btn @if($item['is_open']==1) btn btn-info @else  btn btn-default  @endif'>
+                                        @if($item['is_open']==1)
+                                            启用
+                                        @else
+                                            禁用
+                                        @endif
+                                    </a></td>
+                                <td style="text-align:center;">
+                                    <a class='btn btn-default nav-edit' href="{{ yzWebUrl('plugin.activity-apply.admin.activity-apply-calssify.edit',['id' => $item['id']]) }}"><i class="fa fa-edit"></i></a>
+                                    <a class='btn btn-default nav-del' href="{{ yzWebUrl('plugin.activity-apply.admin.activity-apply-calssify.is_open',['id' => $item['id']]) }}" onclick="return confirm('确认删除此分类吗?');return false;"><i class="fa fa-trash-o"></i></a>
+                                </td>
+                            </tr>
+                        @endforeach
+                    @endif
+                    </tbody>
+                </table>
+                {!! $pager !!}
+            </div>
+            <div class='panel-footer'>
+                <a class="btn btn-info nav-add" href="{{ yzWebUrl('plugin.activity-apply.admin.activity-apply-calssify.add') }}"><i class="fa fa-plus"></i> 添加新分类</a>
+            </div>
+        </div>
+
+    </div>
+    <script language='javascript'>
+        $('#cal_table').on('click','.is_open_btn',function () {
+            var obj = $(this);
+            obj.html('请求中...');
+            obj.attr('disabled',true);
+            var is_open = obj.attr('data');
+            var show_text = '启用';
+            var show_class = 'is_open_btn btn btn-info';
+            if(is_open == 1){
+                var html = '';
+                is_open = 0;   show_text='禁用';  show_class='is_open_btn btn btn-default';
+            }else{
+                is_open = 1;
+            }
+            $.post("{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-calssify.change-is-open') !!}",
+                {id: obj.attr('ca_id'), is_open: is_open}
+                , function (res) {
+                if(res.result == 1){
+                    obj.html(show_text);
+                    obj.attr('class',show_class);
+                    obj.attr('data',is_open);
+                }else{
+                    alert('修改失败');
+                }
+                }
+                , "json"
+            );
+            obj.attr('disabled',false);
+        })
+
+
+
+
+    </script>
+
+
+
+@endsection
+

+ 112 - 0
plugins/activity-apply/views/admin/calssify_add.blade.php

@@ -0,0 +1,112 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('添加分类'))
+<div class="w1200 m0a">
+    <section class="content">
+        <div class="right-titpos">
+            <ul class="add-snav">
+                <li class="active"><a href="#">活动分类</a></li>
+            </ul>
+        </div>
+        <form action="" method="post" class="form-horizontal form">
+            <div class='panel panel-default'>
+                <div class='panel-body'>
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                    style='color:red'>*</span>分类排序</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <input class="form-control" type="text" value="{{$item['sort']}}"
+                                   name="data[sort]">
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                    style='color:red'>*</span>
+                            分类名称</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <input type="text" name="data[calssify_title]" class="form-control"
+                                   value="{{$item['calssify_title']}}"/>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label "><span
+                                    style="color: red;">*</span>分类图片</label>
+                        <div class="col-sm-9 col-xs-12 detail-logo">
+                            {!! app\common\helpers\ImageHelper::tplFormFieldImage('data[thumb]', $item['thumb']) !!}
+                            <span class="help-block">建议尺寸100*100,或正方形图片 </span>
+                        </div>
+                    </div>
+                    @if($item['is_link'] == 1)
+                        <div class="form-group">
+                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类活动</label>
+                            <div class="col-sm-9 col-xs-12">
+                                <a href="javascript:;"
+                                   data-url="{!! \app\common\helpers\Url::absoluteApp('/Sort',array('id'=>$item['id'])) !!}"
+                                   title="复制连接" class="btn btn-default btn-sm " id="btn" data="123">分类活动链接
+                                </a>
+                            </div>
+                        </div>
+                    @endif
+                    <div class="panel-body">
+                        <div class="form-group">
+                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
+                            <div class="col-sm-9 col-xs-12">
+                                <label class="radio-inline"><input type="radio"  name="data[is_open]" value="1" @if($item['is_open'] ==1)
+                                    checked="checked"
+                                            @endif/> 开启</label>
+                                <label class="radio-inline"><input type="radio"  name="data[is_open]" value="0" @if($item['is_open'] ==0)
+                                    checked="checked"
+                                            @endif/> 关闭</label>
+                            </div>
+
+                        </div>
+                    </div>
+                    <div class="form-group"></div>
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                        <div class="col-sm-9">
+                            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1"
+                                   onclick='return formcheck()'/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </section>
+</div>
+<script type="text/javascript">
+    $(document).ready(function(){
+        const btn = document.querySelector('#btn');
+        const financial = document.querySelector('#btn-financial');
+
+        btn.addEventListener('click',() => {
+            const input = document.createElement('input');
+        document.body.appendChild(input);
+        input.setAttribute('value', $("#btn").attr("data-url"));
+        input.select();
+        if (document.execCommand('copy')) {
+            document.execCommand('copy');
+            alert('复制成功');
+        }
+        document.body.removeChild(input);
+    });
+
+        financial.addEventListener('click',() => {
+            const input = document.createElement('input');
+        document.body.appendChild(input);
+        input.setAttribute('value', $("#btn-financial").attr("data-url"));
+        input.select();
+        if (document.execCommand('copy')) {
+            document.execCommand('copy');
+
+            alert('复制成功');
+        }
+        document.body.removeChild(input);
+    });
+
+    });
+</script>
+@endsection
+

+ 81 - 0
plugins/activity-apply/views/admin/cash.blade.php

@@ -0,0 +1,81 @@
+
+<div class="tab-pane" id="tab_cashier_rentun">
+    @if(array_key_exists('single-return', $exist_plugins))
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费赠送</label>
+            <div class="col-sm-6 col-xs-6">
+                <div class='input-group'>
+                    <input type="hidden" name="widgets[single_return][is_single_return]" value="1">
+                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[single_return][return_rate]' class="form-control discounts_value"
+                           value=""/>
+                    <div class='input-group-addon waytxt'>%</div>
+                </div>
+                <div style="padding-top:5px;"><span style="font-size: 10px;">消费赠送, 设置0则不开启消费赠送</span></div>
+            </div>
+        </div>
+    @endif
+        @if(app('plugins')->isEnabled('full-return'))
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费满额赠送</label>
+        <div class="col-sm-9 col-xs-12">
+            <label class='radio-inline'>
+                <input type='radio' name='widgets[activity-apply][profit][full_return][is_open]' value='1'
+                /> 开启
+            </label>
+            <label class='radio-inline'>
+                <input type='radio' name='widgets[activity-apply][profit][full_return][is_open]' value='0'
+                       checked
+                /> 关闭
+            </label>
+        </div>
+    </div>
+        @endif
+        @if(app('plugins')->isEnabled('consume-return'))
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费返现</label>
+        <div class="col-sm-9 col-xs-12">
+            <label class='radio-inline'>
+                <input type='radio' name='widgets[activity-apply][profit][consume-return][is_open]' value='1'
+
+                /> 开启
+            </label>
+            <label class='radio-inline'>
+                <input type='radio' name='widgets[activity-apply][profit][consume-return][is_open]' value='0'
+                      checked
+                /> 关闭
+            </label>
+        </div>
+    </div>
+            @endif
+</div>
+
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+
+<script language='javascript'>
+
+    cascdeInit();
+    function search_members() {
+        if ($('#search-kwd-notice').val() == '') {
+            Tip.focus('#search-kwd-notice', '请输入关键词');
+            return;
+        }
+        $("#module-menus-notice").html("正在搜索....");
+        $.get("{!! yzWebUrl('member.member.get-search-member') !!}", {
+            keyword: $.trim($('#search-kwd-notice').val())
+        }, function (dat) {
+            $('#module-menus-notice').html(dat);
+        });
+    }
+    function select_member(o) {
+        $("#uid").val(o.uid);
+        $("#saleravatar").show();
+        $("#saleravatar").find('img').attr('src', o.avatar);
+        $("#saler").val(o.nickname + "/" + o.realname + "/" + o.mobile);
+        $("#modal-module-menus-notice .close").click();
+    }
+
+
+    $('.diy-notice').select2();
+</script>
+
+

+ 19 - 0
plugins/activity-apply/views/admin/coupon.blade.php

@@ -0,0 +1,19 @@
+<div style='max-height:500px;overflow:auto;min-width:850px;'>
+    <table class="table table-hover" style="min-width:850px;">
+        <tbody>
+        @foreach($coupons as $row)
+            <tr>
+                <td>
+                    {{$row['name']}}
+                </td>
+                <td style="width:80px;"><a href="javascript:;" onclick='select_category({{json_encode($row)}})'>选择</a></td>
+            </tr>
+        @endforeach
+        @if(count($coupons)<=0)
+            <tr>
+                <td colspan='4' align='center'>未找到优惠券</td>
+            </tr>
+        @endif
+        </tbody>
+    </table>
+</div>

+ 165 - 0
plugins/activity-apply/views/admin/fenrun.blade.php

@@ -0,0 +1,165 @@
+
+@if(count($exist_plugins) != 0)
+    <div class="tab-pane" id="tab_cashier_porfit">
+        @if(array_key_exists('commission', $exist_plugins))
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启分销</label>
+                <div class="col-sm-9 col-xs-12">
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[commission][is_commission]' value='1'
+
+                        /> 是
+                    </label>
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[commission][is_commission]' value='0'
+                             checked
+                        /> 否
+                    </label>
+                </div>
+            </div>
+            <input type="hidden" name="widgets[commission][show_commission_button]" value="1">
+            <input type="hidden" name="widgets[commission][has_commission]" value="1">
+
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分销</label>
+                <div class="col-sm-9 col-xs-12">
+                    <div class='panel-body'>
+                        <div class="table-responsive ">
+                            <table class="table table-hover">
+                                <thead>
+                                <tr>
+                                    <th style="width: 10%">等级名称</th>
+                                    <th style="text-align: center;">一级分销</th>
+                                    <th style="text-align: center;">二级分销</th>
+
+                                </tr>
+                                </thead>
+                                <tbody>
+                                <tr>
+                                    <td>默认等级</td>
+                                    <td>
+                                        <div class="input-group">
+                                            <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_0][first_level_rate]"
+                                                   class="form-control"
+                                                   value=""/>
+                                            <div class="input-group-addon">%</div>
+                                        </div>
+                                    </td>
+                                    <td>
+                                        <div class="input-group">
+                                            <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_0][second_level_rate]"
+                                                   class="form-control"
+                                                   value=""/>
+                                            <div class="input-group-addon">%</div>
+                                        </div>
+                                    </td>
+
+                                </tr>
+
+
+                                @foreach($exist_plugins['commission']['commission_levels'] as $level)
+                                    <tr>
+                                        <td>{{$level->name}}</td>
+                                        <td>
+                                            <div class="input-group">
+                                                <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_{{$level->id}}][first_level_rate]"
+                                                       class="form-control"
+                                                       value=""/>
+                                                <div class="input-group-addon">%</div>
+                                            </div>
+                                        </td>
+                                        <td>
+                                            <div class="input-group">
+                                                <input onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" type="text" name="widgets[commission][rule][level_{{$level->id}}][second_level_rate]"
+                                                       class="form-control"
+                                                       value=""/>
+                                                <div class="input-group-addon">%</div>
+                                            </div>
+                                        </td>
+
+                                    </tr>
+                                @endforeach
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        @endif
+
+        @if(array_key_exists('dividend', $exist_plugins))
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启经销商</label>
+                <div class="col-sm-9 col-xs-12">
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[team_dividend][is_dividend]' value='1'/> 是
+                    </label>
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[team_dividend][is_dividend]' value='0' checked/> 否
+                    </label>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                <div class="col-sm-6 col-xs-6">
+                    <table class="table">
+                        <thead >
+                        <tr>
+                            <th class="col-sm-2 col-xs-2">经销商等级</th>
+                            <th class="col-sm-4 col-xs-4">提成比例</th>
+                        </tr>
+                        </thead>
+                        <tbody >
+                        @foreach($exist_plugins['dividend']['dividend_levels'] as  $level)
+                            <tr>
+                                <td>
+                                    {{$level['level_name']}}
+                                </td>
+                                <td>
+                                    <div class="input-group">
+                                        <input type="text" name="widgets[team_dividend][has_dividend_rates][level_{{$level['id']}}]"
+                                               class="form-control"
+                                               value=""/>
+                                        <div class="input-group-addon">%</div>
+                                    </div>
+                                </td>
+                            </tr>
+                        @endforeach
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        @endif
+
+    </div>
+@endif
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+
+<script language='javascript'>
+
+    cascdeInit();
+    function search_members() {
+        if ($('#search-kwd-notice').val() == '') {
+            Tip.focus('#search-kwd-notice', '请输入关键词');
+            return;
+        }
+        $("#module-menus-notice").html("正在搜索....");
+        $.get("{!! yzWebUrl('member.member.get-search-member') !!}", {
+            keyword: $.trim($('#search-kwd-notice').val())
+        }, function (dat) {
+            $('#module-menus-notice').html(dat);
+        });
+    }
+    function select_member(o) {
+        $("#uid").val(o.uid);
+        $("#saleravatar").show();
+        $("#saleravatar").find('img').attr('src', o.avatar);
+        $("#saler").val(o.nickname + "/" + o.realname + "/" + o.mobile);
+        $("#modal-module-menus-notice .close").click();
+    }
+
+
+    $('.diy-notice').select2();
+</script>
+
+

+ 68 - 0
plugins/activity-apply/views/admin/lantetn.blade.php

@@ -0,0 +1,68 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('幻灯片管理'))
+
+<div class="right-titpos">
+    <ul class="add-snav">
+        <li class="active"><a href="#">幻灯片管理</a></li>
+        <a class='btn btn-primary' href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-lantetn-slide.add')}}"
+           style="margin-bottom:5px;"><i class='fa fa-plus'></i> 添加幻灯片</a>
+    </ul>
+</div>
+
+
+<div class='panel panel-default'>
+
+    <div class='panel-body'>
+        <table class="table table-hover" style="overflow:visible;">
+            <thead>
+            <tr>
+                <th style='width:5%;'>ID</th>
+                <th style='width:10%;'>标题</th>
+                <th style='width:15%;'>网页链接</th>
+                <th style='width:15%;'>小程序链接</th>
+                <th style='width:10%;'>状态</th>
+                <th style='width:10%;'>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($list as $row)
+                <tr>
+                    <td>{{$row->id}}</td>
+                    <td>{{$row->title}}</td>
+                    <td>{{$row->link}}</td>
+                    <td>{{$row->app_link}}</td>
+                    @if($row->is_open == 1)
+                    <td>显示</td>
+                   @else
+                        <td>关闭</td>
+                    @endif
+                    <td>
+                        <a class="btn btn-default"
+                           href="{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-lantetn-slide.edit', ['id'=>$row->id]) !!}">编辑</a>
+                        <a class="btn btn-default"
+                           href="{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-lantetn-slide.deleted', ['id'=>$row->id]) !!}"
+                           onclick="return confirm('是否确认删除?');return false;">删除</a>
+                    </td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+        {!! $pager !!}
+    </div>
+</div>
+<div style="width:100%;height:150px;"></div>
+<script language='javascript'>
+    $(function () {
+        $('#export').click(function () {
+            $('#form1').attr('action', '{!! yzWebUrl('plugin.video-demand.admin.lecturer.export') !!}');
+            $('#form1').submit();
+        });
+        $('#search').click(function () {
+            $('#form1').attr('action', '{!! yzWebUrl('plugin.video-demand.admin.lecturer.index') !!}');
+            $('#form1').submit();
+        });
+    });
+</script>
+@endsection

+ 114 - 0
plugins/activity-apply/views/admin/lantetn_info.blade.php

@@ -0,0 +1,114 @@
+@extends('layouts.base')
+
+@section('content')
+@section('title', trans('幻灯片'))
+    <div class="w1200 m0a">
+        <!-- 新增加右侧顶部三级菜单 -->
+        <div class="right-titpos">
+            <ul class="add-snav">
+                <li class="active"><a href="#">幻灯片</a></li>
+            </ul>
+        </div>
+
+
+        @include('layouts.tabs')
+        <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
+            {{--@if(isset($item->id) && !empty($item->id))--}}
+            <input type="hidden" name="data[id]" class="form-control" value="{{$item['id']}}"/>
+            <div class="panel panel-default">
+                <div class="panel-body">
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <input type="text" name="data[display_order]" class="form-control" value="{{$item['display_order']}}"/>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span
+                                    style="color:red">*</span>幻灯片标题</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <input type="text" name="data[title]" class="form-control" value="{{$item['title']}}"/>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片图片</label>
+                        <div class="col-sm-9 col-xs-12">
+                            {!! app\common\helpers\ImageHelper::tplFormFieldImage('data[thumb]',$item['thumb'])!!}
+                            <span class="help-block">建议尺寸:640 * 350 , 请将所有幻灯片图片尺寸保持一致 </span>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">幻灯片连接</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <div class="input-group ">
+                                <input class="form-control" type="text" data-id="PAL-00010" placeholder="请填写指向的链接 (请以http://开头, 不填则不显示)" value="{{$item['link']}}" name="data[link]">
+                                <span class="input-group-btn">
+                                <button class="btn btn-default nav-link" type="button" data-id="PAL-00010" >选择链接</button>
+                            </span>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">小程序跳转</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <div class="input-group">
+                                <input type="text" name="data[app_link]" data-id="PAL-00014" class="form-control" placeholder="请填写指向的链接 " value="{{$item['app_link']}}" />
+                                <span class="input-group-btn">
+                                <button class="btn btn-default nav-app-link" type="button" data-id="PAL-00014" >选择链接</button>
+                                </span>
+                            </div>
+                        </div>
+                    </div>
+
+
+
+
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <label class="radio-inline">
+                                <input type="radio" name="data[is_open]" value="1" @if ($item['is_open']== 1) checked @endif /> 是
+                            </label>
+                            <label class="radio-inline">
+                                <input type="radio" name="data[is_open]" value="0" @if ($item['is_open'] == 0 ) checked @endif/> 否
+                            </label>
+                        </div>
+                    </div>
+
+
+                    <div class="form-group"></div>
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                        <div class="col-sm-9 col-xs-12">
+                            <input type="submit" name="submit" value="提交" class="btn btn-success"
+                                   onclick="return formcheck()"/>
+                            <input type="button" name="back" onclick='history.back()' value="返回列表"
+                                   class="btn btn-default back"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <script language='javascript'>
+        require(['bootstrap'], function ($) {
+            $('form').submit(function () {
+                if ($(':input[name=slide[slide_name]]').isEmpty()) {
+                    Tip.focus(':input[name=slide[slide_name]]', '请输入幻灯片标题!');
+                    return false;
+                }
+                return true;
+            });
+        });
+
+    </script>
+@include('public.admin.mylink')
+@include('Yunshop\ActivityApply::admin.small')
+@endsection('content')
+

+ 324 - 0
plugins/activity-apply/views/admin/marketing.blade.php

@@ -0,0 +1,324 @@
+
+<div class='panel panel-default'>
+<div class='panel-body'>
+
+    <div class="tab-pane" id="tab_cashier_sale">
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分最高抵扣</label>
+            <div class="col-sm-6 col-xs-6">
+                <div class='input-group'>
+                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][max_point_deduct]' class="form-control discounts_value"
+                           value=""/>
+                    <div class='input-group-addon waytxt'>%</div>
+                </div>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分最少抵扣</label>
+            <div class="col-sm-6 col-xs-6">
+                <div class='input-group'>
+                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][min_point_deduct]' class="form-control discounts_value"
+                           value=""/>
+                    <div class='input-group-addon waytxt'>%</div>
+                </div>
+            </div>
+        </div>
+
+        @if(array_key_exists('love', $exist_plugins))
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启{{$data['love_name']}}抵扣</label>
+                <div class="col-sm-9 col-xs-12">
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][deduction]' value='1'
+
+                        /> 是
+                    </label>
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][deduction]' value='0'
+                               checked
+                        /> 否
+                    </label>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">{{$data['love_name']}}最高抵扣</label>
+                <div class="col-sm-6 col-xs-6">
+                    <div class='input-group'>
+                        {{--  <input type="hidden" name="widgets[love][deduction]" value="1">  --}}
+                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][deduction_proportion]' class="form-control discounts_value"
+                               value=""/>
+                        <div class='input-group-addon waytxt'>%</div>
+                    </div>
+                    <div style="padding-top:5px;"><span style="font-size: 10px;">{{$love_name}}最高抵扣, 设置0则不开启爱心值抵扣</span></div>
+                </div>
+            </div>
+        @endif
+
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员奖励积分</label>
+            <div class="col-sm-6 col-xs-6">
+                <div class='input-group'>
+                    <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[sale][point]' class="form-control discounts_value"
+                           value=""/>
+                    <div class='input-group-addon waytxt'>%</div>
+                </div>
+            </div>
+        </div>
+
+        @if(array_key_exists('love', $exist_plugins))
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启{{$data['love_name']}}奖励</label>
+                <div class="col-sm-9 col-xs-12">
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][award]' value='1'
+
+                        /> 是
+                    </label>
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][award]' value='0'
+                                checked
+                        /> 否
+                    </label>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员奖励{{$data['love_name']}}</label>
+                <div class="col-sm-6 col-xs-6">
+                    <div class='input-group'>
+                        {{--  <input type="hidden" name="widgets[love][award]" value="1">  --}}
+                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][award_proportion]' class="form-control discounts_value"
+                               value=""/>
+                        <div class='input-group-addon waytxt'>%</div>
+                    </div>
+                    <div style="padding-top:5px;"><span style="font-size: 10px;">会员奖励{{$love_name}}, 设置0则不开启会员奖励{{$love_name}}</span></div>
+                </div>
+            </div>
+
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否开启上级{{$data['love_name']}}奖励</label>
+                <div class="col-sm-9 col-xs-12">
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][parent_award]' value='1'
+
+                        /> 是
+                    </label>
+                    <label class='radio-inline'>
+                        <input type='radio' name='widgets[love][parent_award]' value='0'
+                              checked
+                        /> 否
+                    </label>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">一级会员奖励{{$data['love_name']}}</label>
+                <div class="col-sm-6 col-xs-6">
+                    <div class='input-group'>
+                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][parent_award_proportion]' class="form-control discounts_value"
+                               value=""/>
+                        <div class='input-group-addon waytxt'>%</div>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">二级会员奖励{{$data['love_name']}}</label>
+                <div class="col-sm-6 col-xs-6">
+                    <div class='input-group'>
+                        <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[love][second_award_proportion]' class="form-control discounts_value"
+                               value=""/>
+                        <div class='input-group-addon waytxt'>%</div>
+                    </div>
+                </div>
+            </div>
+
+        @endif
+
+        <div class="form-group">
+            <label class="col-xs-12 col-sm-3 col-md-2 control-label">赠送优惠券</label>
+            <div class="col-sm-6 col-xs-6">
+                <div class='input-group'>
+                    <div id="category" >
+                        <table class="table">
+                            <tbody id="param-itemscategory">
+                            @if($widgets['cashier']['coupon_names'])
+                                @foreach($widgets['cashier']['coupon_names'] as $k=>$v)
+                                    <tr>
+                                        <td>
+                                            <a href="javascript:;" onclick="deleteParam(this)" style="margin-top:10px;"  title="删除"><i class='fa fa-times'></i></a>
+                                        </td>
+                                        <td  colspan="2">
+                                            <input id="categoryid" type="hidden" class="form-control" name="widgets[cashier][coupon_ids][]" data-id="{{$v['id']}}" data-name="coupon_ids"  value="{{$widgets['cashier']['coupon_ids'][$k]}}" style="width:200px;float:left"  />
+                                            <input id="categoryname" class="form-control" type="text" name="widgets[cashier][coupon_names][]" data-id="{{$v['name']}}" data-name="coupon_names" value="{{$widgets['cashier']['coupon_names'][$k]}}
+                                                    " style="width:200px;float:left" readonly="true">
+                                            <span class="input-group-btn">
+                                    <button class="btn btn-default nav-link" type="button" data-id="{{$v['id']}}" onclick="$('#modal-module-menus-categorys').modal();$(this).parent().parent().addClass('focuscategory')" >选择优惠券</button>
+                                </span>
+                                        </td>
+                                    </tr>
+                                @endforeach
+                            @endif
+                            </tbody>
+                            <tbody>
+                            <tr>
+                                <td colspan="3">
+                                    <a href="javascript:;" id='add-param_category' onclick="addParam('category')"
+                                       style="margin-top:10px;" class="btn btn-primary"  title="添加优惠券"><i class='fa fa-plus'></i> 添加优惠券</a>
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div id="modal-module-menus-categorys" class="modal fade" tabindex="-1"> {{--搜索优惠券的弹窗--}}
+            <div class="modal-dialog" style='width: 920px;'>
+                <div class="modal-content">
+                    <div class="modal-header">
+                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">
+                            ×
+                        </button>
+                        <h3>选择优惠券</h3>
+                    </div>
+                    <div class="modal-body">
+                        <div class="row">
+                            <div class="input-group">
+                                <input type="text" class="form-control" name="keyword" value=""
+                                       id="search-kwd-categorys" placeholder="请输入优惠券名称"/>
+                                <span class='input-group-btn'>
+                            <button type="button" class="btn btn-default" onclick="search_categorys();">搜索
+                            </button>
+                        </span>
+                            </div>
+                        </div>
+                        <div id="module-menus-categorys" style="padding-top:5px;"></div>
+                    </div>
+                    <div class="modal-footer"><a href="#" class="btn btn-default"
+                                                 data-dismiss="modal" aria-hidden="true">关闭</a>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+
+        <div class="tab-pane active" id="tab_discount">
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">折扣类型</label>
+                <div class="col-sm-6 col-xs-6">
+                    <label class="radio-inline">
+                        <input type="radio" name="widgets[discount][level_discount_type]" value="1" checked="">
+                        会员等级
+                    </label>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-xs-12 col-sm-3 col-md-2 control-label">折扣方式</label>
+                <div class="col-sm-6 col-xs-6">
+                    <div class="input-group">
+                        <label class="radio-inline">
+                            <input type="radio" name="widgets[discount][discount_method]" value="1"> 折扣
+                        </label>
+                        <label class="radio-inline">
+                            <input type="radio" name="widgets[discount][discount_method]" value="2" checked="">
+                            固定金额
+                        </label>
+                    </div>
+                </div>
+            </div>
+
+            <div id="ismember">
+                @foreach ($data['levels'] as $level)
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+                        <div class="col-sm-6 col-xs-6">
+                            <div class='input-group'>
+                                <div class='input-group-addon'>{{$level['level_name']}}</div>
+
+                                <input onkeyup="value=value.replace(/[^\d.]/g,'')" type='text' name='widgets[discount][discount_value][{{$level["id"] }}]'
+                                       class="form-control discounts_value"
+                                       value="@if (!empty($widgets['discount']['discount_value'])){{ $widgets['discount']['discount_value'][$level["id"]] }}@endif"/>
+                                <div class='input-group-addon waytxt'>折</div>
+                            </div>
+                        </div>
+                    </div>
+                @endforeach
+            </div>
+
+
+            <script language="javascript">
+                $('input[name="widgets[discount][level_discount_type]"]').click(function () {
+                    var discounttype = $('input:radio[name="widgets[discount][level_discount_type]"]:checked').val();
+                    if (discounttype == 1) {
+                        $('#ismember').show();
+                    } else {
+                        $('#ismember').hide();
+                    }
+                });
+                $('input[name="widgets[discount][discount_method]"]').click(function () {
+                    var discountway = $('input:radio[name="widgets[discount][discount_method]"]:checked').val();
+                    if (discountway == 1) {
+                        $('.waytxt').html('折');
+                    }
+                    else {
+                        $('.waytxt').html('元');
+                    }
+                });
+
+
+
+                $('.chkall').click(function () {
+                    var checked = $(this).get(0).checked;
+                    if (checked) {
+                        $(this).closest('div').find(':checkbox[class!="chkall"]').removeAttr('checked');
+                    }
+                });
+                $('.chksingle').click(function () {
+                    $(this).closest('div').find(':checkbox[class="chkall"]').removeAttr('checked');
+                })
+
+            </script>
+        </div>
+
+
+
+
+
+        <script language='javascript'>
+            function deleteParam(o) {
+                $(o).parent().parent().remove();
+            }
+        </script>
+    </div>
+
+</div>
+</div>
+
+<script type="text/javascript" src="{{static_url('js/area/cascade_street.js')}}"></script>
+
+<script language='javascript'>
+
+    cascdeInit();
+    function search_members() {
+        if ($('#search-kwd-notice').val() == '') {
+            Tip.focus('#search-kwd-notice', '请输入关键词');
+            return;
+        }
+        $("#module-menus-notice").html("正在搜索....");
+        $.get("{!! yzWebUrl('member.member.get-search-member') !!}", {
+            keyword: $.trim($('#search-kwd-notice').val())
+        }, function (dat) {
+            $('#module-menus-notice').html(dat);
+        });
+    }
+    function select_member(o) {
+        $("#uid").val(o.uid);
+        $("#saleravatar").show();
+        $("#saleravatar").find('img').attr('src', o.avatar);
+        $("#saler").val(o.nickname + "/" + o.realname + "/" + o.mobile);
+        $("#modal-module-menus-notice .close").click();
+    }
+
+
+    $('.diy-notice').select2();
+</script>
+

+ 9 - 0
plugins/activity-apply/views/admin/member_power.blade.php

@@ -0,0 +1,9 @@
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">可参加会员</label>
+        <div class="col-sm-9 col-xs-12">
+            @foreach($data['levels'] as $item)
+                <label class="radio-inline"><input type="checkbox"  name="data[member_power][{{ $item['id'] }}]" value="{{ $item['id'] }}"/> {{ $item['level_name'] }}</label>
+            @endforeach
+        </div>
+    </div>

+ 438 - 0
plugins/activity-apply/views/admin/order.blade.php

@@ -0,0 +1,438 @@
+@extends('layouts.base')
+@section('title','导出订单')
+
+@section('content')
+
+    <link href="{{static_url('yunshop/css/order.css')}}" media="all" rel="stylesheet" type="text/css"/>
+
+    <div class="w1200 m0a">
+        <script type="text/javascript" src="{{static_url('js/dist/jquery.gcjs.js')}}"></script>
+        <script type="text/javascript" src="{{static_url('js/dist/jquery.form.js')}}"></script>
+        <script type="text/javascript" src="{{static_url('js/dist/tooltipbox.js')}}"></script>
+
+        <div class="rightlist">
+            <div class="panel panel-info">
+                <div class="panel-body">
+                    <div class="card">
+                        <div class="card-header card-header-icon" data-background-color="rose">
+                            <i class="fa fa-bars" style="font-size: 24px;" aria-hidden="true"></i>
+                        </div>
+                        <div class="card-content">
+                            <h4 class="card-title">订单管理</h4>
+                            <form  action="" method="post" class="form-horizontal" id="form1">
+                                <div>
+                                    @section('search_bar')
+                                        @if($route == 'order.list.waitSend')
+                                            <div class="form-group  col-md-2 col-sm-6">
+                                                <select name="search[sort]" class="form-control">
+                                                    <option value="" @if(!$Search['sort'])  selected="selected"@endif>
+                                                        时间排序
+                                                    </option>
+                                                    <option value="1" @if($Search['sort'] == 1)  selected="selected"@endif>
+                                                        会员排序
+                                                    </option>
+                                                </select>
+                                            </div>
+                                        @endif
+                                        <div class="form-group  col-md-2 col-sm-6">
+                                            <select name="search[ambiguous][field]" id="ambiguous-field"
+                                                    class="form-control">
+                                                <option value="order"
+                                                        @if(array_get($Search,'ambiguous.field','') =='order')  selected="selected"@endif >
+                                                    订单号/支付号
+                                                </option>
+                                                <option value="member"
+                                                        @if( array_get($Search,'ambiguous.field','')=='member')  selected="selected"@endif>
+                                                    用户姓名/ID/昵称/手机号
+                                                </option>
+
+                                                <option value="address"
+                                                        @if( array_get($Search,'ambiguous.field','')=='address')  selected="selected"@endif>
+                                                    收货地址/姓名/手机号
+                                                </option>
+
+                                                <option value="goods_id"{{--order_goods--}}
+                                                @if( array_get($Search,'ambiguous.field','')=='goods_id')  selected="selected"@endif>
+                                                    商品名称/ID
+                                                </option>
+                                                {{--<option value="goods_id"--}}
+                                                {{--@if( array_get($requestSearch,'ambiguous.field','')=='goods_id')  selected="selected"@endif>--}}
+                                                {{--商品ID--}}
+                                                {{--</option>--}}
+                                                <option value="dispatch"
+                                                        @if( array_get($Search,'ambiguous.field','')=='dispatch')  selected="selected"@endif>
+                                                    快递单号
+                                                </option>
+
+                                                <option value="coupon"
+                                                        @if( array_get($Search,'ambiguous.field','')=='coupon')  selected="selected"@endif>
+                                                    优惠券名称
+                                                </option>
+                                            </select>
+                                        </div>
+                                        <div class='form-group col-sm-4 col-lg-3 col-xs-12'>
+
+                                            <input class="form-control" name="search[ambiguous][string]" type="text"
+                                                   value="{{array_get($Search,'ambiguous.string','')}}"
+                                                   placeholder="订单号/支付单号" id="string">
+
+
+                                            <div class="form-group notice" id="goods_name">
+                                                <div >
+                                                    <div class='input-group'>
+                                                        <input type="hidden" id="plugin_id" name="plugin_id" value="@if(!empty($list['plugin_id'])) {{$list['plugin_id']}} @else 0 @endif">
+                                                        <input type="text" name="search[ambiguous][name]" maxlength="30" value="{{array_get($Search,'ambiguous.name','')}}" id="saler" class="form-control" readonly />
+                                                        <div class='input-group-btn'>
+                                                            <button class="btn btn-default" type="button" onclick="popwin = $('#modal-module-menus-notice').modal();">选择商品</button>
+                                                            <button class="btn btn-danger" type="button" onclick="$('#noticeopenid').val('');$('#saler').val('');$('#saleravatar').hide()">清除选择</button>
+                                                        </div>
+                                                    </div>
+                                                    <div id="modal-module-menus-notice"  class="modal fade" tabindex="-1">
+                                                        <div class="modal-dialog" style='width: 920px;'>
+                                                            <div class="modal-content">
+                                                                <div class="modal-header"><button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button><h3>选择商品名称</h3></div>
+                                                                <div class="modal-body" >
+                                                                    <div class="row">
+                                                                        <div class="input-group">
+                                                                            <input type="text" class="form-control" name="keyword" value="" id="search-kwd-notice" placeholder="请输入商品名称" />
+                                                                            <span class='input-group-btn'><button type="button" class="btn btn-default" onclick="search_members();">搜索</button></span>
+                                                                        </div>
+                                                                    </div>
+                                                                    <div id="module-menus-notice" style="padding-top:5px;"></div>
+                                                                </div>
+                                                                <div class="modal-footer"><a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a></div>
+                                                            </div>
+
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            </div>
+
+                                        </div>
+
+                                        <div class="form-group form-group col-sm-8 col-lg-2 col-xs-12">
+                                            <!-- 注意,由于属于支付宝支付的支付方式有好几种,包括app支付宝支付方式,支付宝-YZ方式
+                                            等,所以进行了分组,支付选项传入的支付方式是支付方式组的id,并不是支付方式的id -->
+                                            <select name="search[pay_type]" class="form-control">
+                                                <option value=""
+                                                        @if( array_get($Search,'pay_type',''))  selected="selected"@endif>
+                                                    全部支付方式
+                                                </option>
+                                                <option value="1"
+                                                        @if( array_get($Search,'pay_type','') == '1')  selected="selected"@endif>
+                                                    微信支付
+                                                </option>
+                                                <option value="2"
+                                                        @if( array_get($Search,'pay_type','') == '2')  selected="selected"@endif>
+                                                    支付宝支付
+                                                </option>
+                                                <option value="3"
+                                                        @if( array_get($Search,'pay_type','') == '3')  selected="selected"@endif>
+                                                    余额支付
+                                                </option>
+                                                <option value="4"
+                                                        @if( array_get($Search,'pay_type','') == '4')  selected="selected"@endif>
+                                                    后台付款
+                                                </option>
+                                            </select>
+                                        </div>
+
+                                        <div class="form-group form-group col-sm-8 col-lg-2 col-xs-12">
+                                            <select name="search[first_order]" class="form-control">
+                                                <option value=""
+                                                        @if(!$Search['first_order'])  selected="selected"@endif>
+                                                    不搜索首单
+                                                </option>
+                                                <option value="1"
+                                                        @if($Search['first_order'] == '1')  selected="selected"@endif>
+                                                    搜索首单
+                                                </option>
+                                            </select>
+                                        </div>
+
+                                        <div class="form-group col-sm-12 col-lg-12 col-xs-12"></div>
+                                        <div class="form-group col-sm-8 col-lg-5 col-xs-12">
+
+                                            <select name="search[time_range][field]" class="form-control form-time" >
+                                                <option value=""
+                                                        @if( array_get($Search,'time_range.field',''))selected="selected"@endif >
+                                                    操作时间
+                                                </option>
+                                                <option value="create_time"
+                                                        @if( array_get($Search,'time_range.field','')=='create_time')  selected="selected"@endif >
+                                                    下单
+                                                </option>
+                                                <option value="pay_time"
+                                                        @if( array_get($Search,'time_range.field','')=='pay_time')  selected="selected"@endif>
+                                                    付款
+                                                </option>
+                                                <option value="send_time"
+                                                        @if( array_get($Search,'time_range.field','')=='send_time')  selected="selected"@endif>
+                                                    发货
+                                                </option>
+                                                <option value="finish_time"
+                                                        @if( array_get($Search,'time_range.field','')=='finish_time')  selected="selected"@endif>
+                                                    完成
+                                                </option>
+                                            </select>
+                                            {!!
+                                                app\common\helpers\DateRange::tplFormFieldDateRange('search[time_range]', [
+                                        'starttime'=>array_get($Search,'time_range.start',0),
+                                        'endtime'=>array_get($Search,'time_range.end',0),
+                                        'start'=>0,
+                                        'end'=>0
+                                        ], true)!!}
+
+                                        </div>
+                                    @show
+                                </div>
+
+                                <div class="form-group">
+
+                                    <div class="col-sm-7 col-lg-9 col-xs-12">
+                                        <button class="btn btn-success"><i class="fa fa-search"></i> 搜索</button>
+                                        @section('export')
+                                            <button type="submit" name="export" value="1" id="export" class="btn btn-info">导出
+                                                Excel
+                                            </button>
+                                        @show
+                                        {{--不知道当时写来作用有什么功能--}}
+                                        {{--<button type="button" name="exportThumb" value="1" id="exportThumb" class="btn btn-info">--}}
+                                            {{--导出图片--}}
+                                        {{--</button>--}}
+
+                                    </div>
+
+                                </div>
+                            </form>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+            <div class="panel panel-default">
+                <table class='table'
+                       style='float:left;margin-bottom:0;table-layout: fixed;line-height: 40px;height: 40px'>
+                    <tr class='trhead'>
+                        <td colspan='8' style="text-align: left;">
+                            订单数: <span id="total">{{$list['total']}}</span>
+                            订单金额: <span id="totalmoney" style="color:red">{{$total_price}}</span>元&nbsp;
+                            @section('supplier_apply')
+
+                            @show
+                        </td>
+                    </tr>
+                </table>
+
+                @section('is_plugin')
+                    @foreach ($list['data'] as $order_index => $order)
+                        <div class="order-info">
+                            <table class='table order-title'>
+                                <tr>
+                                    <td class="left" colspan='8'>
+                                        <b>订单编号:</b> {{$order['order_sn']}}
+                                        @if($order['status']>\app\common\models\Order::WAIT_PAY && isset($order['has_one_order_pay']))
+                                            <b>支付单号:</b> {{$order['has_one_order_pay']['pay_sn']}}
+                                        @endif
+                                        <b>下单时间: </b>{{$order['create_time']}}
+                                        @if( $order['has_one_refund_apply'] == \app\common\models\refund\RefundApply::WAIT_RECEIVE_RETURN_GOODS)
+                                            <label class='label label-primary'>客户已经寄出快递</label>@endif
+
+                                        <label class="label label-info">{{$order['shop_name']}}</label>
+
+                                        @if(!empty($order['has_one_refund_apply']))
+                                            <label class="label label-danger">{{$order['has_one_refund_apply']['refund_type_name']}}
+                                                :{{$order['has_one_refund_apply']['status_name']}}</label>
+                                        @endif
+                                        @if($order['has_many_first_order'])
+                                            <label class='label label-primary'>首单</label>
+                                    @endif
+
+
+                                    <td class="right">
+                                        @if(empty($order['status']))
+                                            <a class="btn btn-default btn-sm" href="javascript:;"
+                                               onclick="$('#modal-close').find(':input[name=order_id]').val('{{$order['id']}}')"
+                                               data-toggle="modal" data-target="#modal-close">关闭订单</a>
+                                        @elseif( $order['status'] > 0 && $order['canRefund'] )
+                                            <a class="btn btn-default btn-sm" href="javascript:;"
+                                               onclick="$('#modal-manual-refund').find(':input[name=order_id]').val('{{$order['id']}}')"
+                                               data-toggle="modal" data-target="#modal-manual-refund">退款并关闭订单</a>
+                                        @endif
+
+                                    </td>
+
+
+                                </tr>
+                            </table>
+                            <table class='table order-main'>
+                                @foreach( $order['has_many_order_goods'] as $order_goods_index => $order_goods)
+                                    <tr class='trbody'>
+                                        <td class="goods_info">
+                                            <img src="{{tomedia($order_goods['thumb'])}}">
+                                        </td>
+                                        <td class="top" valign='top' style="font-size: 16px;color: #AEB9C0">
+                                            <a href="{{yzWebUrl('goods.goods.edit', array('id' => $order_goods['goods_id']))}}">{{$order_goods['title']}}</a>
+                                            @if( !empty($order_goods['goods_option_title']))<br/>
+                                            <span style="font-size: 15px;color: #AEB9C0">{{$order_goods['goods_option_title']}}</span>
+
+                                            @endif
+                                            <br/><span style="font-size: 15px;color: #AEB9C0">{{$order_goods['goods_sn']}}</span>
+
+                                        </td>
+                                        <td class="price">
+                                            原价: {{ number_format($order_goods['goods_price']/$order_goods['total'],2)}}
+                                            <br/>应付: {{ number_format($order_goods['price']/$order_goods['total'],2) }}
+                                            <br/>数量: {{$order_goods['total']}}
+                                        </td>
+
+
+                                        @if( $order_goods_index == 0)
+                                            <td rowspan="{{count($order['has_many_order_goods'])}}">
+                                                <a href="{!! yzWebUrl('member.member.detail',array('id'=>$order['belongs_to_member']['uid'])) !!}"> {{$order['belongs_to_member']['nickname']}}</a>
+                                                <br/>
+                                                {{$order['belongs_to_member']['realname']}}
+                                                <br/>{{$order['belongs_to_member']['mobile']}}
+                                            </td>
+
+                                            <td rowspan="{{count($order['has_many_order_goods'])}}">
+                                                <label class='label label-info'>{{$order['pay_type_name']}}</label>
+                                                <br/>
+
+                                                {{$order['has_one_dispatch_type']['name']}}
+                                            </td>
+                                            <td rowspan="{{count($order['has_many_order_goods'])}}" style='width:18%;'>
+                                                <table class="goods-price">
+                                                    <tr>
+                                                        <td style=''>商品小计:</td>
+                                                        <td style=''>¥{!! number_format(
+                                                $order['goods_price'] ,2) !!}
+                                                        </td>
+                                                    </tr>
+
+                                                    <tr>
+                                                        <td style=''>运费:</td>
+                                                        <td style=''>¥{!! number_format(
+                                                $order['dispatch_price'],2) !!}
+                                                        </td>
+                                                    </tr>
+                                                    @if($order['change_price'] != 0)
+                                                        <tr>
+                                                            <td style=''>卖家改价:</td>
+                                                            <td style='color:green'>¥{!! number_format(
+                                                $order['change_price'] ,2) !!}
+                                                            </td>
+                                                        </tr>
+                                                    @endif
+                                                    @if($order['change_dispatch_price'] != 0)
+                                                        <tr>
+                                                            <td style=''>卖家改运费:</td>
+                                                            <td style='color:green'>¥{{ number_format(
+                                                $order['change_dispatch_price'] ,2) }}
+                                                            </td>
+                                                        </tr>
+                                                    @endif
+                                                    <tr>
+                                                        <td style=''>应收款:</td>
+                                                        <td style='color:green'>¥{!! number_format(
+                                                $order['price'] ,2) !!}
+                                                        </td>
+                                                    </tr>
+
+                                                </table>
+                                            </td>
+                                            <td rowspan="{{count($order['has_many_order_goods'])}}"><label
+                                                        class='label label-info'>{{$order['status_name']}}</label>
+                                                <br/>
+                                                <a href="{!! yzWebUrl($detail_url,['id'=>$order['id']])!!}">查看详情</a>
+                                            </td>
+                                            <td rowspan="{{count($order['has_many_order_goods'])}}" width="10%">
+
+                                                @include($include_ops)
+
+                                            </td>
+                                        @endif
+                                    </tr>
+                                @endforeach
+                            </table>
+                        </div>
+                    @endforeach
+                @show
+                @include('order.modals')
+                <div id="pager">{!! $pager !!}</div>
+            </div>
+        </div>
+    </div>
+    <script language='javascript'>
+        // $(function () {
+        //     $("#ambiguous-field").on('change', function () {
+        //
+        //         $(this).next('input').attr('placeholder', $(this).find(':selected').text().trim())
+        //     });
+        // })
+
+        {{--$(function () {--}}
+            {{--$('#exportThumb').click(function () {--}}
+                {{--$('#form1').attr('action', '{!! yzWebFullUrl('plugin.photo-order.admin.order.exportThumb') !!}');--}}
+                {{--$('#form1').submit();--}}
+            {{--});--}}
+        {{--});--}}
+
+        $(function () {
+
+            // $("#goods_name").hide();//页面加载,隐藏选择商品名称控件
+
+            $("#ambiguous-field").on('change', function () {
+                $(this).next('input').attr('placeholder', $(this).find(':selected').text().trim())
+
+
+                if ($(this).val()=='goods_id'){//选择商品名称搜索
+                    $("#string").hide();
+                    $("#goods_name").show();
+                }else {
+                    $('input[name="search[ambiguous][string]"]').val("");
+                    $("#goods_name").hide();
+                    $("#string").show();
+                }
+
+            });
+        })
+
+        if ($("#ambiguous-field").val()=='goods_id'){//选择商品名称搜索
+            $("#string").hide();
+            $("#goods_name").show();
+        }else {
+            $("#goods_name").hide();
+            $("#string").show();
+        }
+
+        function search_members() {
+            if ($('#search-kwd-notice').val() == '') {
+                Tip.focus('#search-kwd-notice', '请输入关键词');
+                return;
+            }
+            $("#module-menus-notice").html("正在搜索....");
+            $.get("{!! yzWebUrl('goods.goods.search-order') !!}", {
+                keyword: $.trim($('#search-kwd-notice').val()),
+                plugin_id : $.trim($('#plugin_id').val()),
+            }, function (dat) {
+                $('#module-menus-notice').html(dat);
+            });
+        }
+
+        function select_good (o) {
+            console.log(o.id)
+            $('input[name="search[ambiguous][string]"]').val(o.id);
+            $('input[name="search[ambiguous][name]"]').val(o.title);
+            $("#saleravatar").show();
+            $("#saleravatar").find('img').attr('src', o.thumb);
+            $("#saler").val(o.title);
+            $("#modal-module-menus-notice .close").click();
+        }
+
+
+    </script>
+@section('plugin_js')
+@show
+@endsection('content')

+ 277 - 0
plugins/activity-apply/views/admin/order/basicDetail.blade.php

@@ -0,0 +1,277 @@
+<style>
+    .form-group {
+        overflow: hidden;
+        margin-bottom: 0 !important;
+    }
+
+    .line {
+        margin: 10px;
+        border-bottom: 1px solid #ddd
+    }
+</style>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <img src='{{$order['belongs_to_member']['avatar']}}'
+             style='width:100px;height:100px;padding:1px;border:1px solid #ccc'/>
+ {{$order['belongs_to_member']['nickname']}}
+
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员信息 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <div class='form-control-static'>ID: {{$order['belongs_to_member']['uid']}}
+            姓名: {{$order['belongs_to_member']['realname']}} /
+            手机号: {{$order['belongs_to_member']['mobile']}}</div>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单编号 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <p class="form-control-static">{{$order['order_sn']}} </p>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单金额 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <div class="form-control-static">
+            <table cellspacing="0" cellpadding="0">
+                <tr>
+                    <td style='border:none;text-align:right;'>商品小计:</td>
+                    <td style='border:none;text-align:right;;'>
+                        ¥{{number_format( $order['goods_price'] ,2)}}</td>
+                </tr>
+                 <tr>
+                    <td style='border:none;text-align:right;'>优惠:</td>
+                    <td style='border:none;text-align:right;'>
+                        ¥{{number_format( $order['discount_price'] ,2)}}</td>
+                </tr>
+                 <tr>
+                    <td style='border:none;text-align:right;'>抵扣:</td>
+                    <td style='border:none;text-align:right;'>
+                        ¥{{number_format( $order['deduction_price'] ,2)}}</td>
+                </tr>
+                 <tr>
+                    <td style='border:none;text-align:right;'>押金:</td>
+                    <td style='border:none;text-align:right;color:red;'>
+                        ¥{{number_format($order['lease_toy']['deposit_total'],2)}}</td>
+                </tr>
+                <tr>
+                    <td style='border:none;text-align:right;'>应收款:</td>
+                    <td style='border:none;text-align:right;color:green;'>
+                        ¥{{number_format($order['price'],2)}}</td>
+                </tr>
+            </table>
+        </div>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单状态 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <p class="form-control-static">
+                                    <span class="label
+                                    @if ($order['status'] == 3) label-success
+                                    @elseif ($order['status'] == -1) label-default
+                                    @else label-info
+                                    @endif">{{$order['status_name']}}</span>
+        </p>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">支付方式 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <p class="form-control-static">
+
+            <span class="label label-info">{{$order['pay_type_name']}}</span>
+        </p>
+
+    </div>
+
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">上传发票</label>
+    <div class="col-sm-9 col-xs-12">
+        {!! app\common\helpers\ImageHelper::tplFormFieldImage('basic-detail[invoice]', $order['invoice']) !!}
+    </div>
+
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+    <div class="col-sm-9 col-xs-12">
+        <br/>
+        <button name='saveremark' onclick="sub('invoice')" class='btn btn-default'>保存发票</button>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">备注 :</label>
+    <div class="col-sm-9 col-xs-12"><textarea style="height:150px;" class="form-control"
+                                              id="remark" name="remark"
+                                              cols="70">{{$order['has_one_order_remark']['remark']}}</textarea>
+    </div>
+</div>
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
+    <div class="col-sm-9 col-xs-12">
+        <br/>
+        <button name='saveremark' onclick="sub('remark')" class='btn btn-default'>保存备注</button>
+    </div>
+</div>
+
+<div class="form-group">
+    <label class="col-xs-12 col-sm-3 col-md-2 control-label">下单日期 :</label>
+    <div class="col-sm-9 col-xs-12">
+        <p class="form-control-static">{{$order['create_time']}}</p>
+    </div>
+</div>
+@if ($order['status'] >= 1)
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">付款时间 :</label>
+        <div class="col-sm-9 col-xs-12">
+            <p class="form-control-static">{{$order['pay_time']}}</p>
+        </div>
+    </div>
+@endif
+@if ($order['status'] == 3)
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">完成时间 :</label>
+        <div class="col-sm-9 col-xs-12">
+            <p class="form-control-static">{{$order['finish_time']}}</p>
+        </div>
+    </div>
+@endif
+@if (!empty($order['address']))
+    @include('dispatch.detail')
+@endif
+
+@if (!$order['has_one_lease_toy_order']['return_status'] > 0)
+@if (!empty($order['has_one_refund_apply']))
+    @include('refund.index')
+@endif
+@if(!empty($order['collect_name']))
+    @include('invoice.display')
+@endif
+@endif
+@if (count($order['deductions']))
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            抵扣信息
+        </div>
+        <div class="panel-body table-responsive">
+            <table class="table table-hover">
+                <thead class="navbar-inner">
+                <tr>
+                    <th class="col-md-5 col-lg-3">名称</th>
+                    <th class="col-md-5 col-lg-1">抵扣值</th>
+                    <th class="col-md-5 col-lg-3">抵扣金额</th>
+                </tr>
+                </thead>
+                @foreach ($order['deductions'] as $deduction)
+                    <tr>
+                        <td>{{$deduction['name']}}</td>
+                        <td>{{$deduction['coin']}}</td>
+                        <td>¥{{$deduction['amount']}}</td>
+                    </tr>
+
+                @endforeach
+            </table>
+        </div>
+    </div>
+@endif
+@if (count($order['coupons']))
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            优惠券信息
+        </div>
+        <div class="panel-body table-responsive">
+            <table class="table table-hover">
+                <thead class="navbar-inner">
+                <tr>
+                    <th class="col-md-5 col-lg-3">名称</th>
+                    <th class="col-md-5 col-lg-3">优惠金额</th>
+                </tr>
+                </thead>
+                @foreach ($order['coupons'] as $coupon)
+                    <tr>
+                        <td>{{$coupon['name']}}</td>
+                        <td>¥{{$coupon['amount']}}</td>
+                    </tr>
+
+                @endforeach
+            </table>
+        </div>
+    </div>
+@endif
+
+<div class="panel panel-default">
+    <div class="panel-heading">
+        商品信息
+    </div>
+    <div class="panel-body table-responsive">
+        <table class="table table-hover">
+            <thead class="navbar-inner">
+            <tr>
+                <th class="col-md-5 col-lg-1">ID</th>
+                <th class="col-md-5 col-lg-3">商品标题</th>
+                <th class="col-md-5 col-lg-3">商品规格</th>
+                <th class="col-md-5 col-lg-3">均摊支付金额</th>
+                <th class="col-md-5 col-lg-3">现价/原价/成本价</th>
+                <th class="col-md-5 col-lg-1">购买数量</th>
+                {{--<th class="col-md-5 col-lg-1" style="color:red;">折扣前<br/>折扣后</th>--}}
+                <th class="col-md-5 col-lg-1">操作</th>
+            </tr>
+            </thead>
+            @foreach ($order['has_many_order_goods'] as $order_goods)
+
+                <tr>
+                    <td>{{$order_goods['goods_id']}}</td>
+                    <td>
+                        <a href="{{yzWebUrl($edit_goods, array('id' => $order_goods['goods_id']))}}">{{$order_goods['title']}}</a>
+                    </td>
+                    <td>{{$order_goods['goods_option_title']}}</td>
+                    <td>{{$order_goods['payment_amount']}}</td>
+                    <td>{{$order_goods['goods_price']}}
+                        /{{$order_goods['goods_market_price']}}
+                        /{{$order_goods['goods_cost_price']}}元
+                    </td>
+                    <td>{{$order_goods['total']}}</td>
+                    {{--<td style='color:red;font-weight:bold;'>{{sprintf('%.2f', $order_goods['goods_price']/$order_goods['total'])}}--}}
+                    {{--<br/>{{sprintf('%.2f', $order_goods['payment_amount']/$order_goods['total'])}}--}}
+                    {{--</td>--}}
+                    <td>
+                        <a href="{!! yzWebUrl($edit_goods, array('id' => $order_goods['goods']['id'])) !!}"
+                           class="btn btn-default btn-sm" title="编辑"><i
+                                    class="fa fa-edit"></i></a>&nbsp;&nbsp;
+                    </td>
+                </tr>
+                <tr style="text-align: right;padding: 6px 0;border-top:none;">
+                    <td colspan="8">
+                        @if ($order_goods['goods']['status'] == 1)
+                            <label data="1"
+                                   class="label label-default  label-info">上架</label>
+                        @else
+                            <label data="1"
+                                   class="label label-default label-info ">下架</label>
+                        @endif
+                        <label data="1"
+                               class="label label-default label-info">
+                            @if ($order_goods['goods']['type'] == 1)
+                                实体商品
+                            @else
+                                虚拟商品
+                            @endif
+                        </label>
+                    </td>
+                </tr>
+            @endforeach
+            <tr>
+                <td colspan="2">
+                    @include('order.modals')
+                    @include($ops)
+                </td>
+                <td colspan="8">
+                </td>
+            </tr>
+        </table>
+    </div>
+</div>

+ 123 - 0
plugins/activity-apply/views/admin/order/detail.blade.php

@@ -0,0 +1,123 @@
+@extends('layouts.base')
+@section('title','订单详情')
+@section('js')
+    <link href="{{static_url('yunshop/css/order.css')}}" media="all" rel="stylesheet" type="text/css"/>
+
+    <script language="javascript">
+        $(function(){
+            $("#myTab li.active>a").css("background","#f15353");
+        })
+        window.optionchanged = false;
+        require(['bootstrap'], function () {
+            $('#myTab a').click(function (e) {
+                e.preventDefault();
+                $(this).tab('show');
+                $(this).css("background","#f15353").parent().siblings().children().css("background","none")
+            })
+        });
+        function sub(type) {
+            var order_id = $('.order_id').val();
+            var remark = $('#remark').val();
+            var invoice = $("[name='basic-detail[invoice]']").val();//获取发票
+            var remarks_url = "{!! yzWebUrl('order.operation.remarks') !!}";
+            var invoice_url = "{!! yzWebUrl('order.operation.invoice') !!}";
+            $.post(type == 'remark' ? remarks_url : invoice_url, {
+                order_id: order_id,
+                remark: remark,
+                invoice: invoice,
+            }, function (json) {
+                var json = $.parseJSON(json);
+                if (json.result == 1) {
+                    location.href = location.href;
+                }
+            });
+        };
+        function showDiyInfo(obj) {
+            var hide = $(obj).attr('hide');
+            if (hide == '1') {
+                $(obj).next().slideDown();
+            }
+            else {
+                $(obj).next().slideUp();
+            }
+            $(obj).attr('hide', hide == '1' ? '0' : '1');
+        }
+
+        //cascdeInit("{!! isset($user['province'])?$user['province']:'' !!}", "{!! isset($user['city'])?$user['city']:'' !!}", "{!! isset($user['area'])?$user['area']:'' !!}");
+
+        $('#editaddress').click(function () {
+            show_address(1);
+        });
+
+        $('#backaddress').click(function () {
+            show_address(0);
+        });
+
+        $('#editexpress').click(function () {
+            show_express(1);
+        });
+
+        $('#backexpress').click(function () {
+            show_express(0);
+        });
+
+
+        function show_address(flag) {
+            if (flag == 1) {
+                $('.ad1').hide();
+                $('.ad2').show();
+            } else {
+                $('.ad1').show();
+                $('.ad2').hide();
+            }
+        }
+        function show_express(flag) {
+            if (flag == 1) {
+                $('.ex1').hide();
+                $('.ex2').show();
+            } else {
+                $('.ex1').show();
+                $('.ex2').hide();
+            }
+        }
+
+    </script>
+@stop
+
+@section('content')
+    <div class="w1200 m0a">
+
+        <div class="rightlist">
+            <!-- 新增加右侧顶部三级菜单 -->
+            <div class="right-titpos">
+                <ul class="add-snav">
+                    <li class="active"><a href="#">订单管理 &nbsp; <i class="fa fa-angle-double-right"></i> &nbsp; 订单详情</a>
+                    </li>
+
+                </ul>
+            </div>
+            <!-- 新增加右侧顶部三级菜单结束 -->
+            <div class="main">
+
+                <input type="hidden" class="order_id" value="{{$order['id']}}"/>
+                <input type="hidden" name="token" value="{{$var['token']}}"/>
+                <input type="hidden" name="dispatchid" value="{{$dispatch['id']}}"/>
+                <div class="panel panel-default">
+                    <div class="top">
+                        <ul class="add-shopnav" id="myTab">
+                            <li class="active"><a href="#tab_basic">基本信息</a></li>
+                        </ul>
+                    </div>
+                    <div class="info">
+                        <div class="panel-body">
+                            <div class="tab-content">
+                                <div class="tab-pane  active" id="tab_basic">@include('Yunshop\ActivityApply::admin.order.basicDetail')</div>
+                            </div>
+                        </div>
+
+                    </div>
+                </div>
+            </div>
+
+@endsection('content')
+

+ 209 - 0
plugins/activity-apply/views/admin/order_enrol.blade.php

@@ -0,0 +1,209 @@
+@extends('layouts.base')
+
+@section('content')
+    <link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
+    <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/goods.css')}}"/>
+    <div class="right-titpos">
+        <ul class="add-snav">
+            <a style="margin-bottom:5px;"> 活动报名数据</a>
+        </ul>
+    </div>
+    <div class='panel panel-default'>
+        <form action="" method="post" class="form-horizontal" id="form1">
+            <div class="panel panel-info">
+                <div class="panel-body">
+                    <div class="form-group col-xs-12 col-sm-3">
+                        <input class="form-control" name="search[member_id]" type="text"
+                               value="{{$search['member_id']}}" placeholder="会员ID">
+                    </div>
+                    <div class="form-group col-xs-12 col-sm-3">
+                        <input class="form-control" name="search[mobile]" type="text"
+                               value="{{$search['mobile']}}" placeholder="手机号码">
+                    </div>
+                    <div class="form-group col-xs-12 col-sm-2">
+                        <div class="col-sm-12">
+                            <label class='radio-inline'>
+                                <input type='radio' value='1' name='search[is_sign][sign]'
+                                       @if($search['sign'] == '1') checked @endif>签到
+                            </label>
+                            <label class='radio-inline'>
+                                <input type='radio' value='0' name='search[is_sign][sign]'
+                                       @if($search['sign'] == '0') checked @endif>未签到
+                            </label>
+                        </div>
+                    </div>
+
+                    <div class="form-group col-xs-12 col-sm-3">
+                        <input type="hidden" name="id" value="{{$activity_id}}">
+                        <input type="submit" class="btn btn-success" id="search" value="搜索">
+                        <input type="button" class="btn btn-success " id="export" value="导出">
+                    </div>
+
+                </div>
+            </div>
+        </form>
+    </div>
+    <div class='panel panel-default'>
+        <div class="panel-heading">统计:报名人数:{{$total}}人,已签到人数{{$count}}人,未签到人数{{$total-$count}}人</div>
+
+        <div class='panel-body' >
+            <table id="table">
+
+            </table>
+            <table id="basis-data" class="table table-hover" style="overflow:visible;">
+                <thead>
+                <tr>
+                    <th style='width:5%;'>会员ID</th>
+                    <th style='width:15%;'>讲师</th>
+                    <th style='width:15%;'>会员</th>
+                    <th style='width:15%;'>姓名</br>手机号码</th>
+                    <th style='width:15%;'>报名信息</th>
+                    <th style='width:20%;'>报名日期</th>
+                    <th>状态</th>
+                </tr>
+                </thead>
+                <tbody>
+
+                @foreach($list['data'] as $row)
+                    <tr>
+                        <td>{{$row['member_id']}}</td>
+                        <td>{{$row['has_one_lecturer']['real_name']}}</td>
+                        <td>
+                            <a target="_blank"
+                               href="{{yzWebUrl('member.member.detail',['id'=>$row['has_one_member']['uid']])}}">
+                                <img src="{{tomedia($row['has_one_member']['avatar_image'])}}"
+                                     style="width: 30px; height: 30px;border:1px solid #ccc;padding:1px;"> </br>
+                                {{$row['has_one_member']['nickname']}}
+                            </a>
+                        </td>
+
+                        <td>
+                            <a target="_blank"
+                               href="{{yzWebUrl('member.member.detail',['id'=>$row['has_one_member']['uid']])}}">
+                                {{$row['has_one_member']['realname']}}
+                                </br>
+                                {{$row['has_one_member']['mobile']}}
+                            </a>
+                        </td>
+                        <td>
+                            <a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.enrol-details',['id'=>$row['has_one_activity']['form_id'],'member_id'=>$row['member_id'],'act_id'=>$row['activity_id']])}}">
+                                详情
+                            </a>
+                        </td>
+                        </td>
+
+                        <td> {{$row['created_at']}} </td>
+                        @if($row['sign'] == 1)
+                            <td>已签到 </td>
+                        @else
+                            <td>未签到</td>
+                        @endif
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+            {!! $pager !!}
+        </div>
+    </div>
+    <div style="width:100%;height:150px;"></div>
+    <script language='javascript'>
+        //鼠标划过显示商品链接二维码
+        $('.umphp').hover(function () {
+                var url = $(this).attr('data-url');
+                $(this).addClass("selected");
+            },
+            function () {
+                $(this).removeClass("selected");
+            });
+
+
+        $(function () {
+            $('#export').click(function () {
+                $('#form1').attr('action', '{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.enrolExport') !!}');
+                $('#form1').submit();
+            });
+            $('#search').click(function () {
+                $('#form1').attr('action', '{!! yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.enrol') !!}');
+                $('#form1').submit();
+            });
+        });
+    </script>
+    <script type="text/javascript">
+        var $table = $('#table');
+        var data = JSON.parse('{!! $searchMember !!}');
+
+        $(function() {
+            if (data == null) {
+                $('#search-data').hide();
+            } else {
+                $("#basis-data").hide();
+            }
+            //控制台输出一下数据
+            console.log(data);
+            $table.bootstrapTable({
+                data:data,
+                idField: 'member_id',
+                dataType:'jsonp',
+                columns: [
+                    { field: 'member_id',  title: '会员ID' },
+                    { field: 'has_one_parent.nickname',  title: '推荐人' , formatter:'parentFormatter'},
+                    { field: 'has_one_member.nickname',  title: '会员' ,formatter: 'memberFormatter'},
+                    { field: 'has_one_member.realname',  title: '姓名手机号' ,formatter: 'phoneFormatter'},
+                    { field: 'member_data',  title: '报名信息' , events : operateEvents, formatter: 'operateFormatter'},
+                    { field: 'created_at',  title: '报名日期' },
+                    { field: 'status_name',  title: '状态' },
+                    { field: 'has_one_team_dividend.has_one_level.level_name',  title: '经销商等级' },
+                ],
+                //在哪一列展开树形
+                treeShowField: 'member_id',
+                //指定父id列
+                parentIdField: 'parent_id',
+                onResetView: function(data) {
+                    $table.treegrid({
+                        initialState: 'collapsed',// 所有节点都折叠
+                        treeColumn: 0,
+                        onChange: function() {
+                            $table.bootstrapTable('resetWidth');
+                        }
+                    });
+                },
+            });
+        });
+
+        // 格式化按钮
+        function operateFormatter(value, row, index) {
+            return [
+                '<a class="Enrol" href="javascript:">详情</a>',
+            ].join('');
+        }
+
+        function memberFormatter(value, row, index) {
+            return [
+                '<img src="'+row.has_one_member.avatar_image+'" style="width: 30px; height: 30px;border:1px solid #ccc;padding:1px;"></br>'+row.has_one_member.nickname+' ',
+            ].join('');
+        }
+
+        function phoneFormatter(value, row, index) {
+            return [
+                row.has_one_member.realname+'</br>'+row.has_one_member.mobile,
+            ].join('');
+        }
+
+        function parentFormatter(value, row, index) {
+            if (row.parent_id == 0) {
+                return ['总店/最高级'];
+            }
+            return [row.has_one_parent.nickname].join('');
+
+
+        }
+
+        //初始化操作按钮的方法
+        window.operateEvents = {
+            'click .Enrol': function (e, value, row, index) {
+                console.log(row);
+                window.location.href="{!! yzWebUrl('plugin.diyform.admin.diyform-data.get-form-data') !!}"+"&id="+row.form_id+"&form_data_id="+row.form_data_id;
+            },
+        };
+    </script>
+@endsection

+ 59 - 0
plugins/activity-apply/views/admin/order_enrol_details.blade.php

@@ -0,0 +1,59 @@
+@extends('layouts.base')
+
+@section('content')
+    <link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
+    <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/goods.css')}}"/>
+    <div class="right-titpos">
+        <ul class="add-snav">
+            <a style="margin-bottom:5px;"> 活动报名数据表单详情</a>
+        </ul>
+    </div>
+    <div class="w1200 m0a">
+        <div  class="main">
+            <form method="post" action="" class="form-horizontal form">
+                <div class="rightlist">
+                    <div class="right-titpos">
+                        <ul class="add-snav">
+                            <li class="active"><a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.enrol',['act_id'=> $act_id])}}" style="color: blue">&#60;&#60;返回列表</a>
+                            </li>
+                        </ul>
+                    </div>
+                    <div class="panel panel-default">
+                        @foreach($fields as $fname => $field)
+                            @foreach($item['form_data'] as $key => $val)
+                                @if($key == $fname)
+                                    <div class="form-group">
+                                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">
+                                            {{$field['tp_name']}}
+                                        </label>
+                                        <div class="col-sm-9 col-xs-12">
+                                                <span class="help-block">
+                                                   @if(is_array($val))
+                                                        @foreach($val as $v)
+                                                            @if(intval($field['data_type']) <> 3)
+                                                                <img style="width:50px;height:50px;border:1px solid #ccc;padding:1px"
+                                                                     src="{!! yz_tomedia($v) !!}"/>
+                                                            @else
+                                                                {{$v}}
+                                                            @endif
+                                                        @endforeach
+                                                    @else
+                                                        {{$val}}
+                                                    @endif
+                                                </span>
+                                        </div>
+                                    </div>
+                                @endif
+                            @endforeach
+                        @endforeach
+                    </div>
+
+                    <div class="panel panel-footer">
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div style="width:100%;height:150px;"></div>
+
+@endsection

+ 168 - 0
plugins/activity-apply/views/admin/set.blade.php

@@ -0,0 +1,168 @@
+@extends('layouts.base')
+@section('content')
+@section('title', trans('基础设置'))
+<script type="text/javascript">
+    window.optionchanged = false;
+    require(['bootstrap'], function () {
+        $('#myTab .tab').click(function (e) {
+            e.preventDefault();
+            $(this).tab('show');
+        })
+    });
+</script>
+<link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/goods.css')}}"/>
+
+<div class='panel panel-default'>
+    <div class="right-titpos">
+        <ul class="add-snav">
+            <li class="active"><a href="#">基础设置</a></li>
+        </ul>
+    </div>
+
+    <form id="setform" action="" method="post" class="form-horizontal form">
+        <div class="info">
+            <div class="panel panel-default">
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动聚合页</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <a href="javascript:;"
+                           data-url="{!! \app\common\helpers\Url::absoluteApp('/activityHome') !!}"
+                           title="复制连接" class="btn btn-default btn-sm " id="btn" data="123">活动聚合页
+                        </a>
+                    </div>
+                </div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示近期热门</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <label class="radio-inline">
+                            <input type="radio" name="setdata[is_hot]" value="1" @if ($set['is_hot']== 1) checked @endif /> 是
+                        </label>
+                        <label class="radio-inline">
+                                <input type="radio" name="setdata[is_hot]" value="0" @if ($set['is_hot'] == 0 ) checked @endif/> 否
+                        </label>
+                    </div>
+                </div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示人气精选</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <label class="radio-inline">
+                            <input type="radio" name="setdata[is_discount]" value="1" @if ($set['is_discount']== 1) checked @endif /> 是
+                        </label>
+                        <label class="radio-inline">
+                            <input type="radio" name="setdata[is_discount]" value="0" @if ($set['is_discount'] == 0 ) checked @endif/> 否
+                        </label>
+                    </div>
+                </div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否显示为您推荐</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <label class="radio-inline">
+                            <input type="radio" name="setdata[is_recommand]" value="1" @if ($set['is_recommand']== 1) checked @endif /> 是
+                        </label>
+                        <label class="radio-inline">
+                            <input type="radio" name="setdata[is_recommand]" value="0" @if ($set['is_recommand'] == 0 ) checked @endif/> 否
+                        </label>
+                    </div>
+                </div>
+                <div class="panel-heading">活动列表分享</div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <input type="text" name="setdata[share_title]" id="setdata[share_title]" class="form-control"
+                               value="{{ $set['share_title'] }}"/>
+                    </div>
+                </div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享图标</label>
+                    <div class="col-sm-9 col-xs-12">
+                        {!! app\common\helpers\ImageHelper::tplFormFieldImage('setdata[share_thumb]', $set['share_thumb']) !!}
+                    </div>
+                </div>
+                <div class="form-group">
+                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享描述</label>
+                    <div class="col-sm-9 col-xs-12">
+                        <textarea name="setdata[share_desc]"  rows="7" class="form-control">{{ $set['share_desc'] }}</textarea>
+                    </div>
+                </div>
+                    <div class="panel-heading">通知模版</div>
+                <div class='panel-body'>
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动报名消息通知</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <select name='setdata[enrol]' class='form-control diy-notice'><option value="" @if                                      (!$set['enrol']) selected @endif >
+                                    请选择消息模板
+                                </option>
+                                @foreach ($temp_list as $item)
+                                    <option value="{{$item['id']}}"
+                                            @if($set['enrol'] == $item['id'])
+                                            selected
+                                            @endif>{{$item['title']}}</option>
+                                @endforeach
+                            </select>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">活动签到消息通知</label>
+                        <div class="col-sm-9 col-xs-12">
+                            <select name='setdata[sign]' class='form-control diy-notice'>
+                                <option value="" @if(!$set['sign']) selected @endif >
+                                    请选择消息模板
+                                </option>
+                                @foreach ($temp_list as $item)
+                                    <option value="{{$item['id']}}"
+                                            @if($set['sign'] == $item['id'])
+                                            selected
+                                            @endif>{{$item['title']}}</option>
+                                @endforeach
+                            </select>
+                        </div>
+                    </div>
+
+
+
+                    <div class="form-group col-sm-12 mrleft40  border-t">
+                        <input type="submit" name="submit" value="提交" class="btn btn-success"/>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </form>
+</div>
+
+<script type="text/javascript">
+    $(document).ready(function(){
+        const btn = document.querySelector('#btn');
+        const financial = document.querySelector('#btn-financial');
+
+        btn.addEventListener('click',() => {
+            const input = document.createElement('input');
+        document.body.appendChild(input);
+        input.setAttribute('value', $("#btn").attr("data-url"));
+        input.select();
+        if (document.execCommand('copy')) {
+            document.execCommand('copy');
+            alert('复制成功');
+        }
+        document.body.removeChild(input);
+    });
+
+        /*financial.addEventListener('click',() => {
+            const input = document.createElement('input');
+        document.body.appendChild(input);
+        input.setAttribute('value', $("#btn-financial").attr("data-url"));
+        input.select();
+        if (document.execCommand('copy')) {
+            document.execCommand('copy');
+
+            alert('复制成功');
+        }
+        document.body.removeChild(input);
+    });*/
+
+    });
+</script>
+
+
+@endsection
+

+ 25 - 0
plugins/activity-apply/views/admin/share.blade.php

@@ -0,0 +1,25 @@
+<div class="tab-pane" id="tab_share">
+
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享标题</label>
+        <div class="col-sm-9 col-xs-12">
+            <input type="text" name="widgets[share][share_title]" id="share[share_title]" class="form-control"
+                   value="{{ $share->share_title }}"/>
+            <span class='help-block'>如果不填写,默认为活动名称</span>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享图标</label>
+        <div class="col-sm-9 col-xs-12">
+            {!! app\common\helpers\ImageHelper::tplFormFieldImage('widgets[share][share_thumb]', $share->share_thumb) !!}
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="col-xs-12 col-sm-3 col-md-2 control-label">分享描述</label>
+        <div class="col-sm-9 col-xs-12">
+            <textarea name="widgets[share][share_desc]" class="form-control">{{ $share->share_desc }}</textarea>
+        </div>
+    </div>
+
+</div>

+ 910 - 0
plugins/activity-apply/views/admin/small.blade.php

@@ -0,0 +1,910 @@
+<!-- mylink start -->
+<style>
+    body {
+        background: #eee;
+    }
+
+    .topmenu {
+        background: #ddd;
+    }
+
+    .fart-editor-content .menu, .fart-editor-menu nav, .fart-editor-content .con2 .con .itembox, .fart-preview .title, .adddiv, .fart-editor-menu .savebtn {
+        moz-user-select: -moz-none;
+        -moz-user-select: none;
+        -o-user-select: none;
+        -khtml-user-select: none;
+        -webkit-user-select: none;
+        -ms-user-select: none;
+        user-select: none;
+    }
+
+    .loading {
+        background: #ddd;
+        border: 1px solid #ccc;
+        color: #999;
+    }
+
+    .mylink-con {
+        height: 300px;
+        overflow-y: auto;
+    }
+
+    .mylink-line {
+        height: 36px;
+        border-bottom: 1px dashed #eee;
+        line-height: 36px;
+        color: #999;
+    }
+
+    .mylink-sub {
+        height: 36px;
+        width: 50px;
+        padding-right: 15px;
+        float: right;
+        text-align: right;
+    }
+
+    .mylink-con .good {
+        height: 70px;
+        width: 330px;
+        padding: 5px;
+        margin: 5px 2px 0px;
+        background: #f5f5f5;
+        float: left;
+    }
+
+    .mylink-con .good .img {
+        height: 60px;
+        width: 60px;
+        background: #eee;
+        float: left;
+    }
+
+    .mylink-con .good .img img {
+        height: 100%;
+        width: 100%;
+        border: 0px;
+        display: block;
+    }
+
+    .mylink-con .good .choosebtn {
+        height: 60px;
+        width: 80px;
+        float: right;
+        line-height: 30px;
+        text-align: right;
+    }
+
+    .mylink-con .good .info {
+        height: 60px;
+        word-break: break-all;
+        padding-left: 70px;
+        color: #999;
+    }
+
+    .mylink-con .good .info-title {
+        height: 40px;
+        line-height: 20px;
+        overflow: hidden;
+    }
+
+    .mylink-con .good .info-price {
+        height: 20px;
+        line-height: 20px;
+        font-size: 12px;
+    }
+
+    .fart-main ::-webkit-scrollbar {
+        width: 6px;
+    }
+
+    .fart-main ::-webkit-scrollbar-track {
+    }
+
+    .fart-main ::-webkit-scrollbar-thumb {
+        background: rgba(0, 0, 0, 0.2);
+    }
+
+    .fart-main ::-webkit-scrollbar-thumb:window-inactive {
+        background: rgba(0, 0, 0, 0.1);
+    }
+
+    .fart-main ::-webkit-scrollbar-thumb:vertical:hover {
+        background-color: rgba(0, 0, 0, 0.3);
+    }
+
+    .fart-main ::-webkit-scrollbar-thumb:vertical:active {
+        background-color: rgba(0, 0, 0, 0.5);
+    }
+
+    .edui-default .edui-editor-toolbarboxouter, .edui-default .edui-editor-toolbarbox {
+        border: 0px;
+        border-radius: 0px
+    }
+
+    .datetimepicker {
+        margin: 0px;
+    }
+
+    section a, section a:hover {
+        color: inherit;
+    }
+
+    .fart-main {
+        height: auto;
+        width: 1400px;
+        overflow: hidden;
+    }
+
+    .fart-preview {
+        height: 800px;
+        width: 400px;
+        float: left;
+        background: #f1f1f1;
+    }
+
+    .fart-preview section {
+        padding: 0px;
+        margin: 0px;
+    }
+
+    .fart-preview .title {
+        height: 50px;
+        background: #00a8e8;
+        color: #fff;
+        text-align: center;
+        line-height: 50px;
+        font-size: 18px;
+        cursor: default;
+        display: none;
+    }
+
+    .fart-preview .top {
+        height: 50px;
+        background: #3366d7;
+        background: #3e4144 url('./top_bg.png') center -3px no-repeat;
+        overflow: hidden;
+        cursor: default;
+    }
+
+    .fart-preview .top p {
+        height: 20px;
+        width: 260px;
+        margin: auto;
+        font-size: 16px;
+        color: #fff;
+        margin-top: 24px;
+        text-align: center;
+        line-height: 20px;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        content: "...";
+    }
+
+    .fart-preview .main {
+        height: 750px;
+        overflow-y: auto;
+    }
+
+    .fart-rich-primary {
+        min-height: 750px;
+        padding: 20px 15px 15px;
+        background: #fff;
+        cursor: default;
+    }
+
+    .fart-rich-title {
+        margin-bottom: 10px;
+        line-height: 1.4;
+        font-weight: 400;
+        font-size: 24px;
+    }
+
+    .fart-rich-mate {
+        margin-bottom: 18px;
+        line-height: 20px;
+        overflow: hidden;
+    }
+
+    .fart-rich-mate-text {
+        margin-right: 8px;
+        margin-bottom: 10px;
+        font-size: 16px;
+        color: #8c8c8c;
+        float: left;
+    }
+
+    .fart-rich-mate .href {
+        color: #607fa6;
+    }
+
+    .fart-rich-content {
+        min-height: 577px;
+        font-size: 16px;
+    }
+
+    .fart-rich-content img {
+        max-width: 100%;
+    }
+
+    .fart-rich-tool {
+        height: auto;
+        padding-top: 15px;
+        line-height: 32px;
+        overflow: hidden;
+    }
+
+    .fart-rich-tool-text {
+        margin-right: 10px;
+        font-size: 16px;
+        color: #8c8c8c;
+        text-decoration: none;
+        float: left;
+    }
+
+    .fart-rich-tool .link {
+        color: #607fa6;
+    }
+
+    .fart-rich-tool .right {
+        float: right;
+    }
+
+    .fart-rich-tool-like {
+        height: 13px;
+        width: 13px;
+        margin-left: 8px;
+        background: url('./like.png') 0 0 no-repeat;
+        background-size: 100% auto;
+        display: inline-block;
+    }
+
+    .fart-rich-sift {
+        height: auto;
+        background: #ddd;
+        padding: 30px 15px 0px;
+        display: none;
+    }
+
+    .fart-rich-sift-line {
+        height: 21px;
+        position: relative;
+    }
+
+    .fart-rich-sift-border {
+        height: 0px;
+        width: 100%;
+        border-top: 1px dashed #eee;
+        position: absolute;
+        top: 10px;
+        left: 0px;
+        z-index: 1;
+    }
+
+    .fart-rich-sift-text {
+        height: 21px;
+        width: 100%;
+        font-size: 14px;
+        color: #999;
+        line-height: 21px;
+        text-align: center;
+        font-size: 16px;
+        z-index: 2;
+        position: absolute;
+        top: 0px;
+        left: 0px;
+    }
+
+    .fart-rich-sift-text a {
+        display: inline-block;
+        padding: 0px 5px;
+        background: #ddd;
+        color: #999;
+        height: 21px;
+        max-width: 80%;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        content: "...";
+    }
+
+    .fart-rich-sift-img {
+        min-height: 10px;
+        background: #fff;
+        margin-top: 12px;
+        padding: 6px;
+    }
+
+    .fart-rich-sift-img img {
+        width: 100%;
+        border: 0px;
+        display: block;
+    }
+
+    .fart-rich-sift-more {
+        line-height: 60px;
+        font-size: 16px;
+        color: #607fa6;
+        text-align: center;
+        height: 60px;
+        margin: auto;
+        max-width: 80%;
+        overflow: hidden;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        content: "...";
+    }
+
+    .fart-editor {
+        height: 800px;
+        width: 1000px;
+        background: #f1f1f1;
+        float: left;
+        font-weight: 100;
+    }
+
+    .fart-editor-menu {
+        height: 50px;
+        background: #00a8e8;
+    }
+
+    .fart-editor-menu nav {
+        height: 50px;
+        width: 30%;
+        text-align: center;
+        line-height: 50px;
+        font-size: 18px;
+        color: #fff;
+        float: left;
+        cursor: pointer;
+    }
+
+    .fart-editor-menu .navon {
+        background: #00b3f7;
+    }
+
+    .fart-editor-menu .savebtn {
+        height: 50px;
+        width: 10%;
+        background: #6c9;
+        float: left;
+        line-height: 50px;
+        text-align: center;
+        font-size: 18px;
+        color: #fff;
+        cursor: pointer;
+    }
+
+    .fart-editor-content {
+        height: 750px;
+        background: #f1f1f1;
+        display: none;
+        overflow: hidden;
+    }
+
+    .fart-editor-content .menu {
+        height: 40px;
+        cursor: default;
+    }
+
+    .fart-editor-content .nav1 {
+        height: 40px;
+        width: 500px;
+        background: #ffba75;
+        font-size: 16px;
+        color: #fff;
+        line-height: 40px;
+        text-align: center;
+        float: left;
+        position: relative;
+    }
+
+    .fart-editor-content .nav1 .trash {
+        height: 24px;
+        width: 24px;
+        position: absolute;
+        top: 8px;
+        right: 8px;
+        font-size: 20px;
+        line-height: 24px;
+        text-align: center;
+        cursor: pointer;
+    }
+
+    .fart-editor-content .nav2 {
+        height: 40px;
+        width: 500px;
+        background: #b4b4da;
+        font-size: 16px;
+        color: #fff;
+        line-height: 40px;
+        text-align: center;
+        float: left;
+        position: relative;
+    }
+
+    .fart-editor-content .nav2 .tip {
+        height: 20px;
+        width: 40px;
+        position: absolute;
+        right: 55px;
+        top: 10px;
+        font-size: 12px;
+        color: #fff;
+        line-height: 20px;
+        text-align: center;
+    }
+
+    .fart-editor-content .nav2 .color {
+        height: 20px;
+        width: 40px;
+        position: absolute;
+        right: 15px;
+        top: 10px;
+        cursor: pointer;
+        border: 0px;
+        padding: 0px;
+        outline: none;
+    }
+
+    .fart-editor-content .nav2 .color::-webkit-color-swatch-wrapper {
+        border: 0px;
+        padding: 0px;
+    }
+
+    .fart-editor-content .content {
+        height: 710px;
+    }
+
+    .fart-editor-content .con1 {
+        height: 710px;
+        width: 500px;
+        background: #f4f4f4;
+        float: left;
+    }
+
+    .fart-editor-content .con2 {
+        height: 710px;
+        width: 500px;
+        background: #f4f4f4;
+        float: left;
+    }
+
+    .fart-editor-content .con2 .tab {
+        height: 710px;
+        width: 74px;
+        background: #ccc;
+        float: left;
+    }
+
+    .fart-editor-content .con2 .tab .nav {
+        height: 42px;
+        line-height: 42px;
+        text-align: center;
+        font-size: 16px;
+        color: #fff;
+        cursor: pointer;
+    }
+
+    .fart-editor-content .con2 .tab .navon {
+        background: #aaa;
+    }
+
+    .fart-editor-content .con2 .con {
+        height: 710px;
+        width: 426px;
+        float: left;
+        display: none;
+        overflow-y: auto;
+        background: #fff;
+    }
+
+    .fart-editor-content .con2 .con img {
+        max-width: 100%;
+    }
+
+    .fart-editor-content .con2 .con .itembox {
+        border-bottom: 1px dashed #ddd;
+        padding: 10px;
+        cursor: pointer;
+    }
+
+    .fart-form {
+        min-height: 500px;
+        padding: 40px;
+    }
+
+    .fart-form input::-webkit-input-placeholder {
+        color: #999;
+    }
+
+    .fart-form input {
+        color: #333;
+    }
+
+    .fart-form .line {
+        height: auto;
+        overflow: hidden;
+    }
+
+    .fart-form .line2 {
+        height: auto;
+        width: 455px;
+        float: left;
+    }
+
+    .fart-form .product {
+        display: none;
+    }
+
+    .fart-form .product .advs {
+        min-height: 10px;
+        background: #eee;
+        padding: 5px;
+        margin-bottom: 15px;
+        border: 2px dashed #ccc;
+        border-radius: 5px;
+        overflow: hidden;
+    }
+
+    .fart-form .product .advs .addbtn {
+        height: 40px;
+        border: 2px dashed #ccc;
+        line-height: 40px;
+        font-size: 18px;
+        color: #bbb;
+        text-align: center;
+        cursor: pointer;
+        margin: 5px;
+        background: #fff;
+    }
+
+    .fart-form .product .adv {
+        height: 100px;
+        background: #fff;
+        border: 1px solid #ddd;
+        margin: 5px;
+        padding: 5px;
+        border-radius: 5px;
+        position: relative;
+    }
+
+    .fart-form .product .adv .img {
+        height: 88px;
+        width: auto;
+        min-width: 88px;
+        max-width: 250px;
+        background: #ccc;
+        float: left;
+        margin-right: 15px;
+    }
+
+    .fart-form .product .adv .img img {
+        height: 100%;
+        width: auto;
+    }
+
+    .fart-form .product .adv .info {
+        height: 90px;
+    }
+
+    .fart-form .product .adv .del {
+        height: 24px;
+        width: 24px;
+        background: rgba(0, 0, 0, 0.5);
+        text-align: center;
+        line-height: 24px;
+        color: #fff;
+        font-size: 18px;
+        position: absolute;
+        top: -10px;
+        right: -10px;
+        border-radius: 30px;
+        cursor: pointer;
+    }
+
+    .page-header {
+        height: 40px;
+    }
+
+    .mylink-app-nav {
+        margin: 5px 0;
+    }
+</style>
+
+<div id="modal-myApplink" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
+    <div class="modal-dialog" style="width: 720px;">
+        <div class="modal-content">
+            <div class="modal-header" style="padding: 5px;">
+                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
+                <ul class="nav nav-pills" role="tablist">
+                    <li role="presentation" class="active" style="display: block;">
+                        <a aria-controls="link_small_system" role="tab" data-toggle="tab" href="#link_small_system"
+                           aria-expanded="true">
+                            系统页面
+                        </a>
+                    </li>
+                    <li role="presentation" style="display: block;">
+                        <a aria-controls="link_small_goods" role="tab" data-toggle="tab" href="#link_small_goods"
+                           aria-expanded="false">
+                            商品链接
+                        </a>
+                    </li>
+                    <li role="presentation" style="display: block;">
+                        <a aria-controls="link_small_cate" role="tab" data-toggle="tab" href="#link_small_cate"
+                           aria-expanded="false">
+                            商品分类
+                        </a>
+                    </li>
+                    <li role="presentation" style="display: block;">
+                        <a aria-controls="link_small_brand" role="tab" data-toggle="tab" href="#link_small_brand"
+                           aria-expanded="false">
+                            商品品牌
+                        </a>
+                    </li>
+                </ul>
+            </div>
+            <div class="modal-body tab-content">
+                <div role="tabpanel" class="tab-pane link_small_system active" id="link_small_system">
+                    <div class="mylink-con">
+
+                        <div class="page-header">
+                            <h4><i class="fa fa-folder-open-o"></i>商城页面链接</h4>
+                        </div>
+                        <div id="fe-tab-link-li-11" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 11)" data-href="/pages/index/index">商城首页</div>
+                        <div id="fe-tab-link-li-12" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 12)" data-href="/pages/category_v2/category_v2">分类导航</div>
+                        <div id="fe-tab-link-li-13" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 13)" data-href="/packageC/member/searchAll/searchAll">全部商品</div>
+                        <div id="fe-tab-link-li-14" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 14)" data-href="/packageC/o2o/o2oHome/o2oHome">门店聚合页面</div>
+
+                        <div class="page-header">
+                            <h4><i class="fa fa-folder-open-o"></i>会员中心链接</h4>
+                        </div>
+                        <div id="fe-tab-link-li-21" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 21)" data-href="/pages/member/index_v2/index_v2">会员中心</div>
+                        <div id="fe-tab-link-li-22" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 22)" data-href="/packageA/member/myOrder_v2/myOrder_v2">我的订单</div>
+                        <div id="fe-tab-link-li-23" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 23)" data-href="/pages/buy/cart_v2/cart_v2">我的购物车</div>
+                        <div id="fe-tab-link-li-24" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 24)" data-href="/pages/member/collection/collection">我的收藏</div>
+                        <div id="fe-tab-link-li-25" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 25)" data-href="/pages/member/footprint/footprint">我的足迹</div>
+                        <div id="fe-tab-link-li-26" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 26)" data-href="/packageA/member/balance/balance/balance">会员充值</div>
+                        {{--<div id="fe-tab-link-li-27" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 27)" data-href="/packageA/member/balance/detailed/detailed">余额明细</div>--}}
+                        {{--<div id="fe-tab-link-li-28" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 28)" data-href="/packageA/member/balance/balance/balance">余额提现</div>--}}
+                        <div id="fe-tab-link-li-29" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 29)" data-href="/pages/member/addressList/addressList">收货地址</div>
+
+                        <div class="page-header">
+                            <h4><i class="fa fa-folder-open-o"></i>其他链接</h4>
+                        </div>
+                        <div id="fe-tab-link-li-34" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 34)" data-href="/packageA/member/info/info">会员信息</div>
+                        <div id="fe-tab-link-li-35" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 35)" data-href="/packageA/member/editmobile/editmobile">修改手机</div>
+                        <div id="fe-tab-link-li-36" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 36)" data-href="/pages/member/balance/balance">会员余额</div>
+                        <div id="fe-tab-link-li-37" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 37)" data-href="/packageA/member/balance/detailed/detailed">余额明细</div>
+                        <div id="fe-tab-link-li-40" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 40)" data-href="/packageB/member/integral/integral">会员积分</div>
+                        <div id="fe-tab-link-li-41" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 41)" data-href="/packageB/member/income/income/income">我的收入</div>
+                        <div id="fe-tab-link-li-44" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 44)" data-href="/packageA/member/withdrawal/withdrawal">收入提现</div>
+                        <div id="fe-tab-link-li-45" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 45)" data-href="/packageA/member/extension/incomedetails/incomedetails">收入明细</div>
+                        <div id="fe-tab-link-li-46" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 46)" data-href="/packageA/member/income_details_info/income_details_info">收入明细详情</div>
+                        <div id="fe-tab-link-li-48" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 48)" data-href="/packageA/member/presentationRecord/presentationRecord">提现记录</div>
+                        <div id="fe-tab-link-li-50" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 50)" data-href="/pages/member/addressList/addressList">收货地址</div>
+                        <div id="fe-tab-link-li-52" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 52)" data-href="/pages/member/addressAdd_v2/addressAdd_v2">添加收货地址</div>
+                        <div id="fe-tab-link-li-53" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 53)" data-href="/packageA/member/extension/notPresent/notPresent">未提现分销佣金</div>
+                        <div id="fe-tab-link-li-54" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 54)" data-href="/pages/member/footprint/footprint">我的足迹</div>
+                        <div id="fe-tab-link-li-55" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 55)" data-href="/pages/member/collection/collection">我的收藏</div>
+                        <div id="fe-tab-link-li-56" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 56)" data-href="/pages/member/myRelationship/myRelationship">我的关系</div>
+                        <div id="fe-tab-link-li-58" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 58)" data-href="/pages/member/myRelationship/myRelationship">我的评价</div>
+                        {{--<div id="fe-tab-link-li-60" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 60)" data-href="">评价详情</div>--}}
+                        <div id="fe-tab-link-li-61" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 61)" data-href="/pages/member/extension/extension">我的推广</div>
+                        <div id="fe-tab-link-li-62" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 62)" data-href="/packageA/member/distribution/distribution">分销商</div>
+                        <div id="fe-tab-link-li-63" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 63)" data-href="/packageA/member/extension/commission/commission">预计佣金</div>
+                        <div id="fe-tab-link-li-65" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 65)" data-href="/packageA/member/extension/unsettled/unsettled">未结算佣金</div>
+                        <div id="fe-tab-link-li-67" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 67)" data-href="/packageA/member/extension/alreadySettled/alreadySettled">已结算佣金</div>
+                        <div id="fe-tab-link-li-69" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 69)" data-href="/packageA/member/extension/notPresent/notPresent">未提现佣金</div>
+                        <div id="fe-tab-link-li-71" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 71)" data-href="/packageA/member/extension/present/present">已提现佣金</div>
+                        <div id="fe-tab-link-li-73" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 73)" data-href="/packageA/member/extension/present/present">分销订单</div>
+                        <div id="fe-tab-link-li-81" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 81)" data-href="/pages/member/myOrder/Aftersaleslist/Aftersaleslist">售后列表</div>
+                        <div id="fe-tab-link-li-84" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 84)" data-href="/packageA/member/coupon_v2/coupon_v2">优惠券</div>
+                        <div id="fe-tab-link-li-85" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 85)" data-href="/pages/coupon/coupon_store">领券中心</div>
+                        <div id="fe-tab-link-li-89" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 89)" data-href="/packageB/member/category/search_v2/search_v2">搜索</div>
+                        {{--<div id="fe-tab-link-li-90" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 90)" data-href="">登录</div>--}}
+                        {{--<div id="fe-tab-link-li-91" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 91)" data-href="">注册</div>--}}
+                        <div id="fe-tab-link-li-92" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 92)" data-href="/pages/category_v2/category_v2">分类</div>
+                        <div id="fe-tab-link-li-94" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 94)" data-href="/packageB/member/category/brand_v2/brand_v2">品牌</div>
+                        <div id="fe-tab-link-li-96" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 96)" data-href="/pages/buy/cart_v2/cart_v2">购物车</div>
+                        <div id="fe-tab-link-li-99" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 99)" data-href="/packageC/o2o/o2oHome/o2oHome">填写订单</div>
+                        <div id="fe-tab-link-li-101" class="btn btn-default mylink-app-nav" ng-click="chooseLink(1, 101)" data-href="packageA/member/course/VoiceList/VoiceL">音频文章</div>
+
+                    </div>
+                </div>
+
+                <!-- 商品链接 start -->
+                <div role="tabpanel" class="tab-pane link_small_goods" id="link_small_goods">
+                    <div class="input-group">
+                        <input type="text" class="form-control" name="keyword" value="" id="select-app-good-kw" placeholder="请输入商品名称进行搜索 (多规格商品不支持一键下单)">
+                        <span class="input-group-btn">
+                            <button type="button" class="btn btn-default"  id="select-app-good-btn">
+                                搜索
+                            </button>
+                        </span>
+                    </div>
+                    <div class="mylink-con" id="select-app-goods" style="height:266px;">
+                        <div class="good" ng-repeat="good in searchGoods">
+                            <div class="img">
+                                <img ng-src="@{{good.thumb}}">
+                            </div>
+                            <div class="choosebtn">
+                                <a href="javascript:;" id="@{{good.id}}" ng-click="chooseLink(1, good.id)" data-href="/pages/detail_v2/detail_v2?id=@{{ good.goods_id }}">
+                                    详情链接
+                                </a>
+                                <br>
+                            </div>
+                            <div class="info">
+                                <div class="info-title">@{{good.title}}</div>
+                                <div class="info-price">原价:¥@{{good.market_price}} 现价¥@{{good.price}}</div>
+                            </div>
+                        </div>
+
+                    </div>
+                </div>
+                <!-- 商品链接 edn -->
+
+                <!-- 商品分类 start -->
+                <div role="tabpanel" class="tab-pane link_small_cate" id="link_small_cate">
+                    <div class="mylink-con">
+                        <?php $category = \app\backend\modules\goods\models\Category::getAllCategory(); ?>
+                        @foreach ($category as $goodcate_parent)
+                            @if (empty($goodcate_parent['parent_id']))
+                                <div class="mylink-line">
+                                    {{ $goodcate_parent['name'] }}
+                                    <div class="mylink-sub">
+                                        <a href="javascript:;" id="category-{{ $goodcate_parent['id'] }}" class="mylink-app-nav" ng-click="chooseLink(1, 'category-{{ $goodcate_parent['id'] }}')" data-href="/packageB/member/category/catelist/catelist?id={!! $goodcate_parent['id'] !!}">选择</a>
+                                    </div>
+                                </div>
+                                <!-- 二级分类 -->
+                                @foreach ($category as $goodcate_chlid)
+                                    @if ($goodcate_chlid['parent_id'] == $goodcate_parent['id'])
+                                        <div class="mylink-line">
+                                            <span style='height:10px; width: 10px; margin-left: 10px; margin-right: 10px; display:inline-block; border-bottom: 1px dashed #ddd; border-left: 1px dashed #ddd;'></span>
+                                            {{ $goodcate_chlid['name'] }}
+                                            <div class="mylink-sub">
+                                                <a href="javascript:;" id="category-{{ $goodcate_chlid['id'] }}" class="mylink-app-nav" ng-click="chooseLink(1, 'category-{{ $goodcate_chlid['id'] }}')" data-href="/packageB/member/category/catelist/catelist?id={!! $goodcate_chlid['id'] !!}">选择</a>
+                                            </div>
+                                        </div>
+                                        <!-- 三级分类 -->
+                                        @foreach ($category as $goodcate_third)
+                                            @if ($goodcate_third['parent_id'] == $goodcate_chlid['id'])
+                                                <div class="mylink-line">
+                                                    <span style='height:10px; width: 10px; margin-left: 30px; margin-right: 10px; display:inline-block; border-bottom: 1px dashed #ddd; border-left: 1px dashed #ddd;'></span>
+                                                    {{ $goodcate_third['name'] }}
+                                                    <div class="mylink-sub">
+                                                        <a href="javascript:;" id="category-{{ $goodcate_third['id'] }}" class="mylink-app-nav" ng-click="chooseLink(1, 'category-{{ $goodcate_third['id'] }}')" data-href="/packageB/member/category/catelist/catelist?id={!! $goodcate_third['id'] !!}">选择</a>
+                                                    </div>
+                                                </div>
+                                            @endif
+                                        @endforeach
+                                        <!-- 三级分类 end -->
+                                    @endif
+                                @endforeach
+                                <!-- 二级分类 end -->
+                            @endif
+                        @endforeach
+                    </div>
+                </div>
+                <!-- 商品分类 end -->
+
+                <!-- 商品品牌 start -->
+                <div role="tabpanel" class="tab-pane link_small_brand" id="link_small_brand">
+                    <div class="mylink-con">
+                        <?php $brands = \app\common\models\Brand::getBrands()->select('id', 'name')->get(); ?>
+                        @if($brands)
+                            @foreach ($brands->toArray() as $brand)
+                                <div class="mylink-line">
+                                    {{ $brand['name'] }}
+                                    <div class="mylink-sub">
+                                        <a href="javascript:;" id="brand-{{ $brand['id'] }}" class="mylink-app-nav" ng-click="chooseLink(1, 'brand-{{ $brand['id'] }}')" data-href="/packageB/member/category/brandgoods/brandgoods?id={!! $brand['id'] !!}">
+                                            选择
+                                        </a>
+                                    </div>
+                                </div>
+                            @endforeach
+                        @endif
+                    </div>
+                </div>
+                <!-- 商品品牌 end -->
+
+                {!! my_link_extra('content') !!}
+            </div>
+        </div>
+    </div>
+</div>
+
+<!-- mylink end -->
+<script language="javascript">
+    require(['jquery'],function(){
+
+
+        $(function() {
+            $("#chkoption").click(function() {
+                var obj = $(this);
+                if (obj.get(0).checked) {
+                    $("#tboption").show();
+                    $(".trp").hide();
+                }
+                else {
+                    $("#tboption").hide();
+                    $(".trp").show();
+                }
+            });
+        })
+
+        $(document).on("click",".nav-app-link",function(){
+            var id = $(this).data("id");
+            if(id){
+                $("#modal-myApplink").attr({"data-id":id});
+                $("#modal-myApplink").modal();
+            }
+        });
+        $(document).on("click",".mylink-app-nav",function(){
+            var href = $(this).data("href");
+            var id = $("#modal-myApplink").attr("data-id");
+            if(id){
+                $("input[data-id="+id+"]").val(href);
+                $("#modal-myApplink").attr("data-id","");
+            }else{
+                // console.log(href);
+                ue.execCommand('link', {href:href});
+            }
+
+            $("#modal-myApplink .close").click();
+        });
+        $(".mylink-app-nav2").click(function(){
+            var href = $("textarea[name=mylink_href]").val();
+            if(href){
+                var id = $("#modal-myApplink").attr("data-id");
+                if(id){
+                    $("input[data-id="+id+"]").val(href);
+                    $("#modal-myApplink").attr("data-id","");
+                }else{
+                    ue.execCommand('link', {href:href});
+                }
+                $("#modal-myApplink .close").click();
+                $("textarea[name=mylink_href]").val("");
+            }else{
+                $("textarea[name=mylink_href]").focus();
+                alert("链接不能为空!");
+            }
+        });
+        // ajax 选择商品
+        $("#select-app-good-btn").click(function(){
+            var kw = $("#select-app-good-kw").val();
+            $.ajax({
+                type: 'POST',
+                url: "{!! yzWebUrl('goods.goods.getMyLinkGoods') !!}",
+                data: {kw:kw},
+                dataType:'json',
+                success: function(data){
+
+                    $("#select-app-goods").html("");
+                    if(data){
+                        $.each(data,function(n,value){
+                            console.log(value);
+                            var html = '<div class="good">';
+                            html+='<div class="img"><img src="'+value.thumb+'"/></div>'
+                            html+='<div class="choosebtn">';
+                            html+='<a href="javascript:;" class="mylink-app-nav" data-href="/pages/detail_v2/detail_v2?id='+value.id+'">详情链接</a><br>';
+                            /*if(value.hasoption==0){
+                                html+='<a href="javascript:;" class="mylink-app-nav" data-href="">下单链接</a>';
+                            }*/
+                            //id="other-1" ng-click="chooseLink(1, 'other-1')"
+                            html+='</div>';
+                            html+='<div class="info">';
+                            html+='<div class="info-title">'+value.title+'</div>';
+                            html+='<div class="info-price">原价:¥'+value.market_price+' 现价¥'+value.price+'</div>';
+                            html+='</div>'
+                            html+='</div>';
+                            $("#select-app-goods").append(html);
+                        });
+                    }
+                }
+            });
+        });
+
+    })
+</script>

+ 12 - 0
plugins/activity-apply/views/admin/tabs.blade.php

@@ -0,0 +1,12 @@
+<div  class="panel panel-info">
+    <ul class="add-shopnav" id="myTab">
+        <li @if(YunShop::request()->route == 'plugin.activity-apply.admin.activity-apply-activity.add') class="active" @endif>
+            <a href="{{yzWebUrl('plugin.activity-apply.admin.activity-apply-activity.add')}}">活动信息</a></li>
+        <li @if(YunShop::request()->route == 'plugin.activity-apply.admin.set.marketing') class="active" @endif>
+            <a href="{{yzWebUrl('plugin.activity-apply.admin.set.marketing')}}">营销设置</a></li>
+        <li @if(YunShop::request()->route == 'plugin.activity-apply.admin.set.fenrun') class="active" @endif>
+            <a href="{{yzWebUrl('plugin.activity-apply.admin.set.fenrun')}}">分润设置</a></li>
+        <li @if(YunShop::request()->route == 'plugin.activity-apply.admin.set.cash') class="active" @endif>
+            <a href="{{yzWebUrl('plugin.activity-apply.admin.set.cash')}}">返现设置</a></li>
+    </ul>
+</div>

+ 12 - 0
plugins/activity-apply/views/admin/tpl/activity.php

@@ -0,0 +1,12 @@
+<tr>
+    <td>
+        <a href="javascript:;" onclick="deleteParam(this)" style="margin-top:10px;"  title="删除"><i class='fa fa-times'></i></a>
+    </td>
+    <td colspan="2">
+        <input type="hidden" class="form-control" name="widgets[cashier][coupon_ids][]"  data-id="{$id}" data-name="coupon_ids" value="" placeholder="按钮名称" style="width:200px;float:left"  />
+        <input class="form-control" type="text" data-id="{$id}" data-name="coupon_names" placeholder="" value="" name="widgets[cashier][coupon_names][]" style="width:200px;float:left" readonly="true">
+        <span class="input-group-btn">
+            <button class="btn btn-default nav-link" type="button" data-id="{$id}" onclick="$('#modal-module-menus-categorys').modal();$(this).parent().parent().addClass('focuscategory')">选择优惠券</button>
+        </span>
+    </td>
+</tr>

+ 1 - 0
plugins/address-mgmt/README.md

@@ -0,0 +1 @@
+init

Plik diff jest za duży
+ 0 - 0
plugins/address-mgmt/asset/address.json


Plik diff jest za duży
+ 0 - 0
plugins/address-mgmt/asset/address.txt


Plik diff jest za duży
+ 0 - 0
plugins/address-mgmt/asset/street.json


Plik diff jest za duży
+ 0 - 0
plugins/address-mgmt/asset/street.txt


+ 11 - 0
plugins/address-mgmt/callbacks.php

@@ -0,0 +1,11 @@
+<?php
+
+
+return [
+    app\common\events\PluginWasEnabled::class => function ($plugins) {
+        \Artisan::call('migrate', ['--path' => 'plugins/address-mgmt/migrations', '--force' => true]);
+    },
+    app\common\events\PluginWasDeleted::class => function ($plugins) {
+        \Artisan::call('migrate:rollback', ['--path' => 'plugins/address-mgmt/migrations']);
+    },
+];

+ 42 - 0
plugins/address-mgmt/migrations/2020_03_24_100756_create_yz_address_mgmt_log_table.php

@@ -0,0 +1,42 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateYzAddressMgmtLogTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        if (!Schema::hasTable('yz_address_mgmt_log')) {
+            Schema::create('yz_address_mgmt_log', function (Blueprint $table) {
+                $table->increments('id');
+                $table->integer('uniacid')->default(0)->nullable();
+                $table->integer('user_id')->default(0)->nullable();
+                $table->string('area_name', 100)->nullable()->comment('地址名称');
+                $table->string('after_address')->nullable()->comment('之后地址');
+                $table->string('before_address')->nullable()->comment('之前地址');
+                $table->string('operate_type')->nullable()->comment('操作类型');
+                $table->tinyInteger('level')->nullable()->default(0)->comment('地址级别');
+                $table->integer('created_at')->nullable();
+                $table->integer('updated_at')->nullable();
+                $table->integer('deleted_at')->nullable();
+            });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('yz_address_mgmt_log');
+    }
+}

+ 11 - 0
plugins/address-mgmt/package.json

@@ -0,0 +1,11 @@
+{
+    "name": "address-mgmt",
+    "terminal": "",
+    "version": "1.0.14",
+    "title": "地址管理",
+    "description": "添加/修改地址,协助用户更改信息。",
+    "author": "blank",
+    "url": "https://www.yunzmall.com/",
+    "namespace": "Yunshop\\AddressMgmt",
+    "config": "config.tpl"
+}

+ 134 - 0
plugins/address-mgmt/src/PluginApplication.php

@@ -0,0 +1,134 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/3/15
+ * Time: 14:30
+ */
+
+namespace Yunshop\AddressMgmt;
+
+use app\common\models\MemberCart;
+use app\common\services\Plugin;
+use Yunshop\NetCar\frontend\order\OrderManager;
+use Yunshop\NetCar\Listener\OrderCanceledListener;
+
+
+class PluginApplication extends \app\common\services\PluginApplication
+{
+
+
+    protected function setConfig()
+    {
+
+    }
+
+    protected function setMenuConfig()
+    {
+        \app\backend\modules\menu\Menu::current()->setPluginMenu('address_mgmt', [
+            'name' => '地址管理',
+            'url' => 'plugin.address-mgmt.admin.manage.index',// url 可以填写http 也可以直接写路由
+            'url_params' => '',//如果是url填写的是路由则启用参数否则不启用
+            'permit' => 1,//如果不设置则不会做权限检测
+            'menu' => 1,//如果不设置则不显示菜单,子菜单也将不显示
+            'top_show' => 0,
+            'left_first_show' => 0,
+            'left_second_show' => 1,
+            'icon' => 'fa-credit-card',
+            'list_icon' => 'address_mgmt',
+            'parents' => [],
+            'type' => 'tool',
+            'child' => [
+                'address_mgmt_explain' => [
+                    'name' => '同步地址',
+                    'permit' => 0,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.address-mgmt.admin.set.explain',
+                    'url_params' => '',
+                    'parents' => ['address_mgmt'],
+                    'child' => [],
+                ],
+                'address_mgmt_select' => [
+                    'name' => '获取地址',
+                    'url' => 'plugin.address-mgmt.admin.select.get-address',
+                    'permit' => 0,
+                    'parents' => ['address_mgmt'],
+                ],
+                'address_mgmt_address_js' => [
+                    'name' => '生成地址js文件',
+                    'url' => 'plugin.address-mgmt.admin.set.generate-js',
+                    'permit' => 1,
+                    'menu' => 0,
+                    'parents' => ['address_mgmt',],
+                ],
+                'address_mgmt_manage' => [
+                    'name' => '地址管理',
+                    'permit' => 1,
+                    'menu' => 1,
+                    'icon' => '',
+                    'url' => 'plugin.address-mgmt.admin.manage.index',
+                    'url_params' => '',
+                    'parents' => ['address_mgmt'],
+                    'child' => [
+                        'address_mgmt_search' => [
+                            'name' => '搜索',
+                            'url' => 'plugin.address-mgmt.admin.manage.search',
+                            'permit' => 0,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_add' => [
+                            'name' => '添加地址',
+                            'url' => 'plugin.address-mgmt.admin.manage.create-show',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_create' => [
+                            'name' => '地址添加保存',
+                            'url' => 'plugin.address-mgmt.admin.manage.create',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_edit' => [
+                            'name' => '修改地址',
+                            'url' => 'plugin.address-mgmt.admin.manage.edit-show',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_delete' => [
+                            'name' => '删除地址',
+                            'url' => 'plugin.address-mgmt.admin.manage.delete',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_refresh' => [
+                            'name' => '初始化地址',
+                            'url' => 'plugin.address-mgmt.admin.manage.refresh-address',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                        'address_mgmt_generateJs' => [
+                            'name' => '同步地址',
+                            'url' => 'plugin.address-mgmt.admin.manage.generate-js',
+                            'permit' => 1,
+                            'menu' => 0,
+                            'parents' => ['address_mgmt', 'address_mgmt_manage'],
+                        ],
+                    ]
+                ],
+
+            ]
+        ]);
+    }
+
+    public function boot()
+    {
+        $events = app('events');
+    }
+}

+ 397 - 0
plugins/address-mgmt/src/admin/ManageController.php

@@ -0,0 +1,397 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: blank
+ * Date: 2020/3/23
+ * Time: 16:31
+ */
+
+namespace Yunshop\AddressMgmt\admin;
+
+
+use app\common\components\BaseController;
+use app\common\exceptions\ShopException;
+use app\common\helpers\PaginationHelper;
+use app\common\helpers\Url;
+use app\common\models\Address;
+use app\common\models\Street;
+use Yunshop\AddressMgmt\models\AddressLog;
+use Yunshop\AddressMgmt\services\VerifyAddressService;
+use Illuminate\Support\Facades\DB;
+
+class ManageController extends BaseController
+{
+    public function index()
+    {
+
+        //$pager = PaginationHelper::show($list->total(), $list->currentPage(), $list->perPage());
+
+
+        return view('Yunshop\AddressMgmt::manage.list', ['data' => json_encode($this->getList())])->render();
+    }
+
+    public function search()
+    {
+
+        $search = request()->input('search');
+
+        $list = AddressLog::getList($search)->paginate(15);
+
+
+        return $this->successJson('成功', $list);
+
+    }
+
+    public function getList()
+    {
+
+        $search = request()->input('search');
+
+        $list = AddressLog::getList($search)->paginate(15);
+
+        return ['list' => $list->toArray()];
+    }
+
+    public function createShow()
+    {
+        return view('Yunshop\AddressMgmt::manage.create-form', [])->render();
+    }
+
+    public function create()
+    {
+        $data = request()->input('address');
+
+
+        if (empty($data['new_id'])) {
+            return $this->errorJson('未输入行政编号');
+        }
+
+
+        $new_address = [
+            'areaname' => $data['name'],
+            'parentid' => $this->getAddressParentId($data['parent_address'], $data['level']),
+            'level' => $data['level'],
+            'id'   => $data['new_id'],
+        ];
+
+
+        if ($new_address['level'] == 4) {
+            if (strlen($new_address['id']) != 9) {
+                return $this->errorJson('街道级行政编号应为9位数');
+            }
+            if (Street::find($new_address['id'])) {
+                return $this->errorJson('行政编号已存在');
+            }
+        } elseif ($new_address['level'] == 3) {
+            if (strlen($new_address['id']) != 6) {
+                return $this->errorJson('区级行政编号应为6位数');
+            }
+            if (Address::find($new_address['id'])) {
+                return $this->errorJson('行政编号已存在');
+            }
+        }
+
+
+
+        $result = VerifyAddressService::verify($new_address);
+
+
+        $new_name = implode(array_filter([$data['parent_address']['province']['areaname'], $data['parent_address']['city']['areaname'], $data['parent_address']['district']['areaname'], $data['name']]), ' ');
+        if (!$result) {
+            return $this->errorJson($new_name . ' 地址已存在');
+        }
+
+
+        $log_data = [
+            'operate_type' => 'create',
+            'level' => $data['level'],
+            'area_name' => $data['name'],
+            'after_address' => implode(array_filter([$data['parent_address']['province']['areaname'], $data['parent_address']['city']['areaname'], $data['parent_address']['district']['areaname']]), ' '),
+            'before_address' => $new_name,
+        ];
+
+
+        if (VerifyAddressService::insertAddress($new_address)) {
+            AddressLog::createData($log_data);
+
+            if ($data['level'] < 4) {
+                (new \app\common\services\address\GenerateAddressJs())->address();
+            }
+
+            return $this->successJson('地址添加成功');
+        }
+
+        return $this->errorJson('地址添加失败');
+    }
+
+
+    /**
+     * 获取添加地址的父级地址id
+     * @param $parent_address
+     * @param $level
+     * @return int|null
+     * @throws ShopException
+     */
+    public function getAddressParentId($parent_address, $level)
+    {
+        $parent_id = null;
+        switch ($level) {
+            case 1:
+                $parent_id = 0;
+                break;
+            case 2:
+                $parent_id = $parent_address['province']['id'];
+                break;
+            case 3:
+                $parent_id = $parent_address['city']['id'];
+                break;
+            case 4:
+                $parent_id = $parent_address['district']['id'];
+                break;
+            default:
+                throw new ShopException('地址级别有误');
+                break;
+        }
+
+        return $parent_id;
+    }
+
+    public function getAddress($parent_address, $level)
+    {
+        $address = null;
+        switch ($level) {
+            case 1:
+                $address = $parent_address['province'];
+                break;
+            case 2:
+                $address = $parent_address['city'];
+                break;
+            case 3:
+                $address = $parent_address['district'];
+                break;
+            case 4:
+                $address = $parent_address['street'];
+                break;
+            default:
+                throw new ShopException('地址级别有误');
+                break;
+        }
+
+        return $address;
+    }
+
+    public function editShow()
+    {
+        return view('Yunshop\AddressMgmt::manage.edit-form', [])->render();
+    }
+
+
+    /*
+     * 同步最新网址
+     */
+    public function refreshAddress()
+    {
+//        $address_file = dirname(__FILE__, 3) . '/asset/address.txt';
+//        $street_file = dirname(__FILE__, 3) . '/asset/street.txt';
+        $address_file = base_path('static/source/address.json');
+        $street_file = base_path('static/source/street.json');
+        try {
+            DB::beginTransaction();
+            Address::truncate();
+            Street::truncate();
+
+            $address_list = array_chunk(json_decode(file_get_contents($address_file), true), 2000);
+            foreach ($address_list as &$address) {
+                Address::insert($address);
+            }
+            unset($address_list);
+
+            $street_list = array_chunk(json_decode(file_get_contents($street_file), true), 2000);
+            foreach ($street_list as &$street) {
+                Street::insert($street);
+            }
+            DB::commit();
+        } catch (\Exception $e) {
+            DB::rollBack();
+            return $this->errorJson($e->getMessage());
+        }
+
+
+        AddressLog::createData([
+            'area_name' => '初始化',
+            'after_address' => '初始化',
+            'before_address' => '初始化地址后,之前的地址修改都无效',
+            'operate_type' => 'refresh'
+        ]);
+
+        (new \app\common\services\address\GenerateAddressJs())->address();
+
+        return $this->successJson('初始化成功');
+    }
+
+    public function generateJs()
+    {
+        $num = (new \app\common\services\address\GenerateAddressJs())->address();
+
+        if ($num) {
+            return $this->successJson('同步成功');
+        }
+
+        return $this->successJson('同步失败');
+    }
+
+
+    /*
+    * 删除地址
+    */
+    public function delete()
+    {
+        $data = request()->input('address');
+
+        if (!$delete_address = $this->getAddress($data['parent_address'], $data['level'])) {
+            return $this->errorJson('地址级别有误');
+        }
+
+        $address_name = [$data['parent_address']['province']['areaname'], $data['parent_address']['city']['areaname'], $data['parent_address']['district']['areaname']];
+        if ($data['level'] == 4) $address_name[] = $data['parent_address']['street']['areaname'];
+
+        if (VerifyAddressService::deleteAddress($delete_address)) {
+            AddressLog::createData([
+                'area_name' => $data['level'] == 4 ? $data['parent_address']['street']['areaname'] : $data['parent_address']['district']['areaname'],
+                'operate_type' => 'del',
+                'level' => $data['level'],
+                'after_address' => implode(array_filter($address_name), ' '),
+            ]);
+            if ($data['level'] < 4) {
+                (new \app\common\services\address\GenerateAddressJs())->address();
+            }
+
+            return $this->successJson('地址删除成功');
+        }
+
+        return $this->errorJson('地址删除失败');
+
+    }
+
+
+    public function edit()
+    {
+        $data = request()->input('address');
+
+        $new_address = $old_address = $this->getAddress($data['parent_address'], $data['level']);
+        $new_address['areaname'] = $data['name'];
+
+
+        $address_name = [$data['parent_address']['province']['areaname'], $data['parent_address']['city']['areaname'], $data['parent_address']['district']['areaname'], $data['parent_address']['street']['areaname']];
+
+
+        $old_name = implode(array_filter($address_name), ' ');
+
+        $address_name[$data['level'] - 1] = $data['name'];
+        $new_name = implode(array_filter($address_name), ' ');
+
+
+        //验证需要修改后的地址是否存在,不存在则可修改
+        $new_result = VerifyAddressService::verify($new_address);
+
+        if (!$new_result) {
+            return $this->errorJson($new_name . ' 地址已存在,无需修改');
+        }
+
+
+        //验证需要修改的地址是否存在,存在则可修改
+        $old_result = VerifyAddressService::verify($old_address);
+
+        if ($old_result) {
+            return $this->errorJson($old_name . ' 地址不存在,不能修改');
+        }
+
+
+        $log_data = [
+            'operate_type' => 'edit',
+            'level' => $data['level'],
+            'area_name' => $data['name'],
+            'after_address' => $old_name,
+            'before_address' => $new_name,
+        ];
+
+        if (VerifyAddressService::updateAddress($new_address)) {
+            AddressLog::createData($log_data);
+
+            if ($data['level'] < 4) {
+                (new \app\common\services\address\GenerateAddressJs())->address();
+            }
+
+            return $this->successJson('地址添加成功');
+        }
+
+        return $this->errorJson('地址添加失败');
+    }
+
+
+//    public function createAddressFile()
+//    {
+//
+//        //yz_test_address使用百度映射表导入数据库生成
+//        $res = DB::table('yz_test_address')->get()->toArray();
+//        $address_data = [];
+//        $province_data = [];
+//        $city_data = [];
+//        $district_data = [];
+//        $street_data = [];
+//        foreach ($res as $v) {
+//            $province_data[$v['code_prov']] = [
+//                'id' => $v['code_prov'],
+//                'areaname' => $v['name_prov'],
+//                'parentid' => 0,
+//                'level' => 1
+//            ];
+//            if ($v['code_city'] != '820000' && $v['code_city'] != '810000') {
+//if ($v['code_city'] == 500200) {
+//$v['code_city'] = 500100;
+//}
+//                $city_data[$v['code_city']] = [
+//                    'id' => $v['code_city'],
+//                    'areaname' => $v['name_city'],
+//                    'parentid' => $v['code_prov'],
+//                    'level' => 2
+//                ];
+
+//                if ($v['code_coun'] == $v['code_city']) {
+//                    $v['code_coun'] = $v['code_coun'] . '01';
+//                }
+//
+//                $district_data[$v['code_coun']] = [
+//                    'id' => $v['code_coun'],
+//                    'areaname' => $v['name_coun'],
+//                    'parentid' => $v['code_city'],
+//                    'level' => 3
+//                ];
+//                $street_data[$v['code_town']] = [
+//                    'id' => $v['code_town'],
+//                    'areaname' => $v['name_town'],
+//                    'parentid' => $v['code_coun'],
+//                    'level' => 4
+//                ];
+//            }
+//        }
+//
+//        $province_data = array_values($province_data);
+//        $city_data = array_values($city_data);
+//        $district_data = array_values($district_data);
+//        $street_data = array_values($street_data);
+//        $another_data = [
+//            ['id' => 810100, 'areaname' => '香港特别行政区', 'level' => 2, 'parentid' => 810000],
+//            ['id' => 810101, 'areaname' => '香港岛', 'level' => 3, 'parentid' => 810100],
+//            ['id' => 820100, 'areaname' => '澳门特别行政区', 'level' => 2, 'parentid' => 820000],
+//            ['id' => 820101, 'areaname' => '澳门岛', 'level' => 3, 'parentid' => 820100],
+//        ];
+//        $address_data = array_merge($province_data, $city_data, $district_data, $another_data);
+//        $address_data = json_encode($address_data, 320);
+//        $street_data = json_encode($street_data, 320);
+//        file_put_contents(dirname(__FILE__) . '/address.txt', $address_data);
+//        file_put_contents(dirname(__FILE__) . '/street.txt', $street_data);
+//
+//    }
+
+}

+ 49 - 0
plugins/address-mgmt/src/admin/SelectController.php

@@ -0,0 +1,49 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: blank
+ * Date: 2020/3/25
+ * Time: 11:28
+ */
+
+namespace Yunshop\AddressMgmt\admin;
+
+
+use app\common\components\BaseController;
+use app\common\models\Address;
+use app\common\models\Street;
+
+class SelectController extends BaseController
+{
+    //获取地址信息
+    /**
+     * @param string type 获取地址级别
+     * @return \Illuminate\Http\JsonResponse
+     */
+    public function getAddress()
+    {
+
+        $type = request()->input('type');
+
+        switch ($type) {
+            case 'province':
+                $addressData = Address::getProvince();
+                break;
+            case 'city':
+                $addressData = Address::getCityByParentId(\YunShop::request()->parentid);
+                break;
+            case 'district':
+                $addressData = Address::getAreaByParentId(\YunShop::request()->parentid);
+                break;
+            case 'street':
+                $addressData = Street::getStreetByParentId(\YunShop::request()->parentid);
+                break;
+            default:
+                $addressData = collect([]);
+        }
+        if ($addressData->isEmpty()) {
+            return $this->errorJson('未检测到数据!', $addressData);
+        }
+        return $this->successJson('成功', $addressData);
+    }
+}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików