dlgroupgoods.html 26.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_cjdianc/template/public/ygcsslist.css">
<style type="text/css">
    .ygrow{margin-top: 20px;font-size: 12px;}
    .ygmartop{margin-top: 30px;font-size: 12px;}
    .ygmartop2{margin-bottom: 10px;}
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;text-align: center;background-color: white;}
    .yg5_tr1>td{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    .yg5_btn2{background-color: white;color: #333;border: 1px solid white;border-radius: 6px;width: 100px;height: 34px;}
    .yg13_img{width: 50px;height: 50px;border-radius: 4px;}
    .yg_name{width: 30%;height: 34px;line-height: 34px;color: #333;float: left;background-color: white;border: 1px solid #E4E4E4;text-align: center;}
    .yg_left{float: left;}
    .form-control{width: 70%;}
    .ygseledi{width: 60%;}
    .dishes{display: flex;align-items: center;}
    .dishes_font{font-size: 20px;}
    .dishes_inp{width: 195px;height: 23px;border: none;}
    .dishes_inp2{margin-right: 20px;}
    .input_box{border: 2px solid #5bc0de;border-radius: 4px;padding: 5px;margin-right: 10px;background-color: #5bc0de;color: white;}
    .store_inp{margin-left: 5px;}
    .dish_left{margin-right: 20px;}
    .dish_btn>button,.dish_btn>a{margin-bottom: 10px;}
    .ygboxl{margin-bottom: 15px;}
    /*.ygboxl>.input-group{border:1px solid green;}*/
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li class="active"><a href="{php echo $this->createWebUrl2('dlgroupgoods')}">商品管理</a></li>
    <li><a href="{php echo $this->createWebUrl2('dladdgroupgoods')}">添加商品</a></li>
</ul> 
   	<div class="row ygmartop">
        <form action="" method="get" class="col-md-12" style="padding: 0px;">
            <div class="col-md-12 ygboxl">
               <input type="hidden" name="c" value="site" />
               <input type="hidden" name="a" value="entry" />
               <input type="hidden" name="m" value="zh_cjdianc" />
               <input type="hidden" name="do" value="dlgroupgoods" />
                <div class="col-md-2" style="padding: 0px;">
                    <div class="yg_name">商品名称</div>
                    <input type="text" name="keywords" class="yg_left form-control" placeholder="请输入商品名称"> 
                </div>
              
                <div class="col-md-3">
                    <div class="yg_name">
                        商品状态
                    </div>
                    <select class="ygseledi" style="color: #333;" name="is_shelves2">
                      <option value="">不限</option>
                      <option value="1">已上架</option>
                      <option value="2">已下架</option>
                    </select>                
                </div>
                <div class="col-md-3">
                    <div class="yg_name">
                        商品分类
                    </div>
                    <select class="ygseledi" style="color: #333;" name="type_id">
                    <option value="">不限</option>
                    {loop $type  $item2}
                      <option value="{$item2['id']}">{$item2['name']}</option>
                      {/loop}
                    </select>                
                </div>
                <div class="col-md-1">
                    <input type="submit" value="搜索" name="submit" class="btn btn-primary btn-sm"/>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                </div>
            </div>
        </form>
  </div>
<div class="dishes">
	<button class="btn ygyouhui2  dish_left" id="allshang">批量上架</button>
	<button class="btn storegrey2  dish_left" id="alldown">批量下架</button>
  	<button class="btn ygshouqian2 dish_left" id="allselect">批量删除</button>
</div>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-heading">
            商品列表
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                    	<td class="store_td1 col-md-1">
                            <input type="checkbox" class="allcheck" />
                            <span class="store_inp">全选</span>
                        </td>
                        <td class="">序号</td>
                   		<td class="">商品图片</td>
                        <td class="">商品名称</td>
                        <td class="col-md-1">分类</td>
                        <td class="col-md-1">拼团价格</td>
                        <td class="col-md-1">单独够价格</td>
                        <td class="col-md-1">开团人数</td>
                        <td class="col-md-1">库存</td>
                        <td class="col-md-1">总销量</td>
                        <td class="col-md-1">是否上架</td>
                        <td class="col-md-2">操作</td>
                    </tr>
                     {loop $list $key $item}
                    <tr class="yg5_tr2">
                    	<td>
                            <input type="checkbox" name="test" value="{$item['id']}">
                        </td>

                        <td class="store_td1 col-md-1"> {$item['id']}</td>
                         <td class="store_td1 col-md-1"> <img class="store_list_img" src="{$item['logo']}" alt=""/></td>
                        <td class="col-md-1 cainame{$item['id']}">
                            <span class="caispan{$item['id']}">{$item['name']}</span>
                            <input style="display: none;width: 100%;" name="inp{$item['id']}" type="text" value="{$item['name']}" class="caininp{$item['id']}"/>
                            <script type="text/javascript">
							    $(function(){
							    	$(".cainame{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".caininp{$item['id']}").eq(index).show().focus();
							                $(".caispan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".caininp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".caininp{$item['id']}").eq(index).hide();
							                $(".caispan{$item['id']}").eq(index).show();
							                var text = $(".caispan{$item['id']}").html();
							                var inp = $(" input[ name='inp{$item['id']}' ] ").val();
							                $(".caispan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        name = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
									    		dataType:"text",
										        data:{id:id,name:name},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                         <td class="col-md-1"> {$item['type_name']}</td>
                        <td class="col-md-1 money{$item['id']}">
                        	<span class="moneyspan{$item['id']}">{$item['pt_price']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="money{$item['id']}" class="moneyinp{$item['id']}" value="{$item['money']}" />
                        	<script type="text/javascript">
							    $(function(){
							    	$(".money{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".moneyinp{$item['id']}").eq(index).show().focus();
							                $(".moneyspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".moneyinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".moneyinp{$item['id']}").eq(index).hide();
							                $(".moneyspan{$item['id']}").eq(index).show();
							                var text = $(".moneyspan{$item['id']}").html();
							                var inp = $(" input[ name='money{$item['id']}' ] ").val();
							                $(".moneyspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        money = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
									    		dataType:"text",
										        data:{id:id,money:money},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 wm_money{$item['id']}">
                        	<span class="wmspan{$item['id']}">{$item['dd_price']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="wmoney{$item['id']}" class="wmoney{$item['id']}" value="{$item['wm_money']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".wm_money{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".wmoney{$item['id']}").eq(index).show().focus();
							                $(".wmspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".wmoney{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".wmoney{$item['id']}").eq(index).hide();
							                $(".wmspan{$item['id']}").eq(index).show();
							                var text = $(".wmspan{$item['id']}").html();
							                var inp = $(" input[ name='wmoney{$item['id']}' ] ").val();
							                $(".wmspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        wm_money = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
									    		dataType:"text",
										        data:{id:id,wm_money:wm_money},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 box_fee{$item['id']}">
                        	<span class="boxspan{$item['id']}">{$item['people']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="boxinp{$item['id']}" class="boxinp{$item['id']}" value="{$item['people']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".box_fee{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".boxinp{$item['id']}").eq(index).show().focus();
							                $(".boxspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".boxinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".boxinp{$item['id']}").eq(index).hide();
							                $(".boxspan{$item['id']}").eq(index).show();
							                var text = $(".boxspan{$item['id']}").html();
							                var inp = $(" input[ name='boxinp{$item['id']}' ] ").val();
							                $(".boxspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        box_fee = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
									    		dataType:"text",
										        data:{id:id,box_fee:box_fee},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 num{$item['id']}"> 
                        	<span class="numspan{$item['id']}">{$item['inventory']}</span>
                        	<input style="display: none;width: 100%;" type="text" name="numinp{$item['id']}" class="numinp{$item['id']}" value="{$item['num']}">
                        
                    		<script type="text/javascript">
							    $(function(){
							    	$(".num{$item['id']}").each(function(index){
							             $(this).dblclick(function(){
							                $(".numinp{$item['id']}").eq(index).show().focus();
							                $(".numspan{$item['id']}").eq(index).hide();							                
							            });
							        });
							        $(".numinp{$item['id']}").each(function(index){
							            $(this).blur(function(){            
							                $(".numinp{$item['id']}").eq(index).hide();
							                $(".numspan{$item['id']}").eq(index).show();
							                var text = $(".numspan{$item['id']}").html();
							                var inp = $(" input[ name='numinp{$item['id']}' ] ").val();
							                $(".numspan{$item['id']}").html(inp);
							                // console.log(inp);
							                id = {$item['id']};
									        num = inp;
									    	$.ajax({
									    		type:"post",
									    		url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
									    		dataType:"text",
										        data:{id:id,num:num},
										        success:function(data){
										        	console.log(data);
											    }
									    	})
							        
							            });
							        });
							    })
							</script>
                        </td>
                        <td class="col-md-1 xs_num{$item['id']}"> 
                            <span class="xspan{$item['id']}">{$item['ysc_num']}</span>
                            <input style="display: none;width: 100%;" type="text" name="xinp{$item['id']}" class="xinp{$item['id']}" value="{$item['xs_num']}">
                        
                            <script type="text/javascript">
                                $(function(){
                                    $(".xs_num{$item['id']}").each(function(index){
                                         $(this).dblclick(function(){
                                            $(".xinp{$item['id']}").eq(index).show().focus();
                                            $(".xspan{$item['id']}").eq(index).hide();                                            
                                        });
                                    });
                                    $(".xinp{$item['id']}").each(function(index){
                                        $(this).blur(function(){            
                                            $(".xinp{$item['id']}").eq(index).hide();
                                            $(".xspan{$item['id']}").eq(index).show();
                                            var text = $(".xspan{$item['id']}").html();
                                            var inp = $(" input[ name='xinp{$item['id']}' ] ").val();
                                            $(".xspan{$item['id']}").html(inp);
                                            // console.log(inp);
                                            id = {$item['id']};
                                            xs_num = inp;
                                            $.ajax({
                                                type:"post",
                                                url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupupdate&m=zh_cjdianc",
                                                dataType:"text",
                                                data:{id:id,xs_num:xs_num},
                                                success:function(data){
                                                    console.log(data);
                                                }
                                            })
                                    
                                        });
                                    });
                                })
                            </script>
                        </td>
                         <td class="col-md-1 dish_btn">
                            {if $item['is_shelves']==1}
                              <button  type="button"  data-toggle="modal" data-target="#myModalc{$item['id']}" class="btn btn-xs storeblue">点击下架</button>
                            {elseif $item['is_shelves']==2}
                            <button type="button"  data-toggle="modal" data-target="#myModalb{$item['id']}" class="btn btn-xs storegrey">点击上架</button>
                            {/if}
                            <input type="hidden" value="{$item['is_shelves']}" name="updtype"/>
                            </td>
                                
                            <td class="col-md-2 dish_btn">
                                <a href="{php echo $this->createWebUrl2('dladdgroupgoods', array('id' => $item['id']))}" class="storespan btn btn-xs">
                                    <span class="fa fa-pencil"></span>
                                    <span class="bianji">编辑
                                        <span class="arrowdown"></span>
                                    </span>                                
                                </a>
            
                                <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                                    <span class="fa fa-trash-o"></span>
                                    <span class="bianji">删除
                                        <span class="arrowdown"></span>
                                    </span>
                                </a>
                            </td>
                        </tr>                          
                     
                    <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么?
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl2('dlgroupgoods', array('op' => 'delete', 'delid' => $item['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            
                <div class="modal fade" id="myModalb{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定上架么?
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl2('dlgroupgoods',array('id'=>$item['id'],'is_shelves'=>1,'page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'],'is_shelves2'=>$_GPC['is_shelves2']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>

             <div class="modal fade" id="myModalc{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定下架么?
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl2('dlgroupgoods',array('id'=>$item['id'],'is_shelves'=>2,'page'=>$_GPC['page'],'keywords'=>$_GPC['keywords'],'dishes_type'=>$_GPC['dishes_type'],'type_id'=>$_GPC['type_id'],'is_shelves2'=>$_GPC['is_shelves2']));}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>

                {/loop}
                {if empty($list)}
                <tr class="yg5_tr2">
                    <td colspan="12">
                      暂无商品信息
                    </td>
                </tr>
                {/if}
                </table>
            </div>
        </div>
    </div>
</div>
<div class="text-right we7-margin-top">{$pager}</div>

<script type="text/javascript">
    $(function(){
    	// $("#frame-2").addClass("in");
        $("#frame-11").show();
        $("#yframe-11").addClass("wyactive");
    	// —————批量上架—————
    	$("#allshang").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要上架的商品!');
                return false;
            }else if(confirm("确认要上架此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupsj&m=zh_cjdianc",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });

    	// 批量下架
        $("#alldown").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要下架的商品!');
                return false;
            }else if(confirm("确认要下架此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=groupxj&m=zh_cjdianc",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });

        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });

        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的商品!');
                return false;
            }else if(confirm("确认要删除此商品?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
               // console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=delgroup&m=zh_cjdianc",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                        location.reload();
                    }
                })
               
            }
        });
        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        
    })
</script>
{template 'common/footer'}