returngoods.html 15 KB

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