hrjy 2 anni fa
parent
commit
28e44f9c0d

+ 13 - 0
app/admin/controller/auction/AuctionProducts.php

@@ -183,6 +183,19 @@ class AuctionProducts extends AuthController
 
     }
 
+    public function off($id)
+    {
+        if (!$id) return Json::fail('参数错误');
+        $product = \app\admin\model\auction\AuctionProduct::find($id);
+        $product['off'] = 1;
+        $res = $product->save();
+        if ($res){
+            return Json::success('成功!');
+        }else{
+            return Json::fail('失败');
+        }
+
+    }
 
 //    public function edit($id)
 //    {

+ 1 - 1
app/admin/model/auction/AuctionProduct.php

@@ -31,9 +31,9 @@ class AuctionProduct extends BaseModel
     {
 
         $model = self::alias('a')
-
             ->field('a.*,u.nickname, au.name as au_name')
             ->order('a.id DESC')
+            ->where('off', 0)
             ->leftJoin('auction au', 'a.auction_id = au.id')
             ->leftJoin('user u', 'a.uid = u.uid');
 

+ 19 - 0
app/admin/view/auction/auction_products/index.php

@@ -113,6 +113,9 @@
 <!--                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal"  onclick="$eb.createModalFrame('商品','{:Url('admin/auction.auction_product/appoint')}?id={{d.id}}',{h:500,w:500})">-->
 <!--                            指定-->
 <!--                        </button>-->
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='off'>
+                            核销
+                        </button>
                         <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
                             编辑
                         </button>
@@ -169,6 +172,22 @@
                     });
                 },code)
                 break;
+            case 'off':
+                var url=layList.U({c:'auction.auction_products',a:'off',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;

+ 1 - 1
app/api/controller/auction/AuctionProductController.php

@@ -34,7 +34,7 @@ class AuctionProductController
         if (!$data['s_id']) return app('json')->fail('数据传入错误');
         $section = AuctionSection::where('id', $data['s_id'])->find();
         $price = (float)SystemConfigService::get('product_hanging_price');
-        $pro = AuctionProduct::where('hanging_price', '>=', $section['low'])->where('hanging_price','<=','high')->select()->toArray();
+        $pro = AuctionProduct::where('hanging_price', '>=', $section['low'])->where('off', 0)->where('hanging_price','<=',$section['high'])->select()->toArray();
         if (empty($pro) and ($price < $section['low'] or $price > $section['high'])) {
             return app('json')->fail('该区间没有商品');
         }

+ 1 - 0
app/models/auction/AuctionOrder.php

@@ -60,6 +60,7 @@ class AuctionOrder extends BaseModel
                     ->order('a.id DESC')
                     ->where('a.uid', $uid)
                     ->where('a.is_show', 0)
+                    ->where('a.off', 0)
                     ->select();
 
             }else{

+ 1 - 0
app/models/auction/AuctionProduct.php

@@ -56,6 +56,7 @@ class AuctionProduct extends BaseModel
             ->where('hanging_price','<=',$section['high'])
             ->where('id', 'notIn', $order)
             ->where('uid', '<>', $uid)
+            ->where('off', 0)
             ->where('is_show', '=', 1)
             ->orderRaw('rand()')
             ->limit(1)->find(); // 随机出来一个商品