hrjy 3 年 前
コミット
f36eef8711
31 ファイル変更2895 行追加420 行削除
  1. 1 3
      app/admin/controller/auction/Auction.php
  2. 84 0
      app/admin/controller/auction/AuctionApply.php
  3. 1 3
      app/admin/controller/auction/AuctionGu.php
  4. 3 2
      app/admin/controller/auction/AuctionOrder.php
  5. 2 2
      app/admin/controller/auction/AuctionProduct.php
  6. 39 41
      app/admin/controller/store/StoreProduct.php
  7. 592 0
      app/admin/controller/ump/StoreMix.php
  8. 54 0
      app/admin/model/auction/AuctionApply.php
  9. 1 0
      app/admin/model/auction/AuctionOrder.php
  10. 8 6
      app/admin/model/store/StoreProductAttr.php
  11. 403 0
      app/admin/model/ump/StoreMix.php
  12. 220 0
      app/admin/view/auction/auction_apply/index.php
  13. 18 1
      app/admin/view/auction/auction_order/index.php
  14. 284 176
      app/admin/view/store/store_product/create.php
  15. 371 0
      app/admin/view/ump/store_mix/attr.php
  16. 121 0
      app/admin/view/ump/store_mix/attr_list.php
  17. 250 0
      app/admin/view/ump/store_mix/index.php
  18. 104 0
      app/admin/view/ump/store_mix/product_list.php
  19. 3 2
      app/api/controller/auction/AuctionController.php
  20. 3 0
      app/api/controller/store/StoreProductController.php
  21. 2 0
      app/models/store/StoreCart.php
  22. 18 2
      app/models/store/StoreOrder.php
  23. 2 0
      app/models/store/StoreProduct.php
  24. 1 0
      route/api/route.php
  25. 285 177
      runtime/admin/temp/3842d4cff02ed8a8fdaa7dea044f6e6b.php
  26. 2 2
      runtime/admin/temp/5a82649edd1b40af6f202faef65620f4.php
  27. 19 2
      runtime/admin/temp/a5e290369d4af2c431b37f2d99f61762.php
  28. 1 1
      runtime/cache/2e/26d95f3b2397f1dbd714cb44636198.php
  29. 1 0
      vendor/dh2y/think-qrcode/src/phpqrcode/73_product_detail_3_is_promoter_1_wap.jpg-errors.txt
  30. 1 0
      vendor/dh2y/think-qrcode/src/phpqrcode/75_product_detail_3_is_promoter_0_wap.jpg-errors.txt
  31. 1 0
      vendor/dh2y/think-qrcode/src/phpqrcode/75_product_detail_3_is_promoter_1_wap.jpg-errors.txt

+ 1 - 3
app/admin/controller/auction/Auction.php

@@ -132,7 +132,6 @@ class Auction extends AuthController
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
-            dump($validate->getError());
         }
         $res = $mode->save($data);
         if ($res){
@@ -167,7 +166,7 @@ class Auction extends AuthController
     public function set_status($id, $status)
     {
 
-        if (empty($id)) Json::fail('修改失败');
+        if (empty($id))return Json::fail('修改失败');
 
         $res = \app\admin\model\auction\Auction::update(['status' => $status, 'id' => $id]);
         if ($res){
@@ -258,7 +257,6 @@ class Auction extends AuthController
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
-            dump($validate->getError());
         }
 
         $res = \app\admin\model\auction\Auction::update($data);

+ 84 - 0
app/admin/controller/auction/AuctionApply.php

@@ -0,0 +1,84 @@
+<?php
+namespace app\admin\controller\auction;
+
+use app\admin\controller\AuthController;
+use app\admin\controller\Union;
+use app\admin\model\auction\AuctionGu;
+use app\admin\model\User;
+use crmeb\services\{ExpressService,
+    JsonService,
+    MiniProgramService,
+    upload\Upload,
+    WechatService,
+    FormBuilder as Form,
+    CacheService,
+    UtilService as Util,
+    JsonService as Json};
+use app\admin\model\system\{
+    SystemAttachment as SystemAttachmentModel, SystemAttachmentCategory as Category
+};
+use think\facade\Route as Url;
+use think\facade\Validate;
+
+/**
+ * 竞拍管理
+ * Class StoreOrder
+ * @package app\admin\controller\store
+ */
+class AuctionApply extends AuthController
+{
+
+
+    public function index()
+    {
+
+
+        return $this->fetch();
+    }
+
+
+    public function list()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['page', 1],
+            ['limit', 20],
+            ['auction']
+        ]);
+        $data = \app\admin\model\auction\AuctionApply::list($where);
+
+        return Json::successlayui($data);
+    }
+
+
+    public function tg($id)
+    {
+        if (empty($id)) return Json::fail('失败');
+
+        $data = \app\admin\model\auction\AuctionApply::where('id', '<>',1)->find($id);
+        if (!$data){
+            return Json::fail('当前状态无法修改');
+        }
+        $res = \app\admin\model\auction\AuctionApply::update(['status' => 2, 'id' => $id]);
+        if ($res){
+            return Json::success('成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+    }
+    public function jj($id)
+    {
+
+        if (empty($id)) Json::fail('失败');
+        $data = \app\admin\model\auction\AuctionApply::where('id', '<>',1)->find($id);
+        if (!$data){
+            return Json::fail('当前状态无法修改');
+        }
+        $res = \app\admin\model\auction\AuctionApply::update(['status' => 0, 'id' => $id]);
+        if ($res){
+            return Json::success('成功!');
+        }else{
+            return Json::fail(\app\admin\model\auction\Auction::getErrorInfo());
+        }
+    }
+}

+ 1 - 3
app/admin/controller/auction/AuctionGu.php

@@ -112,7 +112,6 @@ class AuctionGu extends AuthController
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
-            dump($validate->getError());
         }
         $user = \app\models\user\User::where('uid', $data['uid'])->find();
         if ($user['spread_uid']){
@@ -152,7 +151,7 @@ class AuctionGu extends AuthController
     public function set_status($id, $status)
     {
 
-        if (empty($id)) Json::fail('修改失败');
+        if (empty($id))return Json::fail('修改失败');
 
         $res = \app\admin\model\auction\AuctionGu::update(['status' => $status, 'id' => $id]);
         if ($res){
@@ -221,7 +220,6 @@ class AuctionGu extends AuthController
         ]);
         if (!$validate->check($data)) {
             return Json::fail($validate->getError());
-            dump($validate->getError());
         }
         $user = \app\models\user\User::where('uid', $data['uid'])->find();
         if ($user['spread_uid']){

+ 3 - 2
app/admin/controller/auction/AuctionOrder.php

@@ -35,7 +35,7 @@ class AuctionOrder extends AuthController
 
         $this->assign([
             'year' => get_month(),
-            'auction'=> $list
+            'auction'=> $list,
 
         ]);
         return $this->fetch();
@@ -54,7 +54,8 @@ class AuctionOrder extends AuthController
             ['limit', 20],
             ['auction_id', ''],
             ['store_name', ''],
-            ['data', '']
+            ['data', ''],
+            ['status', '']
         ]);
         $data = model::list($where);
         foreach ($data['data'] as $key => $val){

+ 2 - 2
app/admin/controller/auction/AuctionProduct.php

@@ -115,7 +115,7 @@ class AuctionProduct extends AuthController
      */
     public function delete($id)
     {
-        if (!$id) Json::fail('删除失败');
+        if (!$id)return Json::fail('删除失败');
 
         $res = model::where('id', $id)->delete();
         if ($res){
@@ -130,7 +130,7 @@ class AuctionProduct extends AuthController
     public function set_status($id, $status)
     {
 
-        if (empty($id)) Json::fail('修改失败');
+        if (empty($id))return Json::fail('修改失败');
 
         $res = model::update(['is_show' => $status, 'id' => $id]);
         if ($res){

+ 39 - 41
app/admin/controller/store/StoreProduct.php

@@ -78,7 +78,7 @@ class StoreProduct extends AuthController
             ['cate_id', ''],
             ['excel', 0],
             ['order', ''],
-            [['type', 'd'], $this->request->param('type/d')]
+            ['type', $this->request->param('type')]
         ]);
         return Json::successlayui(ProductModel::ProductList($where));
     }
@@ -184,7 +184,7 @@ class StoreProduct extends AuthController
             $productInfo['description'] = htmlspecialchars_decode(StoreDescription::getDescription($id));
             $productInfo['slider_image'] = is_string($productInfo['slider_image']) ? json_decode($productInfo['slider_image'], true) : [];
             if ($productInfo['spec_type'] == 1) {
-                $result = StoreProductAttrResult::getResult($id, 0);
+                $result = StoreProductAttrResult::getResult($id);
                 foreach ($result['value'] as $k => $v) {
                     $num = 1;
                     foreach ($v['detail'] as $dv) {
@@ -192,21 +192,18 @@ class StoreProduct extends AuthController
                         $num++;
                     }
                 }
-                $productInfo['items'] = $result['attr'];
-                $productInfo['attrs'] = $result['value'];
-                $productInfo['attr'] = ['pic' => '', 'price' => 0, 'cost' => 0, 'ot_price' => 0, 'stock' => 0, 'bar_code' => '', 'weight' => 0, 'volume' => 0, 'brokerage' => 0, 'brokerage_two' => 0];
+                $productInfo['items'] = $result['attr'] ?? [];
+                $productInfo['attrs'] = $result['value'] ?? [];
+                $productInfo['attr'] = ['pic' => '', 'price' => 0, 'integral' => 0, 'cost' => 0, 'ot_price' => 0, 'stock' => 0, 'bar_code' => '', 'weight' => 0, 'volume' => 0, 'brokerage' => 0, 'brokerage_two' => 0];
             } else {
-                $result = StoreProductAttrValue::where('product_id', $id)->where('type', 0)->find();
-                if ($result) {
-                    $single = $result->toArray();
-                } else {
-                    $single = [];
-                }
+                $result = StoreProductAttrResult::getResult($id);
+                $single = isset($result['value'][0]) ? $result['value'][0] : [];
                 $productInfo['items'] = [];
                 $productInfo['attrs'] = [];
                 $productInfo['attr'] = [
-                    'pic' => $single['image'] ?? '',
+                    'pic' => $single['pic'] ?? '',
                     'price' => $single['price'] ?? 0,
+                    'integral' => $single['integral'] ?? 0,
                     'cost' => $single['cost'] ?? 0,
                     'ot_price' => $single['ot_price'] ?? 0,
                     'stock' => $single['stock'] ?? 0,
@@ -286,6 +283,7 @@ class StoreProduct extends AuthController
         $data['activity'] = implode(',', $data['activity']);
         $detail = $data['attrs'];
         $data['price'] = min(array_column($detail, 'price'));
+        $data['integral'] = min(array_column($detail, 'integral'));
         $data['ot_price'] = min(array_column($detail, 'ot_price'));
         $data['cost'] = min(array_column($detail, 'cost'));
         $attr = $data['items'];
@@ -504,7 +502,7 @@ class StoreProduct extends AuthController
      * 生成属性
      * @param int $id
      */
-    public function is_format_attr($id = 0, $type = 0)
+    public function is_format_attr($id = 0)
     {
         $data = Util::postMore([
             ['attrs', []],
@@ -516,15 +514,14 @@ class StoreProduct extends AuthController
         $count = 0;
         foreach ($value as $key => $item) {
             $detail = $item['detail'];
-            sort($item['detail'], SORT_STRING);
+//            sort($item['detail'], SORT_STRING);
             $suk = implode(',', $item['detail']);
-            $types = 1;
             if ($id) {
-                $sukValue = StoreProductAttrValue::where('product_id', $id)->where('type', 0)->where('suk', $suk)->column('bar_code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two', 'suk');
+                $sukValue = StoreProductAttrValue::where('product_id', $id)->where('type', 0)->where('suk', $suk)->column('bar_code,cost,price,ot_price,integral,stock,image as pic,weight,volume,brokerage,brokerage_two', 'suk');
                 if (!count($sukValue)) {
-                    if ($type == 0) $types = 0; //编辑商品时,将没有规格的数据不生成默认值
                     $sukValue[$suk]['pic'] = '';
                     $sukValue[$suk]['price'] = 0;
+                    $sukValue[$suk]['integral'] = 0;
                     $sukValue[$suk]['cost'] = 0;
                     $sukValue[$suk]['ot_price'] = 0;
                     $sukValue[$suk]['stock'] = 0;
@@ -537,6 +534,7 @@ class StoreProduct extends AuthController
             } else {
                 $sukValue[$suk]['pic'] = '';
                 $sukValue[$suk]['price'] = 0;
+                $sukValue[$suk]['integral'] = 0;
                 $sukValue[$suk]['cost'] = 0;
                 $sukValue[$suk]['ot_price'] = 0;
                 $sukValue[$suk]['stock'] = 0;
@@ -546,32 +544,32 @@ class StoreProduct extends AuthController
                 $sukValue[$suk]['brokerage'] = 0;
                 $sukValue[$suk]['brokerage_two'] = 0;
             }
-            if ($types) { //编辑商品时,将没有规格的数据不生成默认值
-                foreach (array_keys($detail) as $k => $title) {
-                    $header[$k]['title'] = $title;
-                    $header[$k]['align'] = 'center';
-                    $header[$k]['minWidth'] = 130;
-                }
-                foreach (array_values($detail) as $k => $v) {
-                    $valueNew[$count]['value' . ($k + 1)] = $v;
-                    $header[$k]['key'] = 'value' . ($k + 1);
-                }
-                $valueNew[$count]['detail'] = $detail;
-                $valueNew[$count]['pic'] = $sukValue[$suk]['pic'] ?? '';
-                $valueNew[$count]['price'] = $sukValue[$suk]['price'] ? floatval($sukValue[$suk]['price']) : 0;
-                $valueNew[$count]['cost'] = $sukValue[$suk]['cost'] ? floatval($sukValue[$suk]['cost']) : 0;
-                $valueNew[$count]['ot_price'] = isset($sukValue[$suk]['ot_price']) ? floatval($sukValue[$suk]['ot_price']) : 0;
-                $valueNew[$count]['stock'] = $sukValue[$suk]['stock'] ? intval($sukValue[$suk]['stock']) : 0;
-                $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
-                $valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ?? 0;
-                $valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ?? 0;
-                $valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ?? 0;
-                $valueNew[$count]['brokerage_two'] = $sukValue[$suk]['brokerage_two'] ?? 0;
-                $count++;
+            foreach (array_keys($detail) as $k => $title) {
+                $header[$k]['title'] = $title;
+                $header[$k]['align'] = 'center';
+                $header[$k]['minWidth'] = 130;
+            }
+            foreach (array_values($detail) as $k => $v) {
+                $valueNew[$count]['value' . ($k + 1)] = $v;
+                $header[$k]['key'] = 'value' . ($k + 1);
             }
+            $valueNew[$count]['detail'] = $detail;
+            $valueNew[$count]['pic'] = $sukValue[$suk]['pic'] ?? '';
+            $valueNew[$count]['price'] = $sukValue[$suk]['price'] ? floatval($sukValue[$suk]['price']) : 0;
+            $valueNew[$count]['integral'] = $sukValue[$suk]['integral'] ? floatval($sukValue[$suk]['integral']) : 0;
+            $valueNew[$count]['cost'] = $sukValue[$suk]['cost'] ? floatval($sukValue[$suk]['cost']) : 0;
+            $valueNew[$count]['ot_price'] = isset($sukValue[$suk]['ot_price']) ? floatval($sukValue[$suk]['ot_price']) : 0;
+            $valueNew[$count]['stock'] = $sukValue[$suk]['stock'] ? intval($sukValue[$suk]['stock']) : 0;
+            $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
+            $valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ?? 0;
+            $valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ?? 0;
+            $valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ?? 0;
+            $valueNew[$count]['brokerage_two'] = $sukValue[$suk]['brokerage_two'] ?? 0;
+            $count++;
         }
         $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '售价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 120];
+        $header[] = ['title' => '积分', 'slot' => 'integral', 'align' => 'center', 'minWidth' => 120];
         $header[] = ['title' => '成本价', 'slot' => 'cost', 'align' => 'center', 'minWidth' => 140];
         $header[] = ['title' => '原价', 'slot' => 'ot_price', 'align' => 'center', 'minWidth' => 140];
         $header[] = ['title' => '库存', 'slot' => 'stock', 'align' => 'center', 'minWidth' => 140];
@@ -717,10 +715,10 @@ class StoreProduct extends AuthController
             if ($res1 || $res2 || $res3) {
                 return Json::successful('该商品有活动开启,无法删除属性');
             } else {
-                return Json::fail('删除成功');
+                return Json::fail();
             }
         } else {
-            return Json::fail('没有参数ID');
+            return Json::fail();
         }
     }
 }

+ 592 - 0
app/admin/controller/ump/StoreMix.php

@@ -0,0 +1,592 @@
+<?php
+
+namespace app\admin\controller\ump;
+
+use app\admin\controller\AuthController;
+use app\admin\model\store\{StoreDescription,
+    StoreProductAttr,
+    StoreProductAttrResult,
+    StoreProduct as ProductModel,
+    StoreProductAttrValue};
+use crmeb\traits\CurdControllerTrait;
+use think\Exception;
+use think\exception\ErrorException;
+use think\exception\ValidateException;
+use think\facade\Route as Url;
+use app\admin\model\system\{SystemAttachment, SystemGroupData, ShippingTemplates};
+use app\admin\model\ump\{StoreSeckillAttr, StoreSeckillAttrResult, StoreMix as StoreSeckillModel, StoreSeckillTime};
+use crmeb\services\{
+    FormBuilder as Form, UtilService as Util, JsonService as Json
+};
+use app\admin\model\store\StoreCategory;
+
+/**
+ * 限时秒杀  控制器
+ * Class StoreSeckill
+ * @package app\admin\controller\store
+ */
+class StoreMix extends AuthController
+{
+
+    use CurdControllerTrait;
+
+    protected $bindModel = StoreSeckillModel::class;
+
+    /**
+     * 显示资源列表
+     *
+     * @return \think\Response
+     */
+    public function index()
+    {
+        $this->assign('countSeckill', StoreSeckillModel::getSeckillCount());
+        $this->assign('seckillId', StoreSeckillModel::getSeckillIdAll());
+        return $this->fetch();
+    }
+
+    public function save_excel()
+    {
+        $where = Util::getMore([
+            ['status', ''],
+            ['store_name', '']
+        ]);
+        StoreSeckillModel::SaveExcel($where);
+    }
+
+    /**
+     * 异步获取砍价数据
+     */
+    public function get_seckill_list()
+    {
+        $where = Util::getMore([
+            ['page', 1],
+            ['limit', 20],
+            ['status', ''],
+            ['store_name', '']
+        ]);
+        $seckillList = StoreSeckillModel::systemPage($where);
+        if (is_object($seckillList['list'])) $seckillList['list'] = $seckillList['list']->toArray();
+        $data = $seckillList['list']['data'];
+        foreach ($data as $k => $v) {
+            $end_time = $v['stop_time'] ? date('Y/m/d', $v['stop_time']) : '';
+            if ($end_time) {
+                $config = SystemGroupData::get($v['time_id']);
+                if ($config) {
+                    $arr = json_decode($config->value, true);
+                    $start_hour = intval($arr['time']['value']);
+                    $continued = intval($arr['continued']['value']);
+                    $end_hour = $start_hour + $continued;
+                    $end_time = $end_time . ' ' . $end_hour . ':00:00';
+                }
+            }
+            $data[$k]['_stop_time'] = $end_time;
+        }
+        return Json::successlayui(['count' => $seckillList['list']['total'], 'data' => $data]);
+    }
+
+    public function get_seckill_id()
+    {
+        return Json::successlayui(StoreSeckillModel::getSeckillIdAll());
+    }
+
+    /**
+     * 添加秒杀商品
+     * @return form-builder
+     */
+    public function create()
+    {
+        $f = array();
+        $f[] = Form::frameImageOne('product', '选择商品', Url::buildUrl('productList', array('fodder' => 'product')))->icon('plus')->width('100%')->height('500px');
+        $f[] = Form::hidden('product_id', '');
+        $f[] = Form::hidden('description', '');
+        $f[] = Form::input('title', '商品标题');
+        $f[] = Form::input('info', '秒杀活动简介')->type('textarea');
+        $f[] = Form::input('unit_name', '单位')->placeholder('个、位');
+        $f[] = Form::select('temp_id', '秒杀运费模板')->setOptions(function () {
+            $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::dateRange('section_time', '活动日期');
+        $f[] = Form::select('time_id', '开始时间')->setOptions(function () {
+            $list = SystemGroupData::getGroupData('routine_seckill_time', 20);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['time'] . '点开始,持续' . $menu['continued'] . '小时'];//,'disabled'=>$menu['pid']== 0];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')))->maxLength(5)->icon('images')->width('100%')->height('500px');
+        $f[] = Form::number('sort', '排序')->col(12);
+        $f[] = Form::number('num', '单次购买商品个数')->precision(0)->col(12);
+        $f[] = Form::number('give_integral', '赠送积分')->min(0)->precision(0)->col(12);
+        $f[] = Form::radio('is_hot', '热门推荐', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
+        $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    /**
+     * 保存秒杀商品
+     * @param int $id
+     */
+    public function save($id = 0)
+    {
+        $data = Util::postMore([
+            'title',
+            'product_id',
+            'info',
+            'unit_name',
+            ['image', ''],
+            ['images', []],
+            ['price', 0],
+            ['ot_price', 0],
+            ['cost', 0],
+            ['sales', 0],
+            ['stock', 0],
+            ['sort', 0],
+            ['give_integral', 0],
+            ['postage', 0],
+            ['section_time', []],
+            ['is_postage', 0],
+            ['cost', 0],
+            ['is_hot', 0],
+            ['status', 0],
+            ['num', 0],
+            'time_id',
+            'temp_id',
+            ['weight', 0],
+            ['volume', 0],
+        ]);
+        $data['description'] = StoreDescription::getDescription($data['product_id']);
+        if (!$data['title']) return Json::fail('请输入商品标题');
+        if (!$data['unit_name']) return Json::fail('请输入商品单位');
+        if (!$data['product_id']) return Json::fail('商品ID不能为空');
+        if (count($data['section_time']) < 1) return Json::fail('请选择活动时间');
+        if (!$data['time_id']) return Json::fail('时间段不能为空');
+        $data['start_time'] = strtotime($data['section_time'][0] .' 00:00:00');
+        $data['stop_time'] = strtotime($data['section_time'][1].' 23:59:59');
+        unset($data['section_time']);
+        if (!$data['image']) return Json::fail('请选择推荐图');
+        if (count($data['images']) < 1) return Json::fail('请选择轮播图');
+        $data['images'] = json_encode($data['images']);
+        if ($data['num'] < 1) return Json::fail('请输入单次秒杀个数');
+        if ($id) {
+            unset($data['description']);
+            $product = StoreSeckillModel::get($id);
+            if (!$product) return Json::fail('数据不存在!');
+            StoreSeckillModel::edit($data, $id);
+            return Json::successful('编辑成功!');
+        } else {
+            if(StoreSeckillModel::checkSeckill($data['product_id'],$data['time_id'])) return Json::fail('该商品当前时间段已有秒杀活动');
+            $data['add_time'] = time();
+            $res = StoreSeckillModel::create($data);
+            $description['product_id'] = $res['id'];
+            $description['description'] = htmlspecialchars_decode($data['description']);
+            $description['type'] = 1;
+            StoreDescription::create($description);
+            return Json::successful('添加成功!');
+        }
+
+    }
+
+    /** 开启秒杀
+     * @param $id
+     * @return mixed|void
+     */
+    public function seckill($id)
+    {
+        if (!$id) return $this->failed('数据不存在');
+        $product = ProductModel::get($id);
+        if (!$product) return Json::fail('数据不存在!');
+        $f = array();
+        $f[] = Form::input('title', '商品标题', $product->getData('store_name'));
+        $f[] = Form::hidden('product_id', $id);
+        $f[] = Form::input('info', '秒杀活动简介', $product->getData('store_info'))->type('textarea');
+        $f[] = Form::input('unit_name', '单位', $product->getData('unit_name'))->placeholder('个、位');
+        $f[] = Form::select('temp_id', '秒杀运费模板', (string)$product->getData('temp_id'))->setOptions(function () {
+            $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::dateRange('section_time', '活动日期');
+        $f[] = Form::select('time_id', '开始时间')->setOptions(function () {
+            $list = SystemGroupData::getGroupData('routine_seckill_time', 20);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['time'] . '点开始,持续' . $menu['continued'] . '小时'];//,'disabled'=>$menu['pid']== 0];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $product->getData('image'))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')), json_decode($product->getData('slider_image')))->maxLength(5)->icon('images')->width('100%')->height('500px');
+        $f[] = Form::number('price', '秒杀价')->min(0)->col(12);
+        $f[] = Form::number('ot_price', '原价', $product->getData('price'))->min(0)->col(12);
+        $f[] = Form::number('cost', '成本价', $product->getData('cost'))->min(0)->col(12);
+        $f[] = Form::number('stock', '库存', $product->getData('stock'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sales', '销量', $product->getData('sales'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('sort', '排序', $product->getData('sort'))->col(12);
+        $f[] = Form::number('num', '单次购买商品个数', 1)->precision(0)->col(12);
+        $f[] = Form::number('give_integral', '赠送积分', $product->getData('give_integral'))->min(0)->precision(0)->col(12);
+        $f[] = Form::number('weight', '重量', 0)->min(0)->col(12);
+        $f[] = Form::number('volume', '体积', 0)->min(0)->col(12);
+        $f[] = Form::radio('is_hot', '热门推荐', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
+        $f[] = Form::radio('status', '活动状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
+        $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save'));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    /**
+     * 显示编辑资源表单页.
+     *
+     * @param int $id
+     * @return \think\Response
+     */
+    public function edit($id)
+    {
+        if (!$id) return $this->failed('数据不存在');
+        $product = StoreSeckillModel::get($id);
+//        $time = StoreSeckillTime::getSeckillTime($id);
+        if (!$product) return Json::fail('数据不存在!');
+        $f = array();
+        $f[] = Form::input('product_id','产品ID', $product->getData('product_id'))->disabled(true);
+        $f[] = Form::input('title', '商品标题', $product->getData('title'));
+        $f[] = Form::input('info', '秒杀活动简介', $product->getData('info'))->type('textarea');
+        $f[] = Form::input('unit_name', '单位', $product->getData('unit_name'))->placeholder('个、位');
+        $f[] = Form::select('temp_id', '秒杀运费模板', (string)$product->getData('temp_id'))->setOptions(function () {
+            $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::dateRange('section_time', '活动时间', date('Y-m-d H:i:s', (int)$product->getData('start_time')), date('Y-m-d H:i:s', (int)$product->getData('stop_time')));
+        $f[] = Form::select('time_id', '开始时间', (string)$product->getData('time_id'))->setOptions(function () {
+            $list = SystemGroupData::getGroupData('routine_seckill_time', 20);
+            $menus = [];
+            foreach ($list['data'] as $menu) {
+                $menus[] = ['value' => $menu['id'], 'label' => $menu['time'] . '点开始,持续' . $menu['continued'] . '小时'];//,'disabled'=>$menu['pid']== 0];
+            }
+            return $menus;
+        })->filterable(1)->col(12);
+        $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $product->getData('image'))->icon('image')->width('100%')->height('500px');
+        $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')), json_decode($product->getData('images')))->maxLength(5)->icon('images')->width('100%')->height('500px');
+        $f[] = Form::number('sort', '排序', $product->getData('sort'))->col(12);
+        $f[] = Form::hidden('stock', $product->getData('stock'));
+        $f[] = Form::hidden('price', $product->getData('price'));
+        $f[] = Form::hidden('ot_price', $product->getData('ot_price'));
+        $f[] = Form::hidden('sales', $product->getData('sales'));
+        $f[] = Form::number('num', '单次购买商品个数', $product->getData('num'))->precision(0)->col(12);
+        $f[] = Form::number('give_integral', '赠送积分', $product->getData('give_integral'))->min(0)->precision(0)->col(12);
+        $f[] = Form::radio('is_hot', '热门推荐', $product->getData('is_hot'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
+        $f[] = Form::hidden('status', $product->getData('status'));
+        $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save', compact('id')));
+        $this->assign(compact('form'));
+        return $this->fetch('public/form-builder');
+    }
+
+    /**
+     * 删除指定资源
+     *
+     * @param int $id
+     * @return \think\Response
+     */
+    public function delete($id)
+    {
+        if (!$id) return $this->failed('数据不存在');
+        $product = StoreSeckillModel::get($id);
+        if (!$product) return Json::fail('数据不存在!');
+        if ($product['is_del']) return Json::fail('已删除!');
+        $data['is_del'] = 1;
+        if (!StoreSeckillModel::edit($data, $id))
+            return Json::fail(StoreSeckillModel::getErrorInfo('删除失败,请稍候再试!'));
+        else
+            return Json::successful('删除成功!');
+    }
+
+    public function edit_content($id)
+    {
+        if (!$id) return $this->failed('数据不存在');
+        $seckill = StoreSeckillModel::get($id);
+        if (!$seckill) return Json::fail('数据不存在!');
+        $this->assign([
+            'content' => htmlspecialchars_decode(StoreDescription::getDescription($id, 1)),
+            'field' => 'description',
+            'action' => Url::buildUrl('change_field', ['id' => $id, 'field' => 'description'])
+        ]);
+        return $this->fetch('public/edit_content');
+    }
+
+    public function change_field($id)
+    {
+        if (!$id) return $this->failed('数据不存在');
+        $seckill = StoreSeckillModel::get($id);
+        if (!$seckill) return Json::fail('数据不存在!');
+        $data['description'] = request()->post('description');
+        StoreDescription::saveDescription($data['description'], $id, 1);
+        $res = StoreSeckillModel::edit($data, $id);
+        if ($res)
+            return Json::successful('添加成功');
+        else
+            return Json::fail('添加失败');
+    }
+
+    /**
+     * 属性页面
+     * @param $id
+     * @return mixed|void
+     */
+    public function attr($id)
+    {
+        if (!$id) return $this->failed('数据不存在!');
+        $result = StoreSeckillAttrResult::getResult($id);
+        $image = StoreSeckillModel::where('id', $id)->value('image');
+        $this->assign(compact('id', 'result', 'image'));
+        return $this->fetch();
+    }
+
+    /**
+     * 秒杀属性选择页面
+     * @param $id
+     * @return string|void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function attr_list($id)
+    {
+        if (!$id) return $this->failed('数据不存在!');
+        $seckillInfo = StoreSeckillModel::where('id', $id)->find();
+        $seckillResult = StoreProductAttrResult::where('product_id', $id)->where('type', 1)->value('result');
+        $productResult = StoreProductAttrResult::where('product_id', $seckillInfo['product_id'])->where('type', 0)->value('result');
+        if ($productResult) {
+            $attr = json_decode($productResult, true)['attr'];
+            $productAttr = $this->get_attr($attr, $seckillInfo['product_id'], 0);
+            $seckillAttr = $this->get_attr($attr, $id, 1);
+            foreach ($productAttr as $pk => $pv) {
+                foreach ($seckillAttr as $sv) {
+                    if ($pv['detail'] == $sv['detail']) {
+                        $productAttr[$pk] = $sv;
+                    }
+                }
+            }
+        } else {
+            if ($seckillResult) {
+                $attr = json_decode($seckillResult, true)['attr'];
+                $productAttr = $this->get_attr($attr, $id, 1);
+            } else {
+                $attr[0]['value'] = '默认';
+                $attr[0]['detailValue'] = '';
+                $attr[0]['attrHidden'] = '';
+                $attr[0]['detail'][0] = '默认';
+                $productAttr[0]['value1'] = '默认';
+                $productAttr[0]['detail'] = json_encode(['默认' => '默认']);
+                $productAttr[0]['pic'] = $seckillInfo['image'];
+                $productAttr[0]['price'] = $seckillInfo['price'];
+                $productAttr[0]['cost'] = $seckillInfo['cost'];
+                $productAttr[0]['ot_price'] = $seckillInfo['ot_price'];
+                $productAttr[0]['stock'] = $seckillInfo['stock'];
+                $productAttr[0]['quota'] = 0;
+                $productAttr[0]['bar_code'] = $seckillInfo['bar_code'];
+                $productAttr[0]['weight'] = 0;
+                $productAttr[0]['volume'] = 0;
+                $productAttr[0]['brokerage'] = 0;
+                $productAttr[0]['brokerage_two'] = 0;
+                $productAttr[0]['check'] = 0;
+            }
+        }
+        $attrs['attr'] = $attr;
+        $attrs['value'] = $productAttr;
+        $this->assign('attr', $attrs);
+        $this->assign('id', $id);
+        return $this->fetch();
+    }
+
+    /**
+     * 秒杀属性保存页面
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function save_attr()
+    {
+        $data = Util::postMore([
+            ['attr', []],
+            ['ids', []],
+            ['id', 0],
+        ]);
+        if (!$data['id']) return Json::fail('数据不存在!');
+        if (!$data['ids']) return Json::fail('你没有选择任何规格!');
+        $productId = StoreSeckillModel::where('id', $data['id'])->value('product_id');
+        $attr = json_decode(StoreProductAttrResult::where('product_id', $productId)->where('type', 0)->value('result'), true)['attr'];
+        foreach ($data['attr'] as $k => $v) {
+            if (in_array($k, $data['ids'])) {
+                $v['detail'] = json_decode(htmlspecialchars_decode($v['detail']), true);
+                $detail[$k] = $v;
+            }
+        }
+        if (min(array_column($detail, 'quota')) == 0) return Json::fail('限购不能为0');
+        $price = min(array_column($detail, 'price'));
+        $otPrice = min(array_column($detail, 'ot_price'));
+        $quota = array_sum(array_column($detail, 'quota'));
+        $stock = array_sum(array_column($detail, 'stock'));
+        if (!$attr) {
+            $attr[0]['value'] = '默认';
+            $attr[0]['detailValue'] = '';
+            $attr[0]['attrHidden'] = '';
+            $attr[0]['detail'][0] = '默认';
+        }
+        StoreProductAttr::createProductAttr($attr, $detail, $data['id'], 1);
+        StoreSeckillModel::where('id', $data['id'])->update(['stock' => $stock, 'quota' => $quota, 'quota_show' => $quota, 'price' => $price, 'ot_price' => $otPrice]);
+        return Json::successful('修改成功!');
+    }
+
+    /**
+     * 生成属性
+     * @param int $id
+     */
+    public function is_format_attr($id = 0)
+    {
+        if (!$id) return Json::fail('商品不存在');
+        list($attr, $detail) = Util::postMore([
+            ['items', []],
+            ['attrs', []]
+        ], $this->request, true);
+        $product = StoreSeckillModel::get($id);
+        if (!$product) return Json::fail('商品不存在');
+        $attrFormat = attr_format($attr)[1];
+        if (count($detail)) {
+            foreach ($attrFormat as $k => $v) {
+                foreach ($detail as $kk => $vv) {
+                    if ($v['detail'] == $vv['detail']) {
+                        $attrFormat[$k]['price'] = $vv['price'];
+                        $attrFormat[$k]['sales'] = $vv['sales'];
+                        $attrFormat[$k]['pic'] = $vv['pic'];
+                        $attrFormat[$k]['check'] = false;
+                        break;
+                    } else {
+                        $attrFormat[$k]['price'] = '';
+                        $attrFormat[$k]['sales'] = '';
+                        $attrFormat[$k]['pic'] = $product['image'];
+                        $attrFormat[$k]['check'] = true;
+                    }
+                }
+            }
+        } else {
+            foreach ($attrFormat as $k => $v) {
+                $attrFormat[$k]['price'] = $product['price'];
+                $attrFormat[$k]['sales'] = $product['stock'];
+                $attrFormat[$k]['pic'] = $product['image'];
+                $attrFormat[$k]['check'] = false;
+            }
+        }
+        return Json::successful($attrFormat);
+    }
+
+    /**
+     * 添加 修改属性
+     * @param $id
+     */
+    public function set_attr($id)
+    {
+        if (!$id) return $this->failed('商品不存在!');
+        list($attr, $detail) = Util::postMore([
+            ['items', []],
+            ['attrs', []]
+        ], $this->request, true);
+        $res = StoreSeckillAttr::createProductAttr($attr, $detail, $id);
+        if ($res)
+            return $this->successful('编辑属性成功!');
+        else
+            return $this->failed(StoreSeckillAttr::getErrorInfo());
+    }
+
+    /**
+     * 清除属性
+     * @param $id
+     */
+    public function clear_attr($id)
+    {
+        if (!$id) return $this->failed('商品不存在!');
+        if (false !== StoreSeckillAttr::clearProductAttr($id) && false !== StoreSeckillAttrResult::clearResult($id))
+            return $this->successful('清空商品属性成功!');
+        else
+            return $this->failed(StoreSeckillAttr::getErrorInfo('清空商品属性失败!'));
+    }
+
+    /**
+     * 修改秒杀商品状态
+     * @param $status
+     * @param int $id
+     */
+    public function set_seckill_status($status, $id = 0)
+    {
+        if (!$id) return Json::fail('参数错误');
+        $res = StoreProductAttrValue::where('product_id', $id)->where('type', 1)->find();
+        if (!$res) return Json::fail('请先配置规格');
+        $res = StoreSeckillModel::edit(['status' => $status], $id);
+        if ($res) return Json::successful('修改成功');
+        else return Json::fail('修改失败');
+    }
+
+    /**
+     * 秒杀获取商品列表
+     * @return string
+     * @throws \Exception
+     */
+    public function productList()
+    {
+        $cate = StoreCategory::getTierList(null, 1);
+        $this->assign('cate', $cate);
+        return $this->fetch();
+    }
+
+    /**
+     * 获取秒杀商品规格
+     * @param $attr
+     * @param $id
+     * @param $type
+     * @return array
+     */
+    public function get_attr($attr, $id, $type)
+    {
+        $value = attr_format($attr)[1];
+        $valueNew = [];
+        $count = 0;
+        foreach ($value as $key => $item) {
+            $detail = $item['detail'];
+            sort($item['detail'], SORT_STRING);
+            $suk = implode(',', $item['detail']);
+            $sukValue = StoreProductAttrValue::where('product_id', $id)->where('type', $type)->where('suk', $suk)->column('bar_code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two,quota', 'suk');
+            if (count($sukValue)) {
+                foreach (array_values($detail) as $k => $v) {
+                    $valueNew[$count]['value' . ($k + 1)] = $v;
+                }
+                $valueNew[$count]['detail'] = json_encode($detail);
+                $valueNew[$count]['pic'] = $sukValue[$suk]['pic'] ?? '';
+                $valueNew[$count]['price'] = isset($sukValue[$suk]['price']) ? floatval($sukValue[$suk]['price']) : 0;
+                $valueNew[$count]['cost'] = isset($sukValue[$suk]['cost']) ? floatval($sukValue[$suk]['cost']) : 0;
+                $valueNew[$count]['ot_price'] = isset($sukValue[$suk]['ot_price']) ? floatval($sukValue[$suk]['ot_price']) : 0;
+                $valueNew[$count]['stock'] = isset($sukValue[$suk]['stock']) ? intval($sukValue[$suk]['stock']) : 0;
+                $valueNew[$count]['quota'] = isset($sukValue[$suk]['quota']) ? intval($sukValue[$suk]['quota']) : 0;
+                $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
+                $valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ?? 0;
+                $valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ?? 0;
+                $valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ?? 0;
+                $valueNew[$count]['brokerage_two'] = $sukValue[$suk]['brokerage_two'] ?? 0;
+                $valueNew[$count]['check'] = $type != 0 ? 1 : 0;
+                $count++;
+            }
+        }
+        return $valueNew;
+    }
+}

+ 54 - 0
app/admin/model/auction/AuctionApply.php

@@ -0,0 +1,54 @@
+<?php
+
+/**
+ *
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/02
+ */
+
+namespace app\admin\model\auction;
+
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+
+/**
+ * 场馆 Model
+ * Class WechatNews
+ * @package app\admin\model\wechat
+ */
+class AuctionApply extends BaseModel
+{
+
+    use ModelTrait;
+
+    protected $pk = 'id';
+
+    protected $name = 'auction_apply';
+    protected $autoWriteTimestamp = true;
+
+
+    public static function list($where)
+    {
+        $model = self::alias('a')
+            ->field('a.*, u.nickname,u.avatar as image')
+            ->order('a.id DESC')
+            ->leftJoin('user u', 'a.uid = u.uid');
+
+        if ($where['auction']) $model->where('u.nickname', 'like', '%'.$where['auction'].'%');
+        if ($where['page'] && $where['limit']){
+            $model->page($where['page'], $where['limit']);
+        }else{
+            $model->page(20, 1);
+        }
+
+        $data['count'] = $model->count();
+        $list = $model->select();
+        $data['data'] = empty($list) ? [] : $list->toArray();
+        return $data;
+
+    }
+
+
+
+
+}

+ 1 - 0
app/admin/model/auction/AuctionOrder.php

@@ -41,6 +41,7 @@ class AuctionOrder extends BaseModel
 
 
         if (trim($where['store_name']) != '') $model->where('a.id|u.account|u.nickname|a.order_id', 'like', '%'.$where['store_name'].'%');
+        if (trim($where['status']) != '') $model->where('a.status', $where['status']);
         if (trim($where['auction_id']) != '') $model->where('a.auction_id', $where['auction_id']);
         if (trim($where['data']) != '') $model = self::getModelTime($where, $model,  'a.create_time');
 

+ 8 - 6
app/admin/model/store/StoreProductAttr.php

@@ -31,7 +31,7 @@ class StoreProductAttr extends BaseModel
     }
 
 
-    public static function createProductAttr($attrList, $valueList, $productId, $type=0)
+    public static function createProductAttr($attrList, $valueList, $productId, $type = 0)
     {
         $result = ['attr' => $attrList, 'value' => $valueList];
         $attrValueList = [];
@@ -83,7 +83,7 @@ class StoreProductAttr extends BaseModel
             ];
         }
         foreach ($valueList as $k => $value) {
-            sort($value['detail'], SORT_STRING);
+//            sort($value['detail'], SORT_STRING);
             $suk = implode(',', $value['detail']);
             $valueGroup[$suk] = [
                 'product_id' => $productId,
@@ -92,7 +92,7 @@ class StoreProductAttr extends BaseModel
                 'cost' => $value['cost'],
                 'ot_price' => $value['ot_price'],
                 'stock' => $value['stock'],
-                'unique' => StoreProductAttrValue::where(['product_id'=>$productId,'suk'=>$suk,'type'=>$type])->value('unique') ? : '',
+                'unique' => StoreProductAttrValue::where(['product_id' => $productId, 'suk' => $suk, 'type' => $type])->value('unique') ?: '',
                 'image' => $value['pic'],
                 'bar_code' => $value['bar_code'] ?? '',
                 'weight' => $value['weight'] ?? 0,
@@ -101,13 +101,15 @@ class StoreProductAttr extends BaseModel
                 'brokerage_two' => $value['brokerage_two'] ?? 0,
                 'type' => $type,
                 'quota' => $value['quota'] ?? 0,
+                'integral' => $value['integral'] ?? 0,
                 'quota_show' => $value['quota'] ?? 0,
+                'point' => $value['point'] ?? 0,
             ];
         }
         if (!count($attrGroup) || !count($valueGroup)) return self::setErrorInfo('请设置至少一个属性!');
         $attrModel = new self;
         $attrValueModel = new StoreProductAttrValue;
-        if (!self::clearProductAttr($productId,$type)) return false;
+        if (!self::clearProductAttr($productId, $type)) return false;
         $res = false !== $attrModel->saveAll($attrGroup)
             && false !== $attrValueModel->saveAll($valueGroup)
             && false !== StoreProductAttrResult::setResult($result, $productId, $type);
@@ -117,11 +119,11 @@ class StoreProductAttr extends BaseModel
             return self::setErrorInfo('编辑商品属性失败!');
     }
 
-    public static function clearProductAttr($productId,$type=0)
+    public static function clearProductAttr($productId, $type = 0)
     {
         if (empty($productId) && $productId != 0) return self::setErrorInfo('商品不存在!');
         $res = false !== self::where('product_id', $productId)->where('type', $type)->delete()
-            && false !== StoreProductAttrValue::clearProductAttrValue($productId,$type);
+            && false !== StoreProductAttrValue::clearProductAttrValue($productId, $type);
         if (!$res)
             return self::setErrorInfo('编辑属性失败,清除旧属性失败!');
         else

+ 403 - 0
app/admin/model/ump/StoreMix.php

@@ -0,0 +1,403 @@
+<?php
+/**
+ * @author: xaboy<365615158@qq.com>
+ * @day: 2017/11/11
+ */
+
+namespace app\admin\model\ump;
+
+use app\admin\model\order\StoreOrder;
+use app\admin\model\store\StoreProductRelation;
+use app\admin\model\system\SystemGroupData;
+use crmeb\traits\ModelTrait;
+use crmeb\basic\BaseModel;
+use app\admin\model\store\StoreProduct;
+use crmeb\services\PHPExcelService;
+
+/**
+ * 混合支付商品
+ * Class StoreSeckill
+ * @package app\admin\model\store
+ */
+class StoreMix extends BaseModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 模型名称
+     * @var string
+     */
+    protected $name = 'store_mix';
+
+    use ModelTrait;
+
+    public function getDescriptionAttr($value)
+    {
+        return htmlspecialchars_decode($value);
+    }
+
+    /**
+     * 秒杀产品过滤条件
+     * @param $model
+     * @param $type
+     * @return mixed
+     */
+    public static function setWhereType($model, $type)
+    {
+        switch ($type) {
+            case 1:
+                $data = ['status' => 0, 'is_del' => 0];
+                break;
+            case 2:
+                $data = ['status' => 1, 'is_del' => 0];
+                break;
+            case 3:
+                $data = ['status' => 1, 'is_del' => 0, 'stock' => 0];
+                break;
+            case 4:
+                $data = ['status' => 1, 'is_del' => 0, 'stock' => ['elt', 1]];
+                break;
+            case 5:
+                $data = ['is_del' => 1];
+                break;
+        }
+        if (isset($data)) $model = $model->where($data);
+        return $model;
+    }
+
+    /**
+     * 秒杀产品数量 图标展示
+     * @param $type
+     * @param $data
+     * @return array
+     */
+    public static function getChatrdata($type, $data)
+    {
+        $legdata = ['销量', '数量', '点赞', '收藏'];
+        $model = self::setWhereType(self::order('id desc'), $type);
+        $list = self::getModelTime(compact('data'), $model)
+            ->field('FROM_UNIXTIME(add_time,"%Y-%c-%d") as un_time,count(id) as count,sum(sales) as sales')
+            ->group('un_time')
+            ->distinct(true)
+            ->select()
+            ->each(function ($item) use ($data) {
+                $item['collect'] = self::getModelTime(compact('data'), new StoreProductRelation)->where('type', 'collect')->count();
+                $item['like'] = self::getModelTime(compact('data'), new StoreProductRelation())->where('type', 'like')->count();
+            })->toArray();
+        $chatrList = [];
+        $datetime = [];
+        $data_item = [];
+        $itemList = [0 => [], 1 => [], 2 => [], 3 => []];
+        foreach ($list as $item) {
+            $itemList[0][] = $item['sales'];
+            $itemList[1][] = $item['count'];
+            $itemList[2][] = $item['like'];
+            $itemList[3][] = $item['collect'];
+            array_push($datetime, $item['un_time']);
+        }
+        foreach ($legdata as $key => $leg) {
+            $data_item['name'] = $leg;
+            $data_item['type'] = 'line';
+            $data_item['data'] = $itemList[$key];
+            $chatrList[] = $data_item;
+            unset($data_item);
+        }
+        unset($leg);
+        $badge = self::getbadge(compact('data'), $type);
+        $count = self::setWhereType(self::getModelTime(compact('data'), new self()), $type)->count();
+        return compact('datetime', 'chatrList', 'legdata', 'badge', 'count');
+
+    }
+
+    /**
+     * 秒杀产品数量
+     * @param $where
+     * @param $type
+     * @return array
+     */
+    public static function getbadge($where, $type)
+    {
+        $StoreOrderModel = new StoreOrder();
+        $replenishment_num = sys_config('replenishment_num');
+        $replenishment_num = $replenishment_num > 0 ? $replenishment_num : 20;
+        $stock1 = self::getModelTime($where, new self())->where('stock', '<', $replenishment_num)->column('stock', 'id');
+        $sum_stock = self::where('stock', '<', $replenishment_num)->column('stock', 'id');
+        $stk = [];
+        foreach ($stock1 as $item) {
+            $stk[] = $replenishment_num - $item;
+        }
+        $lack = array_sum($stk);
+        $sum = [];
+        foreach ($sum_stock as $val) {
+            $sum[] = $replenishment_num - $val;
+        }
+        return [
+            [
+                'name' => '商品种类',
+                'field' => '件',
+                'count' => self::setWhereType(new self(), $type)->where('add_time', '<', mktime(0, 0, 0, date('m'), date('d'), date('Y')))->count(),
+                'content' => '商品种类总数',
+                'background_color' => 'layui-bg-blue',
+                'sum' => self::count(),
+                'class' => 'fa fa fa-ioxhost',
+            ],
+            [
+                'name' => '新增商品',
+                'field' => '件',
+                'count' => self::setWhereType(self::getModelTime($where, new self), $type)->sum('stock'),
+                'content' => '新增商品总数',
+                'background_color' => 'layui-bg-cyan',
+                'sum' => self::where('status', 1)->sum('stock'),
+                'class' => 'fa fa-line-chart',
+            ],
+            [
+                'name' => '秒杀成功商品件数',
+                'field' => '件',
+                'count' => self::getModelTime($where, $StoreOrderModel)->where('seckill_id', '<>', 0)->sum('total_num'),
+                'content' => '秒杀成功商品总件数',
+                'background_color' => 'layui-bg-green',
+                'sum' => $StoreOrderModel->where('seckill_id', '<>', 0)->sum('total_num'),
+                'class' => 'fa fa-bar-chart',
+            ],
+            [
+                'name' => '缺货商品',
+                'field' => '件',
+                'count' => $lack,
+                'content' => '总商品数量',
+                'background_color' => 'layui-bg-orange',
+                'sum' => array_sum($sum),
+                'class' => 'fa fa-cube',
+            ],
+        ];
+    }
+
+    /**
+     * 销量排行 top 10
+     * layui-bg-red 红 layui-bg-orange 黄 layui-bg-green 绿 layui-bg-blue 蓝 layui-bg-cyan 黑
+     */
+    public static function getMaxList($where)
+    {
+        $classs = ['layui-bg-red', 'layui-bg-orange', 'layui-bg-green', 'layui-bg-blue', 'layui-bg-cyan'];
+        $model = StoreOrder::alias('a')->join('store_seckill b', 'b.id=a.seckill_id')->where('a.paid', 1);
+        $list = self::getModelTime($where, $model, 'a.add_time')->group('a.seckill_id')->order('p_count desc')->limit(10)
+            ->field(['count(a.seckill_id) as p_count', 'b.title as store_name', 'sum(b.price) as sum_price'])->select();
+        if (count($list)) $list = $list->toArray();
+        $maxList = [];
+        $sum_count = 0;
+        $sum_price = 0;
+        foreach ($list as $item) {
+            $sum_count += $item['p_count'];
+            $sum_price = bcadd($sum_price, $item['sum_price'], 2);
+        }
+        unset($item);
+        foreach ($list as $key => &$item) {
+            $item['w'] = bcdiv($item['p_count'], $sum_count, 2) * 100;
+            $item['class'] = isset($classs[$key]) ? $classs[$key] : (isset($classs[$key - count($classs)]) ? $classs[$key - count($classs)] : '');
+            $item['store_name'] = self::getSubstrUTf8($item['store_name']);
+        }
+        $maxList['sum_count'] = $sum_count;
+        $maxList['sum_price'] = $sum_price;
+        $maxList['list'] = $list;
+        return $maxList;
+    }
+
+    /**
+     * 获取秒杀利润
+     * @param $where
+     * @return array
+     */
+    public static function ProfityTop10($where)
+    {
+        $classs = ['layui-bg-red', 'layui-bg-orange', 'layui-bg-green', 'layui-bg-blue', 'layui-bg-cyan'];
+        $model = StoreOrder::alias('a')->join('store_seckill b', 'b.id = a.seckill_id')->where('a.paid', 1);
+        $list = self::getModelTime($where, $model, 'a.add_time')->group('a.seckill_id')->order('profity desc')->limit(10)
+            ->field(['count(a.seckill_id) as p_count', 'b.title as store_name', 'sum(b.price) as sum_price', '(b.price-b.cost) as profity'])
+            ->select();
+        if (count($list)) $list = $list->toArray();
+        $maxList = [];
+        $sum_count = 0;
+        $sum_price = 0;
+        foreach ($list as $item) {
+            $sum_count += $item['p_count'];
+            $sum_price = bcadd($sum_price, $item['sum_price'], 2);
+        }
+        foreach ($list as $key => &$item) {
+            $item['w'] = bcdiv($item['sum_price'], $sum_price, 2) * 100;
+            $item['class'] = isset($classs[$key]) ? $classs[$key] : (isset($classs[$key - count($classs)]) ? $classs[$key - count($classs)] : '');
+            $item['store_name'] = self::getSubstrUTf8($item['store_name'], 30);
+        }
+        $maxList['sum_count'] = $sum_count;
+        $maxList['sum_price'] = $sum_price;
+        $maxList['list'] = $list;
+        return $maxList;
+    }
+
+    /**
+     * 获取秒杀缺货
+     * @param $where
+     * @return array
+     */
+    public static function getLackList($where)
+    {
+        $replenishment_num = sys_config('replenishment_num');
+        $replenishment_num = $replenishment_num > 0 ? $replenishment_num : 20;
+        $list = self::where('stock', '<', $replenishment_num)->field(['id', 'title as store_name', 'stock', 'price'])->page((int)$where['page'], (int)$where['limit'])->order('stock asc')->select();
+        if (count($list)) $list = $list->toArray();
+        $count = self::where('stock', '<', $replenishment_num)->count();
+        return ['count' => $count, 'data' => $list];
+    }
+
+    /**
+     * 秒杀产品评价
+     * @param array $where
+     * @return array
+     */
+    public static function getNegativeList($where = array())
+    {
+        $replenishment_num = 3;
+        return [];
+    }
+
+    /**
+     * 秒杀产品退货
+     * @param array $where
+     * @return mixed
+     */
+    public static function getBargainRefundList($where = array())
+    {
+        $model = StoreOrder::alias('a')->join('store_seckill b', 'b.id=a.seckill_id');
+        $list = self::getModelTime($where, $model, 'a.add_time')->where('a.refund_status', '<>', 0)->group('a.seckill_id')->order('count desc')->page((int)$where['page'], (int)$where['limit'])
+            ->field(['count(a.seckill_id) as count', 'b.title as store_name', 'sum(b.price) as sum_price'])->select();
+        if (count($list)) $list = $list->toArray();
+        return $list;
+    }
+
+    /**
+     * @param $where
+     * @return array
+     */
+    public static function systemPage($where)
+    {
+        $model = new self;
+        $model = $model->alias('s');
+//        $model = $model->join('StoreProduct p','p.id=s.product_id');
+        if ($where['status'] != '') $model = $model->where('s.status', $where['status']);
+        if ($where['store_name'] != '') $model = $model->where('s.title|s.id', 'LIKE', "%$where[store_name]%");
+        $model = $model->page(bcmul($where['page'], $where['limit'], 0), $where['limit']);
+        $model = $model->order('s.id desc');
+        $model = $model->where('s.is_del', 0);
+        return self::page($model, function ($item) {
+            $item['store_name'] = StoreProduct::where('id', $item['product_id'])->value('store_name');
+            if ($item['status']) {
+                if ($item['start_time'] > time())
+                    $item['start_name'] = '活动未开始';
+                else if (bcadd($item['stop_time'], 86400) < time())
+                    $item['start_name'] = '活动已结束';
+                else if (bcadd($item['stop_time'], 86400) > time() && $item['start_time'] < time()) {
+                    $config = SystemGroupData::get($item['time_id']);
+                    if ($config) {
+                        $arr = json_decode($config->value, true);
+                        $now_hour = date('H', time());
+                        $start_hour = $arr['time']['value'];
+                        $continued = $arr['continued']['value'];
+                        $end_hour = $start_hour + $continued;
+                        if ($start_hour > $now_hour) {
+                            $item['start_name'] = '活动未开始';
+                        } elseif ($end_hour < $now_hour) {
+                            $item['start_name'] = '活动已结束';
+                        } else {
+                            $item['start_name'] = '正在进行中';
+                        }
+                    } else {
+                        $item['start_name'] = '正在进行中';
+                    }
+                }
+            } else $item['start_name'] = '关闭';
+
+        }, $where, $where['limit']);
+    }
+
+    public static function SaveExcel($where)
+    {
+        $model = new self;
+        if ($where['status'] != '') $model = $model->where('status', $where['status']);
+        if ($where['store_name'] != '') $model = $model->where('title|id', 'LIKE', "%$where[store_name]%");
+        $list = $model->order('id desc')->where('is_del', 0)->select();
+        count($list) && $list = $list->toArray();
+        $excel = [];
+        foreach ($list as $item) {
+            $item['store_name'] = StoreProduct::where('id', $item['product_id'])->value('store_name');
+            if ($item['status']) {
+                if ($item['start_time'] > time())
+                    $item['start_name'] = '活动未开始';
+                else if ($item['stop_time'] < time())
+                    $item['start_name'] = '活动已结束';
+                else if ($item['stop_time'] > time() && $item['start_time'] < time())
+                    $item['start_name'] = '正在进行中';
+            } else $item['start_name'] = '关闭';
+            $excel[] = [
+                $item['id'],
+                $item['title'],
+                $item['info'],
+                $item['ot_price'],
+                $item['price'],
+                $item['stock'],
+                $item['start_name'],
+                $item['stop_time'],
+                $item['stop_time'],
+                $item['status'] ? '开启' : '关闭',
+            ];
+        }
+        PHPExcelService::setExcelHeader(['编号', '活动标题', '活动简介', '原价', '秒杀价', '库存', '秒杀状态', '结束时间', '状态'])
+            ->setExcelTile('秒杀产品导出', ' ', ' 生成时间:' . date('Y-m-d H:i:s', time()))
+            ->setExcelContent($excel)
+            ->ExcelSave();
+    }
+
+    /**
+     * 获取秒杀产品id
+     * @return array
+     */
+    public static function getSeckillIdAll()
+    {
+        return self::where('is_del', 0)->column('id', 'id');
+    }
+
+    /**
+     * 获取秒杀的所有产品
+     * @return int|string
+     */
+    public static function getSeckillCount()
+    {
+        return self::where('is_del', 0)->count();
+    }
+
+    /**
+     * TODO 获取某个字段值
+     * @param $id
+     * @param string $field
+     * @return mixed
+     */
+    public static function getSeckillField($id, $field = 'title')
+    {
+        return self::where('id', $id)->value($field);
+    }
+
+    /**
+     * 判断产品当前时间段是否有秒杀活动
+     * @param $product_id
+     * @param $time_id
+     * @return array|null|\think\Model
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public static function checkSeckill($product_id, $time_id)
+    {
+        return self::where('product_id', $product_id)->where('time_id', $time_id)->where('is_del',0)->find();
+    }
+}

+ 220 - 0
app/admin/view/auction/auction_apply/index.php

@@ -0,0 +1,220 @@
+{extend name="public/container"}
+{block name="head_top"}
+
+{/block}
+{block name="content"}
+<style>
+    .btn-outline{
+        border:none;
+    }
+    .btn-outline:hover{
+        background-color: #0e9aef;
+        color: #fff;
+    }
+    .layui-form-item .layui-btn {
+        margin-top: 5px;
+        margin-right: 10px;
+    }
+    .layui-btn-primary{
+        margin-right: 10px;
+        margin-left: 0!important;
+    }
+    label{
+        margin-bottom: 0!important;
+        margin-top: 4px;
+    }
+</style>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15" id="app">
+        <!--搜索条件-->
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">搜索条件</div>
+                <div class="layui-card-body">
+                    <div class="layui-carousel layadmin-carousel layadmin-shortcut" lay-anim="" lay-indicator="inside" lay-arrow="none" style="background:none">
+                        <form class="layui-form layui-form-pane" action="">
+                            <div class="layui-form-item">
+
+                                <div class="layui-col-lg12">
+                                    <label class="layui-form-label" style="top: -5.5px;">搜索条件</label>
+                                    <div class="layui-input-inline">
+                                        <input type="text" id="auction" name="auction" class="layui-input" placeholder="请输入名称,编号">
+                                    </div>
+                                </div>
+                                <div class="layui-inline">
+                                    <div class="layui-input-inline">
+                                        <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                            <i class="layui-icon layui-icon-search"></i>搜索</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <!-- 中间详细信息-->
+        <div :class="item.col!=undefined ? 'layui-col-sm'+item.col+' '+'layui-col-md'+item.col:'layui-col-sm6 layui-col-md3'"
+             v-for="item in badge" v-cloak="" v-if="item.count > 0">
+        </div>
+        <!--enb-->
+    </div>
+    <!--列表-->
+    <div class="layui-row layui-col-space15">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">场馆列表</div>
+                <div class="layui-card-body">
+
+                    <div class="layui-btn-container" id="container-action">
+<!--                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100})">添加场次</a>-->
+<!--                        <button class="layui-btn layui-btn-sm" data-type="del_auction">批量删除</button>-->
+                    </div>
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+
+
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
+                    </script>
+                    <script type="text/html" id="status">
+                        {{#  if(d.status < 1){ }}
+                        <button type="button" name="status" class="layui-btn-disabled layui-btn-xs" id="">
+                            不通过
+                        </button>
+                        {{#  } else if(d.status == 1) { }}
+                        <button type="button" name="status" class="layui-btn-xs layui-btn-disabled" id="">
+                            待审核
+                        </button>
+                        {{#  } else if(d.status == 2) { }}
+                        <button type="button" name="status" class="layui-btn layui-btn-xs layui-btn-danger" id="">
+                            已完成
+                        </button>
+                        {{#  } }}
+                    </script>
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="tg">
+                            通过
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event="jj">
+                            拒绝
+                        </button>
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">
+                            删除
+                        </button>
+
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!--end-->
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name="script"}
+<script>
+    layui.use('form', function(){
+        var form = layui.form;
+
+        //监听提交
+        form.on('submit(formDemo)', function(data){
+            layer.msg(JSON.stringify(data.field));
+            return false;
+        });
+    });
+
+
+    layList.tableList('List', "{:Url('list')}", function () {
+        return [
+            {type: 'checkbox'},
+            {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%', templet: '#id'},
+            {field: 'nickname', title: '申请人', templet: '#nickname', align: 'center'},
+            {field: 'image', title: '申请人', templet: '#image', align: 'center',width: '5%'},
+            {field: 'status', title: '状态', templet: '#status', align: 'center'},
+            {field: 'create_time', title: '申请时间', templet: '#create_time', align: 'center'},
+            {field: 'right', title: '操作', align: 'center', toolbar: '#act'},
+        ];
+    });
+
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where,true);
+    });
+
+    //点击事件绑定
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delete':
+                var url=layList.U({c:'auction.auctionApply',a:'delete',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定将该商品移入回收站吗?",type:'info',confirm:'是的,移入回收站'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'tg':
+                var url=layList.U({c:'auction.auctionApply',a:'tg',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定通过吗?",type:'info',confirm:'是的'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'jj':
+                var url=layList.U({c:'auction.auctionApply',a:'jj',q:{id:data.id}});
+                var code = {title:"操作提示",text:"确定拒绝吗?",type:'info',confirm:'是的'};
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                            location.reload();
+                        }else
+                            return Promise.reject(res.data.msg || '失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                },code)
+                break;
+            case 'open_image':
+                $eb.openImage(data.image);
+                break;
+        }
+    })
+
+
+    //改状态
+    layList.switch('status',function (odj,value) {
+        if(odj.elem.checked==true){
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:1,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }else{
+            layList.baseGet(layList.Url({c:'auction.auction',a:'set_status',p:{status:0,id:value}}),function (res) {
+                layList.msg(res.msg, function () {
+                    layList.reload();
+                });
+            });
+        }
+    });
+</script>
+{/block}

+ 18 - 1
app/admin/view/auction/auction_order/index.php

@@ -47,10 +47,20 @@
 <!--                            </div>-->
                             <div class="layui-inline">
                                 <label class="layui-form-label" style="top: -4.5px">搜索</label>
-                                <div class="layui-input-block">
+                                <div class="layui-input-inline">
                                     <input type="text" name="store_name" class="layui-input" placeholder="订单号,账号,昵称,编号">
                                 </div>
                             </div>
+                            <div class="layui-col-lg12">
+                                <label class="layui-form-label">创建时间:</label>
+                                <div class="layui-input-block" v-cloak="">
+                                    <button class="layui-btn layui-btn-sm" type="button" v-for="item in statusList"
+                                            @click="where.status = item.value"
+                                            :class="{'layui-btn-primary':where.status!==item.value}">{{item.name}}
+                                    </button>
+                                </div>
+                            </div>
+
                             <div class="layui-col-lg12">
                                 <label class="layui-form-label">创建时间:</label>
                                 <div class="layui-input-block" data-type="data" v-cloak="">
@@ -246,6 +256,13 @@
                     {name: '本月', value: 'month'},
                     {name: '本年', value: 'year'},
                 ],
+                statusList:[
+                    {name: '全部', value: ''},
+                    {name: '过期', value: '0'},
+                    {name: '待上传', value: '1'},
+                    {name: '待审核', value: '2'},
+                    {name: '完成', value: '3'}
+                ],
                 where: {
                     data: '',
                     status: status,

ファイルの差分が大きいため隠しています
+ 284 - 176
app/admin/view/store/store_product/create.php


+ 371 - 0
app/admin/view/ump/store_mix/attr.php

@@ -0,0 +1,371 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    {include file="public/head"}
+    <title>{$title|default=''}</title>
+    <style>
+        .demo-upload{
+            display: block;
+            height: 33px;
+            text-align: center;
+            border: 1px solid transparent;
+            border-radius: 4px;
+            overflow: hidden;
+            background: #fff;
+            position: relative;
+            box-shadow: 0 1px 1px rgba(0,0,0,.2);
+            margin-right: 4px;
+        }
+        .demo-upload img{
+            width: 100%;
+            height: 100%;
+            display: block;
+        }
+        .demo-upload-cover{
+            display: none;
+            position: absolute;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            background: rgba(0,0,0,.6);
+        }
+        .demo-upload:hover .demo-upload-cover{
+            display: block;
+        }
+        .demo-upload-cover i{
+            color: #fff;
+            font-size: 20px;
+            cursor: pointer;
+            margin: 0 2px;
+        }
+        .check{color: #f00}
+    </style>
+</head>
+<body>
+<div id="store-attr" class="mp-form" v-cloak="">
+    <i-Form :label-width="80" style="width: 100%" v-show="hidden == false">
+        <Form-Item>
+            <Row>
+                <i-Col span="5">
+                    <i-Button type="dashed" long @click="hiddenBool" icon="plus-round">添加新规则</i-Button>
+                </i-Col>
+            </Row>
+        </Form-Item>
+    </i-Form>
+    <i-Form :label-width="80" style="width: 100%" v-show="hidden == true">
+        <Form-Item
+                :label="'规则名称:'">
+            <Row>
+                <i-Col style="position: relative;margin-right: 6px"  span="5"
+                       v-for="(item, index) in items"
+                       :key="index">
+                    <i-Input type="text" v-model="item.value" placeholder="设置名称"></i-Input>
+                    <i-Button style="position: absolute;top:0;right:0;margin-top:1px;border: none;font-size: 8px;line-height: 1.8" type="ghost" @click="handleRemove(index)" v-show="item.attrHidden == true"><Icon type="close-round" /></i-Button>
+                    <i-Button style="position: absolute;top:0;right:0;margin-top:1px;border: none;font-size: 8px;line-height: 1.8" type="ghost" @click="attrHiddenBool(item)" v-show="item.attrHidden == false"><Icon type="checkmark-round"></Icon></i-Button>
+                </i-Col>
+                <i-Col span="5">
+                    <i-Button type="dashed" long @click="handleAdd" icon="plus-round">添加新规则</i-Button>
+                </i-Col>
+            </Row>
+        </Form-Item>
+        <Form-Item v-show="item.attrHidden == true"
+                   v-for="(item, index) in items"
+                   :key="index"
+                   :label="''+item.value+':'" >
+            <Row>
+                <i-Col span="3"
+                       v-for="(attr,k) in item.detail"
+                       :key="attr"
+                       :name="attr">
+                    <Tag type="border" closable color="blue" @on-close="attrRemove(item,k)">{{ attr }}</Tag>
+                </i-Col>
+                <i-Col span="5">
+                    <i-Input type="text" v-model="item.detailValue" placeholder="设置属性"></i-Input>
+                </i-Col>
+                <i-Col span="5">
+                    <i-Button type="primary" style="margin-left: 6px" @click="attrAdd(item)">添加</i-Button>
+                </i-Col>
+            </Row>
+        </Form-Item>
+        <Form-Item v-show="hidden == true" style="width: 100%;">
+            <Row style="margin: 0 88px 0 20px">
+                <i-Col span="24">
+                    <i-Button type="primary" long @click="addGoods(true)">生成</i-Button>
+                </i-Col>
+            </Row>
+        </Form-Item>
+
+        <template v-if="items[0].value!='' && items[0].detail.length>0 && attrs.length">
+            <template v-for="(attr,index) in attrs">
+                <Form-Item>
+                    <Row>
+                        <template v-for="(item,index) in attr.detail">
+                            <i-Col span="3" style="margin-right: 3px">
+                                {{index}}:{{item}}
+                            </i-Col>
+                        </template>
+                        <i-Col span="5" style="margin-right: 3px">
+                            <span :class="attr.check ? 'check':''">金额:</span>&nbsp;&nbsp;<i-Input placeholder="请输入金额" v-model="attr.price" style="width: 68%"
+                                        :number="true"></i-Input>
+                        </i-Col>
+                        <i-Col span="5" style="margin-right: 3px">
+                            <span :class="attr.check ? 'check':''">库存:</span>&nbsp;&nbsp;<i-Input placeholder="请输入库存" v-model="attr.sales" style="width: 68%"
+                                        :number="true"></i-Input>
+                        </i-Col>
+                        <i-Col span="2" offset="1" style="margin-right: 3px">
+                            <div class="demo-upload">
+                                <img :src="attr.pic">
+                                <div class="demo-upload-cover">
+                                    <Icon type="ios-eye-outline" @click.native="openPic(attr.pic)" ></Icon>
+                                    <Upload
+                                            :show-upload-list="false"
+                                            :on-success="uploadSuccess(attr)"
+                                            :on-error="uploadError"
+                                            :format="['jpg','jpeg','png']"
+                                            :max-size="2048"
+                                            accept="image/*"
+                                            :on-format-error="uploadFormatError"
+                                            action="{:Url('upload')}"
+                                            style="display: inline-block"
+                                            :goods="attr"
+                                    >
+                                        <Icon type="ios-cloud-upload-outline"></Icon>
+                                    </Upload>
+
+                                </div>
+                            </div>
+                        </i-Col>
+                        <i-Col span="2" style="margin-right: 3px">
+                            <i-Button type="ghost" @click="removeGoods(index)">删除</i-Button>
+                        </i-Col>
+                    </Row>
+                </Form-Item>
+            </template>
+            <Form-Item>
+                <Row>
+                    <!--                    <i-Col span="10">-->
+                    <!--                        <i-Button type="dashed" long @click="addGoods" icon="plus-round">添加新商品</i-Button>-->
+                    <!--                    </i-Col>-->
+                    <i-Col span="2" offset="2">
+                        <i-Button type="primary" @click="submit">提交</i-Button>
+                    </i-Col>
+                    <i-Col span="2" offset="1">
+                        <i-Button type="error" @click="clear">清空所有属性</i-Button>
+                    </i-Col>
+                </Row>
+            </Form-Item>
+        </template>
+    </i-Form>
+    <Spin fix v-show="submiting == true">保存中...</Spin>
+</div>
+<script>
+    var _vm ;
+    mpFrame.start(function(Vue){
+        new Vue({
+            data () {
+                return {
+                    hidden:false,
+                    submiting :false,
+                    items: <?php echo $result && isset($result['attr']) && !empty($result['attr']) ? json_encode($result['attr']) : 'false'; ?> || [
+                    {
+                        value: '',
+                        detailValue:'',
+                        attrHidden:false,
+                        detail:[]
+                    }
+                ],
+                    attrs:<?php echo $result && isset($result['value']) && !empty($result['value']) ? json_encode($result['value']) : '[]'; ?>
+            }
+            },
+            watch:{
+                items:{
+                    handler:function(){
+//                        this.attrs = [];
+                    },
+                    deep:true
+                }
+            },
+            methods: {
+                attrHiddenBool(item){
+                    if(item.value == ''){
+                        $eb.message('error','请填写规则名称');
+                    }else{
+                        item.attrHidden = true;
+                    }
+                },
+                hiddenBool(){
+                    this.hidden = true;
+                },
+                handleAdd () {
+                    if(!this.checkAttr())return ;
+                    this.items.push({
+                        value: '',
+                        detailValue:'',
+                        attrHidden:false,
+                        detail:[]
+                    });
+                },
+                checkAttr(){
+                    var bool = true;
+                    this.items.map(function(item){
+                        if(!bool) return;
+                        if(!item.value){
+                            $eb.message('error','请填写规则名称');
+                            bool = false;
+                        }else if(!item.detail.length){
+                            $eb.message('error','请设置规则属性');
+                            bool = false;
+                        }
+                    });
+                    return bool;
+                },
+                attrAdd (item) {
+                    if(!item.detailValue) return false;
+                    item.detail.push(item.detailValue);
+                    item.detailValue = '';
+                },
+                handleRemove (index) {
+                    if(this.items.length > 1)
+                        this.items.splice(index,1);
+                    else
+                        $eb.message('error','请设置至少一个规则');
+                },
+                attrRemove(item,k){
+                    if(1==item.detail.length){
+                        $eb.message('error','请设置至少一个属性');
+                        return false;
+                    }
+                    item.detail.splice(k,1);
+                },
+                removeGoods(index){
+                    this.attrs.splice(index,1);
+                },
+                checkGoods(){
+                    var bool = true;
+                    this.attrs.map(function(attr){
+                        if(!bool) return ;
+                        if(!Object.keys(attr.detail).length){
+                            $eb.message('error','请选择至少一个属性');
+                            bool = false;
+                        }else if(attr.price != parseFloat(attr.price) || attr.price < 0){
+                            $eb.message('error','请输入正确的商品价格');
+                            bool = false;
+                        }else if(attr.sales != parseInt(attr.sales) || attr.sales < 0){
+                            $eb.message('error','请输入正确的商品库存');
+                            bool = false;
+                        }
+                    });
+                    return bool;
+                },
+                addGoods(type){
+                    var that = this;
+                    if(this.attrs.length){
+                        if(!this.checkGoods())return ;
+                    }
+                    $eb.axios.post("{:Url('is_format_attr',array('id'=>$id))}",{items:this.items,attrs:this.attrs}).then(function(res){
+                        if(res.data.code == 200){
+                            that.attrs = res.data.data
+                        }else{
+                            $eb.message('error',res.data.msg);
+                        }
+                    }).catch(function(err){
+                        if(res.data.code == 200){
+                            that.attrs = res.data.data
+                        }else{
+                            $eb.message('error',res.data.msg);
+                        }
+                    })
+//                    if(type === true){
+//                        this.attrs = [{
+//                            detail:{},
+//                            price:'',
+//                            sales:'',
+//                            pic:'{$image}'
+//                        }];
+//                    }else{
+//                        this.attrs.push({
+//                            detail:{},
+//                            price:'',
+//                            sales:'',
+//                            pic:'{$image}'
+//                        });
+//                    }
+                },
+                openPic(src){
+                    $eb.openImage(src);
+                },
+                uploadSuccess(data){
+                    return function(response, file, fileList){
+                        if(response.code == 200){
+                            data.pic = response.data.url;
+                        }else{
+                            $eb.message('error',response.data.msg || '图片上传失败!');
+                        }
+                    }
+                },
+                uploadError(error, file, fileList){
+                    $eb.message('error',error);
+                },
+                uploadFormatError(file, fileList){
+                    $eb.message('error','图片格式错误');
+                },
+                submit(){
+                    var that = this;
+                    that.submiting = true;
+                    if(!this.checkAttr() || !this.checkGoods()) return ;
+                    for(let attr in that.attrs){
+                        that.attrs[attr].check = false;
+                    }
+                    $eb.axios.post("{:Url('set_attr',array('id'=>$id))}",{items:this.items,attrs:this.attrs}).then(function(res){
+                        that.submiting = false;
+                        if(res.status == 200 && res.data.code == 200){
+                            $eb.message('success',res.data.msg || '编辑成功!');
+                            $eb.closeModalFrame(window.name);
+                        }else{
+                            $eb.message('error',res.data.msg || '请求失败!');
+                        }
+                    }).catch(function(err){
+                        $eb.message('error',err);
+                    })
+                },
+                clear(){
+                    var that = this;
+                    requirejs(['sweetalert'], function (swel) {
+                        swel({
+                            title: "您确定要清空商品属性吗",
+                            text: "删除后将无法恢复,请谨慎操作!",
+                            type: "warning",
+                            showCancelButton: true,
+                            confirmButtonColor: "#DD6B55",
+                            confirmButtonText: "是的,我要清空!",
+                            cancelButtonText: "让我再考虑一下…",
+                            closeOnConfirm: false,
+                            closeOnCancel: false
+                        }).then(function () {
+                            $eb.axios.post("{:Url('clear_attr',array('id'=>$id))}", {
+                                items: that.items,
+                                attrs: that.attrs
+                            }).then(function (res) {
+                                if (res.status == 200 && res.data.code == 200) {
+                                    $eb.message('success', res.data.msg || '清空成功!');
+                                    window.location.reload();
+                                } else {
+                                    $eb.message('error', res.data.msg || '清空失败!');
+                                }
+                            }).catch(function (err) {
+                                $eb.message('error', err);
+                            })
+                        }).catch(console.log);
+                    });
+                }
+            },
+            mounted (){
+                _vm = this;
+                var resultAdmin = <?php echo $result && isset($result['attr']) && !empty($result['attr']) ? json_encode($result['attr']) : 'false'; ?>;
+                if(resultAdmin) this.hidden = true;
+            }
+        }).$mount(document.getElementById('store-attr'));
+    });
+</script>
+</body>

+ 121 - 0
app/admin/view/ump/store_mix/attr_list.php

@@ -0,0 +1,121 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    {include file="public/head"}
+    <script src="/static/plug/jquery-1.4.1.min.js"></script>
+    <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
+    <script src="/static/plug/layui/layui.js"></script>
+    <style>
+        .layui-form-checkbox{
+            margin-top: 0!important;
+            margin-right: 0;
+        }
+        .layui-form-checkbox i{
+            border-left: 1px solid #d2d2d2;
+        }
+    </style>
+</head>
+<body>
+<form class="layui-form" action="" style="padding: 30px 50px 0px 0px;">
+    <div class="layui-form-item">
+        <label class="layui-form-label">规格选择</label>
+        <div class="layui-input-block">
+            <table class="layui-table attrTab">
+                <thead>
+                <tr>
+                    {volist name="attr.attr" id="vo"}
+                    <th>{$vo.value}</th>
+                    {/volist}
+                    <th>图片</th>
+                    <th>售价</th>
+                    <th>成本价</th>
+                    <th>原价</th>
+                    <th>库存</th>
+                    <th>限量</th>
+                    <th>商品编号</th>
+                    <th>重量</th>
+                    <th>体积</th>
+                    <th>选择</th>
+                </tr>
+                </thead>
+                <tbody>
+                {volist name="attr.value" id="vo" key="k"}
+                <tr>
+                    {volist name="$vo" id="item"}
+                    {if condition="$key eq 'pic'"}
+                    <td id="cl{$k}"><input type="hidden" name="attr[{$k}][{$key}]" class="layui-input" value="{$item}"><img src="{$item}" width="50px" onclick="createFrame('选择图片','{:Url('widget.images/index',['fodder'=>'image'])}',{w:900,h:550},'cl{$k}')"></td>
+                    {elseif condition="$key eq 'detail'"/}
+                    <input type="hidden" name="attr[{$k}][{$key}]" class="layui-input" value="{$item}">
+                    {elseif condition="$key eq 'check'"/}
+                    <td><input type="checkbox" name="ids[]" value="{$k}" {if condition="$item eq 1"}checked{/if}></td>
+                    {elseif condition="($key neq 'brokerage') AND ($key neq 'brokerage_two')"/}
+                    {if condition="($key neq 'price') AND ($key neq 'quota')"}
+                    <td style="text-align: center"><span>{$item}</span><input type="hidden" name="attr[{$k}][{$key}]" class="layui-input" value="{$item}"></td>
+                    {else/}
+                    <td><input type="number" name="attr[{$k}][{$key}]" class="layui-input max" value="{$item}" min="0" max="{if condition="$key eq 'quota'"}{$vo['stock']}{else/}{$vo['ot_price']}{/if}" oninput="checknum(this)"></td>
+                    {/if}
+                    {/if}
+                    {/volist}
+                </tr>
+                {/volist}
+                </tbody>
+            </table>
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <div class="layui-input-block">
+            <input type="hidden" name="id" value="{$id}">
+            <button type="button" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
+        </div>
+    </div>
+</form>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+<script>
+    var cl = '';
+    layui.use('form', function () {
+        var form = layui.form;
+        form.on('submit(formDemo)', function (data) {
+            layList.basePost('save_attr', data.field, function (res) {
+                parent.layer.close(parent.layer.getFrameIndex(window.name));
+                parent.layer.msg(res.msg, {icon:1,time:2000});
+            }, function (res) {
+                parent.layer.msg(res.msg, {icon:1,time:2000});
+            });
+        });
+    });
+    function createFrame(title,src,opt,k){
+        cl = k;
+        opt === undefined && (opt = {});
+        var h = parent.document.body.clientHeight - 100;
+        return layer.open({
+            type: 2,
+            title:title,
+            area: [(opt.w || 700)+'px', (opt.h || h)+'px'],
+            fixed: false, //不固定
+            maxmin: true,
+            moveOut:false,//true  可以拖出窗外  false 只能在窗内拖
+            anim:5,//出场动画 isOutAnim bool 关闭动画
+            offset:'auto',//['100px','100px'],//'auto',//初始位置  ['100px','100px'] t[ 上 左]
+            shade:0,//遮罩
+            resize:true,//是否允许拉伸
+            content: src,//内容
+            move:'.layui-layer-title'
+        });
+    }
+    function changeIMG(index,pic){
+        $('#'+cl).children('input').val(pic);
+        $('#'+cl).children('img').attr('src',pic);
+    }
+    function checknum(e){
+        if(parseInt(e.value)>parseInt(e.max)){
+            $(e).val(e.max);
+        }
+        if(parseInt(e.value)<0){
+            $(e).val(0);
+        }
+    }
+</script>
+</body>
+</html>

+ 250 - 0
app/admin/view/ump/store_mix/index.php

@@ -0,0 +1,250 @@
+{extend name="public/container"}
+{block name="head_top"}
+<script type="text/javascript" src="{__PLUG_PATH}jquery.downCount.js"></script>
+{/block}
+{block name="content"}
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">秒杀商品搜索</div>
+                <div class="layui-card-body">
+                    <div class="alert alert-success alert-dismissable">
+                        <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
+                        目前拥有{$countSeckill}个秒杀商品
+                    </div>
+                    <form class="layui-form">
+                        <div class="layui-form-item">
+                            <div class="layui-inline">
+                                <label class="layui-form-label">搜  索:</label>
+                                <div class="layui-input-inline">
+                                    <input type="text" name="store_name" lay-verify="store_name" style="width: 100%" autocomplete="off" placeholder="请输入商品名称,关键字,编号" class="layui-input">
+                                </div>
+                            </div>
+                            <div class="layui-inline">
+                                <label class="layui-form-label">秒杀状态:</label>
+                                <div class="layui-input-inline">
+                                    <select name="status" lay-verify="status">
+                                        <option value="">全部</option>
+                                        <option value="1">开启</option>
+                                        <option value="0">关闭</option>
+                                    </select>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="layui-form-item">
+                            <label class="layui-form-label">
+                                <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="search" style="font-size:14px;line-height: 9px;">
+                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索</button>
+                                <button lay-submit="export" lay-filter="export" class="layui-btn layui-btn-primary layui-btn-sm">
+                                    <i class="layui-icon layui-icon-delete layuiadmin-button-btn" ></i> Excel导出</button>
+                            </label>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">秒杀商品列表</div>
+                <div class="layui-card-body">
+                    <div class="layui-btn-container">
+                        <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100});">添加秒杀商品</a>
+                    </div>
+                    <table class="layui-hide" id="seckillList" lay-filter="seckillList"></table>
+                    <script type="text/html" id="status">
+                        <input type='checkbox' name='status' lay-skin='switch' value="{{d.id}}" lay-filter='status' lay-text='开启|关闭'  {{ d.status == 1 ? 'checked' : '' }}>
+                    </script>
+                    <script type="text/html" id="stopTime">
+                        <div class="count-time-{{d.id}}" data-time="{{d._stop_time}}">
+                            <span class="days">00</span>
+                            :
+                            <span class="hours">00</span>
+                            :
+                            <span class="minutes">00</span>
+                            :
+                            <span class="seconds">00</span>
+                        </div>
+                    </script>
+                    <script type="text/html" id="statusCn">
+                        {{ d.status == 1 ? d.start_name : '关闭' }}
+                    </script>
+                    <script type="text/html" id="barDemo">
+                        <button type="button" class="layui-btn layui-btn-xs" onclick="$eb.createModalFrame('{{d.title}}-设置规格','{:Url('attr_list')}?id={{d.id}}',{h:1000,w:1400});"><i class="layui-icon layui-icon-util"></i>规格</button>
+
+                        <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作<span class="caret"></span></button>
+                        <ul class="layui-nav-child layui-anim layui-anim-upbit">
+                            <li>
+                                <a href="javascript:void(0);" onclick="$eb.createModalFrame('{{d.title}}-编辑','{:Url('edit')}?id={{d.id}}')"><i class="layui-icon layui-icon-edit"></i> 编辑活动</a>
+                            </li>
+                            <li>
+                                <a href="javascript:void(0);" onclick="$eb.createModalFrame('{{d.title}}-编辑内容','{:Url('edit_content')}?id={{d.id}}')"><i class="layui-icon layui-icon-edit"></i>编辑内容</a>
+                            </li>
+                            <li>
+                                <a href="javascript:void(0);" class="delstor" lay-event='delstor'><i class="layui-icon layui-icon-delete"></i> 删除</a>
+                            </li>
+                        </ul>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+<script src="{__FRAME_PATH}js/content.min.js?v=1.0.0"></script>
+<script>
+    setTime();
+    function setTime() {
+        setTimeout(function () {
+            $eb.axios.get("{:Url('get_seckill_id')}").then(function(res){
+                $.each(res.data.count,function (index,item) {
+                    var time = $('.count-time-'+item).attr('data-time');
+                    if(time != ''){
+                        $('.count-time-'+item).downCount({
+                            date: time,
+                            offset: +8
+                        });
+                    }
+                })
+            }).catch(function(err){
+                console.log(err);
+            });
+        },2000);
+    }
+</script>
+<script>
+    layList.form.render();
+    layList.tableList('seckillList',"{:Url('get_seckill_list')}",function () {
+        return [
+            {field: 'id', title: 'ID', sort: true,width:'6%',event:'id'},
+            {field: 'image', title: '商品图片', width: '10%',templet: '<p><img src="{{d.image}}" alt="{{d.title}}" class="open_image" data-image="{{d.image}}"></p>'},
+            {field: 'title', title: '活动标题'},
+            {field: 'info', title: '活动简介',width:'20%'},
+            {field: 'ot_price', title: '原价',width:'6%'},
+            {field: 'price', title: '秒杀价',width:'6%'},
+            {field: 'quota_show', title: '限量',width:'6%'},
+            {field: 'quota', title: '限量剩余',width:'6%'},
+            {field: 'start_name', title: '秒杀状态',width:'6%',toolbar:"#statusCn"},
+            {field: 'stop_time', title: '结束时间', width: '8%',toolbar: '#stopTime'},
+            {field: 'status', title: '状态',width:'6%',toolbar:"#status"},
+            {field: 'right', title: '操作',width:'10%', align: 'center', toolbar: '#barDemo'}
+        ]
+    });
+    layList.tool(function (event,data,obj) {
+        switch (event) {
+            case 'delstor':
+                var url=layList.U({c:'ump.store_seckill',a:'delete',q:{id:data.id}});
+                $eb.$swal('delete',function(){
+                    $eb.axios.get(url).then(function(res){
+                        if(res.status == 200 && res.data.code == 200) {
+                            $eb.$swal('success',res.data.msg);
+                            obj.del();
+                        }else
+                            return Promise.reject(res.data.msg || '删除失败')
+                    }).catch(function(err){
+                        $eb.$swal('error',err);
+                    });
+                })
+                break;
+        }
+    })
+    $(document).click(function (e) {
+        $('.layui-nav-child').hide();
+    })
+    function dropdown(that){
+        var oEvent = arguments.callee.caller.arguments[0] || event;
+        oEvent.stopPropagation();
+        var offset = $(that).offset();
+        var top=offset.top-$(window).scrollTop();
+        var index = $(that).parents('tr').data('index');
+        $('.layui-nav-child').each(function (key) {
+            if (key != index) {
+                $(this).hide();
+            }
+        })
+        if($(document).height() < top+$(that).next('ul').height()){
+            $(that).next('ul').css({
+                'padding': 10,
+                'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }else{
+            $(that).next('ul').css({
+                'padding': 10,
+                'top':$(that).parent('td').height() / 2 + $(that).height(),
+                'min-width': 'inherit',
+                'position': 'absolute'
+            }).toggle();
+        }
+    }
+    layList.search('search',function(where){
+        layList.reload(where);
+        setTime();
+    });
+    layList.search('export',function(where){
+        location.href=layList.U({c:'ump.store_seckill',a:'save_excel',q:{status:where.status,store_name:where.store_name}});
+    })
+    layList.switch('status',function (odj,value,name) {
+        if (odj.elem.checked == true) {
+            layList.baseGet(layList.Url({
+                c: 'ump.store_seckill',
+                a: 'set_seckill_status',
+                p: {status: 1, id: value}
+            }), function (res) {
+                layList.msg(res.msg);
+            }, function () {
+                odj.elem.checked = false;
+                layui.form.render();
+                layer.open({
+                    type: 1
+                    ,offset: 'auto'
+                    ,id: 'layerDemoauto' //防止重复弹出
+                    ,content: '<div style="padding: 20px 100px;">请先配置规格</div>'
+                    ,btn: '设置规格'
+                    ,btnAlign: 'c' //按钮居中
+                    ,shade: 0 //不显示遮罩
+                    ,yes: function(){
+                        layer.closeAll();
+                        $eb.createModalFrame('设置规格','{:Url('attr_list')}?id='+value+'',{h:1000,w:1400});
+                    }
+                });
+            });
+        } else {
+            layList.baseGet(layList.Url({
+                c: 'ump.store_seckill',
+                a: 'set_seckill_status',
+                p: {status: 0, id: value}
+            }), function (res) {
+                layList.msg(res.msg);
+            });
+        }
+    })
+    $('.js-group-btn').on('click',function(){
+        $('.js-group-btn').css({zIndex:1});
+        $(this).css({zIndex:2});
+    });
+    $('#delstor').on('click',function(){
+        window.t = $(this);
+        var _this = $(this),url =_this.data('url');
+        $eb.$swal('delete',function(){
+            $eb.axios.get(url).then(function(res){
+                console.log(res);
+                if(res.status == 200 && res.data.code == 200) {
+                    $eb.$swal('success',res.data.msg);
+                    _this.parents('tr').remove();
+                }else
+                    return Promise.reject(res.data.msg || '删除失败')
+            }).catch(function(err){
+                $eb.$swal('error',err);
+            });
+        })
+    });
+    $(document).on('click',".open_image",function (e) {
+        var image = $(this).data('image');
+        $eb.openImage(image);
+    });
+</script>
+{/block}

+ 104 - 0
app/admin/view/ump/store_mix/product_list.php

@@ -0,0 +1,104 @@
+{extend name="public/container"}
+{block name="content"}
+<style type="text/css">
+    .form-add{position: fixed;left: 0;bottom: 0;width:100%;}
+    .form-add .sub-btn{border-radius: 0;width: 100%;padding: 6px 0;font-size: 14px;outline: none;border: none;color: #fff;background-color: #2d8cf0;}
+</style>
+<div class="layui-fluid">
+    <div class="layui-row layui-col-space15"  id="app">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-header">搜索条件</div>
+                <div class="layui-card-body">
+                    <form class="layui-form layui-form-pane" action="">
+                        <div class="layui-inline">
+                            <label class="layui-form-label">所有分类</label>
+                            <div class="layui-input-block">
+                                <select name="cate_id">
+                                    <option value=" ">全部</option>
+                                    {volist name='cate' id='vo'}
+                                    <option value="{$vo.id}">{$vo.html}{$vo.cate_name}</option>
+                                    {/volist}
+                                </select>
+                            </div>
+                        </div>
+                        <div class="layui-inline">
+                            <label class="layui-form-label">商品名称</label>
+                            <div class="layui-input-block">
+                                <input type="text" name="store_name" class="layui-input" placeholder="请输入商品名称,关键字,编号">
+                            </div>
+                        </div>
+                        <div class="layui-inline">
+                            <div class="layui-input-inline">
+                                <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
+                                    <i class="layui-icon layui-icon-search"></i>搜索</button>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+            </div>
+        </div>
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-body">
+                    <table class="layui-hide" id="List" lay-filter="List"></table>
+                    <!--图片-->
+                    <script type="text/html" id="image">
+                        <img style="cursor: pointer" lay-event="open_image" src="{{d.image}}">
+                    </script>
+                    <!--操作-->
+                    <script type="text/html" id="act">
+                        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm select" lay-event='select'>选择</button>
+                    </script>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="{__ADMIN_PATH}js/layuiList.js"></script>
+{/block}
+{block name='script'}
+<script>
+    var parentinputname = '{$Request.param.fodder}';
+    layList.form.render();
+    //加载列表
+    layList.tableList('List',"{:Url('store.store_product/product_ist',['type'=>1])}",function (){
+        return [
+            {field: 'id', title: 'ID', sort: true,event:'id',width:'8%'},
+            {field: 'image', title: '商品图片',templet:'#image',width:'12%'},
+            {field: 'store_name', title: '商品名称',templet:'#store_name',width:'40%'},
+            {field: 'right', title: '操作',align:'center',toolbar:'#act'}
+        ]
+    });
+    //点击事件绑定
+    layList.tool(function (event,data) {
+        switch (event) {
+            case 'select':
+                parent.$f.changeField('product',data.image);
+                parent.$f.changeField('product_id',data.id);
+                parent.$f.changeField('title',data.store_name);
+                parent.$f.changeField('store_name',data.store_name);
+                parent.$f.changeField('info',data.store_info);
+                parent.$f.changeField('unit_name',data.unit_name);
+                parent.$f.changeField('temp_id',data.temp_id.toString());
+                parent.$f.changeField('image',data.image);
+                parent.$f.changeField('images',eval('('+data.slider_image+')'));
+                parent.$f.changeField('price',data.price);
+                parent.$f.changeField('ot_price',data.ot_price);
+                parent.$f.changeField('cost',data.cost);
+                parent.$f.changeField('stock',data.stock);
+                parent.$f.changeField('sales',data.sales);
+                parent.$f.changeField('sort',data.sort);
+                parent.$f.changeField('num',1);
+                parent.$f.changeField('give_integral',data.give_integral);
+                parent.$f.changeField('description',data.description);
+                parent.$f.closeModal(parentinputname);
+                break;
+        }
+    })
+    //查询
+    layList.search('search',function(where){
+        layList.reload(where);
+    });
+</script>
+{/block}

+ 3 - 2
app/api/controller/auction/AuctionController.php

@@ -366,7 +366,8 @@ class AuctionController
      */
     public function apply(Request $request)
     {
-        if (!AuctionApply::where('status', '>', 0)->find($request->uid())){
+        $data = AuctionApply::where('status', '>', 0)->where('uid', $request->uid())->find();
+        if (!$data){
             $res = AuctionApply::create([
                 'uid' => $request->uid()
             ]);
@@ -379,7 +380,7 @@ class AuctionController
 
     public function apply_status(Request $request)
     {
-        $data = AuctionApply::where('uid', $request->uid())->find($request->uid());
+        $data = AuctionApply::where('uid', $request->uid())->find();
         if (!$data){
             return app('json')->successful(['status' => 0, 'str' => '未提交申请']); // 未提交申请
         }

+ 3 - 0
app/api/controller/store/StoreProductController.php

@@ -3,6 +3,7 @@
 namespace app\api\controller\store;
 
 use app\admin\model\store\StoreDescription;
+use app\admin\model\store\StoreProductAttrValue;
 use app\admin\model\system\SystemAttachment;
 use app\models\store\StoreOrder;
 use app\models\store\StoreVisit;
@@ -184,6 +185,8 @@ class StoreProductController
         $data['mapKey'] = sys_config('tengxun_map_key');
         $data['store_self_mention'] = (int)sys_config('store_self_mention') ?? 0;//门店自提是否开启
         $data['activity'] = StoreProduct::activity($data['storeInfo']['id'], false);
+        $integral = StoreProductAttrValue::where('product_id', $id)->field('integral')->find();
+        $data['integral'] = $integral['integral'] ?? 0;
         return app('json')->successful($data);
     }
 

+ 2 - 0
app/models/store/StoreCart.php

@@ -219,6 +219,7 @@ class StoreCart extends BaseModel
                         }
                         $cart['trueStock'] = $attrInfo['stock'];
                         $cart['costPrice'] = $attrInfo['cost'];
+                        $cart['integral'] = $attrInfo['integral'];
                         $cart['productInfo']['image'] = empty($attrInfo['image']) ? $cart['productInfo']['image'] : $attrInfo['image'];
                         $valid[] = $cart;
                     }
@@ -237,6 +238,7 @@ class StoreCart extends BaseModel
                     }
                     $cart['trueStock'] = $cart['productInfo']['stock'];
                     $cart['costPrice'] = $cart['productInfo']['cost'];
+                    $cart['integral'] = $cart['productInfo']['integral'] ?? 0;
                     $valid[] = $cart;
                 }
             }

+ 18 - 2
app/models/store/StoreOrder.php

@@ -77,6 +77,7 @@ class StoreOrder extends BaseModel
     {
         $storeFreePostage = floatval(sys_config('store_free_postage')) ?: 0;//满额包邮
         $totalPrice = self::getOrderSumPrice($cartInfo, 'truePrice');//获取订单总金额
+        $int = self::getOrderSumPrice($cartInfo, 'integral');//获取订单总金额
         $costPrice = self::getOrderSumPrice($cartInfo, 'costPrice');//获取订单成本价
         $vipPrice = self::getOrderSumPrice($cartInfo, 'vip_truePrice');//获取订单会员优惠金额
         //如果满额包邮等于0
@@ -148,7 +149,7 @@ class StoreOrder extends BaseModel
             }
             if ($storeFreePostage <= $totalPrice) $storePostage = 0;//如果总价大于等于满额包邮 邮费等于0
         }
-        return compact('storePostage', 'storeFreePostage', 'totalPrice', 'costPrice', 'vipPrice');
+        return compact('storePostage', 'storeFreePostage', 'totalPrice', 'costPrice', 'vipPrice', 'int');
     }
 
 
@@ -265,6 +266,7 @@ class StoreOrder extends BaseModel
      * @param int $shipping_type
      * @param string $real_name
      * @param string $phone
+     * @param string $integral
      * @return StoreOrder|bool|\think\Model
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -289,6 +291,7 @@ class StoreOrder extends BaseModel
             $priceGroup = $cartGroup['priceGroup'];
             $other = $cartGroup['other'];
             $payPrice = (float)$priceGroup['totalPrice'];
+            $int = (float)$priceGroup['int'];
             $addr = UserAddress::where('uid', $uid)->where('id', $addressId)->find();
             if ($payType == 'offline' && sys_config('offline_postage') == 1) {
                 $payPostage = 0;
@@ -373,6 +376,18 @@ class StoreOrder extends BaseModel
                 }
             }
 
+
+            // 趣豆抵扣
+
+            if ((float)$userInfo['integral'] >= (float)$priceGroup['int']){
+                $SurplusIntegral = bcsub($userInfo['integral'], $priceGroup['int'], 2);
+                User::where('uid', $userInfo['uid'])->update(['integral' => $SurplusIntegral]);
+
+                UserBill::expend('趣豆抵扣', $uid, 'integral', 'deduction', $priceGroup['int'], $userInfo['spread_uid'], $SurplusIntegral, '购买商品使用' . $priceGroup['int'] . '趣豆' );
+            }else{
+                return self::setErrorInfo('趣豆不足!', true);
+            }
+
             //积分抵扣
             $res2 = true;
             $SurplusIntegral = 0;
@@ -406,6 +421,7 @@ class StoreOrder extends BaseModel
                     'coupon_price' => $couponPrice,
                     'deduction_price' => $deductionPrice,
                     'SurplusIntegral' => $SurplusIntegral,
+                    'int' => $int
                 ];
             }
             $orderInfo = [
@@ -425,7 +441,6 @@ class StoreOrder extends BaseModel
                 'deduction_price' => $deductionPrice,
                 'paid' => 0,
                 'pay_type' => $payType,
-                'use_integral' => $usedIntegral,
                 'gain_integral' => $gainIntegral,
                 'mark' => htmlspecialchars($mark),
                 'combination_id' => $combinationId,
@@ -437,6 +452,7 @@ class StoreOrder extends BaseModel
                 'add_time' => time(),
                 'unique' => $key,
                 'shipping_type' => $shipping_type,
+                'use_integral' => $usedIntegral
             ];
             if ($shipping_type === 2) {
                 $orderInfo['verify_code'] = self::getStoreCode();

+ 2 - 0
app/models/store/StoreProduct.php

@@ -129,6 +129,8 @@ class StoreProduct extends BaseModel
         if (!empty($list)) {
             foreach ($list as $k => $v) {
                 $list[$k]['activity'] = self::activity($v['id']);
+                $integral = StoreProductAttrValueModel::where('product_id', $v['id'])->field('integral')->find();
+                $list[$k]['integral'] = $integral['integral'] ?? 0;
             }
         }
         return self::setLevelPrice($list, $uid);

+ 1 - 0
route/api/route.php

@@ -54,6 +54,7 @@ Route::group(function () {
     Route::post('switch_h5', 'AuthController/switch_h5')->name('switch_h5');// 切换账号
     Route::post('binding', 'AuthController/binding_phone')->name('bindingPhone');// 绑定手机号
     Route::post('rname', 'user.userController/rname')->name('rname');// 实名认证
+    Route::get('rate', 'user.userController/rate')->name('rate');// 实名认证查询
     //产品类
     Route::get('product/code/:id', 'store.StoreProductController/code')->name('productCode');//产品分享二维码 推广员
 

ファイルの差分が大きいため隠しています
+ 285 - 177
runtime/admin/temp/3842d4cff02ed8a8fdaa7dea044f6e6b.php


+ 2 - 2
runtime/admin/temp/5a82649edd1b40af6f202faef65620f4.php

@@ -1,4 +1,4 @@
-<?php /*a:5:{s:66:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\auction\auction\index.php";i:1648778269;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
+<?php /*a:5:{s:66:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\auction\auction\index.php";i:1648778587;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
 <!DOCTYPE html>
 <html lang="zh-CN">
 <head>
@@ -155,7 +155,7 @@
                         <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='status' lay-text='使用|禁用'  {{ d.status  == 1 ? 'checked' : '' }}>
                     </script>
                     <script type="text/html" id="act">
-                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.title}}-编辑','<?php echo Url('edit'); ?>?id={{d.id}}',{h:700,w:1100})"">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.title}}-编辑','<?php echo Url('edit'); ?>?id={{d.id}}',{h:700,w:1100})">
                             编辑
                         </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-danger" lay-event='delete' id="">

+ 19 - 2
runtime/admin/temp/a5e290369d4af2c431b37f2d99f61762.php

@@ -1,4 +1,4 @@
-<?php /*a:5:{s:72:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\auction\auction_order\index.php";i:1648720931;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
+<?php /*a:5:{s:72:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\auction\auction_order\index.php";i:1648790731;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
 <!DOCTYPE html>
 <html lang="zh-CN">
 <head>
@@ -121,10 +121,20 @@
 <!--                            </div>-->
                             <div class="layui-inline">
                                 <label class="layui-form-label" style="top: -4.5px">搜索</label>
-                                <div class="layui-input-block">
+                                <div class="layui-input-inline">
                                     <input type="text" name="store_name" class="layui-input" placeholder="订单号,账号,昵称,编号">
                                 </div>
                             </div>
+                            <div class="layui-col-lg12">
+                                <label class="layui-form-label">创建时间:</label>
+                                <div class="layui-input-block" v-cloak="">
+                                    <button class="layui-btn layui-btn-sm" type="button" v-for="item in statusList"
+                                            @click="where.status = item.value"
+                                            :class="{'layui-btn-primary':where.status!==item.value}">{{item.name}}
+                                    </button>
+                                </div>
+                            </div>
+
                             <div class="layui-col-lg12">
                                 <label class="layui-form-label">创建时间:</label>
                                 <div class="layui-input-block" data-type="data" v-cloak="">
@@ -321,6 +331,13 @@
                     {name: '本月', value: 'month'},
                     {name: '本年', value: 'year'},
                 ],
+                statusList:[
+                    {name: '全部', value: ''},
+                    {name: '过期', value: '0'},
+                    {name: '待上传', value: '1'},
+                    {name: '待审核', value: '2'},
+                    {name: '完成', value: '3'}
+                ],
                 where: {
                     data: '',
                     status: status,

+ 1 - 1
runtime/cache/2e/26d95f3b2397f1dbd714cb44636198.php

@@ -1,4 +1,4 @@
 <?php
 //000000086400
  exit();?>
-8
+19

+ 1 - 0
vendor/dh2y/think-qrcode/src/phpqrcode/73_product_detail_3_is_promoter_1_wap.jpg-errors.txt

@@ -0,0 +1 @@
+2022-04-01 14:20:05: gzuncompress() has been disabled for security reasons2022-04-01 14:59:02: gzuncompress() has been disabled for security reasons

+ 1 - 0
vendor/dh2y/think-qrcode/src/phpqrcode/75_product_detail_3_is_promoter_0_wap.jpg-errors.txt

@@ -0,0 +1 @@
+2022-04-01 14:12:44: gzuncompress() has been disabled for security reasons2022-04-01 14:13:03: gzuncompress() has been disabled for security reasons2022-04-01 14:16:02: gzuncompress() has been disabled for security reasons

+ 1 - 0
vendor/dh2y/think-qrcode/src/phpqrcode/75_product_detail_3_is_promoter_1_wap.jpg-errors.txt

@@ -0,0 +1 @@
+2022-04-01 14:20:12: gzuncompress() has been disabled for security reasons2022-04-01 14:20:35: gzuncompress() has been disabled for security reasons2022-04-01 14:59:15: gzuncompress() has been disabled for security reasons2022-04-01 15:00:54: gzuncompress() has been disabled for security reasons2022-04-01 15:29:02: gzuncompress() has been disabled for security reasons2022-04-01 15:39:17: gzuncompress() has been disabled for security reasons2022-04-01 15:39:26: gzuncompress() has been disabled for security reasons2022-04-01 15:40:35: gzuncompress() has been disabled for security reasons2022-04-01 15:41:18: gzuncompress() has been disabled for security reasons2022-04-01 15:41:22: gzuncompress() has been disabled for security reasons2022-04-01 15:42:17: gzuncompress() has been disabled for security reasons2022-04-01 15:52:02: gzuncompress() has been disabled for security reasons2022-04-01 16:08:55: gzuncompress() has been disabled for security reasons2022-04-01 16:09:16: gzuncompress() has been disabled for security reasons2022-04-01 16:09:25: gzuncompress() has been disabled for security reasons

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません