index.html 64 KB

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