returngoods.html 16 KB

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