This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

1627
app/admin/view/product/add.html Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,129 @@
<!-- Select2 -->
<link rel="stylesheet" href="__PUBLIC__/adminlte/bower_components/select2/dist/css/select2.min.css">
<style>
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #d2d6de;
border-radius: 0;
}
.select2-container .select2-selection--single{height:34px;}
ul, li{list-style: none;}
</style>
<!-- Select2 -->
<script src="__PUBLIC__/adminlte/bower_components/select2/dist/js/select2.full.min.js"></script>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
编辑sku
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/product/lists');?>"> 产品列表</a></li>
<li class="active"> 产品</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-md-10">
<form class="form-horizontal" action="<?php echo url('/admin/product/update_sku');?>" method="post" name="productform">
<div class="nav-tabs-custom">
<div class="tab-content" style="overflow: hidden;">
<?php if (!empty($sku_list)): ?>
<div>
<div class="col-sm-12 table">
<ul class="col-sm-12" style="text-align: center; font-size: 12px; font-weight: 600">
<li class="col-sm-2">SKU</li>
<li class="col-sm-2">功能/版本</li>
<li class="col-sm-2">接口</li>
<li class="col-sm-1">颜色</li>
<li class="col-sm-1">长度</li>
<li class="col-sm-2">安规</li>
<li class="col-sm-1">包装</li>
<li class="col-sm-1"></li>
</ul>
<?php foreach($sku_list as $key => $value): ?>
<ul class="form-group col-sm-12">
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="sku[]" value="<?php echo $value['sku']; ?>"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="version[]" value="<?php echo $value['version']; ?>"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="interface[]" value="<?php echo $value['interface']; ?>"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="color[]" value="<?php echo $value['color']; ?>"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="length[]" value="<?php echo $value['length']; ?>"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="regulatory[]" value="<?php echo $value['regulatory']; ?>"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="package[]" value="<?php echo $value['package']; ?>"></li>
<?php if ($key == 0): ?>
<li class="col-sm-1" ><input type="button" class="add_item" value="+" style="background-color: #00B2EE;width: 30px;"></li>
<?php else: ?>
<li class="col-sm-1" ><input type="button" class="del_item" value="-" style="background-color: #EE0000;width: 30px;"></li>
<?php endif; ?>
</ul>
<?php endforeach; ?>
</div>
</div>
<?php else: ?>
<div>
<div class="col-sm-12 table">
<ul class="col-sm-12" style="text-align: center; font-size: 12px; font-weight: 600">
<li class="col-sm-2">SKU</li>
<li class="col-sm-2">功能/版本</li>
<li class="col-sm-2">接口</li>
<li class="col-sm-1">颜色</li>
<li class="col-sm-1">长度</li>
<li class="col-sm-2">安规</li>
<li class="col-sm-1">包装</li>
<li class="col-sm-1"></li>
</ul>
<ul class="form-group col-sm-12">
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="sku[]"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="version[]"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="interface[]"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="color[]"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="length[]"></li>
<li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="regulatory[]"></li>
<li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="package[]"></li>
<li class="col-sm-1" ><input type="button" class="add_item" value="+" style="background-color: #00B2EE;width: 30px;"></li>
</ul>
</div>
</div>
<?php endif; ?>
</div>
</div>
<!-- /.tab-content -->
<div class="nav-footer row">
<input name="id" value="<?php echo $product_id;?>" type="hidden">
<div class="col-sm-2 col-sm-offset-2">
<p><button id="reset-btn" type="button" class="btn btn-warning btn-block">重置</button></p>
</div>
<div class="col-sm-2">
<p><button id="submit-btn" type="submit" class="btn btn-danger btn-block">提交</button></p>
</div>
<!-- /. row -->
</div>
</form>
</div>
<!-- /.nav-tabs-custom -->
</div>
</div>
</section>
<!-- /.content -->
</div>
<script type="text/javascript">
$(document).on('click', '.add_item', function () {
/* var html = '<div class="active tab-pane"><label class="col-sm-2 control-label"></label><div class="form-group" ><div class="col-sm-3" style="display: flex;"><input type="text" class="form-control" name="sku[]" class="sku"><input type="button" class="del_item" value="-" style="background-color: #EE0000;width: 30px;"></div></div></div>';*/
var html = '<ul class="form-group col-sm-12 tab-pane"><li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="sku[]"></li><li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="version[]"></li><li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="interface[]"></li><li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="color[]"></li><li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="length[]"></li><li class="col-sm-2" style="padding-right: 5px"><input type="text" class="form-control" name="regulatory[]"></li><li class="col-sm-1" style="padding-right: 5px"><input type="text" class="form-control" name="package[]"></li><li class="col-sm-1" ><input type="button" class="del_item" value="-" style="background-color: #EE0000;width: 30px;"></li></ul>';
$(".table").append(html);
});
$(document).on('click', '.del_item', function () {
$(this).parents('ul').remove();
});
</script>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base target='_blank'>
<title>产品内容</title>
</head>
<body>
<div><?php echo isset($addproduct['content'])?$addproduct['content']:'';?></div>
</body>
</html>

1627
app/admin/view/product/create.html Executable file

File diff suppressed because it is too large Load Diff

1810
app/admin/view/product/edit.html Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
产品管理
<small>产品导出</small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin/index/index');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/article/lists');?>"> 产品列表</a></li>
<li class="active"> 产品导出</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-fw fa-download"></i></h3>
<div class="box-tools">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-fw fa-search-plus"></i> 展开/关闭
</button>
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-fw fa-plus"></i>
</button>
</div>
</div>
<div class="box-body">
<form class="form-horizontal" action="<?php echo url('/admin/product/export');?>" method="post" target="_blank">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label">字段</label>
<div class="col-sm-8">
<?php foreach($fields as $cbkey=>$cbname):?>
<label class="checkbox-inline">
<input type="checkbox" name="field[<?php echo $cbkey;?>]" value="<?php echo $cbname;?>"> <?php echo $cbname;?>
</label>
<?php endforeach;?>
</div>
<div class="col-sm-2"><button type="button" class="btn btn-info btn-sm" id="checkbox-suball">全选</button></div>
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">标签</label>
<div class="col-sm-10">
<input type="text" name="tags" class="form-control">
</div>
</div>
</div>
<div class="col-sm-7">
<div class="form-group">
<label class="col-sm-2 control-label">发布时间</label>
<div class="col-sm-10">
<div class="col-xs-12 col-sm-6 no-padding">
<div class="input-group">
<input type="text" name="timebegin" id="timebegin" class="form-control">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timebegin');"><i class="fa fa-fw fa-calendar"></i></button>
</span>
</div>
</div>
<div class="col-xs-12 col-sm-6 no-padding">
<div class="input-group">
<input type="text" name="timeend" id="timeend" class="form-control">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timeend');"><i class="fa fa-fw fa-calendar"></i></button>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">分类</label>
<div class="col-sm-10">
<select name="cid" class="form-control"><!-- class="col-xs-10 col-sm-4" -->
<option value="0">默认值</option>
<?php echo $categoryOptions;?>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary btn-sm" name="submit" value="export"><i class="fa fa-fw fa-check"></i>导出</button>
<button type="reset" class="btn btn-info btn-sm" ><i class="fa fa-fw fa-undo"></i>重置</button>
<button type="button" class="btn btn-info btn-sm" id="doclear"><i class="fa fa-fw fa-remove"></i>清空</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<style>
.table-responsive .table tbody > tr > th,.table-responsive .table thead > tr > td, .table-responsive .table tbody > tr > td {
vertical-align: middle;
}
</style>
<!-- Page Script -->
<script type="text/javascript">
$(function() {
$('#checkbox-suball').click(function() {
var clicks = $(this).data('clicks');
$('form.form-horizontal input[name^=field]').each(function(i) {
$(this).prop("checked", !clicks);
});
$(this).data("clicks", !clicks);
});
});
</script>

496
app/admin/view/product/lists.html Executable file
View File

@@ -0,0 +1,496 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
产品管理
<small>产品列表</small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/product/lists');?>"> 产品</a></li>
<li class="active"> 产品列表</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="box box-solid collapsed-box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-fw fa-search"></i>...</h3>
<div class="box-tools">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-fw fa-search-plus"></i> 展开/关闭
</button>
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-fw fa-plus"></i>
</button>
</div>
</div>
<div class="box-body">
<form class="form-horizontal" action="<?php echo url('/admin/product/lists');?>" method="get">
<div class="col-sm-5">
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" name="name" class="form-control" value="<?php echo $search['name']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">型号</label>
<div class="col-sm-10">
<input type="text" name="brand_id" class="form-control" value="<?php echo $search['brand_id']; ?>">
</div>
</div>
</div>
<div class="col-sm-7">
<div class="form-group">
<label class="col-sm-2 control-label">添加时间</label>
<div class="col-sm-10">
<div class="col-xs-12 col-sm-6 no-padding">
<div class="input-group">
<input type="text" name="timebegin" id="timebegin" class="form-control" value="<?php echo $search['timebegin']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timebegin');"><i class="fa fa-fw fa-calendar"></i></button>
</span>
</div>
</div>
<div class="col-xs-12 col-sm-6 no-padding">
<div class="input-group">
<input type="text" name="timeend" id="timeend" class="form-control" value="<?php echo $search['timeend']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="button" onclick="laydate_datetime('#timeend');"><i class="fa fa-fw fa-calendar"></i></button>
</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">分类</label>
<div class="col-sm-10">
<select name="cid" class="form-control"><!-- class="col-xs-10 col-sm-4" -->
<option value="0">默认值</option>
<?php echo $categoryOptions;?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">上架状态</label>
<div class="col-sm-2">
<select name="is_show" class="form-control">
<option value="" <?php if ($search['is_show'] !==0 && $search['is_show'] !==-1): ?>
selected
<?php endif; ?>>全部
</option>
<option value="0" <?php if ($search['is_show']===0): ?> selected
<?php endif; ?>>已上架
</option>
<option value="-1" <?php if ($search['is_show']===-1): ?> selected
<?php endif; ?>>未上架
</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-fw fa-check"></i>搜索</button>
<button type="reset" class="btn btn-info btn-sm"><i class="fa fa-fw fa-undo"></i>重置</button>
<button type="button" class="btn btn-info btn-sm" id="doclear"><i class="fa fa-fw fa-remove"></i>清空</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">产品列表</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse">
<i class="fa fa-fw fa-minus"></i>
</button>
</div>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body no-padding">
<?php if(!empty($list)):?>
<div class="table-responsive lists-table">
<table class="table table-hover table-bordered">
<tbody>
<tr>
<th width="35rem">&nbsp;</th>
<th width="60rem" class="text-center">图片</th>
<th width="60rem" class="text-center">ID</th>
<th>产品名称</th>
<th width="75rem" class="text-center">型号</th>
<th class="text-center">分类</th>
<th width="75rem" class="text-center">产品排序</th>
<th width="45rem" class="text-center">新品</th>
<th width="45rem" class="text-center">热门</th>
<th width="45rem" class="text-center">爆款</th>
<th width="45rem" class="text-center">特色</th>
<th width="75rem" class="text-center">添加时间</th>
<th width="60rem" class="text-center">状态</th>
<th width="45rem" class="text-center">在售</th>
<th width="75rem" class="text-center">库存数量</th>
<th width="80rem" class="text-center">上架状态</th>
<th width="200rem" class="text-center">操作</th>
</tr>
<?php foreach($list as $k=>$product):?>
<tr>
<td class="text-center"><input type="checkbox" name="ids[]" value="<?php echo $product['id'];?>"></td>
<td><img src="<?php echo getImage($product['list_bk_img'],110,110,1,'smallimg');?>" class="img-thumbnail" data-image="<?php echo $product['picture'];?>" data-toggle="preview-image"></td>
<td class="text-center">
<?php echo $product['id'];?>
</td>
<td class="text-left">
<a href="<?php echo url('/admin/product/edit',['id'=>$product['id']]);?>">
<?php echo $product['name'];?>
</a>
</td>
<td class="text-center">
<?php echo $product['brand_id'];?>
</td>
<td class="text-center">
<a href="<?php echo url('/admin/product/catlists',['cid'=>$product['cid']]);?>">
<?php echo $product['categoryname'];?>
</a>
</td>
<td class="text-center"><input size="3" maxlength="7" value="<?php echo $product['sort'];?>" type="text" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/updatesort');?>" data-cod="sort"></td>
<td class="text-center">
<span class="fa <?php if($product['isnew']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleisnew');?>" data-cod="state"></span>
</td>
<td class="text-center">
<span class="fa <?php if($product['ishot']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleishot');?>" data-cod="state"></span>
</td>
<td class="text-center">
<span class="fa <?php if($product['recommend']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/togglerecommend');?>" data-cod="state"></span>
</td>
<td class="text-center">
<span class="fa <?php if($product['isfeatured']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/togglefeatured');?>" data-cod="state"></span>
</td>
<td class="text-center">
<?php echo date('Y-m-d',$product['createtime']);;?>
</td>
<td class="text-center">
<?php echo array_switch(array('-2' => '<span class="label label-warning">已删除</span>','-1' => '<span class="label label-danger">删除</span>', '0' => '<span class="label label-success">启用</span>', '1' => '<span class="label label-info">已审核</span>'),$product['stat']);?>
</td>
<td class="text-center">
<span class="fa <?php if($product['is_onsale']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleonsale');?>" data-cod="state"></span>
</td>
<td class="text-center">
<?php echo $product['stock_quantity'];?>
</td>
<td class="text-center">
<?php echo array_switch(array('-1' => '<span class="label label-warning">未上架</span>', '0' => '<span class="label label-success">已上架</span>'), $product['is_show']);?>
</td>
<td>
<?php if ($product['is_show'] == 0): ?>
<a class="btn btn-xs btn-info" onclick="handle_show(<?php echo $product['id']; ?>, 'xiajia')">下架</a>
<?php else: ?>
<a class="btn btn-xs btn-info" onclick="handle_show(<?php echo $product['id']; ?>, 'shangjia')">上架</a>
<?php endif; ?>
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/product/add_sku',['id'=>$product['id']]);?>">添加sku</a>
<a class="btn btn-xs btn-info" href="<?php echo url('/admin/product/edit',['id'=>$product['id']]);?>">编辑</a>
<!-- <a class="btn btn-xs btn-info" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/delete');?>" data-cod="dowarn">删除</a> -->
<a class="btn btn-xs btn-default" disabled="disabled" href="javascript:void(0);">删除</a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!-- /.table -->
</div>
<?php endif;?>
<!-- /.lists-table -->
</div>
<!-- /.box-body -->
<div class="box-footer no-padding">
<div class="mailbox-controls row">
<div class="col-sm-3">
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" data-cod="copy">复制</button>
<!--<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/product/deletes');?>" data-cod="batch">删除</button>-->
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/product/recommends');?>" data-cod="batch">爆款</button>
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
</div>
<!-- /.btn-group -->
<!--<a href="<?php echo url('/admin/product/create');?>" class="btn btn-default btn-sm">添加</a>-->
<a onclick="tongbu()" class="btn btn-default btn-sm">同步至商城</a>
</div>
<div class="col-sm-3">
<div class="form-inline input-group">
<span class="input-group-addon">分类</span>
<select name="cid" id="move_cid" class="form-control input-sm">
<option value="0">默认值</option>
<?php echo $categoryOptions;?>
</select>
<span class="input-group-btn">
<button type="button" class="btn btn-info btn-sm" data-url="<?php echo url('/admin/product/movecategory');?>" data-cod="move">移动</button>
</span>
</div>
</div>
<div class="col-sm-6">
<div class="pull-right">
<?php if($page):?>
<?php echo $page;?>
<?php endif;?>
</div>
<!-- /.pull-right -->
</div>
</div>
</div>
</div>
<!-- /.box -->
</section>
<!-- /.content -->
</div>
<style>
.countries_all {
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
top: 0;
z-index: 9999;
display: none;
}
.countries {
position: relative;
background-color: #FFF;
width: 1400px;
height: 500px;
top: 200px;
margin: auto;
padding: 30px;
}
.countries_list ul {
padding: 0;
margin: 0;
width: 100%;
}
.countries_list li {
padding: 0;
margin: 0;
list-style: none;
width: 5%;
float: left;
position: relative;
height: 400px;
}
</style>
<div class="countries_all">
<div class="countries">
<p>
<a href="javascript:;" id="quanAll">全选</a> 
<a href="javascript:;" id="fanAll">反选</a> 
<a href="javascript:;" id="quAll">取消</a>
</p>
<div class="countries_list" id="country_copy">
</div>
<div style="clear: both;"></div>
<div class="s4">
<ul id="ulId">
</ul>
</div>
<div style="clear: both;"></div>
<p style="text-align: center;"><input type="submit" name="sub" value="提交" id="sub" /></p>
</div>
</div>
<!-- /.content-wrapper -->
<style>
.table-responsive .table tbody>tr>th,
.table-responsive .table thead>tr>td,
.table-responsive .table tbody>tr>td {
vertical-align: middle;
}
</style>
<!-- Page Script -->
<script type="text/javascript">
var checkIdx = [];
$("[data-cod='copy']").click(function () {
$(function () {
$.ajax({
url: '/admin/product/get_country',
type: 'post',
dataType: 'json',
success: function (res) {
var country = res.data.country;
var html = '<ul>';
country.forEach((item, index) => {
if (item.code == 'ZH' || item.code == 'US')
html += '<li class="s31"><input type="checkbox" name="country[]" value="' + item.code + '"> ' + item.country_name + '</li>';
});
html += '</ul>';
$('#country_copy').html(html);
},
error: function (res) {
console.log(res);
}
})
});
var state = false;
checkIdx = [];
$("input[name='ids[]']:checked").each(function (i) {
state = true;
checkIdx[i] = $(this).val();
});
if (state == false) {
alert("没有选择需要操作的项");
} else {
$(".countries_all").show();
}
});
$('#sub').click(function () {
var country = [];
$("input[name='country[]']:checked").each(function (i) {
country[i] = $(this).val();
});
$(".countries_all").hide();
$("#loading-box-top").showLoading(1);
$.ajax({
url: '/admin/product/copy_data',
type: 'post',
data: {
country: country,
product_ids: checkIdx
},
dataType: 'json',
success: function (res) {
$("#loading-box-top").hideLoading();
alert(res.msg);
if (res.code == 200) {
location.reload();
}
}
});
})
/*
* 全选 反选 取消
* */
//全选
$("#quanAll").click(function () {
$(".countries_list").find("input").prop("checked", true);
});
//取消
$("#quAll").click(function () {
$(".countries_all").hide();
});
//反选
$("#fanAll").click(function () {
$("[id^=fr_]").each(function () {
$(this).click();
});
});
$("[id^=fr_]").each(function () {
$(this).click(function () {
});
});
/*$(function(){
$("[data-cod='copy']").click(function(){
var state = false;
$(".lists-table input[name='ids[]']").each(function(i) {
var current = $(this);
if (current[0].checked) {
state = true;
ids.push(current.val());
}
});
if (state == false) {
alert("没有选择需要操作的项");
}
$(".countries_all").show();
});
});
*/
</script>
<script type="text/javascript">
function handle_show(product_id, type) {
var url = '/admin/product/' + type;
var data = {
product_id: product_id
};
$("#loading-box-top").showLoading(1);
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
$("#loading-box-top").hideLoading();
if (res.code < 0) {
alert(res.msg);
}
else if (res.code == 200) {
location.reload();
}
}
})
}
function tongbu() {
checkIdx = [];
$("input[name='ids[]']:checked").each(function (i) {
state = true;
checkIdx[i] = $(this).val();
});
if (checkIdx.length <= 0) {
alert('没有选择项');
return;
}
if (!confirm('确认同步到商城?'))
return;
var url = '/admin/product/update_product_to_shop';
var data = {
ids: checkIdx
};
$("#loading-box-top").showLoading(1);
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
$("#loading-box-top").hideLoading();
alert(res.msg);
if (res.code == 200) {
location.reload();
}
}
})
}
</script>

View File

@@ -0,0 +1,172 @@
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">产品(个数共计<?php echo $total;?>)</h4>
</div>
<div class="modal-body">
<div class="row">
<!-- <div class="col-sm-5"></div>-->
<div class="col-sm-12">
<div class="input-group">
<input type="text" name="search" value="<?php echo $filter_name;?>" placeholder="检索中....." class="form-control">
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" title="检索" id="modal-button-search" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</div>
</div>
<hr />
<?php if(!empty($list)):?>
<div class="row">
<?php foreach($list as $k=>$product):?>
<div class="col-sm-3 col-xs-6 text-center">
<a href="<?php //echo url('/admin/product/edit',['id'=>$product['id']]);?>" class="producter thumbnail" title="<?php echo $product['name'];?>">
<img src="<?php echo $product['list_bk_img'];?>" data-toggle="product-toggle"
alt="<?php echo $product['name'];?>"
data-content="
<p>编号:<?php echo $product['item_number'];?></p>
<p>标签:<?php echo $product['tags'];?></p>"
/>
</a>
<label>
<input type="checkbox" name="product[]" value="<?php echo $product['id'];?>" />
<?php echo msubstr($product['name'], 0, 9, 'utf-8');?>
</label>
</div>
<?php endforeach;?>
</div>
<?php endif;?>
</div>
<div class="modal-footer">
<div class="col-sm-12 col-xs-12">
<div class="pull-left">
<?php if($page):?>
<?php echo $page;?>
<?php endif;?>
</div>
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">取消</button>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<style>
#modal-product .pagination{margin:0;}
</style>
<!--<script type="text/javascript">-->
<!--$('#modal-product input[name=\'search\']').on('keydown', function(e) {-->
<!--if (e.which == 13) {-->
<!--$('#modal-button-search').trigger('click');-->
<!--}-->
<!--});-->
<!--$('#modal-button-search').on('click', function(e) {-->
<!--var url = '<?php echo url("admin/product/modallists",array_filter(["inputid"=>urlencode($inputid),"titleid"=>urlencode($titleid),"callback"=>urlencode($callback),])); ?>';-->
<!--//var url = '<?php echo url("admin/product/modallists"); ?>?inputid=' + encodeURIComponent('<?php echo $inputid; ?>') + '&titleid=' + encodeURIComponent('<?php echo $titleid; ?>') + '&callback=' + encodeURIComponent('<?php echo $callback; ?>');-->
<!--var filter_name = $('#modal-product input[name=\'search\']').val();-->
<!--if (filter_name) {-->
<!--url += '&filter_name=' + encodeURIComponent(filter_name);-->
<!--$('#modal-product').load(url);-->
<!--}-->
<!--});-->
<!--$('#modal-product [data-toggle="product-toggle"]').popover({placement: 'auto top', trigger: 'hover', html: true, delay: {show: 5, hide: 10}});-->
<!--$('#modal-product .modal-footer .pagination a').on('click', function(e) {-->
<!--e.preventDefault();-->
<!--$('#modal-product').load($(this).attr('href'));-->
<!--});-->
<!--$('#modal-product a.producter').on('click', function(e) {-->
<!--e.preventDefault();-->
<!--var titleid = "<?php echo $titleid; ?>";-->
<!--var inputid = "<?php echo $inputid; ?>";-->
<!--var callback = "<?php echo $callback;?>";-->
<!--if (callback != "undefined" && callback) {-->
<!--eval('window.parent.' + callback + '("' + $(this).parent().find('input').val() + '","' + $(this).prop('title') + '");');-->
<!--$('#modal-product').modal('hide');-->
<!--return;-->
<!--}-->
<!--if (titleid) {-->
<!--$('#' + titleid).val($(this).prop('title'));-->
<!--}-->
<!--if (inputid) {-->
<!--$('#' + inputid).val($(this).parent().find('input').val());-->
<!--}-->
<!--$('#modal-product').modal('hide');-->
<!--});-->
<!--</script> -->
<script type="text/javascript">
var RelatedList = related_list;
console.log(RelatedList);
$(":checkbox").each(function (i,val){
console.log($(val).attr('value'));
$(val).attr("onclick","boxFun(this)");
if(inArray($(val).attr('value'),related_list)){
$(val).attr("checked",'true');
}
});
$('#modal-product input[name=\'search\']').on('keydown', function(e) {
if (e.which == 13) {
$('#modal-button-search').trigger('click');
}
});
$('#modal-button-search').on('click', function(e) {
var url = '/admin/product/modallists.html?callback=addRelated';
//var url = '/admin/product/modallists.html?inputid=' + encodeURIComponent('') + '&titleid=' + encodeURIComponent('') + '&callback=' + encodeURIComponent('addRelated');
var filter_name = $('#modal-product input[name=\'search\']').val();
if (filter_name) {
url += '&filter_name=' + encodeURIComponent(filter_name);
$('#modal-product').load(url);
}
});
// $('#modal-product [data-toggle="product-toggle"]').popover({placement: 'auto top', trigger: 'hover', html: true, delay: {show: 5, hide: 10}});
$('#modal-product .modal-footer .pagination a').on('click', function(e) {
e.preventDefault();
$('#modal-product').load($(this).attr('href'));
});
$('#modal-product a.producter').on('click', function(e) {
e.preventDefault();
var titleid = "";
var inputid = "";
var callback = "addRelated";
if (callback != "undefined" && callback) {
eval('window.parent.' + callback + '("' + $(this).parent().find('input').val() + '","' + $(this).prop('title') + '");');
$('#modal-product').modal('hide');
return;
}
if (titleid) {
$('#' + titleid).val($(this).prop('title'));
}
if (inputid) {
$('#' + inputid).val($(this).parent().find('input').val());
}
$('#modal-product').modal('hide');
});
function inArray(need,array) {
if(typeof array !="object"){
return false;
}
var index;
for (index in array){
if(index == need){
return true;
}
}
return false;
}
function boxFun(elm) {
console.log("box: ",$(elm).prop('checked'));
if($(elm).prop('checked')){
$(elm).attr("checked",'false');
// delRelated($(elm).attr('value'));
addRelated($(elm).attr('value'),$(elm).parent().text().trim());
}else{
$(elm).attr("checked",'true');
// addRelated($(elm).attr('value'),$(elm).parent().text().trim());
delRelated($(elm).attr('value'));
}
}
</script>

View File

@@ -0,0 +1,110 @@
<!-- Select2 -->
<link rel="stylesheet" href="__PUBLIC__/adminlte/bower_components/select2/dist/css/select2.min.css">
<style>
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #d2d6de;
border-radius: 0;
}
.select2-container .select2-selection--single{height:34px;}
</style>
<!-- Select2 -->
<script src="__PUBLIC__/adminlte/bower_components/select2/dist/js/select2.full.min.js"></script>
<div class="modal-dialog modal-lg" xmlns="http://www.w3.org/1999/html">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">产品(个数共计<?php echo $total;?>)</h4>
</div>
<form action="<?php echo url('/admin/Product/cont');?>" method="post">
<div class="modal-body">
<div class="row">
<!-- <div class="col-sm-5"></div>-->
<div class="col-sm-12">
<div class="input-group">
<input type="text" name="search" value="<?php echo $filter_name;?>" placeholder="检索中....." class="form-control">
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" title="检索" id="modal-button-search" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</div>
</div>
<hr />
<?php if(!empty($list)):?>
<div class="row">
<?php foreach($list as $k=>$product):?>
<div class="col-sm-3 col-xs-6 text-center">
<a href="<?php //echo url('/admin/product/edit',['id'=>$product['id']]);?>" class="producter thumbnail" title="<?php echo $product['name'];?>">
<img src="<?php echo getImage($product['picture'],110,110,1,'smallimg');?>" data-toggle="product-toggle"
alt="<?php echo $product['name'];?>"
data-content="
<p>编号:<?php echo $product['item_number'];?></p>
<p>标签:<?php echo $product['tags'];?></p>"
/>
</a>
<label>
<input type="checkbox" name="product[]" value="<?php echo $product['id'];?>" />
<?php echo $product['name'];?>
</label>
</div>
<?php endforeach;?>
</div>
<?php endif;?>
</div>
<div class="modal-footer">
<div class="col-sm-12 col-xs-12">
<div class="pull-left">
<?php if($page):?>
<?php echo $page;?>
<?php endif;?>
</div>
<button id='add' type="submit">提交</button>
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">取消</button>
</div>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<style>
#modal-product .pagination{margin:0;}
</style>
<script type="text/javascript">
$('#modal-product input[name=\'search\']').on('keydown', function(e) {
if (e.which == 13) {
$('#modal-button-search').trigger('click');
}
});
$('#modal-button-search').on('click', function(e) {
var url = '<?php echo url("admin/product/modallists",array_filter(["inputid"=>urlencode($inputid),"titleid"=>urlencode($titleid),"callback"=>urlencode($callback),])); ?>';
//var url = '<?php echo url("admin/product/modallists"); ?>?inputid=' + encodeURIComponent('<?php echo $inputid; ?>') + '&titleid=' + encodeURIComponent('<?php echo $titleid; ?>') + '&callback=' + encodeURIComponent('<?php echo $callback; ?>');
var filter_name = $('#modal-product input[name=\'search\']').val();
if (filter_name) {
url += '&filter_name=' + encodeURIComponent(filter_name);
$('#modal-product').load(url);
}
});
$('#modal-product [data-toggle="product-toggle"]').popover({placement: 'auto top', trigger: 'hover', html: true, delay: {show: 5, hide: 10}});
$('#modal-product .modal-footer .pagination a').on('click', function(e) {
e.preventDefault();
$('#modal-product').load($(this).attr('href'));
});
$('#modal-product a.producter').on('click', function(e) {
e.preventDefault();
var titleid = "<?php echo $titleid; ?>";
var inputid = "<?php echo $inputid; ?>";
var callback = "<?php echo $callback;?>";
if (callback != "undefined" && callback) {
eval('window.parent.' + callback + '("' + $(this).parent().find('input').val() + '","' + $(this).prop('title') + '");');
$('#modal-product').modal('hide');
return;
}
if (titleid) {
$('#' + titleid).val($(this).prop('title'));
}
if (inputid) {
$('#' + inputid).val($(this).parent().find('input').val());
}
$('#modal-product').modal('hide');
});
</script>

View File

@@ -0,0 +1,147 @@
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
产品管理
<small>产品回收站</small>
</h1>
<ol class="breadcrumb">
<li><a href="<?php echo url('/admin');?>"><i class="fa fa-dashboard"></i> 首页</a></li>
<li><a href="<?php echo url('/admin/product/lists');?>"> 产品</a></li>
<li class="active"> 产品回收站</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">产品回收站</h3>
<div class="box-tools pull-right">
<div class="input-group input-group-sm">
<input type="text" class="form-control pull-right" id="list-search-in" placeholder="Search Name" value="<?php echo $search['skeyword'];?>">
<div class="input-group-btn">
<button type="button" class="btn btn-default" id="list-search-btn"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body no-padding">
<?php if(!empty($list)):?>
<div class="table-responsive lists-table">
<table class="table table-hover table-bordered">
<tbody>
<tr>
<th width="35rem">&nbsp;</th>
<th width="60rem" class="text-center">图片</th>
<th width="60rem" class="text-center">ID</th>
<th>产品名称</th>
<th width="75rem" class="text-center">货号</th>
<th class="text-center">分类</th>
<th width="75rem" class="text-center">产品排序</th>
<th width="45rem" class="text-center">新品</th>
<th width="45rem" class="text-center">热门</th>
<th width="45rem" class="text-center">爆款</th>
<th width="75rem" class="text-center">添加时间</th>
<th width="60rem" class="text-center">状态</th>
<th width="45rem" class="text-center">在售</th>
<th width="75rem" class="text-center">库存数量</th>
<th width="135rem" class="text-center">操作</th>
</tr>
<?php foreach($list as $k=>$product):?>
<tr>
<td class="text-center"><input type="checkbox" name="ids[]" value="<?php echo $product['id'];?>"></td>
<td><img src="<?php echo getImage($product['picture'],110,110,1,'smallimg');?>" class="img-thumbnail" data-image="<?php echo $product['picture'];?>" data-toggle="preview-image"></td>
<td class="text-center"><?php echo $product['id'];?></td>
<td class="text-left">
<?php echo $product['name'];?>
</td>
<td class="text-center"><?php echo $product['item_number'];?></td>
<td class="text-center">
<?php echo $product['categoryname'];?>
</td>
<td class="text-center"><input size="3" maxlength="7" value="<?php echo $product['sort'];?>" type="text" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/updatesort');?>" data-cod="sort"></td>
<td class="text-center">
<span class="fa <?php if($product['isnew']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleisnew');?>" data-cod="state"></span>
</td>
<td class="text-center">
<span class="fa <?php if($product['ishot']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleishot');?>" data-cod="state"></span>
</td>
<td class="text-center">
<span class="fa <?php if($product['recommend']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/togglerecommend');?>" data-cod="state"></span>
</td>
<td class="text-center"><?php echo date('Y-m-d',$product['createtime']);;?></td>
<td class="text-center"><?php echo array_switch(array('-2' => '<span class="label label-warning">已删除</span>','-1' => '<span class="label label-danger">删除</span>', '0' => '<span class="label label-success">启用</span>', '1' => '<span class="label label-info">已审核</span>'),$product['stat']);?></td>
<td class="text-center">
<span class="fa <?php if($product['is_onsale']):?>fa-check<?php else:?>fa-remove<?php endif;?>" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/toggleonsale');?>" data-cod="state"></span>
</td>
<td class="text-center"><?php echo $product['stock_quantity'];?></td>
<td>
<a class="btn btn-xs btn-info" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/destroy');?>" data-cod="dowarn">删除</a>
<a class="btn btn-xs btn-info" data-id="<?php echo $product['id'];?>" data-url="<?php echo url('/admin/product/recovery');?>" data-cod="dowarn">恢复</a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<!-- /.table -->
</div>
<?php endif;?>
<!-- /.lists-table -->
</div>
<!-- /.box-body -->
<div class="box-footer no-padding">
<div class="mailbox-controls row">
<div class="col-sm-3">
<button type="button" class="btn btn-default btn-sm checkbox-toggle"><i class="fa fa-square-o"></i></button>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/product/destroys');?>" data-cod="batch">删除</button>
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/product/recommends');?>" data-cod="batch">爆款</button>
<button type="button" class="btn btn-default btn-sm" data-url="<?php echo url('/admin/product/recoverys');?>" data-cod="batch">恢复</button>
<button type="button" class="btn btn-default btn-sm" data-cod="refresh">刷新</button>
</div>
<!-- /.btn-group -->
<a href="<?php echo url('/admin/product/add');?>" class="btn btn-default btn-sm">添加</a>
</div>
<div class="col-sm-3">
<div class="form-inline input-group">
<span class="input-group-addon">分类</span>
<select name="cid" id="move_cid" class="form-control input-sm">
<option value="0">默认值</option>
<?php echo $categoryOptions;?>
</select>
<span class="input-group-btn">
<button type="button" class="btn btn-info btn-sm" data-url="<?php echo url('/admin/product/movecategory');?>" data-cod="move">移动</button>
</span>
</div>
</div>
<div class="col-sm-6">
<div class="pull-right">
<?php if($page):?>
<?php echo $page;?>
<?php endif;?>
</div>
<!-- /.pull-right -->
</div>
</div>
</div>
</div>
<!-- /.box --
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<style>
.table-responsive .table tbody > tr > th,.table-responsive .table thead > tr > td, .table-responsive .table tbody > tr > td {
vertical-align: middle;
}
</style>
<!-- Page Script -->
<script type="text/javascript">
$(function() {
});
</script>