returngoods.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. {Template header}
  2. <style>
  3. .btn {
  4. display: inline-block;
  5. padding: 6px 12px;
  6. margin-bottom: 0;
  7. font-size: 14px;
  8. font-weight: 400;
  9. line-height: 1.42857143;
  10. text-align: center;
  11. white-space: nowrap;
  12. vertical-align: middle;
  13. -ms-touch-action: manipulation;
  14. touch-action: manipulation;
  15. cursor: pointer;
  16. -webkit-user-select: none;
  17. -moz-user-select: none;
  18. -ms-user-select: none;
  19. user-select: none;
  20. background-image: none;
  21. border: 1px solid transparent;
  22. border-radius: 4px;
  23. }
  24. .btn-success {
  25. color: #fff !important;
  26. background-color: #5cb85c !important;
  27. border-color: #4cae4c;
  28. }
  29. .btn-info {
  30. color: #fff;
  31. background-color: #5bc0de;
  32. border-color: #46b8da;
  33. }
  34. .btn_warning{
  35. color: #fff;
  36. background-color: #f39c12 !important;
  37. border-color: #e08e0b !important;
  38. }
  39. .btn-xs {
  40. padding: 1px 5px;
  41. font-size: 12px;
  42. line-height: 1.5;
  43. border-radius: 3px;
  44. }
  45. </style>
  46. <body>
  47. <div class="warp">
  48. <div class="fixed">
  49. <form >
  50. <ul class="search">
  51. <li>订单号:<input value="{$orderinfo}" name="orderinfo" type="text" ></li>
  52. <li>编号:<input value="" name="number" type="text" ></li>
  53. <li>退货单:<input value="" name="back_no" type="text" ></li>
  54. <li>
  55. 店铺:
  56. <select name="shop" class="select">
  57. <option value="">选择店铺</option>
  58. {loop $shop_list as $key=>$val}
  59. <option value="{$key}">{$val}</option>
  60. {/loop}
  61. </select>
  62. </li>
  63. <li>
  64. 状态:
  65. <select name="status" class="select">
  66. <option value="">选择状态</option>
  67. {loop $status_list as $key=>$val}
  68. <option value="{$key}">{$val}</option>
  69. {/loop}
  70. </select>
  71. </li>
  72. <li>
  73. 售后类型:
  74. <select name="back_status" class="select">
  75. <option value="">选择售后类型</option>
  76. {loop $back_status_list as $key=>$val}
  77. <option value="{$key}">{$val}</option>
  78. {/loop}
  79. </select>
  80. </li>
  81. <li>登记人:<input value="" name="recorder" type="text" ></li>
  82. <li>
  83. 登记时间:
  84. <input id="ktime" value="{date('Y-m-d',time()-10*24*3600)} 0:00" name="ktime" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})">
  85. 至&nbsp;&nbsp;&nbsp;&nbsp;
  86. <input id="jtime" value="{date('Y-m-d',time()+24*3600)} 0:00" name="jtime" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})">
  87. </li>
  88. <li>
  89. 原因一级分类:
  90. <select name="cate_one" class="select" style="width:150px;" onchange="changeCateOne(this)">
  91. <option value="">请选择</option>
  92. {loop $cate_one_list as $key=>$val}
  93. <option value="{$key}">{$val}</option>
  94. {/loop}
  95. </select>
  96. </li>
  97. <li>
  98. 原因二级分类:
  99. <select name="cate_two" style="width:150px;" class="select cate_two">
  100. <option value="">请选择</option>
  101. </select>
  102. </li>
  103. <li><span>确 定</span></li>
  104. </ul>
  105. </form>
  106. <div class="control">
  107. <!-- <a href="javascript:void(0);" class="window btn btn-success" data-h="/returngoods/add/1100000573" data-t="售后登记 - 添加">添 加</a> -->
  108. <a href="javascript:void(0);" style="font-size: 15px;" class="check">删 除</a>
  109. <a href="javascript:void(0);" style="font-size: 15px;background-color: #f39c12;" onclick="excelexport()">按条件导出</a>
  110. </div>
  111. <table class="datatitle data" border="0" style="border-collapse:collapse;">
  112. <tr>
  113. <td>
  114. <label onClick="swapCheck()"><input name="checkbox" type="checkbox" class="regular-checkbox"></label>
  115. </td>
  116. <td>订单号</td>
  117. <td>店铺</td>
  118. <td>编号</td>
  119. <td>状态</td>
  120. <td>登记原因</td>
  121. <td>备注信息</td>
  122. <td>售后类型</td>
  123. <td>重发订单编号</td>
  124. <td>退款金额</td>
  125. <td>登记人</td>
  126. <td>登记时间</td>
  127. <td>操作</td>
  128. </tr>
  129. </table>
  130. </div>
  131. <table class="datatext data" border="0" style="border-collapse:collapse;">
  132. </table>
  133. <div class="bomf"></div>
  134. </div>
  135. <div class="ts"><p class="tsn"></p></div>
  136. <div class="systemwindow">
  137. <div>
  138. <p></p>
  139. <p><font class="button">确 定</font><font class="esc">取 消</font></p>
  140. </div>
  141. </div>
  142. <script>
  143. var dataurl = "/returngoods";
  144. // var editurl = "/returngoods/edit/";
  145. // var editdj = 3;
  146. // var editt = "售后登记 - 修改";
  147. var customon = 1;
  148. function custom(){
  149. $(".data tr").each(function() {
  150. $(this).find('td:eq(0)').css("width","1%");
  151. $(this).find('td:eq(1)').css("width","7%");
  152. $(this).find('td:eq(2)').css("width","7%");
  153. $(this).find('td:eq(3)').css("width","6%");
  154. $(this).find('td:eq(4)').css("width","4%");
  155. $(this).find('td:eq(5)').css("width","10%");
  156. $(this).find('td:eq(6)').css("width","22%");
  157. $(this).find('td:eq(7)').css("width","4%");
  158. $(this).find('td:eq(8)').css("width","7%");
  159. $(this).find('td:eq(9)').css("width","5%");
  160. $(this).find('td:eq(10)').css("width","5%");
  161. $(this).find('td:eq(11)').css("width","5%");
  162. // $(this).find('td:eq(11)').css("width","5%");
  163. });}
  164. function changeCateOne(that){
  165. let json_str = '{$cate_two_list}';
  166. let cate_two_list = JSON.parse(json_str);
  167. let cate_one_val = $(that).val();
  168. let str = '';
  169. str += '<option value="">请选择</option>';
  170. if(cate_one_val){
  171. if(cate_two_list[cate_one_val]){
  172. for(let key in cate_two_list[cate_one_val]){
  173. str += '<option value="'+key+'">'+cate_two_list[cate_one_val][key]+'</option>';
  174. }
  175. }else{
  176. console.log("数据不存在")
  177. }
  178. }
  179. $(".cate_two").html(str);
  180. }
  181. function cancel(that){
  182. layx.load('loadId','取消中',{shadable:0.6});
  183. let id = $(that).data("id");
  184. let type = $(that).data("type");
  185. $.ajax({
  186. url:"/returngoods/cancel",
  187. data:"review="+type+"&id="+id,
  188. type:"post",
  189. dataType:"json",
  190. success:function(a){
  191. layx.destroy('loadId');
  192. if (a && a.success) {
  193. $(".ts p").html(a.msg);
  194. $(".ts").fadeIn();
  195. setTimeout('searchspan(2)', 900);
  196. }
  197. if (a && !a.success) {
  198. $(".ts p").html(a.msg);
  199. $(".ts").fadeIn();
  200. }
  201. }
  202. })
  203. }
  204. function huifu(that){
  205. layx.load('loadId','恢复中',{shadable:0.6});
  206. let id = $(that).data("id");
  207. let type = $(that).data("type");
  208. $.ajax({
  209. url:"/returngoods/huifu",
  210. data:"review="+type+"&id="+id,
  211. type:"post",
  212. dataType:"json",
  213. success:function(a){
  214. layx.destroy('loadId');
  215. if (a && a.success) {
  216. $(".ts p").html(a.msg);
  217. $(".ts").fadeIn();
  218. setTimeout('searchspan(2)', 900);
  219. }
  220. if (a && !a.success) {
  221. $(".ts p").html(a.msg);
  222. $(".ts").fadeIn();
  223. }
  224. }
  225. })
  226. }
  227. //快递发送
  228. function expressSend(that){
  229. layx.load('loadId','恢复中',{shadable:0.6});
  230. let id = $(that).data("id");
  231. let type = $(that).data("type");
  232. $.ajax({
  233. url:"/returngoods/do_first_phase/"+id+"/7",
  234. data:{},
  235. type:"post",
  236. dataType:"json",
  237. success:function(a){
  238. layx.destroy('loadId');
  239. if (a && a.success) {
  240. $(".ts p").html(a.msg);
  241. $(".ts").fadeIn();
  242. setTimeout('searchspan(2)', 900);
  243. }
  244. if (a && !a.success) {
  245. $(".ts p").html(a.msg);
  246. $(".ts").fadeIn();
  247. }
  248. }
  249. })
  250. }
  251. //登记完结
  252. function finish(that){
  253. layx.load('loadId','请求中',{shadable:0.6});
  254. let id = $(that).data("id");
  255. let type = $(that).data("type");
  256. $.ajax({
  257. url:"/returngoods/do_first_phase/"+id+"/8",
  258. data:{},
  259. type:"post",
  260. dataType:"json",
  261. success:function(a){
  262. layx.destroy('loadId');
  263. if (a && a.success) {
  264. $(".ts p").html(a.msg);
  265. $(".ts").fadeIn();
  266. setTimeout('searchspan(2)', 900);
  267. }
  268. if (a && !a.success) {
  269. $(".ts p").html(a.msg);
  270. $(".ts").fadeIn();
  271. }
  272. }
  273. })
  274. }
  275. function excelexport(){
  276. layx.load('loadId','请求中',{shadable:0.6});
  277. // return console.log($("form").serialize())
  278. let select_list = [];
  279. $("input[name=check]").each(function(){
  280. if($(this).prop('checked')){
  281. select_list.push($(this).val())
  282. }
  283. })
  284. let form_data = $("form").serialize();
  285. if(select_list.length > 0){
  286. form_data = {sid:select_list}
  287. }
  288. $.post("/returngoodsexcel/excel",form_data,function(a){
  289. layx.destroy('loadId');
  290. if (a && a.success) {
  291. if (a.data.length > 0){
  292. $(".ts p").html(a.msg);
  293. $(".ts").fadeIn();
  294. const now = new Date();
  295. const dateString = now.toISOString().split('T')[0];
  296. const [year, month, day] = dateString.split('-');
  297. let filename = "售后登记清单"+year+month+day+".xlsx";
  298. explortExcel(a.data,filename)
  299. }else{
  300. $(".ts p").html("没有数据");
  301. $(".ts").fadeIn();
  302. }
  303. }else{
  304. $(".ts p").html(a.msg);
  305. $(".ts").fadeIn();
  306. }
  307. },'json')
  308. }
  309. function getCellWidth(value) {
  310. // 判断是否为null或undefined
  311. if (value == null) {
  312. return 10;
  313. } else if (/.*[\u4e00-\u9fa5]+.*$/.test(value)) {
  314. // 中文的长度
  315. const chineseLength = value.match(/[\u4e00-\u9fa5]/g).length;
  316. // 其他不是中文的长度
  317. const otherLength = value.length - chineseLength;
  318. return chineseLength * 2.1 + otherLength * 1.1;
  319. } else {
  320. return value.toString().length * 1.1;
  321. /* 另一种方案
  322. value = value.toString()
  323. return value.replace(/[\u0391-\uFFE5]/g, 'aa').length
  324. */
  325. }
  326. }
  327. function explortExcel(data,filename){
  328. let sheet = XLSX.utils.json_to_sheet(data)
  329. sheet['!cols'] = [
  330. //订单号
  331. {
  332. wch:20,
  333. },
  334. //订单编码
  335. {
  336. wch:20,
  337. },
  338. //店铺名称
  339. {
  340. wch:18,
  341. },
  342. //状态
  343. {
  344. wch:15,
  345. },
  346. //登记原因
  347. {
  348. wch:25,
  349. },
  350. //备注信息
  351. {
  352. wch:35,
  353. },
  354. //售后类型
  355. {
  356. wch:15,
  357. },
  358. //重发单号
  359. {
  360. wch:20,
  361. },
  362. //退款金额
  363. {
  364. wch:10,
  365. },
  366. //登记人
  367. {
  368. wch:10,
  369. },
  370. //登记时间
  371. {
  372. wch:21,
  373. },
  374. //仓库品名
  375. {
  376. wch:35,
  377. },
  378. //快递方式
  379. {
  380. wch:14,
  381. },
  382. //运单号
  383. {
  384. wch:23,
  385. },
  386. //出库时间
  387. {
  388. wch:21,
  389. }
  390. ];
  391. let workbook = XLSX.utils.book_new();
  392. XLSX.utils.book_append_sheet(workbook, sheet, "Sheet1");
  393. XLSX.writeFile(workbook, filename);
  394. }
  395. $(".datatext").on('mouseover mouseout',".method",function(event) {
  396. if (event.type === "mouseover") {
  397. $(this).parent().parent("td").append('<font style="position: absolute;right:10px;z-index: 1;border-radius:3px;border: 1px solid #39F;padding:0 10px;background-color: #FFF;box-shadow: rgba(0, 0, 0, 0.3) 1px 1px 24px;">'+$(this).data("t")+'</font>');
  398. }else if(event.type == "mouseout"){
  399. $(this).parent().siblings("font").remove();
  400. }
  401. });
  402. //记录重发单的信息
  403. function recordCf(that){
  404. let rid = $(that).data("id")
  405. layx.html('no-icon', '<span style="font-size:18px;padding-left:10px">重发单编号</span>', layx.multiLine(function() {
  406. /*
  407. <style type="text/css">
  408. p{
  409. padding:10px;
  410. }
  411. .order_no {width:98%;margin:0px;height:90px}
  412. </style>
  413. <p><textarea class='order_no' name="order_no" style="border: 1px solid #000" placeholder="请输入重发的订单编号" ></textarea></p>
  414. */
  415. }), {
  416. minMenu: false,
  417. closeMenu: false,
  418. movable: false,
  419. shadable: true,
  420. width: 300,
  421. height: 50,
  422. statusBar: true,
  423. buttons: [
  424. {
  425. label: '取消',
  426. callback: function(id, button, event) {
  427. layx.destroy(id);
  428. },
  429. style: 'color:#000;font-size:16px;'
  430. },
  431. {
  432. label: '提交',
  433. callback: function(id, button, event) {
  434. let order_no = $(".order_no").val()
  435. layx.destroy(id);
  436. layx.load('loadId','提交中,请稍后',{shadable:0.6});
  437. $.post("/returngoods/recordbyno",{
  438. id:rid,
  439. re_number:order_no
  440. },function(a){
  441. layx.destroy('loadId');
  442. console.log(a)
  443. console.log(a.msg)
  444. console.log(a.success)
  445. if (a && a.success) {
  446. $(".systemwindow div p:eq(0)").html(a.msg);
  447. $(".systemwindow div p:eq(1)").html("<font onclick='doCheck()'>确 定</font>");
  448. $(".systemwindow").show();
  449. }else{
  450. $(".systemwindow div p:eq(0)").text(a.msg);
  451. $(".systemwindow div p:eq(1)").html("<p><font onclick='doCheck()'>确 定</font></p>");
  452. $(".systemwindow").show();
  453. }
  454. },'json')
  455. },
  456. style: 'color:#000;font-size:16px;'
  457. }
  458. ]
  459. });
  460. }
  461. function doCheck(){
  462. $(".systemwindow").hide();
  463. setTimeout('searchspan(2)', 500);
  464. }
  465. </script>
  466. <script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>
  467. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  468. {Template footer}