orderaftersales.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css?v=32" rel="stylesheet">
  44. <style>
  45. tbody tr td{
  46. position: relative;
  47. }
  48. tbody tr .icow-weibiaoti--{
  49. visibility: hidden;
  50. display: inline-block;
  51. color: #fff;
  52. height:18px;
  53. width:18px;
  54. background: #e0e0e0;
  55. text-align: center;
  56. line-height: 18px;
  57. vertical-align: middle;
  58. }
  59. tbody tr:hover .icow-weibiaoti--{
  60. visibility: visible;
  61. }
  62. tbody tr .icow-weibiaoti--.hidden{
  63. visibility: hidden !important;
  64. }
  65. .full .icow-weibiaoti--{
  66. margin-left:10px;
  67. }
  68. .full>span{
  69. display: -webkit-box;
  70. display: -webkit-flex;
  71. display: -ms-flexbox;
  72. display: flex;
  73. vertical-align: middle;
  74. align-items: center;
  75. }
  76. tbody tr .label{
  77. margin: 5px 0;
  78. }
  79. .goods_attribute a{
  80. cursor: pointer;
  81. }
  82. .newgoodsflag{
  83. width: 22px;height: 16px;
  84. background-color: #ff0000;
  85. color: #fff;
  86. text-align: center;
  87. position: absolute;
  88. bottom: 70px;
  89. left: 57px;
  90. font-size: 12px;
  91. }
  92. .a{cursor: pointer;}
  93. .img-40 {
  94. width: 40px;
  95. height: 40px;
  96. }
  97. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect{
  98. width:auto!important;
  99. }
  100. </style>
  101. </head>
  102. <body layadmin-themealias="default">
  103. <table id="demo" lay-filter="test"></table>
  104. <div class="layui-fluid">
  105. <div class="layui-card">
  106. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">售后订单管理
  107. </span>
  108. </div>
  109. <div class="layui-tab layui-tab-brief" >
  110. <ul class="layui-tab-title">
  111. <li <?php if( (empty($_GPC['state']) || $_GPC['state']=='-1' )&& $_GPC['state'] !='0' ){ ?>class="layui-this"<?php } ?>><a href="{:U('order/orderaftersales', array('state' => -1))}">全部申请</a></li>
  112. <li <?php if($_GPC['state']=='0'){ ?>class="layui-this"<?php } ?> ><a href="{:U('order/orderaftersales', array('state' => 0))}">待处理</a></li>
  113. <li <?php if($_GPC['state']=='6'){ ?>class="layui-this"<?php } ?> ><a href="{:U('order/orderaftersales', array('state' => 6))}">退货中</a></li>
  114. <li <?php if($_GPC['state']=='3'){ ?>class="layui-this"<?php } ?> ><a href="{:U('order/orderaftersales', array('state' => 3))}">已完成</a></li>
  115. <li <?php if( $_GPC['state']=='1' ){ ?>class="layui-this"<?php } ?> ><a href="{:U('order/orderaftersales', array('state' => 1))}">已拒绝</a></li>
  116. </ul>
  117. </div>
  118. <div class="layui-card-body" style="padding:15px;">
  119. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  120. <input type="hidden" name="c" value="order" />
  121. <input type="hidden" name="a" value="orderaftersales" />
  122. <input type="hidden" name="order_status_id" value="{$order_status_id}" />
  123. <div class="layui-form-item">
  124. <div class="layui-inline">
  125. <div class="layui-input-inline" style="width:100px;">
  126. <select name='searchtime' lay-ignore class='layui-input layui-unselect' style="width:100px;padding:0 5px;" id="searchtime">
  127. <option value=''>不按时间</option>
  128. <option value='create' <?php if( $searchtime=='create'){ ?>selected<?php } ?>>下单时间</option>
  129. <option value='pay' <?php if( $searchtime=='pay'){ ?>selected<?php } ?>>付款时间</option>
  130. <option value='send' <?php if( $searchtime=='send'){ ?>selected<?php } ?>>发货时间</option>
  131. <option value='finish' <?php if( $searchtime=='finish'){ ?>selected<?php } ?>>完成时间</option>
  132. </select>
  133. </div>
  134. <div class="layui-input-inline" style="width:280px;">
  135. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  136. </div>
  137. <div class="layui-input-inline" style="width:100px;">
  138. <select name='delivery' lay-ignore class='layui-input layui-unselect' style="width:100px;padding:0 5px;" id="type">
  139. <option value=''>配送方式</option>
  140. <option value='pickup' <?php if( $delivery=='pickup'){ ?>selected<?php } ?>>自提</option>
  141. <option value='tuanz_send' <?php if( $delivery=='tuanz_send'){ ?>selected<?php } ?>>团长配送</option>
  142. <option value='express' <?php if( $delivery=='express'){ ?>selected<?php } ?>>快递</option>
  143. </select>
  144. </div>
  145. <div class="layui-input-inline" style="width:110px;">
  146. <select name='searchfield' lay-ignore class='layui-input layui-unselect' style="width:110px;padding:0 5px;" >
  147. <option value='ordersn' <?php if( $searchfield=='ordersn'){ ?>selected<?php } ?>>订单号</option>
  148. <option value='member' <?php if( $searchfield=='member'){ ?>selected<?php } ?>>会员信息</option>
  149. <option value='mobile' <?php if( $searchfield=='mobile'){ ?>selected<?php } ?>>手机号</option>
  150. <option value='address' <?php if( $searchfield=='address'){ ?>selected<?php } ?>>收件人信息</option>
  151. <option value='location' <?php if( $searchfield=='location'){ ?>selected<?php } ?>>地址信息</option>
  152. <option value='shipping_no' <?php if( $searchfield=='shipping_no'){ ?>selected<?php } ?>>快递单号</option>
  153. <option value='goodstitle' <?php if( $searchfield=='goodstitle'){ ?>selected<?php } ?>>商品名称</option>
  154. <option value='trans_id' <?php if( $searchfield=='trans_id'){ ?>selected<?php } ?>>微信支付单号</option>
  155. <?php if($is_community != 1){ ?>
  156. <option value='head_name' <?php if( $searchfield=='head_name'){ ?>selected<?php } ?>>团长姓名</option>
  157. <option value='head_address' <?php if( $searchfield=='head_address'){ ?>selected<?php } ?>>小区名称</option>
  158. <?php } ?>
  159. <?php
  160. if (!defined('ROLE') || ROLE != 'agenter' )
  161. {
  162. ?>
  163. <option value='supply_name' <?php if( $searchfield=='supply_name'){ ?>selected<?php } ?>>供应商名称</option>
  164. <?php } ?>
  165. <!--<option value='goodssn' <?php if( $searchfield=='goodssn'){ ?>selected<?php } ?>>商品编码</option>-->
  166. </select>
  167. </div>
  168. <div class="layui-input-inline" >
  169. <input type="text" class="layui-input" name="keyword" value="{$keyword}" placeholder="请输入关键词"/>
  170. </div>
  171. <input type="hidden" name="export" id="export" value="0">
  172. <div class="layui-input-inline">
  173. <button class="layui-btn layui-btn-sm" data-export="0" type="submit"> 搜索</button>
  174. <button type="submit" name="export" data-export="1" value="1" class="layui-btn layui-btn-sm">导出</button>
  175. </div>
  176. </div>
  177. </div>
  178. </form>
  179. <form action="" class="layui-form" lay-filter="example" method="post" >
  180. <div class="row">
  181. <div class="list-div list-tb-div">
  182. <table cellpadding="0" cellspacing="0" border="0">
  183. <thead>
  184. <tr>
  185. <th width="3%" class="sign"><div class="tDiv">
  186. <label for="all_list" class="checkbox_stars"></label></div></th>
  187. <th width="25%"><div class="tDiv">订单号</div></th>
  188. <th width="9%"><div class="tDiv">单价/数量</div></th>
  189. <th width="12%"><div class="tDiv">买家</div></th>
  190. <th width="8%"><div class="tDiv">支付/配送</div></th>
  191. <th width="14%"><div class="tDiv">小区/团长</div></th>
  192. <th width="10%"><div class="tDiv">价格</div></th>
  193. <th width="8%"><div class="tDiv">处理状态</div></th>
  194. <th width="9%"><div class="tDiv">操作</div></th>
  195. </tr>
  196. </thead>
  197. </table>
  198. <table cellpadding="0" cellspacing="0" border="0">
  199. <colgroup>
  200. <col width="28%">
  201. <col width="9%">
  202. <col width="12%">
  203. <col width="8%">
  204. <col width="14%">
  205. <col width="10%">
  206. <col width="9%">
  207. <col width="8%">
  208. </colgroup>
  209. <tbody>
  210. <?php foreach( $list as $item ){ ?>
  211. <tr class="tr-order-sn">
  212. <td colspan="10">
  213. <div class="tDiv ml10">
  214. <span class="sign">
  215. </span>
  216. <span class="words">订单号: {$item['order_num_alias']}</span>
  217. <span class="words">下单时间:{:date('Y-m-d',$item['date_added'])}&nbsp {:date('H:i:s',$item['date_added'])}</span>
  218. <span class="words">
  219. <?php if(in_array($item['ore_state'], array(3))){ ?>&nbsp;<span class="label label-success">{$order_refund_state[$item['ore_state']]}</span><?php } ?>
  220. <?php if( in_array($item['ore_state'], array(1,4)) ){ ?><label class='label label-danger'>{$order_refund_state[$item['ore_state']]}</label><?php } ?>
  221. <?php if( in_array($item['ore_state'], array(0,5)) ){ ?><label class='label label-default'>{$order_refund_state[$item['ore_state']]}</label><?php } ?>
  222. </span>
  223. </div>
  224. </td>
  225. </tr>
  226. <tr class="">
  227. <td class="td-product">
  228. <?php $i =1;
  229. foreach($item['goods'] as $k => $g){ ?>
  230. <div class="tDiv relative tpinfo <?php if($i == count($item['goods'])){ ?>last<?php } ?> ">
  231. <div class="img"><img width="70" src="{:tomedia($g['goods_images'])}" alt="" /></div>
  232. <div class="product-info">
  233. <div class="name mb5">
  234. {$g['name']}
  235. </div>
  236. <div>
  237. <?php if( !empty($g['option_sku'])){ ?>{$g['option_sku']}<?php } ?>
  238. </div>
  239. <div class="order_icon_items">
  240. </div>
  241. </div>
  242. </div>
  243. <?php $i++; } ?>
  244. </td>
  245. <td class="td-price" style="vertical-align: top;">
  246. <?php $i =1;
  247. foreach($item['goods'] as $k => $g){ ?>
  248. <div class="tDiv tpinfo <?php if($i == count($item['goods'])){ ?>last<?php } ?>" style="display: flex;align-items: center;">¥<?php echo round($g['total']/$g['quantity'],2); ?>
  249. x {$g['quantity']} </div>
  250. <?php $i++; } ?>
  251. </td>
  252. <td>
  253. <div class="tDiv" >
  254. <font style="color: #999;">{$item['shipping_name']}</font><br/><font style="color: #999;">{$item['shipping_tel']}</font>
  255. <br/>
  256. <?php if (defined('ROLE') && ROLE == 'agenter' ){ ?>
  257. <font style="color: #999;">会员名:</font>{$item['nickname']}
  258. <?php if( !empty($item['member_content']) ){ ?>
  259. <br/><font class="text-danger">{$item['member_content']}</font>
  260. <?php } ?>
  261. <?php }else{ ?>
  262. <?php if($s_id == 1){ ?>
  263. <a class="text-primary" href="{:U('user/detail',array('id'=>$item['member_id']))}"><font style="color: #999;">会员名:</font>{$item['nickname']}</a>
  264. <?php }else{ ?>
  265. <a class="text-primary user"><font style="color: #999;">会员名:</font>{$item['nickname']}</a>
  266. <?php } ?>
  267. <?php if( !empty($item['member_content']) ){ ?>
  268. <br/><font class="text-danger">{$item['member_content']}</font>
  269. <?php } ?>
  270. <?php } ?>
  271. <br/>
  272. </div>
  273. </td>
  274. <td>
  275. <div class="tDiv" style="height: 100px;">
  276. <!-- 已支付 -->
  277. <?php if( $item['order_status_id'] != 3 && $item['order_status_id'] != 5){ ?>
  278. <?php if( $item['payment_code']=='yuer'){ ?>
  279. <span> <i class="text-warning" style="font-size: 17px;"></i><span>余额支付</span></span>
  280. <?php }else if( $item['payment_code']=='admin' ){ ?>
  281. <span> <i class=" text-danger" style="font-size: 17px"></i>后台付款</span>
  282. <?php }else{ ?>
  283. <span class="line-text"> 微信支付</span>
  284. <?php } ?>
  285. <?php }elseif( $item['order_status_id'] == 3 || $item['order_status_id'] == 5 ){ ?>
  286. <!-- 未支付 -->
  287. <?php if( $item['paytypevalue']!=3){ ?>
  288. <label class='label label-default'>未支付</label>
  289. <?php }else{ ?>
  290. <span> <i class="text-primary style="font-size: 17px"></i>货到付款</span>
  291. <?php } ?>
  292. <?php } ?>
  293. <br/>
  294. <?php if( $item['delivery']=='pickup'){ ?><font class="text-danger">(自提)</font><?php } ?>
  295. <?php if( $item['delivery']=='express'){ ?><font class="text-danger">(快递)</font><?php } ?>
  296. <?php if( $item['delivery']=='tuanz_send'){ ?><font class="text-danger">(团长配送)</font><?php } ?>
  297. </div>
  298. </td>
  299. <?php if($is_can_look_headinfo){ ?>
  300. <td>
  301. <div class="tDiv" style="text-align: left;">
  302. <div style='margin-top:5px;display:block;float:left;'>
  303. {$item['head_name']}
  304. </div>
  305. <div style='margin-top:5px;display:block;float:left;'>
  306. 电话:{$item['head_mobile']}
  307. </div>
  308. <div style='margin-top:5px;display:block;float:left;cursor: pointer;' >
  309. <font style="color: #999;">小区:</font> <font class="line-text">{$item['community_name']} ({$item['province']} {$item['city']})
  310. </div>
  311. </div>
  312. </td>
  313. <?php }else{ ?>
  314. <td>
  315. <div class="tDiv" style="text-align: left;">
  316. <div style='margin-top:5px;display:block; text-align: center;'>
  317. {$item['head_name']}
  318. </div>
  319. </div>
  320. </td>
  321. <?php } ?>
  322. <td>
  323. <div class="tDiv" style="">
  324. <?php if($item['is_free_shipping_fare'] == 1){ ?>
  325. <span style='margin-top:5px;margin-left:5px;display:block;'>
  326. 运 费:+{:round( $item['fare_shipping_free'],2)}
  327. </span>
  328. <span style='margin-top:5px;margin-left:5px;display:block;'>
  329. 满{$item['man_e_money']}免运费:-{:round( $item['fare_shipping_free'],2)}
  330. </span>
  331. <?php }else{ ?>
  332. <span style='margin-top:5px;margin-left:5px;display:block;'>
  333. 运 费:+{:round( $item['shipping_fare'],2)}
  334. </span>
  335. <?php } ?>
  336. <?php if($item['fullreduction_money'] >0){ ?>
  337. <span style='margin-top:5px;margin-left:5px;display:block;'>
  338. 满 减:-{:round( $item['fullreduction_money'],2)}
  339. </span>
  340. <?php } ?>
  341. <?php if($item['voucher_credit'] >0){ ?>
  342. <span style='margin-top:5px;margin-left:5px;display:block;'>
  343. 优惠券:-{:round( $item['voucher_credit'],2)}
  344. </span>
  345. <?php } ?>
  346. <span style='margin-top:5px;margin-left:5px;display:block;'>
  347. 商品小计:{:round($item['total'],2)}
  348. </span>
  349. <span style='margin-top:5px;margin-left:5px;display:block;'>
  350. <?php $free_tongji = $item['total']+$item['shipping_fare']-$item['voucher_credit']-$item['fullreduction_money'];
  351. if($free_tongji < 0){
  352. $free_tongji = 0;
  353. }
  354. ?>
  355. <?php
  356. if($item['type'] == 'integral'){
  357. ?>
  358. 应收总款:<br/>{:round($item['total'] ,2)}积分<?php if( !empty( $item['shipping_fare'] ) ){ ?>+运费:{:round($item['shipping_fare'] ,2)}<?php } ?>
  359. <?php }else{ ?>
  360. 应收总款:{:round($free_tongji ,2)}
  361. <?php } ?>
  362. </span>
  363. </div>
  364. </td>
  365. <td>
  366. <div class="tDiv" style="">
  367. <span class='text-{$item[order_status_id]}'>
  368. <?php
  369. if($item['ore_state'] == 0){
  370. ?>
  371. 待处理
  372. <?php }else if($item['ore_state'] == 1){ ?>
  373. 已拒绝
  374. <?php }else if($item['ore_state'] == 3){ ?>
  375. 已完成
  376. <?php }else if($item['ore_state'] == 5){ ?>
  377. 已拒绝
  378. <?php }else if($item['ore_state'] == 6){ ?>
  379. 退货中
  380. <?php } ?>
  381. </span>
  382. </div>
  383. </td>
  384. <td>
  385. <div class="tDiv" style="">
  386. <a class='op text-primary' href="{:U('order/oprefund', array('id' => $item['order_id'],'ref_id' => $item['ref_id']))}" >查看详情</a>
  387. <?php if($item['ore_state'] == 0){ ?>
  388. <a class='op' data-toggle="ajaxModal" href="javascript:;" data-href="{:U('order/oprefund_doform', array('ref_id' => $item['ref_id']))}" >
  389. <i class="icow icow-flag-o" style="color: #df5254;display: inline-block;vertical-align: middle" title="平台审核"></i>
  390. 平台审核
  391. &nbsp
  392. </a>
  393. <?php } ?>
  394. <?php if($item['is_forbidden'] == 1){ ?>
  395. <p style="color:red;">禁止此用户再次申请</p>
  396. <?php } ?>
  397. </div>
  398. </td>
  399. </tr>
  400. <tr>
  401. <td colspan="8">
  402. <div style='background:#fdeeee;color:red;padding-left: 10px;'>
  403. 订单状态:{$order_status_arr[$item['order_status_id']]}
  404. </div>
  405. </td>
  406. </tr>
  407. <tr>
  408. <td colspan="8">
  409. <div style="height:20px;">&nbsp;</div>
  410. </td>
  411. </tr>
  412. <?php } ?>
  413. </tbody>
  414. <tfoot>
  415. <tr>
  416. <td colspan="0">
  417. <div class="page-table-header">
  418. </div>
  419. </td>
  420. <td colspan="8" style="text-align: right">
  421. {$pager}
  422. </td>
  423. </tr>
  424. </tfoot>
  425. </table>
  426. </div>
  427. </div>
  428. </form>
  429. </div>
  430. </div>
  431. </div>
  432. <script src="/layuiadmin/layui/layui.js"></script>
  433. <script>
  434. layui.config({
  435. base: '/layuiadmin/' //静态资源所在路径
  436. }).extend({
  437. index: 'lib/index' //主入口模块
  438. }).use('index');
  439. </script>
  440. <script>
  441. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  442. var layer = layui.layer;
  443. var $;
  444. layui.use(['jquery', 'layer','form'], function(){
  445. $ = layui.$;
  446. var form = layui.form;
  447. $('.deldom').click(function(){
  448. var s_url = $(this).attr('data-href');
  449. layer.confirm($(this).attr('data-confirm'), function(index){
  450. $.ajax({
  451. url:s_url,
  452. type:'post',
  453. dataType:'json',
  454. success:function(info){
  455. $('#ajaxModal').removeClass('in');
  456. $('.modal-backdrop').removeClass('in');
  457. if(info.status == 0)
  458. {
  459. layer.msg(info.result.message,{icon: 1,time: 2000});
  460. }else if(info.status == 1){
  461. var go_url = location.href;
  462. if( info.result.hasOwnProperty("url") )
  463. {
  464. go_url = info.result.url;
  465. }
  466. layer.msg('操作成功',{time: 1000,
  467. end:function(){
  468. location.href = info.result.url;
  469. }
  470. });
  471. }
  472. }
  473. })
  474. },function(){
  475. console.log(232323);
  476. $('#ajaxModal').removeClass('in');
  477. $('.modal-backdrop').removeClass('in');
  478. });
  479. })
  480. $('.btn-operation').click(function(){
  481. var ids_arr = [];
  482. var obj = $(this);
  483. var s_toggle = $(this).attr('data-toggle');
  484. var s_url = $(this).attr('data-href');
  485. $("input[name=item_checkbox]").each(function() {
  486. if( $(this).prop('checked') )
  487. {
  488. ids_arr.push( $(this).val() );
  489. }
  490. })
  491. if(ids_arr.length < 1)
  492. {
  493. layer.msg('请选择要操作的内容');
  494. }else{
  495. var can_sub = true;
  496. if( s_toggle == 'batch-remove' )
  497. {
  498. can_sub = false;
  499. layer.confirm($(obj).attr('data-confirm'), function(index){
  500. $.ajax({
  501. url:s_url,
  502. type:'post',
  503. dataType:'json',
  504. data:{ids:ids_arr},
  505. success:function(info){
  506. if(info.status == 0)
  507. {
  508. layer.msg(info.result.message,{icon: 1,time: 2000});
  509. }else if(info.status == 1){
  510. var go_url = location.href;
  511. if( info.result.hasOwnProperty("url") )
  512. {
  513. go_url = info.result.url;
  514. }
  515. layer.msg('操作成功',{time: 1000,
  516. end:function(){
  517. location.href = info.result.url;
  518. }
  519. });
  520. }
  521. }
  522. })
  523. });
  524. }else{
  525. $.ajax({
  526. url:s_url,
  527. type:'post',
  528. dataType:'json',
  529. data:{ids:ids_arr},
  530. success:function(info){
  531. if(info.status == 0)
  532. {
  533. layer.msg(info.result.message,{icon: 1,time: 2000});
  534. }else if(info.status == 1){
  535. var go_url = location.href;
  536. if( info.result.hasOwnProperty("url") )
  537. {
  538. go_url = info.result.url;
  539. }
  540. layer.msg('操作成功',{time: 1000,
  541. end:function(){
  542. location.href = info.result.url;
  543. }
  544. });
  545. }
  546. }
  547. })
  548. }
  549. }
  550. })
  551. form.on('switch(restwsitch)', function(data){
  552. var s_url = $(this).attr('data-href')
  553. var rest = 1;
  554. if(data.elem.checked)
  555. {
  556. rest = 1;
  557. }else{
  558. rest = 0;
  559. }
  560. $.ajax({
  561. url:s_url,
  562. type:'post',
  563. dataType:'json',
  564. data:{rest:rest},
  565. success:function(info){
  566. if(info.status == 0)
  567. {
  568. layer.msg(info.result.message,{icon: 1,time: 2000});
  569. }else if(info.status == 1){
  570. var go_url = location.href;
  571. if( info.result.hasOwnProperty("url") )
  572. {
  573. go_url = info.result.url;
  574. }
  575. layer.msg('操作成功',{time: 1000,
  576. end:function(){
  577. location.href = info.result.url;
  578. }
  579. });
  580. }
  581. }
  582. })
  583. });
  584. form.on('switch(enablewsitch)', function(data){
  585. var s_url = $(this).attr('data-href')
  586. var enable = 1;
  587. if(data.elem.checked)
  588. {
  589. enable = 1;
  590. }else{
  591. enable = 0;
  592. }
  593. $.ajax({
  594. url:s_url,
  595. type:'post',
  596. dataType:'json',
  597. data:{enable:enable},
  598. success:function(info){
  599. if(info.status == 0)
  600. {
  601. layer.msg(info.result.message,{icon: 1,time: 2000});
  602. }else if(info.status == 1){
  603. var go_url = location.href;
  604. if( info.result.hasOwnProperty("url") )
  605. {
  606. go_url = info.result.url;
  607. }
  608. layer.msg('操作成功',{time: 1000,
  609. end:function(){
  610. location.href = info.result.url;
  611. }
  612. });
  613. }
  614. }
  615. })
  616. });
  617. form.on('switch(statewsitch)', function(data){
  618. var s_url = $(this).attr('data-href')
  619. var state = 1;
  620. if(data.elem.checked)
  621. {
  622. state = 1;
  623. }else{
  624. state = 0;
  625. }
  626. $.ajax({
  627. url:s_url,
  628. type:'post',
  629. dataType:'json',
  630. data:{state:state},
  631. success:function(info){
  632. if(info.status == 0)
  633. {
  634. layer.msg(info.result.message,{icon: 1,time: 2000});
  635. }else if(info.status == 1){
  636. var go_url = location.href;
  637. if( info.result.hasOwnProperty("url") )
  638. {
  639. go_url = info.result.url;
  640. }
  641. layer.msg('操作成功',{time: 1000,
  642. end:function(){
  643. location.href = info.result.url;
  644. }
  645. });
  646. }
  647. }
  648. })
  649. });
  650. form.on('checkbox(checkboxall)', function(data){
  651. if(data.elem.checked)
  652. {
  653. $("input[name=item_checkbox]").each(function() {
  654. $(this).prop("checked", true);
  655. });
  656. $("input[name=checkall]").each(function() {
  657. $(this).prop("checked", true);
  658. });
  659. }else{
  660. $("input[name=item_checkbox]").each(function() {
  661. $(this).prop("checked", false);
  662. });
  663. $("input[name=checkall]").each(function() {
  664. $(this).prop("checked", false);
  665. });
  666. }
  667. form.render('checkbox');
  668. });
  669. $('.user').click(function(){
  670. layer.msg('权限不足!',{icon: 2,time: 1200});
  671. })
  672. //监听提交
  673. form.on('submit(formDemo)', function(data){
  674. $.ajax({
  675. url: data.form.action,
  676. type: data.form.method,
  677. data: data.field,
  678. dataType:'json',
  679. success: function (info) {
  680. if(info.status == 0)
  681. {
  682. layer.msg(info.result.message,{icon: 1,time: 2000});
  683. }else if(info.status == 1){
  684. var go_url = location.href;
  685. if( info.result.hasOwnProperty("url") )
  686. {
  687. go_url = info.result.url;
  688. }
  689. layer.msg('操作成功',{time: 1000,
  690. end:function(){
  691. location.href = info.result.url;
  692. }
  693. });
  694. }
  695. }
  696. });
  697. return false;
  698. });
  699. })
  700. </script>
  701. <script>
  702. var ajax_url = "";
  703. $(function(){
  704. $("[data-toggle='ajaxModal']").click(function () {
  705. var s_url = $(this).attr('data-href');
  706. ajax_url = s_url;
  707. console.log(23);
  708. $.ajax({
  709. url:s_url,
  710. type:"get",
  711. success:function(shtml){
  712. $('#ajaxModal').html(shtml);
  713. $("#ajaxModal").modal();
  714. }
  715. })
  716. });
  717. $(document).delegate(".modal-footer .btn-primary","click",function(){
  718. var s_data = $('#ajaxModal form').serialize();
  719. var loadingIndex = layer.load();
  720. $.ajax({
  721. url:ajax_url,
  722. type:'post',
  723. dataType:'json',
  724. data:s_data,
  725. success:function(info){
  726. if(info.status == 0)
  727. {
  728. layer.msg(info.result.message,{icon: 1,time: 2000});
  729. layer.close(loadingIndex);
  730. }else if(info.status == 1){
  731. var go_url = location.href;
  732. if( info.result.hasOwnProperty("url") )
  733. {
  734. go_url = info.result.url;
  735. }
  736. layer.msg('操作成功',{time: 1000,
  737. end:function(){
  738. location.href = info.result.url;
  739. }
  740. });
  741. }
  742. }
  743. })
  744. return false;
  745. })
  746. })
  747. </script>
  748. <div id="ajaxModal" class="modal fade" style="display: none;">
  749. </div>
  750. <script>
  751. //没有选中时间段不能导出
  752. $(function () {
  753. $('.btn-submit').click(function () {
  754. var e = $(this).data('export');
  755. if(e==1 ){
  756. if($('#keyword').val() !='' ){
  757. $('#export').val(1);
  758. $('#search').submit();
  759. }else if($('#searchtime').val()!=''){
  760. $('#export').val(1);
  761. $('#search').submit();
  762. }else{
  763. $('#export').val(1);
  764. $('#search').submit();
  765. return;
  766. }
  767. }else{
  768. $('#export').val(0);
  769. $('#search').submit();
  770. }
  771. })
  772. })
  773. </script>
  774. </body>