Explorar el Código

商品列表修改

shensong %!s(int64=5) %!d(string=hace) años
padre
commit
e9ae27bce3

+ 33 - 6
app/Http/Controllers/Admin/GoodsController.php

@@ -734,12 +734,15 @@ class GoodsController extends Controller
734 734
         foreach($result as $k=>&$v){
735 735
             # 获取goods信息
736 736
             $goodsInfo = Goods::where('id', $v['goodsCode'])->first();
737
-                $quantity = GoodsSkus::actualQuantityByRedis($v['id']);
738
-                $v['real_quantity'] = $quantity['quantity'];
739
-                $v['pre_quantity'] = $quantity['w_num'];
740
-                $v['total_quantity'] = $v['quantity'];
741
-                $v['name'] = $goodsInfo->name;
742
-                $v['goodsCategoryName'] = $goodsInfo->goodsCategoryName;
737
+            $quantity = GoodsSkus::actualQuantityByRedis($v['id']);
738
+            $v['real_quantity'] = $quantity['quantity'];
739
+            $v['pre_quantity'] = $quantity['w_num'];
740
+            $v['total_quantity'] = $v['quantity'];
741
+            $v['name'] = $goodsInfo->name;
742
+            $v['goodsCategoryName'] = $goodsInfo->goodsCategoryName;
743
+            if($goodsInfo->is_del == 1){
744
+                $v['is_del'] = 1;
745
+            }
743 746
         }
744 747
 
745 748
         //返回给页面
@@ -812,6 +815,9 @@ class GoodsController extends Controller
812 815
             $v['total_quantity'] = $v['quantity'];
813 816
             $v['name'] = $goodsInfo->name;
814 817
             $v['goodsCategoryName'] = $goodsInfo->goodsCategoryName;
818
+            if($goodsInfo->is_del == 1){
819
+                $v['is_del'] = 1;
820
+            }
815 821
             if($v['is_del'] == 1){
816 822
                 $v['status'] = '已下架';
817 823
             } else {
@@ -826,5 +832,26 @@ class GoodsController extends Controller
826 832
         return Order::export_excel($result, $filename, $indexKey, $title);
827 833
     }
828 834
 
835
+    /**
836
+     * 编辑建议零售价或者分销商价格
837
+     * @param Request $request
838
+     */
839
+    public function editGoodsSku(Request $request){
840
+        $id = $request->input('id');
841
+        $outPrice = trim($request->input('outPrice'));
842
+        $price = trim($request->input('price'));
843
+
844
+        if($outPrice){
845
+            $res = GoodsSkus::where('id',$id)->update(['outPrice'=>$outPrice]);
846
+            if($res) return 0;
847
+        }
848
+        if($price){
849
+            $res = GoodsSkus::where('id',$id)->update(['price'=>$price]);
850
+            if($res) return 0;
851
+        }
852
+
853
+        return 1;
854
+    }
855
+
829 856
 }
830 857
 

+ 1 - 0
app/Http/routes.php

@@ -331,6 +331,7 @@ Route::group(['prefix' => 'admin'], function(){
331 331
 
332 332
         Route::get('goods/index_copy','Admin\GoodsController@indexCopy');
333 333
         Route::get('goods/index_copy_export','Admin\GoodsController@indexCopyExport');
334
+        Route::get('goods/editGoodsSku','Admin\GoodsController@editGoodsSku');
334 335
 
335 336
     });
336 337
     

+ 6 - 8
resources/views/customer/vipCustomerList.blade.php

@@ -67,14 +67,12 @@
67 67
                 <!-- <td class="text-c">{{$a['is_del'] == 0 ? '启用' : '禁用'}}</td> -->
68 68
 
69 69
                 <td class="f-14 product-brand-manage">
70
-                   <!--  <a style="text-decoration:none" onClick='user_edit("{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a><br><br>
71
-
72
-                    {{--@if($a['is_del']==0)--}}
73
-                        {{--<a style="text-decoration:none" class="ml-5" onClick="user_del(this, '{{$a["id"]}}')" href="javascript:;" title="禁用"><span class="btn btn-danger radius">禁用</span></a><br/><br/>--}}
74
-                    {{--@elseif($a['is_del']==1)--}}
75
-                        {{--<a style="text-decoration:none" class="ml-5" onClick="user_up(this, '{{$a['id']}}')" href="javascript:;" title="启用"><span class="btn btn-success radius">启用</span></a><br/><br/>--}}
76
-                    {{--@endif--}} -->
77
-
70
+                    {{--<a style="text-decoration:none" onClick='user_edit("{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a><br><br>--}}
71
+                    @if($a['is_del']==0)
72
+                        <a style="text-decoration:none" class="ml-5" onClick="user_del(this, '{{$a["id"]}}')" href="javascript:;" title="禁用"><span class="btn btn-danger radius">禁用</span></a><br/><br/>
73
+                    @elseif($a['is_del']==1)
74
+                        <a style="text-decoration:none" class="ml-5" onClick="user_up(this, '{{$a['id']}}')" href="javascript:;" title="启用"><span class="btn btn-success radius">启用</span></a><br/><br/>
75
+                    @endif
78 76
                     <a style="text-decoration:none" onClick='coupon_log("{{$a['phone']}}")' href="javascript:;" title="代金券使用记录"><span class="btn btn-primary radius">代金券</span></a><br><br>
79 77
                     <a style="text-decoration:none" onClick='month_gift_log("{{$a['phone']}}")' href="javascript:;" title="每月礼品使用记录"><span class="btn btn-primary radius">每月礼</span></a><br><br>
80 78
                     <a style="text-decoration:none" onClick='birthday_gift_log("{{$a['phone']}}")' href="javascript:;" title="生日套餐使用记录"><span class="btn btn-primary radius">生日礼</span></a>

+ 64 - 2
resources/views/goods/indexcopy.blade.php

@@ -66,8 +66,18 @@
66 66
                             <td class="text-c">{{$a['propsName']}}</td>
67 67
                             <td class="text-c">{{$a['code']}}</td>
68 68
                             <td class="text-c">{{$a['realPrice']}}</td>
69
-                            <td class="text-c">{{$a['price']}}</td>
70
-                            <td class="text-c">{{$a['outPrice']}}</td>
69
+                            {{--<td class="text-c">{{$a['price']}}</td>--}}
70
+                            <td class ="change_logistics_id">
71
+                                <p id="price_1{{$a['id']}}">{{$a['price']}}</p>
72
+                                <input id="price_2{{$a['id']}}" style="display: none" type='text' name='price' value="{{$a['price']}}" onblur="change_price({{$a['id']}})" />
73
+                                <span class="sort_icon" hidden onClick='change_price_click("{{$a['id']}}","{{$a['price']}}")' style="cursor:pointer"><i class="Hui-iconfont">&#xe647;</i></span>
74
+                            </td>
75
+                            {{--<td class="text-c">{{$a['outPrice']}}</td>--}}
76
+                            <td class ="change_logistics_id">
77
+                                <p id="outPrice_1{{$a['id']}}">{{$a['outPrice']}}</p>
78
+                                <input id="outPrice_2{{$a['id']}}" style="display: none" type='text' name='outPrice' value="{{$a['outPrice']}}" onblur="change_outPrice({{$a['id']}})" />
79
+                                <span class="sort_icon" hidden  onClick='change_outPrice_click("{{$a['id']}}","{{$a['outPrice']}}")' style="cursor:pointer"><i class="Hui-iconfont">&#xe647;</i></span>
80
+                            </td>
71 81
                             <td class="text-c">@if($a['is_del']==1) <span class="btn btn-danger radius">已下架</span> @else <span class="btn btn-success radius">已上架</span> @endif</td>
72 82
                             <td class="text-c">{{$a['createTime']}}</td>
73 83
                             <td class="text-c">{{$a['real_quantity']}}</td>
@@ -128,6 +138,58 @@
128 138
             }
129 139
         })
130 140
 
141
+        function change_outPrice_click(id, outPrice){
142
+            $("#outPrice_1"+id).hide();
143
+            $("#outPrice_2"+id).show();
144
+            $("#outPrice_2"+id).focus();
145
+        }
146
+
147
+        function change_outPrice(id){
148
+            var outPrice = $("#outPrice_2"+id).val();
149
+            $.ajax({
150
+                url: '/admin/goods/editGoodsSku?id='+id+'&outPrice='+outPrice,
151
+                type: 'get',
152
+                dateType: 'json',
153
+                success:function(msg){
154
+                    $("#outPrice_1"+id).html(outPrice);
155
+                    $("#outPrice_1"+id).show();
156
+                    $("#outPrice_2"+id).hide();
157
+                }
158
+            });
159
+        }
160
+
161
+        function change_price_click(id, price){
162
+            $("#price_1"+id).hide();
163
+            $("#price_2"+id).show();
164
+            $("#price_2"+id).focus();
165
+        }
166
+
167
+        function change_price(id){
168
+            var price = $("#price_2"+id).val();
169
+            $.ajax({
170
+                url: '/admin/goods/editGoodsSku?id='+id+'&price='+price,
171
+                type: 'get',
172
+                dateType: 'json',
173
+                success:function(msg){
174
+                    $("#price_1"+id).html(price);
175
+                    $("#price_1"+id).show();
176
+                    $("#price_2"+id).hide();
177
+                }
178
+            });
179
+        }
180
+
181
+        $(".change_logistics_id").mouseover(
182
+            function(){
183
+                $(this).children("span").show();
184
+                $(this).children("span").addClass('f-18 c-success');
185
+                $(this).mouseout(
186
+                    function(){
187
+                        $(this).children("span").hide();
188
+                    }
189
+                );
190
+            }
191
+        );
192
+
131 193
     </script>
132 194
     </body>
133 195