dyjh 6 년 전
부모
커밋
c667ede193
3개의 변경된 파일97개의 추가작업 그리고 75개의 파일을 삭제
  1. 2 3
      app/Http/Controllers/Admin/Album/ProductController.php
  2. 1 0
      myb/we7_new_1_7
  3. 94 72
      resources/views/admin/album/product/edit.blade.php

+ 2 - 3
app/Http/Controllers/Admin/Album/ProductController.php

xqd xqd
@@ -114,7 +114,7 @@ class ProductController extends Controller
         if ($request->method() == 'POST') {
             return $this->_createSave();
         }
-        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0]])->get();
+        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id','!=',0]])->get();
 
         $data['cat_id'] = null;
         return view('admin.album.product.edit', compact('data', 'cat', 'style'));
@@ -179,9 +179,8 @@ class ProductController extends Controller
         if ($request->method() == 'POST') {
             return $this->_updateSave();
         }
-        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0]])->get();
+        $cat = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id','!=',0]])->get();
         $data = $this->repository->find($request->get('id'));
-        $parent = AlbumCatModel::where([['store_id',$this->getStoreId()],['parent_id',0],['id',$data->cat_id]])->get();
         $data['install_img'] = json_decode($data['install_img']);
         $data['specifications_img'] = json_decode($data['specifications_img']);
         $data['detail'] = json_decode($data['detail']);

+ 1 - 0
myb/we7_new_1_7

xqd
@@ -0,0 +1 @@
+Subproject commit 4fdeec9268ac03de0c46cb0371ddedab2518061b

+ 94 - 72
resources/views/admin/album/product/edit.blade.php

xqd xqd xqd
@@ -10,59 +10,61 @@
     if(!$data && session('_old_input')){
         $data = session("_old_input");
     }
-    ?>
-    <div class="wrapper wrapper-content animated fadeInRight">
-        <div class="row">
-            <div class="col-sm-12">
-                <div class="ibox float-e-margins">
-                    <div class="ibox-title">
-                        <h5>产品列表</h5>
-                        <div class="ibox-tools">
-                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
-                            </a>
-                        </div>
-                    </div>
-                    <div class="ibox-content">
-                        @if(role('Album/Product/index'))
-                            <div class="row">
-                                <div class="col-sm-3 pull-right">
-                                    <a href="{{ U('Album/Product/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
-                                </div>
-                            </div>
-                        @endif
-
-                        <div class="row">
-                            <div class="col-lg-10">
-                                <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post" onsubmit="return checkLevel()">
-
-
-                                    <div class="form-group">
-
-                                        <label class="control-label col-sm-3">产品名称</label>
-
-                                        <div class="col-sm-9">
-                                            <input id="data_store_id" name="data[name]" class="form-control" value="{{ $data['name'] or ''}}" required="" aria-required="true"  placeholder="">
-                                        </div>
-                                    </div>
-                                    <div class="form-group">
 
-                                        <label class="control-label col-sm-3">分类</label>
+?>
+<div class="wrapper wrapper-content animated fadeInRight">
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>产品列表</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+                    @if(role('Album/Product/index'))
+				    <div class="row">
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Album/Product/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+    					</div>
+					</div>
+                    @endif
+
+		            <div class="row">
+                        <div class="col-lg-10">
+                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post" onsubmit="return checkLevel()">
+
+                                    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">产品名称</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_store_id" name="data[name]" class="form-control" value="{{ $data['name'] or ''}}" required="" aria-required="true"  placeholder="">
+                    </div>
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">分类</label>
+                                    
+                   <div class="col-sm-3">
+                       <select id="data_parent_id" class="form-control" name="data[cat_id]" >
+                           @if(isset($cat))
+                               @foreach($cat as $key=>$val)
+                                       <option value="{{$val->id}}"  @if($val['id'] == (isset($data['cat_id'])? $data['cat_id']:''))selected @endif>{{$val->name}}</option>
+                               @endforeach
+                           @endif
+                       </select>
+                   </div>
+                    {{--<div class="col-sm-3" id="app">
+                        <select name="data[cat_id]" id="data_cat_id" class="form-control"  required="" aria-required="true">
+                            <option v-for="item in list.data" :value="item.id">@{{ item.name }}</option>
+                        </select>
+                    </div>--}}
+                </div>
 
-                                        <div class="col-sm-3">
-                                            <select id="data_parent_id" class="form-control" onchange="getLevelSecondCategory()">
-                                                @if(isset($cat))
-                                                    @foreach($cat as $key=>$val)
-                                                        <option value="{{$val->id}}"  @if($val['id'] == (isset($parent['id'])? $parent['id']:''))selected @endif>{{$val->name}}</option>
-                                                    @endforeach
-                                                @endif
-                                            </select>
-                                        </div>
-                                        <div class="col-sm-3" id="app">
-                                            <select name="data[cat_id]" id="data_cat_id" class="form-control"  required="" aria-required="true">
-                                                <option v-for="item in list.data" :value="item.id">@{{ item.name }}</option>
-                                            </select>
-                                        </div>
-                                    </div>
                                     <div class="form-group">
 
                                         <label class="control-label col-sm-3">默认价格</label>
@@ -174,26 +176,46 @@
                         </div>
                         <!-- /.row -->
                     </div>
-                </div>
-            </div>
-        </div>
-    </div>
-    <script src="/base/js/vue.js"></script>
-    <link href="/base/css/plugins/toastr/toastr.min.css" rel="stylesheet">
-    <script src="/base/js/plugins/toastr/toastr.min.js"></script>
-    <script>
-        toastr.options.positionClass = 'toast-bottom-center';
-        toastr.options.timeOut = '4000';
-
-        var level = new Vue({
-            el:"#app",
-            data:{
-                list:{
-                    data:[
-                        {'id':0,'name':'请先选择一级类目'},
-                    ],
-                },
-                //      num:0
+
+                    <!-- /.row -->
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+<script src="/base/js/vue.js"></script>
+<link href="/base/css/plugins/toastr/toastr.min.css" rel="stylesheet">
+<script src="/base/js/plugins/toastr/toastr.min.js"></script>
+<script>
+    toastr.options.positionClass = 'toast-bottom-center';
+    toastr.options.timeOut = '4000';
+
+  /*  var level = new Vue({
+        el:"#app",
+        data:{
+            list:{
+                data:[
+                    {'id':0,'name':'请先选择一级类目'},
+                ],
+            },
+            //      num:0
+        },
+        methods:{
+            changeData:function (e) {
+                Vue.set(this.list,'data',e)
+            }
+        }
+    });
+
+    function getLevelSecondCategory(){
+        var first = $('#data_parent_id').val();
+        $.ajax({
+            url: "{{ U('Album/Product/getSecondCategory') }}",
+            method: 'POST',
+            data: {
+                'cat_id':first,
+                '_token':"{{ csrf_token() }}"
+
             },
             methods:{
                 changeData:function (e) {
@@ -224,7 +246,7 @@
         }
 
 
-        getLevelSecondCategory();
+        getLevelSecondCategory();*/
 
 
         function checkLevel(){