xxxrrrdddd 3 years ago
parent
commit
368c347854
2 changed files with 20 additions and 2 deletions
  1. 8 1
      application/admin/controller/Mobile.php
  2. 12 1
      public/assets/js/backend/mobile.js

+ 8 - 1
application/admin/controller/Mobile.php

@@ -113,6 +113,13 @@ class Mobile extends Backend
     }
     #取消设为特价
     public function cancelsetdiscount(){
-
+        $ids=input('ids/a');
+        if($ids){
+            $this->model->whereIn('id',$ids)->update([
+                'is_activity'=>0,
+                'activity_time_end'=>null,
+            ]);
+        }
+        $this->success('');
     }
 }

+ 12 - 1
public/assets/js/backend/mobile.js

@@ -13,6 +13,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     import_url: 'mobile/import',
                     batch: 'mobile/batch',
                     table: 'mobile',
+                    cancel_discount: 'mobile/cancelsetdiscount',
                 }
             });
 
@@ -88,10 +89,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             })
             $(document).on('click','.btn-set-discount',function (){
                 let set=$(this).data('set')
-                let select=table.bootstrapTable('getSelections')
+                let select=table.bootstrapTable('getSelections'),
+                    a=[]
                 if(!select.length){
                     return
                 }
+                select.forEach(item=>{
+                    a.push(item.id)
+                })
+                if(!set){
+                    $.post($.fn.bootstrapTable.defaults.extend.cancel_discount,{ids:a},function (){
+                        layer.msg('操作成功')
+                        $('.btn-refresh').trigger('click')
+                    })
+                }
             })
 
             // 为表格绑定事件