index.html 65 KB

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