goodslist.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. <style>
  45. tbody tr td{
  46. position: relative;
  47. }
  48. tbody tr .icow-weibiaoti--{
  49. visibility: hidden;
  50. display: inline-block;
  51. color: #fff;
  52. height:18px;
  53. width:18px;
  54. background: #e0e0e0;
  55. text-align: center;
  56. line-height: 18px;
  57. vertical-align: middle;
  58. }
  59. tbody tr:hover .icow-weibiaoti--{
  60. visibility: visible;
  61. }
  62. tbody tr .icow-weibiaoti--.hidden{
  63. visibility: hidden !important;
  64. }
  65. .full .icow-weibiaoti--{
  66. margin-left:10px;
  67. }
  68. .full>span{
  69. display: -webkit-box;
  70. display: -webkit-flex;
  71. display: -ms-flexbox;
  72. display: flex;
  73. vertical-align: middle;
  74. align-items: center;
  75. }
  76. tbody tr .label{
  77. margin: 5px 0;
  78. }
  79. .goods_attribute a{
  80. cursor: pointer;
  81. }
  82. .newgoodsflag{
  83. width: 22px;height: 16px;
  84. background-color: #ff0000;
  85. color: #fff;
  86. text-align: center;
  87. position: absolute;
  88. bottom: 70px;
  89. left: 57px;
  90. font-size: 12px;
  91. }
  92. .a{cursor: pointer;}
  93. </style>
  94. </head>
  95. <body layadmin-themealias="default">
  96. <table id="demo" lay-filter="test"></table>
  97. <div class="layui-fluid">
  98. <div class="layui-card">
  99. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">团长在售商品管理</span></div>
  100. <div class="layui-card-body" style="padding:15px;">
  101. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  102. <input type="hidden" name="c" value="communityhead" />
  103. <input type="hidden" name="a" value="goodslist" />
  104. <input type="hidden" name="head_id" value="{$head_id}" />
  105. <div class="layui-form-item">
  106. <div class="layui-inline">
  107. <div class="layui-input-inline">
  108. <input type="text" class="layui-input" name='keyword' value="{$keyword}" placeholder="输入商品编码或者商品名称然后回车">
  109. </div>
  110. <div class="layui-input-inline" >
  111. <select name="cate" class='layui-input layui-unselect' data-placeholder="商品分类">
  112. <option value="" <?php if( empty($cate)){ ?>selected<?php } ?> >商品分类</option>
  113. <?php foreach( $category as $c ){ ?>
  114. <option value="{$c['id']}" <?php if( $cate==$c['id']){ ?>selected<?php } ?> >{$c['name']}</option>
  115. <?php } ?>
  116. </select>
  117. </div>
  118. <div class="layui-input-inline">
  119. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  120. </div>
  121. </div>
  122. </div>
  123. </form>
  124. <form action="" class="layui-form" lay-filter="example" method="post" >
  125. <div class="row">
  126. <div class="col-md-12">
  127. <div class="page-table-header">
  128. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  129. <div class="btn-group">
  130. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/down_sales', array('head_id' => $head_id ))}">
  131. 取消售卖
  132. </button>
  133. </div>
  134. </div>
  135. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  136. <thead>
  137. <tr>
  138. <th style="width:25px;"></th>
  139. <th style="width:80px;text-align:center;">ID</th>
  140. <th style="">&nbsp;</th>
  141. <th style="width:280px;">商品名称</th>
  142. <th style="">分类</th>
  143. <th style="width: 100px;">价格</th>
  144. <th style="width: 100px;">佣金</th>
  145. <th style="width: 80px;">销量</th>
  146. <th style="width: 80px;">库存</th>
  147. <th style="">操作</th>
  148. </tr>
  149. </thead>
  150. <tbody>
  151. <?php foreach( $list as $item ){ ?>
  152. <tr>
  153. <?php if( in_array($item['id'], $all_goods_ids)){ ?>
  154. <td>
  155. </td>
  156. <?php }else{ ?>
  157. <td>
  158. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$item['id']}"/>
  159. </td>
  160. <?php } ?>
  161. <td>
  162. {$item['id']}
  163. </td>
  164. <td>
  165. <img src="{$item['thumb']}" style="width:72px;height:72px;padding:1px;border:1px solid #efefef;margin: 7px 0" onerror="this.src='/static/images/nopic.png'" />
  166. </td>
  167. <td class='full' >
  168. <span>
  169. <span style="display: block;width: 100%;">
  170. {$item['goodsname']}
  171. </span>
  172. </span>
  173. </td>
  174. <td>
  175. <?php foreach( $item['cate'] as $g_cate ){ ?>
  176. <span class="text-danger">[{$category[$g_cate['cate_id']]['name']}]</span>
  177. <?php } ?>
  178. </td>
  179. <td>&yen;
  180. <span >{$item['price_arr']['price']} <?php if( isset($item['price_arr']['max_danprice'])){ ?>~&yen;{$item['price_arr']['max_danprice']}<?php } ?> </span>
  181. </td>
  182. <td>{$item['community_head_commission']}%</td>
  183. <td>{$item['sales']}</td>
  184. <td>{$item['total']}</td>
  185. <td style="overflow:visible;position:relative">
  186. <?php if( in_array($item['id'], $all_goods_ids)){ ?>
  187. 全网售卖
  188. <?php }else{ ?>
  189. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('communityhead/down_sales' , array('head_id' => $head_id , 'id' => $item['id']))}" data-confirm='确认要取消吗?'>
  190. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="取消售卖">
  191. <i class="layui-icon">&#xe640;</i>取消售卖
  192. </span>
  193. </a>
  194. <?php } ?>
  195. </td>
  196. </tr>
  197. <?php } ?>
  198. </tbody>
  199. <tfoot>
  200. <tr>
  201. <td colspan="4">
  202. <div class="page-table-header">
  203. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  204. <div class="btn-group">
  205. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('communityhead/down_sales', array('head_id' => $head_id ))}">
  206. 取消售卖
  207. </button>
  208. </div>
  209. </div>
  210. </td>
  211. <td colspan="4" style="text-align: right">
  212. {$pager}
  213. </td>
  214. </tr>
  215. </tfoot>
  216. </table>
  217. </div>
  218. </div>
  219. </form>
  220. </div>
  221. </div>
  222. </div>
  223. <script src="/layuiadmin/layui/layui.js"></script>
  224. <script>
  225. layui.config({
  226. base: '/layuiadmin/' //静态资源所在路径
  227. }).extend({
  228. index: 'lib/index' //主入口模块
  229. }).use('index');
  230. </script>
  231. <script>
  232. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  233. var layer = layui.layer;
  234. var $;
  235. layui.use(['jquery', 'layer','form'], function(){
  236. $ = layui.$;
  237. var form = layui.form;
  238. $('.deldom').click(function(){
  239. var s_url = $(this).attr('data-href');
  240. layer.confirm($(this).attr('data-confirm'), function(index){
  241. $.ajax({
  242. url:s_url,
  243. type:'post',
  244. dataType:'json',
  245. success:function(info){
  246. if(info.status == 0)
  247. {
  248. layer.msg(info.result.message,{icon: 1,time: 2000});
  249. }else if(info.status == 1){
  250. var go_url = location.href;
  251. if( info.result.hasOwnProperty("url") )
  252. {
  253. go_url = info.result.url;
  254. }
  255. layer.msg('操作成功',{time: 1000,
  256. end:function(){
  257. location.href = info.result.url;
  258. }
  259. });
  260. }
  261. }
  262. })
  263. });
  264. })
  265. $('.btn-operation').click(function(){
  266. var ids_arr = [];
  267. var obj = $(this);
  268. var s_toggle = $(this).attr('data-toggle');
  269. var s_url = $(this).attr('data-href');
  270. $("input[name=item_checkbox]").each(function() {
  271. if( $(this).prop('checked') )
  272. {
  273. ids_arr.push( $(this).val() );
  274. }
  275. })
  276. if(ids_arr.length < 1)
  277. {
  278. layer.msg('请选择要操作的内容');
  279. }else{
  280. var can_sub = true;
  281. if( s_toggle == 'batch-remove' )
  282. {
  283. can_sub = false;
  284. layer.confirm($(obj).attr('data-confirm'), function(index){
  285. $.ajax({
  286. url:s_url,
  287. type:'post',
  288. dataType:'json',
  289. data:{ids:ids_arr},
  290. success:function(info){
  291. if(info.status == 0)
  292. {
  293. layer.msg(info.result.message,{icon: 1,time: 2000});
  294. }else if(info.status == 1){
  295. var go_url = location.href;
  296. if( info.result.hasOwnProperty("url") )
  297. {
  298. go_url = info.result.url;
  299. }
  300. layer.msg('操作成功',{time: 1000,
  301. end:function(){
  302. location.href = info.result.url;
  303. }
  304. });
  305. }
  306. }
  307. })
  308. });
  309. }else{
  310. $.ajax({
  311. url:s_url,
  312. type:'post',
  313. dataType:'json',
  314. data:{ids:ids_arr},
  315. success:function(info){
  316. if(info.status == 0)
  317. {
  318. layer.msg(info.result.message,{icon: 1,time: 2000});
  319. }else if(info.status == 1){
  320. var go_url = location.href;
  321. if( info.result.hasOwnProperty("url") )
  322. {
  323. go_url = info.result.url;
  324. }
  325. layer.msg('操作成功',{time: 1000,
  326. end:function(){
  327. location.href = info.result.url;
  328. }
  329. });
  330. }
  331. }
  332. })
  333. }
  334. }
  335. })
  336. form.on('switch(statewsitch)', function(data){
  337. var s_url = $(this).attr('data-href')
  338. var s_value = 1;
  339. if(data.elem.checked)
  340. {
  341. s_value = 1;
  342. }else{
  343. s_value = 0;
  344. }
  345. $.ajax({
  346. url:s_url,
  347. type:'post',
  348. dataType:'json',
  349. data:{value:s_value},
  350. success:function(info){
  351. if(info.status == 0)
  352. {
  353. layer.msg(info.result.message,{icon: 1,time: 2000});
  354. }else if(info.status == 1){
  355. var go_url = location.href;
  356. if( info.result.hasOwnProperty("url") )
  357. {
  358. go_url = info.result.url;
  359. }
  360. layer.msg('操作成功',{time: 1000,
  361. end:function(){
  362. location.href = info.result.url;
  363. }
  364. });
  365. }
  366. }
  367. })
  368. });
  369. form.on('checkbox(checkboxall)', function(data){
  370. if(data.elem.checked)
  371. {
  372. $("input[name=item_checkbox]").each(function() {
  373. $(this).prop("checked", true);
  374. });
  375. $("input[name=checkall]").each(function() {
  376. $(this).prop("checked", true);
  377. });
  378. }else{
  379. $("input[name=item_checkbox]").each(function() {
  380. $(this).prop("checked", false);
  381. });
  382. $("input[name=checkall]").each(function() {
  383. $(this).prop("checked", false);
  384. });
  385. }
  386. form.render('checkbox');
  387. });
  388. //监听提交
  389. form.on('submit(formDemo)', function(data){
  390. $.ajax({
  391. url: data.form.action,
  392. type: data.form.method,
  393. data: data.field,
  394. dataType:'json',
  395. success: function (info) {
  396. if(info.status == 0)
  397. {
  398. layer.msg(info.result.message,{icon: 1,time: 2000});
  399. }else if(info.status == 1){
  400. var go_url = location.href;
  401. if( info.result.hasOwnProperty("url") )
  402. {
  403. go_url = info.result.url;
  404. }
  405. layer.msg('操作成功',{time: 1000,
  406. end:function(){
  407. location.href = info.result.url;
  408. }
  409. });
  410. }
  411. }
  412. });
  413. return false;
  414. });
  415. })
  416. </script>
  417. </body>