xieruidong 2 年之前
父节点
当前提交
6a79d0f96c

+ 28 - 0
application/admin/controller/GoodsSku.php

@@ -55,6 +55,34 @@ class GoodsSku extends Backend
         return $this->view->fetch();
     }
 
+    public function add()
+    {
+        $this->error('禁止添加');
+    }
+
+    public function edit($ids = null)
+    {
+        $row=$this->model->find($ids);
+        $this->assign('row',$row);
+        if($this->request->isGet()){
+            return $this->fetch();
+        }else{
+            $data=input('row/a');
+            $this->validate($data,[
+                'fx_per|比例'=>['require','float','min:0','max:100'],
+            ]);
+            if($data['fx_per']>100){
+                $this->error('比例不能大于100');
+            }
+            if($data['fx_per']<0){
+                $this->error('比例不能小于0');
+            }
+            $row['fx_per']=$data['fx_per'];
+            $row->save();
+            $this->success();
+        }
+    }
+
     public function bind_list(){
         $name=input('name');
         $page=input('pageNumber')?:1;

+ 15 - 0
application/admin/view/goods_sku/edit.html

@@ -0,0 +1,15 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-group forCom">
+        <label class="control-label col-xs-12 col-sm-2">{:__('分销比例')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-reg_phone" data-rule="required" class="form-control" name="row[fx_per]" type="text" value="{$row.fx_per|default=''}">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 1 - 1
application/admin/view/goods_sku/index.html

@@ -12,7 +12,7 @@
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-edit="{:$auth->check('programme_goods/edit')}" 
-                           data-operate-del="{:$auth->check('programme_goods/del')}" 
+                           data-operate-del="0"
                            width="100%">
                     </table>
                 </div>

+ 4 - 2
public/assets/js/backend/goods_sku.js

@@ -22,12 +22,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
                 sortName: 'id',
-                searchFormVisible:false,
                 columns: [
                     [
+                        {checkbox:true},
                         {field: 'goods.name', title: __('商品'),operate: false,},
                         {field: 'name', title: __('规格'),operate: false,},
-                        {field: 'fx_per', title: __('分销比例'),operate: false,},
+                        {field: 'fx_per', title: __('分销比例'),operate: 'between',formatter(a){
+                            return `${a}%`
+                            }},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]