goods.html 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  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('points/goods')}">全部商品({$all_count})</a></li>
  107. <li <?php if($type=='saleon'){ ?>class="layui-this"<?php } ?> ><a href="{:U('points/goods',array('type'=>'saleon'))}">出售中({$onsale_count})</a></li>
  108. <li <?php if($type=='stock_notice'){ ?>class="layui-this"<?php } ?> ><a href="{:U('points/goods',array('type'=>'stock_notice'))}">库存预警({$stock_notice_count})</a></li>
  109. <li <?php if($type=='getdown'){ ?>class="layui-this"<?php } ?> ><a href="{:U('points/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('points/goods',array('type'=>'warehouse'))}">仓库({$warehouse_count})</a></li>
  112. <?php } ?>
  113. <li <?php if($type=='recycle'){ ?>class="layui-this"<?php } ?> ><a href="{:U('points/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="points" />
  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. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  145. </div>
  146. </div>
  147. </div>
  148. </form>
  149. <form action="" class="layui-form" lay-filter="example" method="post" >
  150. <div class="row">
  151. <div class="col-md-12">
  152. <div class="page-table-header">
  153. <span class="pull-right">
  154. <a href="{:U('points/addgoods', array('ok' =>1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加商品</a>
  155. </span>
  156. <div class="btn-group">
  157. <?php if($is_updown){ ?>
  158. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>1))}">
  159. <i class='icow icow-shangjia2'></i> 上架
  160. </button>
  161. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>0))}">
  162. <i class='icow icow-xiajia3'></i> 下架
  163. </button>
  164. <?php } ?>
  165. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchtime" >设置活动时间</button>
  166. <?php if($type!='recycle'){ ?>
  167. <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))}">
  168. <i class='icow icow-shanchu1'></i> 删除
  169. </button>
  170. <?php } ?>
  171. <?php if($type=='recycle'){ ?>
  172. <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>
  173. <?php } ?>
  174. </div>
  175. </div>
  176. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  177. <thead>
  178. <tr>
  179. <th style="width:25px;">
  180. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  181. </th>
  182. <th style="width:80px;text-align:center;">ID</th>
  183. <th style="">&nbsp;</th>
  184. <th style="width:200px;">商品名称</th>
  185. <th style="">活动时间</th>
  186. <th style="width: 120px;">价格</th>
  187. <th style="width: 80px;">销量</th>
  188. <th style="width: 80px;">库存</th>
  189. <th style="width:180px;" >是否上架<?php if($is_open_shenhe==1){ ?><br/>是否审核<?php } ?></th>
  190. <?php if($is_top){ ?>
  191. <?php if($index_sort_method == 1){ ?>
  192. <th>首页排序</th>
  193. <?php }else{ ?>
  194. <th>置顶</th>
  195. <?php } ?>
  196. <?php } ?>
  197. <th style="">操作</th>
  198. </tr>
  199. </tr>
  200. </thead>
  201. <tbody>
  202. <?php foreach($list as $item){ ?>
  203. <tr>
  204. <td>
  205. <input type='checkbox' name="item_checkbox" class="checkone" lay-skin="primary" value="{$item['id']}"/>
  206. </td>
  207. <td style="text-align:center;">
  208. {$item['id']}
  209. </td>
  210. <td>
  211. <a href="{:U('points/editgoods', array('id' => $item['id'],'goodsfrom'=>$goodsfrom,'page'=>$page))}">
  212. <img src="{$item['thumb']}" style="width:72px;height:72px;padding:1px;border:1px solid #efefef;margin: 7px 0" />
  213. </a>
  214. </td>
  215. <td class='full' >
  216. <span>
  217. <span style="display: block;width: 100%;">
  218. <?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 } ?>
  219. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'goodsname','id'=>$item['id']))}" >
  220. <span class="text-danger">{$item['goodsname']}</span>
  221. </a>
  222. <?php if( !empty($item['cate']) ){ ?>
  223. <?php foreach($item['cate'] as $g_cate){ ?>
  224. <span class="text-danger">[<?php echo isset($category[$g_cate['cate_id']]) ? $category[$g_cate['cate_id']]['name']: '无分类';?>]</span>
  225. <?php } ?>
  226. <?php }else{ ?>
  227. <span class="text-danger">[无分类]</span>
  228. <?php } ?>
  229. <?php if( $pintuan_model_buy == 1 ){ ?>
  230. <br/>
  231. <?php if( $item['is_all_sale'] == 1 ){ ?>
  232. <span class="text-green">[所有团长{$item['head_count']}]</span>
  233. <?php }else if( $item['head_count'] >0 ){ ?>
  234. <span class="text-green">[部分团长{$item['head_count']}]</span>
  235. <?php }else if( $item['head_count'] == 0 ){ ?>
  236. <span class="text-green">[无团长0]</span>
  237. <?php } ?>
  238. <?php } ?>
  239. <?php if($item['is_new_buy'] == 1){ ?>
  240. <span class="line-text">新人专享</a>
  241. <?php } ?>
  242. </span>
  243. </span>
  244. </td>
  245. <td>
  246. {:date("Y-m-d H:i:s",$item['begin_time'])}
  247. <br/>
  248. {:date("Y-m-d H:i:s",$item['end_time'])}
  249. <br/>
  250. <?php if($item['grounding']==1){ ?>
  251. <?php if($item['end_time'] <= time()){ ?>
  252. <span class="text-danger">活动已结束</span>
  253. <?php } ?>
  254. <?php if( $item['begin_time'] <= time() && $item['end_time'] > time() ){ ?>
  255. <span class="text-danger">正在进行中</span>
  256. <?php } ?>
  257. <?php if( $item['begin_time'] > time() ){ ?>
  258. <span class="text-danger">活动未开始</span>
  259. <?php } ?>
  260. <?php }else{ ?>
  261. <?php if( $item['end_time'] <= time() ){ ?>
  262. <span class="text-danger">活动已结束</span>
  263. <?php } ?>
  264. <?php if( $item['begin_time'] <= time() && $item['end_time'] > time() ){ ?>
  265. <span class="text-danger">未上架</span>
  266. <?php } ?>
  267. <?php if( $item['begin_time'] > time() ){ ?>
  268. <span class="text-danger">活动未开始</span>
  269. <?php } ?>
  270. <?php } ?>
  271. </td>
  272. <td >&yen;
  273. <?php if( $item['hasoption']==1 ){ ?>
  274. {$item['price_arr']['price']} <?php if( isset($item['price_arr']['max_danprice']) ){ ?>~&yen;{$item['price_arr']['max_danprice']}<?php } ?>
  275. <?php }else{ ?>
  276. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'price','id'=>$item['id']))}" >
  277. {$item['price']}
  278. </a>
  279. <?php } ?>
  280. </td>
  281. <td>{$item['seller_count']}</td>
  282. <td>
  283. <?php if( $item['hasoption']==1 ){ ?>
  284. {$item['total']}
  285. <?php }else{ ?>
  286. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'total','id'=>$item['id']))}" >
  287. <span class="text-danger">{$item['total']}</span>
  288. </a>
  289. <?php } ?>
  290. </td>
  291. <td>
  292. <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="上架|下架">
  293. </td>
  294. <?php if($is_top){ ?>
  295. <?php if($index_sort_method == 1){ ?>
  296. <td style="text-align:center;">
  297. <a href='javascript:;' data-toggle='ajaxEdit' data-href="{:U('goods/change',array('type'=>'index_sort','id'=>$item['id']))}" >
  298. <span class="text-danger">{$item['index_sort']}</span>
  299. </a>
  300. </td>
  301. <?php }else{ ?>
  302. <td >
  303. <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="置顶|未置顶">
  304. </td>
  305. <?php } ?>
  306. <?php } ?>
  307. <td style="overflow:visible;position:relative">
  308. <a class='layui-btn layui-btn-xs' href="{:U('points/editgoods', array('id' => $item['id'],'ok'=>1,'page'=>$page))}" >
  309. <i class="layui-icon layui-icon-edit"></i>编辑
  310. </a>
  311. <?php if($type!='recycle'){ ?>
  312. <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='确认要删除吗,删除后商品将进入回收站?'>
  313. <i class="layui-icon">&#xe640;</i>删除
  314. </a>
  315. <?php } ?>
  316. <?php if($type=='recycle'){ ?>
  317. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('goods/delete', array('id' => $item['id']))}" data-confirm='确认要彻底删除吗?'>
  318. <i class="layui-icon">&#xe640;</i>彻底删除
  319. </a>
  320. <?php } ?>
  321. </td>
  322. </tr>
  323. <?php } ?>
  324. </tbody>
  325. <tfoot>
  326. <tr>
  327. <td colspan="7">
  328. <div class="page-table-header">
  329. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  330. <div class="btn-group">
  331. <?php if($is_updown){ ?>
  332. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>1))}">
  333. <i class='icow icow-shangjia2'></i> 上架
  334. </button>
  335. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('goods/change',array('type'=>'grounding','value'=>0))}">
  336. <i class='icow icow-xiajia3'></i> 下架
  337. </button>
  338. <?php } ?>
  339. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-group' id="batchtime" >设置活动时间</button>
  340. <?php if($type!='recycle'){ ?>
  341. <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))}">
  342. <i class='icow icow-shanchu1'></i> 删除
  343. </button>
  344. <?php } ?>
  345. <?php if($type=='recycle'){ ?>
  346. <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>
  347. <?php } ?>
  348. </div>
  349. </div>
  350. </td>
  351. <td colspan="5" style="text-align: right">
  352. {$pager}
  353. </td>
  354. </tr>
  355. </tfoot>
  356. </table>
  357. </div>
  358. </div>
  359. </form>
  360. </div>
  361. </div>
  362. </div>
  363. <div id="batchcates_html" style="display:none;">
  364. <div class="layui-card">
  365. <div class="layui-card-body">
  366. <div class="modal-body" >
  367. <div class="layui-form-item">
  368. <label class="layui-form-label"></label>
  369. <div class="layui-input-block">
  370. <label class="radio-inline"><input type="radio" name="iscover" value="0" <?php if($iscover ==0){ ?> checked="checked"<?php } ?> /> 保留原有分类</label>
  371. <label class="radio-inline"><input type="radio" name="iscover" value="1" <?php if($iscover ==1){ ?> checked="checked"<?php } ?> /> 覆盖原有分类</label>
  372. </div>
  373. </div>
  374. <div class="layui-form-item">
  375. <label class="layui-form-label">商品分类</label>
  376. <div class="layui-input-block">
  377. <select id="cates2" lay-verify="cates_sel" name='cates' class="form-control " style='' >
  378. <?php foreach($category as $c){ ?>
  379. <option value="{$c['id']}" <?php if(is_array($cates) && in_array($c['id'],$cates)){ ?>selected<?php } ?> >{$c['name']}</option>
  380. <?php } ?>
  381. </select>
  382. </div>
  383. </div>
  384. <div class="layui-form-item">
  385. <div class="layui-input-block">
  386. <button class="btn btn-primary modal-fenlei">确认</button>
  387. <button class="btn btn-default cancle" >取消</button>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. </div>
  394. <div id="batchcates_headgroup_html" style="display:none;">
  395. <div class="layui-card">
  396. <div class="layui-card-body">
  397. <div class="modal-body" >
  398. <div class="layui-form-item">
  399. <label class="layui-form-label">团长分组</label>
  400. <div class="layui-input-block">
  401. <select id="group_heads" lay-verify="group_heads" name='group_heads' class="form-control " style='' >
  402. <?php foreach($group_list as $c){ ?>
  403. <option value="{$c['id']}" <?php if(is_array($cates) && in_array($c['id'],$cates)){ ?>selected<?php } ?> >{$c['groupname']}</option>
  404. <?php } ?>
  405. </select>
  406. </div>
  407. </div>
  408. <div class="layui-form-item">
  409. <div class="layui-input-block">
  410. <button class="btn btn-primary modal-group-head">确认</button>
  411. <button class="btn btn-default cancle" >取消</button>
  412. </div>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <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">
  419. <div class="modal-dialog" style="position: absolute;margin-top: -300px">
  420. <div class="modal-content">
  421. <div class="modal-header">
  422. <button data-dismiss="modal" class="close" type="button">×</button>
  423. <h4 class="modal-title">选取团长</h4>
  424. </div>
  425. <div class="modal-body" style="height:600px">
  426. <div class="form-group">
  427. <label class="col-sm-2 control-label">社区位置</label>
  428. <div class="col-sm-10 col-xs-12">
  429. <p>
  430. <select id="sel-provance" name="province_id" onChange="selectCity();" class="select form-control" style="width:130px;display:inline;">
  431. <option value="" selected="true">省/直辖市</option>
  432. </select>
  433. <select id="sel-city" name="city_id" onChange="selectcounty(0)" class="select form-control" style="width:135px;display:inline;">
  434. <option value="" selected="true">请选择</option>
  435. </select>
  436. <select id="sel-area" name="area_id" onChange="selectstreet(0)" class="select form-control" style="width:130px;display:inline;">
  437. <option value="" selected="true">请选择</option>
  438. </select>
  439. <select id="sel-street" name="country_id" class="select form-control" style="width:130px;display:inline;">
  440. <option value="" selected="true">请选择</option>
  441. </select>
  442. </p>
  443. </div>
  444. </div>
  445. <div class="form-group">
  446. <label class="col-sm-2 control-label">团长名称</label>
  447. <div class="col-sm-10 col-xs-12">
  448. <div class="input-group">
  449. <input type="text" class="form-control" name="keyword" id="supply_id_input" placeholder="团长名称/团长手机号/社区地址">
  450. <span class="input-group-btn">
  451. <button type="button" class="btn btn-default" onclick="search_heads()">搜索</button>
  452. </span>
  453. </div>
  454. </div>
  455. </div>
  456. <div class="form-group">
  457. <div class="col-sm-1 control-label">
  458. </div>
  459. <div class="col-sm-10 col-xs-12">
  460. <div class="page-table-header">
  461. <input type="checkbox" class="check_heads_all">
  462. <div class="btn-group">
  463. 全选/反选
  464. </div>
  465. </div>
  466. </div>
  467. </div>
  468. <div class="row">
  469. <label class="col-sm-1 control-label"></label>
  470. <div class="col-sm-11 col-xs-12">
  471. <div class="content" style="padding-top:5px;" data-name="supply_id">
  472. <div style="max-height:450px;overflow:auto;" id="batchheads_content">
  473. </div>
  474. <div class="" id="batchheads_page">
  475. </div>
  476. </div>
  477. </div>
  478. </div>
  479. </div>
  480. <div class="modal-footer">
  481. <button class="btn btn-primary model_heads">确认</button>
  482. <button class="btn btn-default" >取消</button>
  483. </div>
  484. </div>
  485. </div>
  486. </div>
  487. <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">
  488. <div class="modal-dialog" style="position: absolute;margin-top: -190px">
  489. <div class="modal-content">
  490. <div class="modal-header">
  491. <button data-dismiss="modal" class="close" type="button">×</button>
  492. <h4 class="modal-title">设置活动时间</h4>
  493. </div>
  494. <div class="modal-body" style="height:270px">
  495. <div class="form-group">
  496. <label class="col-sm-2 control-label">活动时间</label>
  497. <div class="col-sm-8 col-xs-12">
  498. <span class="input-group-btn">
  499. {:tpl_form_field_daterange('setsametime', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  500. </span>
  501. </div>
  502. </div>
  503. </div>
  504. <div class="modal-footer">
  505. <button class="btn btn-primary modal-time">确认</button>
  506. <button class="btn btn-default cancle" >取消</button>
  507. </div>
  508. </div>
  509. </div>
  510. </div>
  511. <script src="/layuiadmin/layui/layui.js"></script>
  512. <script>
  513. layui.config({
  514. base: '/layuiadmin/' //静态资源所在路径
  515. }).extend({
  516. index: 'lib/index' //主入口模块
  517. }).use('index');
  518. </script>
  519. <script>
  520. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  521. var layer = layui.layer;
  522. var $;
  523. layui.use(['jquery', 'layer','form'], function(){
  524. $ = layui.$;
  525. var form = layui.form;
  526. $('.deldom').click(function(){
  527. var s_url = $(this).attr('data-href');
  528. layer.confirm($(this).attr('data-confirm'), function(index){
  529. $.ajax({
  530. url:s_url,
  531. type:'post',
  532. dataType:'json',
  533. success:function(info){
  534. if(info.status == 0)
  535. {
  536. layer.msg(info.result.message,{icon: 1,time: 2000});
  537. }else if(info.status == 1){
  538. var go_url = location.href;
  539. if( info.result.hasOwnProperty("url") )
  540. {
  541. go_url = info.result.url;
  542. }
  543. layer.msg('操作成功',{time: 1000,
  544. end:function(){
  545. location.href = info.result.url;
  546. }
  547. });
  548. }
  549. }
  550. })
  551. });
  552. })
  553. $('.btn-operation').click(function(){
  554. var ids_arr = [];
  555. var obj = $(this);
  556. var s_toggle = $(this).attr('data-toggle');
  557. var s_url = $(this).attr('data-href');
  558. $("input[name=item_checkbox]").each(function() {
  559. if( $(this).prop('checked') )
  560. {
  561. ids_arr.push( $(this).val() );
  562. }
  563. })
  564. if(ids_arr.length < 1)
  565. {
  566. layer.msg('请选择要操作的内容');
  567. return false;
  568. }else{
  569. var can_sub = true;
  570. if( s_toggle == 'batch-remove' )
  571. {
  572. can_sub = false;
  573. layer.confirm($(obj).attr('data-confirm'), function(index){
  574. $.ajax({
  575. url:s_url,
  576. type:'post',
  577. dataType:'json',
  578. data:{ids:ids_arr},
  579. success:function(info){
  580. if(info.status == 0)
  581. {
  582. layer.msg(info.result.message,{icon: 1,time: 2000});
  583. }else if(info.status == 1){
  584. var go_url = location.href;
  585. if( info.result.hasOwnProperty("url") )
  586. {
  587. go_url = info.result.url;
  588. }
  589. layer.msg('操作成功',{time: 1000,
  590. end:function(){
  591. location.href = info.result.url;
  592. }
  593. });
  594. }
  595. }
  596. })
  597. });
  598. }else{
  599. $.ajax({
  600. url:s_url,
  601. type:'post',
  602. dataType:'json',
  603. data:{ids:ids_arr},
  604. success:function(info){
  605. if(info.status == 0)
  606. {
  607. layer.msg(info.result.message,{icon: 1,time: 2000});
  608. }else if(info.status == 1){
  609. var go_url = location.href;
  610. if( info.result.hasOwnProperty("url") )
  611. {
  612. go_url = info.result.url;
  613. }
  614. layer.msg('操作成功',{time: 1000,
  615. end:function(){
  616. location.href = info.result.url;
  617. }
  618. });
  619. }
  620. }
  621. })
  622. }
  623. }
  624. })
  625. form.on('switch(cmwsitch)', function(data){
  626. var s_url = $(this).attr('data-href')
  627. var is_take_fullreduction = 1;
  628. if(data.elem.checked)
  629. {
  630. is_take_fullreduction = 1;
  631. }else{
  632. is_take_fullreduction = 0;
  633. }
  634. $.ajax({
  635. url:s_url,
  636. type:'post',
  637. dataType:'json',
  638. data:{value:is_take_fullreduction},
  639. success:function(info){
  640. if(info.status == 0)
  641. {
  642. layer.msg(info.result.message,{icon: 1,time: 2000});
  643. }else if(info.status == 1){
  644. var go_url = location.href;
  645. if( info.result.hasOwnProperty("url") )
  646. {
  647. go_url = info.result.url;
  648. }
  649. layer.msg('操作成功',{time: 1000,
  650. end:function(){
  651. location.href = info.result.url;
  652. }
  653. });
  654. }
  655. }
  656. })
  657. });
  658. form.on('switch(groundingsitch)', function(data){
  659. var s_url = $(this).attr('data-href')
  660. var grounding = 1;
  661. if(data.elem.checked)
  662. {
  663. grounding = 1;
  664. }else{
  665. grounding = 0;
  666. }
  667. $.ajax({
  668. url:s_url,
  669. type:'post',
  670. dataType:'json',
  671. data:{value:grounding},
  672. success:function(info){
  673. if(info.status == 0)
  674. {
  675. layer.msg(info.result.message,{icon: 1,time: 2000});
  676. }else if(info.status == 1){
  677. var go_url = location.href;
  678. if( info.result.hasOwnProperty("url") )
  679. {
  680. go_url = info.result.url;
  681. }
  682. layer.msg('操作成功',{time: 1000,
  683. end:function(){
  684. location.href = info.result.url;
  685. }
  686. });
  687. }
  688. }
  689. })
  690. });
  691. form.on('switch(unengroundingsitch)', function(data){
  692. var s_url = $(this).attr('data-href')
  693. var grounding = 1;
  694. if(data.elem.checked)
  695. {
  696. grounding = 5;
  697. }
  698. $.ajax({
  699. url:s_url,
  700. type:'post',
  701. dataType:'json',
  702. data:{value:grounding},
  703. success:function(info){
  704. if(info.status == 0)
  705. {
  706. layer.msg(info.result.message,{icon: 1,time: 2000});
  707. }else if(info.status == 1){
  708. var go_url = location.href;
  709. if( info.result.hasOwnProperty("url") )
  710. {
  711. go_url = info.result.url;
  712. }
  713. layer.msg('操作成功',{time: 1000,
  714. end:function(){
  715. location.href = info.result.url;
  716. }
  717. });
  718. }
  719. }
  720. })
  721. });
  722. form.on('switch(engroundingsitch)', function(data){
  723. var s_url = $(this).attr('data-href')
  724. var grounding = 1;
  725. if(data.elem.checked)
  726. {
  727. grounding = 1;
  728. }else{
  729. grounding = 5;
  730. }
  731. $.ajax({
  732. url:s_url,
  733. type:'post',
  734. dataType:'json',
  735. data:{value:grounding},
  736. success:function(info){
  737. if(info.status == 0)
  738. {
  739. layer.msg(info.result.message,{icon: 1,time: 2000});
  740. }else if(info.status == 1){
  741. var go_url = location.href;
  742. if( info.result.hasOwnProperty("url") )
  743. {
  744. go_url = info.result.url;
  745. }
  746. layer.msg('操作成功',{time: 1000,
  747. end:function(){
  748. location.href = info.result.url;
  749. }
  750. });
  751. }
  752. }
  753. })
  754. });
  755. form.on('switch(undowngroundingsitch)', function(data){
  756. var s_url = $(this).attr('data-href')
  757. var grounding = 1;
  758. if(data.elem.checked)
  759. {
  760. grounding = 1;
  761. }else{
  762. grounding = 0;
  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(is_index_showsitch)', function(data){
  789. var s_url = $(this).attr('data-href')
  790. var is_index_show = 1;
  791. if(data.elem.checked)
  792. {
  793. is_index_show = 1;
  794. }else{
  795. is_index_show = 0;
  796. }
  797. $.ajax({
  798. url:s_url,
  799. type:'post',
  800. dataType:'json',
  801. data:{value:is_index_show},
  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(istop_showsitch)', function(data){
  822. var s_url = $(this).attr('data-href')
  823. var istop = 1;
  824. if(data.elem.checked)
  825. {
  826. istop = 1;
  827. }else{
  828. istop = 0;
  829. }
  830. $.ajax({
  831. url:s_url,
  832. type:'post',
  833. dataType:'json',
  834. data:{value:istop},
  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(restwsitch)', function(data){
  855. var s_url = $(this).attr('data-href')
  856. var rest = 1;
  857. if(data.elem.checked)
  858. {
  859. rest = 1;
  860. }else{
  861. rest = 0;
  862. }
  863. $.ajax({
  864. url:s_url,
  865. type:'post',
  866. dataType:'json',
  867. data:{rest:rest},
  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(enablewsitch)', function(data){
  888. var s_url = $(this).attr('data-href')
  889. var enable = 1;
  890. if(data.elem.checked)
  891. {
  892. enable = 1;
  893. }else{
  894. enable = 0;
  895. }
  896. $.ajax({
  897. url:s_url,
  898. type:'post',
  899. dataType:'json',
  900. data:{enable:enable},
  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(statewsitch)', function(data){
  921. var s_url = $(this).attr('data-href')
  922. var state = 1;
  923. if(data.elem.checked)
  924. {
  925. state = 1;
  926. }else{
  927. state = 0;
  928. }
  929. $.ajax({
  930. url:s_url,
  931. type:'post',
  932. dataType:'json',
  933. data:{state:state},
  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('checkbox(checkboxall)', function(data){
  954. if(data.elem.checked)
  955. {
  956. $("input[name=item_checkbox]").each(function() {
  957. $(this).prop("checked", true);
  958. });
  959. $("input[name=checkall]").each(function() {
  960. $(this).prop("checked", true);
  961. });
  962. }else{
  963. $("input[name=item_checkbox]").each(function() {
  964. $(this).prop("checked", false);
  965. });
  966. $("input[name=checkall]").each(function() {
  967. $(this).prop("checked", false);
  968. });
  969. }
  970. form.render('checkbox');
  971. });
  972. //监听提交
  973. form.on('submit(formDemo)', function(data){
  974. $.ajax({
  975. url: data.form.action,
  976. type: data.form.method,
  977. data: data.field,
  978. dataType:'json',
  979. success: function (info) {
  980. if(info.status == 0)
  981. {
  982. layer.msg(info.result.message,{icon: 1,time: 2000});
  983. }else if(info.status == 1){
  984. var go_url = location.href;
  985. if( info.result.hasOwnProperty("url") )
  986. {
  987. go_url = info.result.url;
  988. }
  989. layer.msg('操作成功',{time: 1000,
  990. end:function(){
  991. location.href = info.result.url;
  992. }
  993. });
  994. }
  995. }
  996. });
  997. return false;
  998. });
  999. })
  1000. </script>
  1001. <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
  1002. <script>
  1003. var heads_page = 1;
  1004. $("body").delegate("#batchheads_page .pagination a","click",function(){
  1005. heads_page = $(this).attr('page');
  1006. search_heads_do();
  1007. })
  1008. function search_heads()
  1009. {
  1010. heads_page = 1;
  1011. search_heads_do();
  1012. }
  1013. function search_heads_do()
  1014. {
  1015. var province_name = $('#sel-provance').val();
  1016. var city_name = $('#sel-city').val();
  1017. var area_name = $('#sel-area').val();
  1018. var country_name = $('#sel-street').val();
  1019. var keyword = $('#supply_id_input').val();
  1020. $.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},
  1021. function (ret) {
  1022. if (ret.status == 1) {
  1023. $('#batchheads_content').html(ret.html);
  1024. $('#batchheads_page').html(ret.page_html);
  1025. return
  1026. } else {
  1027. layer.msg('修改失败');
  1028. }
  1029. }, 'json');
  1030. }
  1031. //显示批量分类
  1032. $('#batchcatesbut').click(function () {
  1033. // var index = layer.load(1);
  1034. var index = layer.open({
  1035. type: 1,
  1036. area: '500px',
  1037. title: '选取分类'
  1038. ,content: $('#batchcates_html').html(),
  1039. yes: function(index, layero){
  1040. //do something
  1041. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1042. }
  1043. });
  1044. })
  1045. $('#batch_head_group').click(function () {
  1046. // var index = layer.load(1);
  1047. var index = layer.open({
  1048. type: 1,
  1049. area: '500px',
  1050. title: '选取团长分组'
  1051. ,content: $('#batchcates_headgroup_html').html(),
  1052. yes: function(index, layero){
  1053. //do something
  1054. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1055. }
  1056. });
  1057. })
  1058. $('#batch_head_group2').click(function () {
  1059. // var index = layer.load(1);
  1060. var index = layer.open({
  1061. type: 1,
  1062. area: '500px',
  1063. title: '选取团长分组'
  1064. ,content: $('#batchcates_headgroup_html').html(),
  1065. yes: function(index, layero){
  1066. //do something
  1067. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1068. }
  1069. });
  1070. })
  1071. $('.check_heads_all').click(function(){
  1072. //head_id
  1073. if($(this).is(':checked')){
  1074. $('.head_id').prop('checked',true);
  1075. }else{
  1076. $('.head_id').prop('checked',false);
  1077. }
  1078. })
  1079. $('#batch_head,#batch_head2').click(function(){
  1080. cascdeInit("1","1","","","","");
  1081. search_heads_do();
  1082. var offs_lf = ( $(window).width() -720 )/2;
  1083. var offs_ht = ( $(window).height() -690 )/2;
  1084. $('#batchheads .modal-dialog').css('top',offs_ht+'px');
  1085. $('#batchheads .modal-dialog').css('margin-top','0px');
  1086. $('#batchheads .modal-dialog').css('left',offs_lf+'px');
  1087. $('#batchheads .modal-dialog').css('margin-left','0px');
  1088. $('#batchheads').show();
  1089. })
  1090. $('#batchcatesbut2').click(function () {
  1091. var index = layer.open({
  1092. type: 1,
  1093. area: '500px',
  1094. title: '选取分类'
  1095. ,content: $('#batchcates_html').html(),
  1096. yes: function(index, layero){
  1097. //do something
  1098. layer.close(index); //如果设定了yes回调,需进行手工关闭
  1099. }
  1100. });
  1101. })
  1102. //关闭批量分类
  1103. $('.modal-header .close').click(function () {
  1104. $('#batchcates').hide();
  1105. $('#batchheads').hide();
  1106. $('#batch_time').hide();
  1107. })
  1108. // 取消批量分类
  1109. $('.modal-footer .btn.btn-default').click(function () {
  1110. $('#batchcates').hide();
  1111. $('#batchheads').hide();
  1112. $('#batch_time').hide();
  1113. })
  1114. $('.model_heads').click(function(){
  1115. var head_id_arr = [];
  1116. $('.head_id').each(function(){
  1117. if($(this).is(':checked')) {
  1118. head_id_arr.push( $(this).val() )
  1119. }
  1120. })
  1121. if(head_id_arr.length > 0)
  1122. {
  1123. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1124. var goodsids = selected_checkboxs.map(function () {
  1125. return $(this).val()
  1126. }).get();
  1127. $.post("{:U('goods/ajax_batchheads')}",{'goodsids':goodsids,'head_id_arr': head_id_arr}, function (ret) {
  1128. if (ret.status == 1) {
  1129. $('#batchheads').hide();
  1130. layer.msg('分配成功');
  1131. // window.location.reload();
  1132. return
  1133. } else {
  1134. layer.msg('修改失败');
  1135. }
  1136. }, 'json');
  1137. }else{
  1138. layer.msg('请选择团长');
  1139. }
  1140. })
  1141. //确认
  1142. var cates2 = 0;
  1143. $("body").delegate("#cates2","click",function(){
  1144. cates2 = $(this).val() ;
  1145. })
  1146. var group_heads2 = 'default';
  1147. $("body").delegate("#group_heads","click",function(){
  1148. group_heads2 = $(this).val() ;
  1149. })
  1150. $("body").delegate(".cancle","click",function(){
  1151. layer.closeAll();
  1152. })
  1153. $("body").delegate(".modal-group-head","click",function(){
  1154. var group_heads=$('#group_heads').val();
  1155. if(group_heads2 != 'default')
  1156. {
  1157. group_heads = group_heads2;
  1158. }
  1159. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1160. var goodsids = selected_checkboxs.map(function () {
  1161. return $(this).val()
  1162. }).get();
  1163. if(goodsids.length <=0 )
  1164. {
  1165. layer.msg('请先选择商品');
  1166. return false;
  1167. }
  1168. var iscover=$('input[name="iscover"]:checked').val();
  1169. $.post("{:U('goods/ajax_batchcates_headgroup')}",{'goodsids':goodsids,'groupid': group_heads}, function (ret) {
  1170. if (ret.status == 1) {
  1171. layer.msg('分配成功', {
  1172. time: 1000
  1173. }, function(){
  1174. window.location.reload();
  1175. });
  1176. return
  1177. } else {
  1178. layer.msg('分配失败');
  1179. }
  1180. }, 'json');
  1181. })
  1182. $("body").delegate(".modal-fenlei","click",function(){
  1183. var cates=$('#cates2').val();
  1184. if(cates2 != 0)
  1185. {
  1186. cates = cates2;
  1187. }
  1188. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1189. var goodsids = selected_checkboxs.map(function () {
  1190. return $(this).val()
  1191. }).get();
  1192. //id="cates"
  1193. var iscover=$('input[name="iscover"]:checked').val();
  1194. $.post("{:U('goods/ajax_batchcates')}",{'goodsids':goodsids,'cates': cates,'iscover':iscover}, function (ret) {
  1195. if (ret.status == 1) {
  1196. $('#batchcates').hide();
  1197. layer.msg('修改成功', {
  1198. time: 1000
  1199. }, function(){
  1200. window.location.reload();
  1201. });
  1202. return
  1203. } else {
  1204. layer.msg('修改失败');
  1205. }
  1206. }, 'json');
  1207. })
  1208. //----
  1209. //显示时间设置
  1210. $('#batchtime,#batchtime2').click(function () {
  1211. var offs_lf = ( $(window).width() -720 )/2;
  1212. var offs_ht = ( $(window).height() -290 )/2;
  1213. $('#batch_time .modal-dialog').css('top',offs_ht+'px');
  1214. $('#batch_time .modal-dialog').css('margin-top','0px');
  1215. $('#batch_time .modal-dialog').css('left',offs_lf+'px');
  1216. $('#batch_time .modal-dialog').css('margin-left','0px');
  1217. $('#batch_time').show();
  1218. })
  1219. $('.modal-time').click(function () {
  1220. var selected_checkboxs = $('.table-responsive tbody tr td:first-child [type="checkbox"]:checked');
  1221. var goodsids = selected_checkboxs.map(function () {
  1222. return $(this).val()
  1223. }).get();
  1224. var begin_time=$('#batch_time input[name="setsametime[start]"]').val();
  1225. var end_time=$('#batch_time input[name="setsametime[end]"]').val();
  1226. $.post("{:U('goods/ajax_batchtime')}",{'goodsids':goodsids,'begin_time': begin_time,'end_time':end_time}, function (ret) {
  1227. if (ret.status == 1) {
  1228. $('#batch_time').hide();
  1229. layer.msg('设置成功');
  1230. window.location.reload();
  1231. return
  1232. } else {
  1233. layer.msg('设置失败');
  1234. }
  1235. }, 'json');
  1236. })
  1237. $(document).on("click", '[data-toggle="ajaxEdit"]', function(e) {
  1238. var obj = $(this),
  1239. url = obj.data('href') || obj.attr('href'),
  1240. data = obj.data('set') || {},
  1241. html = $.trim(obj.text()),
  1242. required = obj.data('required') || true,
  1243. edit = obj.data('edit') || 'input';
  1244. var oldval = $.trim($(this).text());
  1245. e.preventDefault();
  1246. submit = function() {
  1247. e.preventDefault();
  1248. var val = $.trim(input.val());
  1249. if (required) {
  1250. if (val == '') {
  1251. layer.msg(tip.lang.empty);
  1252. return
  1253. }
  1254. }
  1255. if (val == html) {
  1256. input.remove(), obj.html(val).show();
  1257. return
  1258. }
  1259. if (url) {
  1260. $.post(url, {
  1261. value: val
  1262. }, function(ret) {
  1263. ret = eval("(" + ret + ")");
  1264. if (ret.status == 1) {
  1265. obj.html(val).show()
  1266. input.remove();
  1267. location.reload();
  1268. }else if(ret.status == 3 ){
  1269. layer.msg('输入错误,请输入正确的数字', {icon: 2,time: 2000 }, function(){
  1270. location.reload();
  1271. });
  1272. } else {
  1273. layer.msg(ret.result.message, ret.result.url)
  1274. input.remove();
  1275. location.reload();
  1276. }
  1277. }).fail(function() {
  1278. input.remove(), layer.msg(tip.lang.exception)
  1279. })
  1280. } else {
  1281. input.remove();
  1282. obj.html(val).show()
  1283. }
  1284. obj.trigger('valueChange', [val, oldval])
  1285. }, obj.hide().html('<i class="fa fa-spinner fa-spin"></i>');
  1286. var input = $('<input type="text" class="form-control input-sm" style="width: 80%;display: inline;" />');
  1287. if (edit == 'textarea') {
  1288. input = $('<textarea type="text" class="form-control" style="resize:none" rows=3 ></textarea>')
  1289. }
  1290. obj.after(input);
  1291. input.val(html).select().blur(function() {
  1292. submit(input)
  1293. }).keypress(function(e) {
  1294. if (e.which == 13) {
  1295. submit(input)
  1296. }
  1297. })
  1298. })
  1299. </script>
  1300. </body>