goods.html 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716
  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. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  42. <link href="/static/css/snailfish.css" rel="stylesheet">
  43. <style>
  44. tbody tr td{
  45. position: relative;
  46. }
  47. tbody tr .icow-weibiaoti--{
  48. visibility: hidden;
  49. display: inline-block;
  50. color: #fff;
  51. height:18px;
  52. width:18px;
  53. background: #e0e0e0;
  54. text-align: center;
  55. line-height: 18px;
  56. vertical-align: middle;
  57. }
  58. tbody tr:hover .icow-weibiaoti--{
  59. visibility: visible;
  60. }
  61. tbody tr .icow-weibiaoti--.hidden{
  62. visibility: hidden !important;
  63. }
  64. .full .icow-weibiaoti--{
  65. margin-left:10px;
  66. }
  67. .full>span{
  68. display: -webkit-box;
  69. display: -webkit-flex;
  70. display: -ms-flexbox;
  71. display: flex;
  72. vertical-align: middle;
  73. align-items: center;
  74. }
  75. tbody tr .label{
  76. margin: 5px 0;
  77. }
  78. .goods_attribute a{
  79. cursor: pointer;
  80. }
  81. .newgoodsflag{
  82. width: 22px;height: 16px;
  83. background-color: #ff0000;
  84. color: #fff;
  85. text-align: center;
  86. position: absolute;
  87. bottom: 70px;
  88. left: 57px;
  89. font-size: 12px;
  90. }
  91. .a{cursor: pointer;}
  92. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect{
  93. width:auto!important;
  94. }
  95. .we7-modal-dialog .modal-footer, .modal-dialog .modal-footer{padding:0px;}
  96. .modal-footer{padding:0px;}
  97. </style>
  98. </head>
  99. <body layadmin-themealias="default">
  100. <table id="demo" lay-filter="test"></table>
  101. <div class="layui-fluid">
  102. <div class="layui-card">
  103. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">商品列表</span></div>
  104. <div class="layui-tab layui-tab-brief" >
  105. <ul class="layui-tab-title">
  106. <li <?php if(empty($type) || $type=='all'){ ?>class="layui-this"<?php } ?>><a href="{:U('group/goods')}">全部商品({$all_count})</a></li>
  107. <li <?php if($type=='saleon'){ ?>class="layui-this"<?php } ?> ><a href="{:U('group/goods',array('type'=>'saleon'))}">出售中({$onsale_count})</a></li>
  108. <li <?php if($type=='stock_notice'){ ?>class="layui-this"<?php } ?> ><a href="{:U('group/goods',array('type'=>'stock_notice'))}">库存预警({$stock_notice_count})</a></li>
  109. <li <?php if($type=='getdown'){ ?>class="layui-this"<?php } ?> ><a href="{:U('group/goods',array('type'=>'getdown'))}">已下架({$getdown_count})</a></li>
  110. <?php if($is_open_shenhe == 1){ ?>
  111. <li <?php if($type=='warehouse'){ ?>class="layui-this"<?php } ?> ><a href="{:U('group/goods',array('type'=>'warehouse'))}">仓库({$warehouse_count})</a></li>
  112. <?php } ?>
  113. <li <?php if($type=='recycle'){ ?>class="layui-this"<?php } ?> ><a href="{:U('group/goods',array('type'=>'recycle'))}">回收站({$recycle_count})</a></li>
  114. </ul>
  115. </div>
  116. <div class="layui-card-body" style="padding:15px;">
  117. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  118. <input type="hidden" name="c" value="group" />
  119. <input type="hidden" name="a" value="goods" />
  120. <input type="hidden" name="type" value="{$type}" />
  121. <div class="layui-form-item">
  122. <div class="layui-inline">
  123. <div class="layui-input-inline" >
  124. <input type="text" class="layui-input" name="keyword" value="{$keyword}" placeholder="输入商品编码或者名称"/>
  125. </div>
  126. <div class="layui-input-inline" >
  127. <select name='searchtime' class='layui-input layui-unselect' style="width:100px;padding:0 5px;">
  128. <option value=''>不按时间</option>
  129. <option value='create' <?php if($searchtime=='create'){ ?>selected<?php } ?>>团购时间</option>
  130. </select>
  131. </div>
  132. <div class="layui-input-inline" style="width:280px;">
  133. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  134. </div>
  135. <div class="layui-input-inline" >
  136. <select name="cate" class='layui-input layui-unselect' style="width:200px;" >
  137. <option value="" <?php if( empty($cate) ){ ?>selected<?php } ?> >商品分类</option>
  138. <?php foreach($category as $c){ ?>
  139. <option value="{$c['id']}" <?php if( $cate==$c['id'] ){ ?>selected<?php } ?> >{$c['name']}</option>
  140. <?php } ?>
  141. </select>
  142. </div>
  143. <div class="layui-input-inline" >
  144. <select name="goods_type" class='layui-input layui-unselect' style="width:200px;" >
  145. <option value="" <?php if( empty($goods_type) ){ ?>selected<?php } ?> >商品类型</option>
  146. <option value="1" <?php if( $goods_type==1 ){ ?>selected<?php } ?> >普通商品</option>
  147. <option value="2" <?php if( $goods_type==2 ){ ?>selected<?php } ?> >返利商品</option>
  148. </select>
  149. </div>
  150. <div class="layui-input-inline">
  151. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  152. </div>
  153. </div>
  154. </div>
  155. </form>
  156. <form action="" class="layui-form" lay-filter="example" method="post" >
  157. <div class="row">
  158. <div class="col-md-12">
  159. <div class="page-table-header">
  160. <span class="pull-right">
  161. <a href="{:U('group/addgoods', array('ok' =>1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加商品</a>
  162. </span>
  163. <div class="btn-group">
  164. <?php if($is_index){ ?>
  165. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'is_index_show', 'value' => 1))}">
  166. <i class='icow icow-xiajia3'></i> 主页推荐
  167. </button>
  168. <?php } ?>
  169. <?php if($is_updown){ ?>
  170. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>1))}">
  171. <i class='icow icow-shangjia2'></i> 上架
  172. </button>
  173. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>0))}">
  174. <i class='icow icow-xiajia3'></i> 下架
  175. </button>
  176. <?php } ?>
  177. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchcatesbut" >商品分类</button>
  178. <?php if( $pintuan_model_buy == 1 ){ ?>
  179. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batch_head" >分配售卖团长</button>
  180. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batch_head_group" >分配售卖团长分组</button>
  181. <?php } ?>
  182. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchtime" >设置活动时间</button>
  183. <?php if($type!='recycle'){ ?>
  184. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗,删除后商品将进入回收站?" data-href="{:U('goods/change',array('type'=>'grounding','value'=>3))}">
  185. <i class='icow icow-shanchu1'></i> 删除
  186. </button>
  187. <?php } ?>
  188. <?php if($type=='recycle'){ ?>
  189. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要彻底删除吗?" data-href="{:U('goods/delete')}"><i class='icow icow-shanchu1'></i> 彻底删除</button>
  190. <?php } ?>
  191. </div>
  192. </div>
  193. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  194. <thead>
  195. <tr>
  196. <th style="width:25px;">
  197. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  198. </th>
  199. <th style="width:80px;text-align:center;">ID</th>
  200. <th style="">&nbsp;</th>
  201. <th style="width:200px;">商品名称</th>
  202. <th style="">活动时间</th>
  203. <th style="width: 120px;">价格</th>
  204. <th style="width: 80px;">销量</th>
  205. <th style="width: 80px;">库存</th>
  206. <th style="width:180px;" >是否上架<?php if($is_open_shenhe==1){ ?><br/>是否审核<?php } ?></th>
  207. <?php if($is_top){ ?>
  208. <?php if($index_sort_method == 1){ ?>
  209. <th>主页排序</th>
  210. <?php }else{ ?>
  211. <th>置顶</th>
  212. <?php } ?>
  213. <?php } ?>
  214. <?php if($is_index){ ?>
  215. <th>主页推荐</th>
  216. <?php } ?>
  217. <th style="">操作</th>
  218. </tr>
  219. </tr>
  220. </thead>
  221. <tbody>
  222. <?php foreach($list as $item){ ?>
  223. <tr>
  224. <td>
  225. <input type='checkbox' name="item_checkbox" data_is_all_sale="{$item['is_all_sale']}" class="checkone" lay-skin="primary" value="{$item['id']}"/>
  226. </td>
  227. <td style="text-align:center;">
  228. {$item['id']}
  229. </td>
  230. <td>
  231. <a href="{:U('group/editgoods', array('id' => $item['id'],'goodsfrom'=>$goodsfrom,'page'=>$page))}">
  232. <img src="{$item['thumb']}" style="width:72px;height:72px;padding:1px;border:1px solid #efefef;margin: 7px 0" />
  233. </a>
  234. </td>
  235. <td class='full' >
  236. <span>
  237. <span style="display: block;width: 100%;">
  238. <?php if($item['is_pintuan_rebate'] == 1){?><span class="text" style="color:#009688;">[拼团返利]</span><?php }?>
  239. <?php if($item['supply_id'] <=0){ ?><span class="text">[自营<?php if( !empty($item['supply_name']) ){ ?>{$item['supply_name']}<?php } ?>]</span><?php }else if( !empty($item['supply_name']) ){ ?><span class="text">[{$item['supply_name']}]</span><?php } ?>
  240. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'goodsname','id'=>$item['id']))}" >
  241. <span class="text-danger">{$item['goodsname']}</span>
  242. </a>
  243. <?php if( !empty($item['cate']) ){ ?>
  244. <?php foreach($item['cate'] as $g_cate){ ?>
  245. <span class="text-danger">[<?php echo isset($category[$g_cate['cate_id']]) ? $category[$g_cate['cate_id']]['name']: '无分类';?>]</span>
  246. <?php } ?>
  247. <?php }else{ ?>
  248. <span class="text-danger">[无分类]</span>
  249. <?php } ?>
  250. <?php if( $pintuan_model_buy == 1 ){ ?>
  251. <br/>
  252. <?php if( $item['is_all_sale'] == 1 ){ ?>
  253. <span class="text-green">[所有团长{$item['head_count']}]</span>
  254. <?php }else if( $item['head_count'] >0 ){ ?>
  255. <span class="text-green">[部分团长{$item['head_count']}]</span>
  256. <?php }else if( $item['head_count'] == 0 ){ ?>
  257. <span class="text-green">[无团长0]</span>
  258. <?php } ?>
  259. <?php } ?>
  260. <?php if($item['is_new_buy'] == 1){ ?>
  261. <span class="line-text">新人专享</a>
  262. <?php } ?>
  263. </span>
  264. </span>
  265. </td>
  266. <td>
  267. {:date("Y-m-d H:i:s",$item['begin_time'])}
  268. <br/>
  269. {:date("Y-m-d H:i:s",$item['end_time'])}
  270. <br/>
  271. <?php if($item['grounding']==1){ ?>
  272. <?php if($item['end_time'] <= time()){ ?>
  273. <span class="text-danger">活动已结束</span>
  274. <?php } ?>
  275. <?php if( $item['begin_time'] <= time() && $item['end_time'] > time() ){ ?>
  276. <span class="text-danger">正在进行中</span>
  277. <?php } ?>
  278. <?php if( $item['begin_time'] > time() ){ ?>
  279. <span class="text-danger">活动未开始</span>
  280. <?php } ?>
  281. <?php }else{ ?>
  282. <?php if( $item['end_time'] <= time() ){ ?>
  283. <span class="text-danger">活动已结束</span>
  284. <?php } ?>
  285. <?php if( $item['begin_time'] <= time() && $item['end_time'] > time() ){ ?>
  286. <span class="text-danger">未上架</span>
  287. <?php } ?>
  288. <?php if( $item['begin_time'] > time() ){ ?>
  289. <span class="text-danger">活动未开始</span>
  290. <?php } ?>
  291. <?php } ?>
  292. </td>
  293. <td >&yen;
  294. <?php if( $item['hasoption']==1 ){ ?>
  295. {$item['price_arr']['pin_price']} <?php if( isset($item['price_arr']['max_pinprice']) ){ ?>~&yen;{$item['price_arr']['max_pinprice']}<?php } ?>
  296. <?php }else{ ?>
  297. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'price','id'=>$item['id']))}" >
  298. {$item['price_arr']['pin_price']}
  299. </a>
  300. <?php } ?>
  301. </td>
  302. <td>{$item['seller_count']}</td>
  303. <td>
  304. <?php if( $item['hasoption']==1 ){ ?>
  305. {$item['total']}
  306. <?php }else{ ?>
  307. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'total','id'=>$item['id']))}" >
  308. <span class="text-danger">{$item['total']}</span>
  309. </a>
  310. <?php } ?>
  311. </td>
  312. <td>
  313. <input type="checkbox" name="" lay-filter="undowngroundingsitch" data-href="{:U('goods/change',array('type'=>'grounding','id'=>$item['id']))}" <?php if( $item['grounding']==1 ){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="上架|下架">
  314. </td>
  315. <?php if($is_top){ ?>
  316. <?php if($index_sort_method == 1){ ?>
  317. <td style="text-align:center;">
  318. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'index_sort','id'=>$item['id']))}" >
  319. <span class="text-danger">{$item['index_sort']}</span>
  320. </a>
  321. </td>
  322. <?php }else{ ?>
  323. <td >
  324. <input type="checkbox" name="" lay-filter="istop_showsitch" data-href="{:U('goods/settop',array('type'=>'istop','id'=>$item['id']))}" <?php if($item['istop']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="置顶|未置顶">
  325. </td>
  326. <?php } ?>
  327. <?php } ?>
  328. <?php if($is_index){ ?>
  329. <td >
  330. <input type="checkbox" name="" lay-filter="is_index_showsitch" data-href="{:U('goods/change',array('type'=>'is_index_show','id'=>$item['id']))}" <?php if( $item['is_index_show']==1 ){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="主页推荐|未推荐">
  331. </td>
  332. <?php } ?>
  333. <td style="overflow:visible;position:relative">
  334. <a class='layui-btn layui-btn-xs' href="{:U('group/editgoods', array('id' => $item['id'],'ok'=>1,'page'=>$page))}" >
  335. <i class="layui-icon layui-icon-edit"></i>编辑
  336. </a>
  337. <?php if($type!='recycle'){ ?>
  338. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('goods/change',array('id' => $item['id'],'type'=>'grounding','value'=>3))}" data-confirm='确认要删除吗,删除后商品将进入回收站?'>
  339. <i class="layui-icon">&#xe640;</i>删除
  340. </a>
  341. <?php } ?>
  342. <?php if($type=='recycle'){ ?>
  343. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('goods/delete', array('id' => $item['id']))}" data-confirm='确认要彻底删除吗?'>
  344. <i class="layui-icon">&#xe640;</i>彻底删除
  345. </a>
  346. <?php } ?>
  347. <a href="javascript:;" class="js-clip layui-btn layui-btn-xs" data-url="lionfish_comshop/moduleA/pin/goodsDetail?id={$item['id']}"><i class="layui-icon">&#xe64c;</i>小程序链接</a>
  348. </td>
  349. </tr>
  350. <?php } ?>
  351. </tbody>
  352. <tfoot>
  353. <tr>
  354. <td colspan="7">
  355. <div class="page-table-header">
  356. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  357. <div class="btn-group">
  358. <?php if($is_index){ ?>
  359. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'is_index_show', 'value' => 1))}">
  360. <i class='icow icow-xiajia3'></i> 主页推荐
  361. </button>
  362. <?php } ?>
  363. <?php if($is_updown){ ?>
  364. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>1))}">
  365. <i class='icow icow-shangjia2'></i> 上架
  366. </button>
  367. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>0))}">
  368. <i class='icow icow-xiajia3'></i> 下架
  369. </button>
  370. <?php } ?>
  371. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchcatesbut2" >商品分类</button>
  372. <?php if( $pintuan_model_buy == 1 ){ ?>
  373. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batch_head2" >分配售卖团长</button>
  374. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batch_head_group2" >分配售卖团长分组</button>
  375. <?php } ?>
  376. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchtime" >设置活动时间</button>
  377. <?php if($type!='recycle'){ ?>
  378. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗,删除后商品将进入回收站?" data-href="{:U('goods/change',array('type'=>'grounding','value'=>3))}">
  379. <i class='icow icow-shanchu1'></i> 删除
  380. </button>
  381. <?php } ?>
  382. <?php if($type=='recycle'){ ?>
  383. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要彻底删除吗?" data-href="{:U('goods/delete')}"><i class='icow icow-shanchu1'></i> 彻底删除</button>
  384. <?php } ?>
  385. </div>
  386. </div>
  387. </td>
  388. <td colspan="5" style="text-align: right">
  389. {$pager}
  390. </td>
  391. </tr>
  392. </tfoot>
  393. </table>
  394. </div>
  395. </div>
  396. </form>
  397. </div>
  398. </div>
  399. </div>
  400. <div id="batchcates_html" style="display:none;">
  401. <div class="layui-card">
  402. <div class="layui-card-body">
  403. <div class="modal-body" >
  404. <div class="layui-form-item">
  405. <label class="layui-form-label"></label>
  406. <div class="layui-input-block">
  407. <label class="radio-inline"><input type="radio" name="iscover" value="0" <?php if($iscover ==0){ ?> checked="checked"<?php } ?> /> 保留原有分类</label>
  408. <label class="radio-inline"><input type="radio" name="iscover" value="1" <?php if($iscover ==1){ ?> checked="checked"<?php } ?> /> 覆盖原有分类</label>
  409. </div>
  410. </div>
  411. <div class="layui-form-item">
  412. <label class="layui-form-label">商品分类</label>
  413. <div class="layui-input-block">
  414. <select id="cates2" lay-verify="cates_sel" name='cates' class="form-control " style='' >
  415. <?php foreach($category as $c){ ?>
  416. <option value="{$c['id']}" <?php if(is_array($cates) && in_array($c['id'],$cates)){ ?>selected<?php } ?> >{$c['name']}</option>
  417. <?php } ?>
  418. </select>
  419. </div>
  420. </div>
  421. <div class="layui-form-item">
  422. <div class="layui-input-block">
  423. <button class="btn btn-primary modal-fenlei">确认</button>
  424. <button class="btn btn-default cancle" >取消</button>
  425. </div>
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. </div>
  431. <div id="batchcates_headgroup_html" style="display:none;">
  432. <div class="layui-card">
  433. <div class="layui-card-body">
  434. <div class="modal-body" >
  435. <div class="layui-form-item">
  436. <label class="layui-form-label">团长分组</label>
  437. <div class="layui-input-block">
  438. <select id="group_heads" lay-verify="group_heads" name='group_heads' class="form-control " style='' >
  439. <?php foreach($group_list as $c){ ?>
  440. <option value="{$c['id']}" <?php if(is_array($cates) && in_array($c['id'],$cates)){ ?>selected<?php } ?> >{$c['groupname']}</option>
  441. <?php } ?>
  442. </select>
  443. </div>
  444. </div>
  445. <div class="layui-form-item">
  446. <label class="layui-form-label">仅这个团长可售</label>
  447. <div class="layui-input-block">
  448. <label><input type="checkbox" class="is_cancle_old2" id="is_cancle_old2" name="is_cancle_old2" style="vertical-align: text-bottom;">
  449. <div class="btn-group" style="color:#666;">
  450. 备注:会取消以往所有分配
  451. </div>
  452. </label>
  453. <label><input type="checkbox" class="is_cancle_allhead2" id="is_cancle_allhead2" name="is_cancle_allhead2" style="vertical-align: text-bottom;">
  454. <div class="btn-group" style="color:#666;">
  455. 取消商品 “所有团长可售”
  456. </div>
  457. <div style="color: #999;font-size: 12px;display: none;" id="all_headgroup_tip">所有商品中包含“所有团长可售”商品,建议取消以免设置失效</div>
  458. </label>
  459. </div>
  460. </div>
  461. <div class="layui-form-item">
  462. <div class="layui-input-block">
  463. <button class="btn btn-primary modal-group-head">确认</button>
  464. <button class="btn btn-default cancle" >取消</button>
  465. </div>
  466. </div>
  467. </div>
  468. </div>
  469. </div>
  470. </div>
  471. <div id="batchheads" style="z-index: 999;display: none;position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.5)" class="form-horizontal form-validate batchcates" enctype="multipart/form-data">
  472. <div class="modal-dialog" style="position: absolute;margin-top: -300px">
  473. <div class="modal-content">
  474. <div class="modal-header">
  475. <button data-dismiss="modal" class="close" type="button">×</button>
  476. <h4 class="modal-title">选取团长</h4>
  477. </div>
  478. <div class="modal-body" style="height:600px">
  479. <div class="form-group">
  480. <label class="col-sm-2 control-label">社区位置</label>
  481. <div class="col-sm-10 col-xs-12">
  482. <p>
  483. <select id="sel-provance" name="province_id" onChange="selectCity();" class="select form-control" style="width:130px;display:inline;">
  484. <option value="" selected="true">省/直辖市</option>
  485. </select>
  486. <select id="sel-city" name="city_id" onChange="selectcounty(0)" class="select form-control" style="width:135px;display:inline;">
  487. <option value="" selected="true">请选择</option>
  488. </select>
  489. <select id="sel-area" name="area_id" onChange="selectstreet(0)" class="select form-control" style="width:130px;display:inline;">
  490. <option value="" selected="true">请选择</option>
  491. </select>
  492. <select id="sel-street" name="country_id" class="select form-control" style="width:130px;display:inline;">
  493. <option value="" selected="true">请选择</option>
  494. </select>
  495. </p>
  496. </div>
  497. </div>
  498. <div class="form-group">
  499. <label class="col-sm-2 control-label">团长名称</label>
  500. <div class="col-sm-10 col-xs-12">
  501. <div class="input-group">
  502. <input type="text" class="form-control" name="keyword" id="supply_id_input" placeholder="团长名称/团长手机号/社区地址">
  503. <span class="input-group-btn">
  504. <button type="button" class="btn btn-default" onclick="search_heads()">搜索</button>
  505. </span>
  506. </div>
  507. </div>
  508. </div>
  509. <div class="form-group">
  510. <div class="col-sm-1 control-label">
  511. </div>
  512. <div class="col-sm-10 col-xs-12">
  513. <div class="page-table-header">
  514. <input type="checkbox" class="check_heads_all">
  515. <div class="btn-group">
  516. 全选/反选
  517. </div>
  518. <br/>
  519. <label><input type="checkbox" class="is_cancle_old" id="is_cancle_old" style="vertical-align: text-bottom;">
  520. <div class="btn-group" style="color:#666;">
  521. 同时取消以前所有分配
  522. </div>
  523. </label>
  524. &nbsp;&nbsp;&nbsp;&nbsp;
  525. <label>
  526. <input type="checkbox" class="is_cancle_allhead" id="is_cancle_allhead" style="vertical-align: text-bottom;">
  527. <div class="btn-group" style="color:#666;">
  528. 同时取消商品 “所有团长可售”
  529. </div>
  530. </label>
  531. </div>
  532. </div>
  533. </div>
  534. <div class="row">
  535. <label class="col-sm-1 control-label"></label>
  536. <div class="col-sm-11 col-xs-12">
  537. <div class="content" style="padding-top:5px;" data-name="supply_id">
  538. <div style="max-height:450px;overflow:auto;" id="batchheads_content">
  539. </div>
  540. <div class="" id="batchheads_page">
  541. </div>
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. <div class="modal-footer">
  547. <button class="btn btn-primary model_heads">确认</button>
  548. <button class="btn btn-default" >取消</button>
  549. </div>
  550. </div>
  551. </div>
  552. </div>
  553. <div id="batch_time" style="z-index: 8;display: none;position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.5)" class="form-horizontal form-validate batchtime" enctype="multipart/form-data">
  554. <div class="modal-dialog" style="position: absolute;margin-top: -190px">
  555. <div class="modal-content">
  556. <div class="modal-header">
  557. <button data-dismiss="modal" class="close" type="button">×</button>
  558. <h4 class="modal-title">设置活动时间</h4>
  559. </div>
  560. <div class="modal-body" style="height:270px">
  561. <div class="form-group">
  562. <label class="col-sm-2 control-label">活动时间</label>
  563. <div class="col-sm-8 col-xs-12">
  564. <span class="input-group-btn">
  565. {:tpl_form_field_daterange('setsametime', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  566. </span>
  567. </div>
  568. </div>
  569. </div>
  570. <div class="modal-footer">
  571. <button class="btn btn-primary modal-time">确认</button>
  572. <button class="btn btn-default cancle" >取消</button>
  573. </div>
  574. </div>
  575. </div>
  576. </div>
  577. <script src="/layuiadmin/layui/layui.js"></script>
  578. <script>
  579. layui.config({
  580. base: '/layuiadmin/' //静态资源所在路径
  581. }).extend({
  582. index: 'lib/index' //主入口模块
  583. }).use('index');
  584. </script>
  585. <script>
  586. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  587. var layer = layui.layer;
  588. var $;
  589. layui.use(['jquery', 'layer','form'], function(){
  590. $ = layui.$;
  591. var form = layui.form;
  592. $('.deldom').click(function(){
  593. var s_url = $(this).attr('data-href');
  594. layer.confirm($(this).attr('data-confirm'), function(index){
  595. $.ajax({
  596. url:s_url,
  597. type:'post',
  598. dataType:'json',
  599. success:function(info){
  600. if(info.status == 0)
  601. {
  602. layer.msg(info.result.message,{icon: 1,time: 2000});
  603. }else if(info.status == 1){
  604. var go_url = location.href;
  605. if( info.result.hasOwnProperty("url") )
  606. {
  607. go_url = info.result.url;
  608. }
  609. layer.msg('操作成功',{time: 1000,
  610. end:function(){
  611. location.href = info.result.url;
  612. }
  613. });
  614. }
  615. }
  616. })
  617. });
  618. })
  619. $('.btn-operation').click(function(){
  620. var ids_arr = [];
  621. var obj = $(this);
  622. var s_toggle = $(this).attr('data-toggle');
  623. var s_url = $(this).attr('data-href');
  624. $("input[name=item_checkbox]").each(function() {
  625. if( $(this).prop('checked') )
  626. {
  627. ids_arr.push( $(this).val() );
  628. }
  629. })
  630. if(ids_arr.length < 1)
  631. {
  632. layer.msg('请选择要操作的内容');
  633. return false;
  634. }else{
  635. var can_sub = true;
  636. if( s_toggle == 'batch-remove' )
  637. {
  638. can_sub = false;
  639. layer.confirm($(obj).attr('data-confirm'), function(index){
  640. $.ajax({
  641. url:s_url,
  642. type:'post',
  643. dataType:'json',
  644. data:{ids:ids_arr},
  645. success:function(info){
  646. if(info.status == 0)
  647. {
  648. layer.msg(info.result.message,{icon: 1,time: 2000});
  649. }else if(info.status == 1){
  650. var go_url = location.href;
  651. if( info.result.hasOwnProperty("url") )
  652. {
  653. go_url = info.result.url;
  654. }
  655. layer.msg('操作成功',{time: 1000,
  656. end:function(){
  657. location.href = info.result.url;
  658. }
  659. });
  660. }
  661. }
  662. })
  663. });
  664. }else{
  665. $.ajax({
  666. url:s_url,
  667. type:'post',
  668. dataType:'json',
  669. data:{ids:ids_arr},
  670. success:function(info){
  671. if(info.status == 0)
  672. {
  673. layer.msg(info.result.message,{icon: 1,time: 2000});
  674. }else if(info.status == 1){
  675. var go_url = location.href;
  676. if( info.result.hasOwnProperty("url") )
  677. {
  678. go_url = info.result.url;
  679. }
  680. layer.msg('操作成功',{time: 1000,
  681. end:function(){
  682. location.href = info.result.url;
  683. }
  684. });
  685. }
  686. }
  687. })
  688. }
  689. }
  690. })
  691. form.on('switch(cmwsitch)', function(data){
  692. var s_url = $(this).attr('data-href')
  693. var is_take_fullreduction = 1;
  694. if(data.elem.checked)
  695. {
  696. is_take_fullreduction = 1;
  697. }else{
  698. is_take_fullreduction = 0;
  699. }
  700. $.ajax({
  701. url:s_url,
  702. type:'post',
  703. dataType:'json',
  704. data:{value:is_take_fullreduction},
  705. success:function(info){
  706. if(info.status == 0)
  707. {
  708. layer.msg(info.result.message,{icon: 1,time: 2000});
  709. }else if(info.status == 1){
  710. var go_url = location.href;
  711. if( info.result.hasOwnProperty("url") )
  712. {
  713. go_url = info.result.url;
  714. }
  715. layer.msg('操作成功',{time: 1000,
  716. end:function(){
  717. location.href = info.result.url;
  718. }
  719. });
  720. }
  721. }
  722. })
  723. });
  724. form.on('switch(groundingsitch)', function(data){
  725. var s_url = $(this).attr('data-href')
  726. var grounding = 1;
  727. if(data.elem.checked)
  728. {
  729. grounding = 1;
  730. }else{
  731. grounding = 0;
  732. }
  733. $.ajax({
  734. url:s_url,
  735. type:'post',
  736. dataType:'json',
  737. data:{value:grounding},
  738. success:function(info){
  739. if(info.status == 0)
  740. {
  741. layer.msg(info.result.message,{icon: 1,time: 2000});
  742. }else if(info.status == 1){
  743. var go_url = location.href;
  744. if( info.result.hasOwnProperty("url") )
  745. {
  746. go_url = info.result.url;
  747. }
  748. layer.msg('操作成功',{time: 1000,
  749. end:function(){
  750. location.href = info.result.url;
  751. }
  752. });
  753. }
  754. }
  755. })
  756. });
  757. form.on('switch(unengroundingsitch)', function(data){
  758. var s_url = $(this).attr('data-href')
  759. var grounding = 1;
  760. if(data.elem.checked)
  761. {
  762. grounding = 5;
  763. }
  764. $.ajax({
  765. url:s_url,
  766. type:'post',
  767. dataType:'json',
  768. data:{value:grounding},
  769. success:function(info){
  770. if(info.status == 0)
  771. {
  772. layer.msg(info.result.message,{icon: 1,time: 2000});
  773. }else if(info.status == 1){
  774. var go_url = location.href;
  775. if( info.result.hasOwnProperty("url") )
  776. {
  777. go_url = info.result.url;
  778. }
  779. layer.msg('操作成功',{time: 1000,
  780. end:function(){
  781. location.href = info.result.url;
  782. }
  783. });
  784. }
  785. }
  786. })
  787. });
  788. form.on('switch(engroundingsitch)', function(data){
  789. var s_url = $(this).attr('data-href')
  790. var grounding = 1;
  791. if(data.elem.checked)
  792. {
  793. grounding = 1;
  794. }else{
  795. grounding = 5;
  796. }
  797. $.ajax({
  798. url:s_url,
  799. type:'post',
  800. dataType:'json',
  801. data:{value:grounding},
  802. success:function(info){
  803. if(info.status == 0)
  804. {
  805. layer.msg(info.result.message,{icon: 1,time: 2000});
  806. }else if(info.status == 1){
  807. var go_url = location.href;
  808. if( info.result.hasOwnProperty("url") )
  809. {
  810. go_url = info.result.url;
  811. }
  812. layer.msg('操作成功',{time: 1000,
  813. end:function(){
  814. location.href = info.result.url;
  815. }
  816. });
  817. }
  818. }
  819. })
  820. });
  821. form.on('switch(undowngroundingsitch)', function(data){
  822. var s_url = $(this).attr('data-href')
  823. var grounding = 1;
  824. if(data.elem.checked)
  825. {
  826. grounding = 1;
  827. }else{
  828. grounding = 0;
  829. }
  830. $.ajax({
  831. url:s_url,
  832. type:'post',
  833. dataType:'json',
  834. data:{value:grounding},
  835. success:function(info){
  836. if(info.status == 0)
  837. {
  838. layer.msg(info.result.message,{icon: 1,time: 2000});
  839. }else if(info.status == 1){
  840. var go_url = location.href;
  841. if( info.result.hasOwnProperty("url") )
  842. {
  843. go_url = info.result.url;
  844. }
  845. layer.msg('操作成功',{time: 1000,
  846. end:function(){
  847. location.href = info.result.url;
  848. }
  849. });
  850. }
  851. }
  852. })
  853. });
  854. form.on('switch(is_index_showsitch)', function(data){
  855. var s_url = $(this).attr('data-href')
  856. var is_index_show = 1;
  857. if(data.elem.checked)
  858. {
  859. is_index_show = 1;
  860. }else{
  861. is_index_show = 0;
  862. }
  863. $.ajax({
  864. url:s_url,
  865. type:'post',
  866. dataType:'json',
  867. data:{value:is_index_show},
  868. success:function(info){
  869. if(info.status == 0)
  870. {
  871. layer.msg(info.result.message,{icon: 1,time: 2000});
  872. }else if(info.status == 1){
  873. var go_url = location.href;
  874. if( info.result.hasOwnProperty("url") )
  875. {
  876. go_url = info.result.url;
  877. }
  878. layer.msg('操作成功',{time: 1000,
  879. end:function(){
  880. location.href = info.result.url;
  881. }
  882. });
  883. }
  884. }
  885. })
  886. });
  887. form.on('switch(istop_showsitch)', function(data){
  888. var s_url = $(this).attr('data-href')
  889. var istop = 1;
  890. if(data.elem.checked)
  891. {
  892. istop = 1;
  893. }else{
  894. istop = 0;
  895. }
  896. $.ajax({
  897. url:s_url,
  898. type:'post',
  899. dataType:'json',
  900. data:{value:istop},
  901. success:function(info){
  902. if(info.status == 0)
  903. {
  904. layer.msg(info.result.message,{icon: 1,time: 2000});
  905. }else if(info.status == 1){
  906. var go_url = location.href;
  907. if( info.result.hasOwnProperty("url") )
  908. {
  909. go_url = info.result.url;
  910. }
  911. layer.msg('操作成功',{time: 1000,
  912. end:function(){
  913. location.href = info.result.url;
  914. }
  915. });
  916. }
  917. }
  918. })
  919. });
  920. form.on('switch(restwsitch)', function(data){
  921. var s_url = $(this).attr('data-href')
  922. var rest = 1;
  923. if(data.elem.checked)
  924. {
  925. rest = 1;
  926. }else{
  927. rest = 0;
  928. }
  929. $.ajax({
  930. url:s_url,
  931. type:'post',
  932. dataType:'json',
  933. data:{rest:rest},
  934. success:function(info){
  935. if(info.status == 0)
  936. {
  937. layer.msg(info.result.message,{icon: 1,time: 2000});
  938. }else if(info.status == 1){
  939. var go_url = location.href;
  940. if( info.result.hasOwnProperty("url") )
  941. {
  942. go_url = info.result.url;
  943. }
  944. layer.msg('操作成功',{time: 1000,
  945. end:function(){
  946. location.href = info.result.url;
  947. }
  948. });
  949. }
  950. }
  951. })
  952. });
  953. form.on('switch(enablewsitch)', function(data){
  954. var s_url = $(this).attr('data-href')
  955. var enable = 1;
  956. if(data.elem.checked)
  957. {
  958. enable = 1;
  959. }else{
  960. enable = 0;
  961. }
  962. $.ajax({
  963. url:s_url,
  964. type:'post',
  965. dataType:'json',
  966. data:{enable:enable},
  967. success:function(info){
  968. if(info.status == 0)
  969. {
  970. layer.msg(info.result.message,{icon: 1,time: 2000});
  971. }else if(info.status == 1){
  972. var go_url = location.href;
  973. if( info.result.hasOwnProperty("url") )
  974. {
  975. go_url = info.result.url;
  976. }
  977. layer.msg('操作成功',{time: 1000,
  978. end:function(){
  979. location.href = info.result.url;
  980. }
  981. });
  982. }
  983. }
  984. })
  985. });
  986. form.on('switch(statewsitch)', function(data){
  987. var s_url = $(this).attr('data-href')
  988. var state = 1;
  989. if(data.elem.checked)
  990. {
  991. state = 1;
  992. }else{
  993. state = 0;
  994. }
  995. $.ajax({
  996. url:s_url,
  997. type:'post',
  998. dataType:'json',
  999. data:{state:state},
  1000. success:function(info){
  1001. if(info.status == 0)
  1002. {
  1003. layer.msg(info.result.message,{icon: 1,time: 2000});
  1004. }else if(info.status == 1){
  1005. var go_url = location.href;
  1006. if( info.result.hasOwnProperty("url") )
  1007. {
  1008. go_url = info.result.url;
  1009. }
  1010. layer.msg('操作成功',{time: 1000,
  1011. end:function(){
  1012. location.href = info.result.url;
  1013. }
  1014. });
  1015. }
  1016. }
  1017. })
  1018. });
  1019. form.on('checkbox(checkboxall)', function(data){
  1020. if(data.elem.checked)
  1021. {
  1022. $("input[name=item_checkbox]").each(function() {
  1023. $(this).prop("checked", true);
  1024. });
  1025. $("input[name=checkall]").each(function() {
  1026. $(this).prop("checked", true);
  1027. });
  1028. }else{
  1029. $("input[name=item_checkbox]").each(function() {
  1030. $(this).prop("checked", false);
  1031. });
  1032. $("input[name=checkall]").each(function() {
  1033. $(this).prop("checked", false);
  1034. });
  1035. }
  1036. form.render('checkbox');
  1037. });
  1038. //监听提交
  1039. form.on('submit(formDemo)', function(data){
  1040. $.ajax({
  1041. url: data.form.action,
  1042. type: data.form.method,
  1043. data: data.field,
  1044. dataType:'json',
  1045. success: function (info) {
  1046. if(info.status == 0)
  1047. {
  1048. layer.msg(info.result.message,{icon: 1,time: 2000});
  1049. }else if(info.status == 1){
  1050. var go_url = location.href;
  1051. if( info.result.hasOwnProperty("url") )
  1052. {
  1053. go_url = info.result.url;
  1054. }
  1055. layer.msg('操作成功',{time: 1000,
  1056. end:function(){
  1057. location.href = info.result.url;
  1058. }
  1059. });
  1060. }
  1061. }
  1062. });
  1063. return false;
  1064. });
  1065. })
  1066. </script>
  1067. <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
  1068. <script>
  1069. var heads_page = 1;
  1070. $("body").delegate("#batchheads_page .pagination a","click",function(){
  1071. heads_page = $(this).attr('page');
  1072. search_heads_do();
  1073. })
  1074. function search_heads()
  1075. {
  1076. heads_page = 1;
  1077. search_heads_do();
  1078. }
  1079. function search_heads_do()
  1080. {
  1081. var province_name = $('#sel-provance').val();
  1082. var city_name = $('#sel-city').val();
  1083. var area_name = $('#sel-area').val();
  1084. var country_name = $('#sel-street').val();
  1085. var keyword = $('#supply_id_input').val();
  1086. $.post("{:U('communityhead/query_head')}",{page:heads_page,'province_name':province_name,'city_name': city_name,'area_name':area_name,'country_name':country_name,'keyword':keyword},
  1087. function (ret) {
  1088. if (ret.status == 1) {
  1089. $('#batchheads_content').html(ret.html);
  1090. $('#batchheads_page').html(ret.page_html);
  1091. return
  1092. } else {
  1093. layer.msg('修改失败');
  1094. }
  1095. }, 'json');
  1096. }
  1097. //显示批量分类
  1098. $('#batchcatesbut').click(function () {
  1099. // var index = layer.load(1);
  1100. var index = layer.open({
  1101. type: 1,
  1102. area: '500px',
  1103. title: '选取分类'
  1104. ,content: $('#batchcates_html').html(),
  1105. yes: function(index, layero){
  1106. //do something
  1107. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1108. }
  1109. });
  1110. })
  1111. $('#batch_head_group').click(function () {
  1112. // var index = layer.load(1);
  1113. var index = layer.open({
  1114. type: 1,
  1115. area: '500px',
  1116. title: '选取团长分组'
  1117. ,content: $('#batchcates_headgroup_html').html(),
  1118. yes: function(index, layero){
  1119. //do something
  1120. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1121. }
  1122. });
  1123. })
  1124. $('#batch_head_group2').click(function () {
  1125. // var index = layer.load(1);
  1126. var index = layer.open({
  1127. type: 1,
  1128. area: '500px',
  1129. title: '选取团长分组'
  1130. ,content: $('#batchcates_headgroup_html').html(),
  1131. yes: function(index, layero){
  1132. //do something
  1133. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1134. }
  1135. });
  1136. })
  1137. $('.check_heads_all').click(function(){
  1138. //head_id
  1139. if($(this).is(':checked')){
  1140. $('.head_id').prop('checked',true);
  1141. }else{
  1142. $('.head_id').prop('checked',false);
  1143. }
  1144. })
  1145. $('#batch_head,#batch_head2').click(function(){
  1146. cascdeInit("1","1","","","","");
  1147. search_heads_do();
  1148. var offs_lf = ( $(window).width() -720 )/2;
  1149. var offs_ht = ( $(window).height() -690 )/2;
  1150. $('#batchheads .modal-dialog').css('top',offs_ht+'px');
  1151. $('#batchheads .modal-dialog').css('margin-top','0px');
  1152. $('#batchheads .modal-dialog').css('left',offs_lf+'px');
  1153. $('#batchheads .modal-dialog').css('margin-left','0px');
  1154. $('#batchheads').show();
  1155. })
  1156. $('#batchcatesbut2').click(function () {
  1157. var index = layer.open({
  1158. type: 1,
  1159. area: '500px',
  1160. title: '选取分类'
  1161. ,content: $('#batchcates_html').html(),
  1162. yes: function(index, layero){
  1163. //do something
  1164. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1165. }
  1166. });
  1167. })
  1168. //关闭批量分类
  1169. $('.modal-header .close').click(function () {
  1170. $('#batchcates').hide();
  1171. $('#batchheads').hide();
  1172. $('#batch_time').hide();
  1173. })
  1174. // 取消批量分类
  1175. $('.modal-footer .btn.btn-default').click(function () {
  1176. $('#batchcates').hide();
  1177. $('#batchheads').hide();
  1178. $('#batch_time').hide();
  1179. })
  1180. $('.model_heads').click(function(){
  1181. var head_id_arr = [];
  1182. $('.head_id').each(function(){
  1183. if($(this).is(':checked')) {
  1184. head_id_arr.push( $(this).val() )
  1185. }
  1186. })
  1187. //modal-group-head
  1188. var is_clear_old = 0;
  1189. if( $('#is_cancle_old').is(':checked') )
  1190. {
  1191. is_clear_old = 1;
  1192. }
  1193. var is_cancle_allhead2 = 0;
  1194. if( $('#is_cancle_allhead').is(':checked') )
  1195. {
  1196. is_cancle_allhead2 = 1;
  1197. }
  1198. if(head_id_arr.length > 0)
  1199. {
  1200. var is_tip_notice = 0;
  1201. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1202. var goodsids = selected_checkboxs.map(function () {
  1203. if( $(this).attr('data_is_all_sale') == 1 )
  1204. {
  1205. is_tip_notice = 1;
  1206. }
  1207. return $(this).val()
  1208. }).get();
  1209. if(is_tip_notice == 1) {
  1210. layer.confirm('分配售卖团中的商品中有部分商品开启了“<span style="color:red;">所有团长可售</span>”,请确认是否已经取消了“所有团长可售”,未取消的情况下部分商品分配设置可能无效!', function(index){
  1211. $.post("{:U('goods/ajax_batchheads')}", {
  1212. 'goodsids': goodsids,
  1213. 'head_id_arr': head_id_arr,
  1214. 'is_clear_old': is_clear_old,
  1215. 'is_cancle_allhead':is_cancle_allhead2
  1216. }, function (ret) {
  1217. if (ret.status == 1) {
  1218. $('#batchheads').hide();
  1219. layer.msg('分配成功', {
  1220. time: 1000
  1221. }, function () {
  1222. window.location.reload();
  1223. });
  1224. return
  1225. } else {
  1226. layer.msg('修改失败');
  1227. }
  1228. }, 'json');
  1229. });
  1230. }else{
  1231. $.post("{:U('goods/ajax_batchheads')}", {
  1232. 'goodsids': goodsids,
  1233. 'head_id_arr': head_id_arr,
  1234. 'is_clear_old': is_clear_old,
  1235. 'is_cancle_allhead':is_cancle_allhead2
  1236. }, function (ret) {
  1237. if (ret.status == 1) {
  1238. $('#batchheads').hide();
  1239. layer.msg('分配成功', {
  1240. time: 1000
  1241. }, function () {
  1242. window.location.reload();
  1243. });
  1244. return
  1245. } else {
  1246. layer.msg('修改失败');
  1247. }
  1248. }, 'json');
  1249. }
  1250. }else{
  1251. layer.msg('请选择团长');
  1252. }
  1253. })
  1254. //确认
  1255. var cates2 = 0;
  1256. $("body").delegate("#cates2","click",function(){
  1257. cates2 = $(this).val() ;
  1258. })
  1259. var group_heads2 = 'default';
  1260. $("body").delegate("#group_heads","click",function(){
  1261. group_heads2 = $(this).val() ;
  1262. })
  1263. $("body").delegate(".cancle","click",function(){
  1264. layer.closeAll();
  1265. })
  1266. $("body").delegate(".modal-group-head","click",function(){
  1267. var group_heads=$('#group_heads').val();
  1268. if(group_heads2 != 'default')
  1269. {
  1270. group_heads = group_heads2;
  1271. }
  1272. var is_tip_notice = 0;
  1273. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1274. var goodsids = selected_checkboxs.map(function () {
  1275. if( $(this).attr('data_is_all_sale') == 1 )
  1276. {
  1277. is_tip_notice = 1;
  1278. }
  1279. return $(this).val()
  1280. }).get();
  1281. if(goodsids.length <=0 )
  1282. {
  1283. layer.msg('请先选择商品');
  1284. return false;
  1285. }
  1286. var is_clear_old = 0;
  1287. $('.is_cancle_old2').each(function(){
  1288. if( $(this).is(':checked') )
  1289. {
  1290. is_clear_old = 1;
  1291. }
  1292. })
  1293. var is_cancle_allhead = 0;
  1294. $('.is_cancle_allhead2').each(function(){
  1295. if( $(this).is(':checked') )
  1296. {
  1297. is_cancle_allhead = 1;
  1298. }
  1299. })
  1300. var iscover=$('input[name="iscover"]:checked').val();
  1301. if(is_tip_notice == 1){
  1302. layer.confirm('分配售卖团长分组中的商品中有部分商品开启了“<span style="color:red;">所有团长可售</span>”,请确认是否已经取消了“所有团长可售”,未取消的情况下部分商品分配设置可能无效!', function(index) {
  1303. $.post("{:U('goods/ajax_batchcates_headgroup')}", {
  1304. 'goodsids': goodsids,
  1305. 'groupid': group_heads,
  1306. 'is_clear_old': is_clear_old,
  1307. 'is_cancle_allhead':is_cancle_allhead
  1308. }, function (ret) {
  1309. if (ret.status == 1) {
  1310. layer.msg('分配成功', {
  1311. time: 1000
  1312. }, function () {
  1313. window.location.reload();
  1314. });
  1315. return
  1316. } else {
  1317. layer.msg('分配失败');
  1318. }
  1319. }, 'json');
  1320. });
  1321. }else{
  1322. $.post("{:U('goods/ajax_batchcates_headgroup')}", {
  1323. 'goodsids': goodsids,
  1324. 'groupid': group_heads,
  1325. 'is_clear_old': is_clear_old,
  1326. 'is_cancle_allhead':is_cancle_allhead
  1327. }, function (ret) {
  1328. if (ret.status == 1) {
  1329. layer.msg('分配成功', {
  1330. time: 1000
  1331. }, function () {
  1332. window.location.reload();
  1333. });
  1334. return
  1335. } else {
  1336. layer.msg('分配失败');
  1337. }
  1338. }, 'json');
  1339. }
  1340. })
  1341. $("body").delegate(".modal-fenlei","click",function(){
  1342. var cates=$('#cates2').val();
  1343. if(cates2 != 0)
  1344. {
  1345. cates = cates2;
  1346. }
  1347. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1348. var goodsids = selected_checkboxs.map(function () {
  1349. return $(this).val()
  1350. }).get();
  1351. //id="cates"
  1352. var iscover=$('input[name="iscover"]:checked').val();
  1353. $.post("{:U('goods/ajax_batchcates')}",{'goodsids':goodsids,'cates': cates,'iscover':iscover}, function (ret) {
  1354. if (ret.status == 1) {
  1355. $('#batchcates').hide();
  1356. layer.msg('修改成功', {
  1357. time: 1000
  1358. }, function(){
  1359. window.location.reload();
  1360. });
  1361. return
  1362. } else {
  1363. layer.msg('修改失败');
  1364. }
  1365. }, 'json');
  1366. })
  1367. //----
  1368. //显示时间设置
  1369. $('#batchtime,#batchtime2').click(function () {
  1370. var offs_lf = ( $(window).width() -720 )/2;
  1371. var offs_ht = ( $(window).height() -290 )/2;
  1372. $('#batch_time .modal-dialog').css('top',offs_ht+'px');
  1373. $('#batch_time .modal-dialog').css('margin-top','0px');
  1374. $('#batch_time .modal-dialog').css('left',offs_lf+'px');
  1375. $('#batch_time .modal-dialog').css('margin-left','0px');
  1376. $('#batch_time').show();
  1377. })
  1378. $('.modal-time').click(function () {
  1379. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1380. var goodsids = selected_checkboxs.map(function () {
  1381. return $(this).val()
  1382. }).get();
  1383. var begin_time=$('#batch_time input[name="setsametime[start]"]').val();
  1384. var end_time=$('#batch_time input[name="setsametime[end]"]').val();
  1385. $.post("{:U('goods/ajax_batchtime_pintuan')}",{'goodsids':goodsids,'begin_time': begin_time,'end_time':end_time}, function (ret) {
  1386. if (ret.status == 1) {
  1387. $('#batch_time').hide();
  1388. layer.msg('设置成功');
  1389. window.location.reload();
  1390. return
  1391. } else {
  1392. layer.msg('设置失败');
  1393. }
  1394. }, 'json');
  1395. })
  1396. $(document).on("click", '[data-toggle="ajaxEdit"]', function(e) {
  1397. var obj = $(this),
  1398. url = obj.data('href') || obj.attr('href'),
  1399. data = obj.data('set') || {},
  1400. html = $.trim(obj.text()),
  1401. required = obj.data('required') || true,
  1402. edit = obj.data('edit') || 'input';
  1403. var oldval = $.trim($(this).text());
  1404. e.preventDefault();
  1405. submit = function() {
  1406. e.preventDefault();
  1407. var val = $.trim(input.val());
  1408. if (required) {
  1409. if (val == '') {
  1410. layer.msg(tip.lang.empty);
  1411. return
  1412. }
  1413. }
  1414. if (val == html) {
  1415. input.remove(), obj.html(val).show();
  1416. return
  1417. }
  1418. if (url) {
  1419. $.post(url, {
  1420. value: val
  1421. }, function(ret) {
  1422. ret = eval("(" + ret + ")");
  1423. if (ret.status == 1) {
  1424. obj.html(val).show()
  1425. input.remove();
  1426. location.reload();
  1427. }else if(ret.status == 3 ){
  1428. layer.msg('输入错误,请输入正确的数字', {icon: 2,time: 2000 }, function(){
  1429. location.reload();
  1430. });
  1431. } else {
  1432. layer.msg(ret.result.message, ret.result.url)
  1433. input.remove();
  1434. location.reload();
  1435. }
  1436. }).fail(function() {
  1437. input.remove(), layer.msg(tip.lang.exception)
  1438. })
  1439. } else {
  1440. input.remove();
  1441. obj.html(val).show()
  1442. }
  1443. obj.trigger('valueChange', [val, oldval])
  1444. }, obj.hide().html('<i class="fa fa-spinner fa-spin"></i>');
  1445. var input = $('<input type="text" class="form-control input-sm" style="width: 80%;display: inline;" />');
  1446. if (edit == 'textarea') {
  1447. input = $('<textarea type="text" class="form-control" style="resize:none" rows=3 ></textarea>')
  1448. }
  1449. obj.after(input);
  1450. input.val(html).select().blur(function() {
  1451. submit(input)
  1452. }).keypress(function(e) {
  1453. if (e.which == 13) {
  1454. submit(input)
  1455. }
  1456. })
  1457. })
  1458. </script>
  1459. </body>