xieruidong il y a 2 ans
Parent
commit
7d495934aa

+ 7 - 0
application/admin/controller/ProgrammeGoods.php

@@ -44,6 +44,7 @@ class ProgrammeGoods extends Backend
      */
     public function index()
     {
+        $pid=$this->request->get('pid');
         //当前是否为关联查询
         $this->relationSearch = false;
         //设置过滤方法
@@ -55,9 +56,15 @@ class ProgrammeGoods extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
 
+            $map=[];
+            if($pid){
+                $map['programme_id']=$pid;
+            }
+
             $list = $this->model
                     ->with(['goods','sku_obj'])
                     ->where($where)
+                ->where($map)
                     ->order($sort, $order)
                     ->paginate($limit);
 

+ 1 - 1
application/admin/view/user/user/show.html

@@ -31,7 +31,7 @@
         <td>历史方案</td>
         <td>
             {foreach name='programmes' item='a'}
-            <div>{:$key+1}、<a>{$a.name}</a></div>
+            <div>{:$key+1}、<a class="showProgram" data-id="{$a.id}" data-url="{:url('/programme_goods')}">{$a.name}</a></div>
             {/foreach}
         </td>
     </tr>

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

@@ -27,10 +27,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         //{checkbox: true},
                         {field: 'programme_id', title: __('Programme_id'),operate: false,},
-                        {field: 'goods.name', title: __('Goods_id'),operate: false,},
-                        {field: 'sku_id', title: __('Sku_id'),operate: false,},
-                        {field: 'name', title: __('Name'),operate: false,},
-                        {field: 'sku', title: __('Sku'),operate: false,},
+                        {field: 'goods.name', title: __('商品'),operate: false,},
+                        {field: 'sku_obj.name', title: __('Sku'),operate: false,},
                         {field: 'amount', title: __('Amount'),operate: false,},
                         {field: 'num', title: __('Num'),operate: false,},
                         {field: 'amount_install', title: __('Amount_install'),operate: false,},

+ 9 - 0
public/assets/js/backend/user/user.js

@@ -138,6 +138,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));
             }
+        },
+        show(){
+            $('.showProgram').click(function (){
+                let id=$(this).data('id')
+                let url=$(this).data('url')
+                parent.Fast.api.open(`${url}?pid=${id}`,'方案',{
+                    area:['1000px','500px']
+                })
+            })
         }
     };
     return Controller;