25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

816 lines
23 KiB

  1. //每页显示的数据个数
  2. var pagesize = 10;
  3. var tttHTML = '';
  4. var order_status = 0;
  5. var goHTML = '';
  6. var backHTML = '';
  7. var gosuccessHTML = '';
  8. var backsuccessHTML = '';
  9. window.onload = function (){
  10. iflogin();
  11. var paceker1 = getDateTime(0);
  12. $('#id-date-picker-2').val(paceker1);
  13. //for (var i = 0 ; i < 6 ; i ++) {
  14. paceker1 = before(paceker1)
  15. //}
  16. $('#id-date-picker-1').val(paceker1);
  17. $('#order_style_parent').children().removeClass('order_style_selected');
  18. var cur = "";
  19. var currpage = getPar("currpage");
  20. var time_style = '';
  21. var start_time = '';
  22. var end_time = '';
  23. var start_area = '';
  24. var end_area = '';
  25. var product_type = '';
  26. //更多查询
  27. var order_id = '';
  28. var condition = '';
  29. // var order_status = '';
  30. if(!currpage){
  31. cur = 1;
  32. time_style = $('#order_time').val();
  33. start_time = $('#id-date-picker-1').val();
  34. end_time = $('#id-date-picker-2').val();
  35. start_area = $('#start_area').val();
  36. end_area = $('#end_area').val();
  37. product_type = $('#order_product').val();
  38. order_id = $('#order_condition').val();
  39. condition = $('#more_search_input').val();
  40. order_status = order_status;
  41. switch (order_status){
  42. case 0:
  43. $('#all').addClass('order_style_selected');
  44. break;
  45. case 146:
  46. $('#out_ticket').addClass('order_style_selected');
  47. break;
  48. case 147:
  49. $('#all').addClass('order_style_selected');
  50. break;
  51. case 148:
  52. $('#cansel').addClass('order_style_selected');
  53. break;
  54. default:
  55. break;
  56. }
  57. // order_status = '';
  58. }else{
  59. cur = currpage;
  60. time_style = getPar('time_style');
  61. $('#order_time').val(time_style);
  62. start_time = getPar('start_time');
  63. $('#id-date-picker-1').val(start_time);
  64. end_time = getPar('end_time');
  65. $('#id-date-picker-2').val(end_time);
  66. start_area = getPar('start_area');
  67. $('#start_area').val(start_area);
  68. end_area = getPar('end_area');
  69. $('#end_area').val(end_area);
  70. product_type = getPar('product_type');
  71. $('#order_product').val(product_type);
  72. order_id = getPar('order_id');
  73. $('#order_condition').val(order_id);
  74. more_search_input = getPar('more_search_input');
  75. $('#more_search_input').val(more_search_input);
  76. order_status = getPar('order_status');
  77. switch (order_status){
  78. case '0':
  79. $('#all').addClass('order_style_selected');
  80. break;
  81. case '146':
  82. $('#out_ticket').addClass('order_style_selected');
  83. break;
  84. case '147':
  85. $('#all').addClass('order_style_selected');
  86. break;
  87. case '148':
  88. $('#cansel').addClass('order_style_selected');
  89. break;
  90. default:
  91. break;
  92. }
  93. }
  94. tttHTML = $('#list').html();
  95. searchBtnDidClicked(cur,time_style,start_time,end_time,start_area,end_area,product_type,order_id,more_search_input,order_status);
  96. goHTML = $('#refund_ticket_go').html();
  97. gosuccessHTML = $('#refund_ticket_go_success').html();
  98. backHTML = $('#refund_ticket_back').html();
  99. backsuccessHTML = $('#refund_ticket_back_success').html();
  100. }
  101. //查询按钮
  102. function searchBtnDidClicked(cur,time_style,start_time,end_time,start_area,end_area,product_type,order_id,more_search_input,order_status1){
  103. if(!cur){
  104. cur = 1;
  105. }
  106. if(!time_style||!start_time||!end_time||!start_area||!end_area||!product_type||!order_id||!more_search_input){
  107. time_style = $('#order_time').val();
  108. start_time = $('#id-date-picker-1').val();
  109. end_time = $('#id-date-picker-2').val();
  110. start_area = $('#start_area').val();
  111. end_area = $('#end_area').val();
  112. product_type = $('#order_product').val();
  113. order_id = $('#order_condition').val();
  114. more_search_input = $('#more_search_input').val();
  115. order_status = order_status;
  116. }
  117. $.ajax({
  118. url:'./zz-fx/control.php', //请求地址
  119. type: "post", //请求方式
  120. data:{
  121. type:"distribut_OrderList",
  122. time_style:time_style,
  123. start_time:start_time,
  124. end_time:end_time,
  125. start_area:start_area,
  126. end_area:end_area,
  127. product_type:product_type,
  128. order_id:order_id,
  129. condition:more_search_input,
  130. order_status:order_status,
  131. currpage:cur,
  132. pagesize:pagesize
  133. },
  134. async:false,
  135. dataType: "json",
  136. success: function (data) {
  137. if(data.code == 0){
  138. console.log(data.info);
  139. var sum = data.list_count;
  140. if (sum==0) {
  141. window.wxc.xcConfirm("没有相关订单信息!", window.wxc.xcConfirm.typeEnum.info);
  142. }
  143. var tag = "test";
  144. var sendurl = './order_list.html?time_style='+time_style+'&start_time='+start_time+'&end_time='+end_time+'&start_area='+start_area+'&end_area='+end_area+'&product_type='+product_type+'&order_id='+order_id+'&more_search_input='+more_search_input+'&order_status='+order_status;
  145. getPager(sendurl, sum, cur, pagesize,tag,'currpage');
  146. reloadInfo(data);
  147. }
  148. },
  149. fail: function (date) {
  150. window.wxc.xcConfirm("数据加载失败!", window.wxc.xcConfirm.typeEnum.info);
  151. }
  152. });
  153. if(cur!=1){
  154. time_style = getPar('time_style');
  155. $('#order_time').val(time_style);
  156. start_time = getPar('start_time');
  157. $('#id-date-picker-1').val(start_time);
  158. end_time = getPar('end_time');
  159. $('#id-date-picker-2').val(end_time);
  160. start_area = getPar('start_area');
  161. $('#start_area').val(start_area);
  162. end_area = getPar('end_area');
  163. $('#end_area').val(end_area);
  164. product_type = getPar('product_type');
  165. $('#order_product').val(product_type);
  166. order_id = getPar('order_id');
  167. $('#order_condition').val(order_id);
  168. more_search_input = getPar('more_search_input');
  169. $('#more_search_input').val(more_search_input);
  170. order_status = order_status1;
  171. }
  172. }
  173. //订单状态的筛选
  174. function orderStyleDidClicked(selectID){
  175. $('#order_style_parent').children().removeClass('order_style_selected');
  176. $('#'+selectID).addClass('order_style_selected');
  177. switch (selectID){
  178. case "all":
  179. order_status = 0;
  180. searchBtnDidClicked();
  181. break;
  182. case "out_ticket":
  183. order_status = 146;
  184. searchBtnDidClicked();
  185. break;
  186. case "out_go":
  187. order_status = 147;
  188. searchBtnDidClicked();
  189. break;
  190. default:
  191. order_status = 148;
  192. searchBtnDidClicked();
  193. break;
  194. }
  195. }
  196. //加载数据
  197. function reloadInfo(data){
  198. console.log(data);
  199. var list = data.searchInfo;
  200. //console.log(tttHTML)
  201. var newHTML='';
  202. for(var i=0;i<list.length;i++){
  203. var tempHTML=tttHTML;
  204. tempHTML=tempHTML.replace('[订单编号]',list[i].order_id);
  205. tempHTML=tempHTML.replace('[下单时间]',list[i].create_time);
  206. tempHTML=tempHTML.replace('[预订产品]',list[i].product_info);
  207. tempHTML=tempHTML.replace('[出发时间]',list[i].run_time);
  208. tempHTML=tempHTML.replace('[联系人]',list[i].customer_info);
  209. tempHTML=tempHTML.replace('[订单金额]',list[i].order_pay);
  210. tempHTML=tempHTML.replace('[支付方式]',list[i].order_pay_type);
  211. tempHTML=tempHTML.replace('[状态]',list[i].order_status);
  212. tempHTML=tempHTML.replace('[order_pay_style]','order_pay_style'+list[i].order_id);
  213. tempHTML=tempHTML.replace('[use]','use'+list[i].order_id);
  214. tempHTML=tempHTML.replace('[order_id]',list[i].order_id);
  215. tempHTML=tempHTML.replace('[ifdisney]',list[i].ifdisney);
  216. var nowDay = getDateTime(0);
  217. var nowHour = getDateTime(2);
  218. var newTimeStr = nowDay+" "+nowHour
  219. var ifTime = judgFailTime(list[i].run_time);
  220. //现在时间转换
  221. var time = new Date(newTimeStr.replace(/-/g, "/"));
  222. // var time = new Date(newTimeStr.replace("-","/"));
  223. time.setMinutes(time.getMinutes() - 0, time.getSeconds(), 0);
  224. // var subTime = ifTime.toString();
  225. // subTime = subTime.substring(16,21);
  226. //
  227. // var order_day = list[i].run_time.substring(0,10);
  228. // var now_day = getDateTime(0);
  229. // var now_hour = getDateTime(2);
  230. // now_hour = now_hour.substring(0,5);
  231. // var end_date1 = new Date(subTime);
  232. // var end_date2 = new Date(now_hour);
  233. if (list[i].go_pay == 0) {
  234. tempHTML=tempHTML.replace('[操作]','-');
  235. }else if(list[i].go_pay == 1){
  236. var str = '<span order_id="'+list[i].order_id+'" ifdisney="'+list[i].ifdisney+'" class="goto_pay" style="cursor:pointer;color:rgb(66,142,210)">去支付</span>';
  237. tempHTML=tempHTML.replace('[操作]',str);
  238. }else if(list[i].go_pay == 2){
  239. var str = '<span onclick="refundTicket('+list[i].order_id+')" style="cursor:pointer;color:rgb(66,142,210)">退票<input id="ifbackstyle'+list[i].order_id+'" type="hidden" value="'+list[i].ifback+'"></span>';
  240. tempHTML=tempHTML.replace('[操作]',str);
  241. }
  242. // time = format(time,'yyyy年MM月dd日 HH时mm分');
  243. // ifTime = format(ifTime,'yyyy年MM月dd日 HH时mm分');
  244. // alert(time);
  245. // alert(ifTime);
  246. //
  247. // if (time>ifTime) {
  248. // var str = '<span style="color:gray">退票</span>';
  249. // tempHTML=tempHTML.replace('[操作]',str);
  250. // } else{
  251. // var str = '<span onclick="refundTicket('+list[i].order_id+')" style="cursor:pointer;color:rgb(66,142,210)">退票<input id="ifbackstyle'+list[i].order_id+'" type="hidden" value="'+list[i].ifback+'"></span>';
  252. // tempHTML=tempHTML.replace('[操作]',str);
  253. // }
  254. newHTML+=tempHTML;
  255. }
  256. $('#list').html(newHTML);
  257. $(".goto_pay").click(function(){
  258. var order_id = $(this).attr("order_id");
  259. var ifdisney = $(this).attr("ifdisney");
  260. var submite_success = {
  261. order_id : order_id,
  262. ifdisney : ifdisney
  263. }
  264. if(ifdisney==0){
  265. alert(1)
  266. setStorJson('submite_success',submite_success);
  267. window.open("pay_code_bus.html")
  268. }else{
  269. alert(submite_success)
  270. console.log(submite_success)
  271. setStorJson('disney_success',submite_success);
  272. window.open("pay_code.html")
  273. }
  274. })
  275. }
  276. var format = function(time, format){
  277. var t = new Date(time);
  278. var tf = function(i){return (i < 10 ? '0' : '') + i};
  279. return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
  280. switch(a){
  281. case 'yyyy':
  282. return tf(t.getFullYear());
  283. break;
  284. case 'MM':
  285. return tf(t.getMonth() + 1);
  286. break;
  287. case 'mm':
  288. return tf(t.getMinutes());
  289. break;
  290. case 'dd':
  291. return tf(t.getDate());
  292. break;
  293. case 'HH':
  294. return tf(t.getHours());
  295. break;
  296. case 'ss':
  297. return tf(t.getSeconds());
  298. break;
  299. }
  300. })
  301. }
  302. //时间加减
  303. function judgFailTime(agoTime) {
  304. var x = agoTime; // 取得的TextBox中的时间
  305. var time = new Date(x.replace(/-/g, "/"));
  306. var b = 30; //分钟数
  307. time.setMinutes(time.getMinutes() - b, time.getSeconds(), 0);
  308. return(time);
  309. }
  310. //点击退票
  311. function refundTicket(orderId){
  312. var ifback = $('#ifbackstyle'+orderId).val();
  313. $.ajax({
  314. url:'./zz-fx/control.php', //请求地址
  315. type: "post", //请求方式
  316. data:{
  317. type:"distribut_DropOrder",
  318. order_id:orderId,
  319. iffirst:1
  320. },
  321. async:false,
  322. dataType: "json",
  323. success: function (data) {
  324. if(data.code == 0){
  325. console.log(data);
  326. //展示退单信息
  327. showRefundOrder(data.ifback,data,orderId);
  328. }else{
  329. window.wxc.xcConfirm(data.massge, window.wxc.xcConfirm.typeEnum.info);
  330. }
  331. },
  332. fail: function (date) {
  333. window.wxc.xcConfirm("数据加载失败!", window.wxc.xcConfirm.typeEnum.info);
  334. }
  335. });
  336. }
  337. //展示退单信息
  338. function showRefundOrder(ifback,data,orderId){
  339. if (ifback == 0) {
  340. //去程退票
  341. center_show($('.refund_ticket_go'));
  342. refundOrderGo(data,orderId,ifback);
  343. } else{
  344. //往返退票
  345. center_show($('.refund_ticket_back'));
  346. refundOrderBack(data,orderId,ifback);
  347. }
  348. }
  349. //填充去程退单数据
  350. function refundOrderGo(data,orderId,ifback){
  351. var tempHTML = goHTML;
  352. var list = data.list;
  353. tempHTML=tempHTML.replace('[去程出发地]',list.start_station);
  354. tempHTML=tempHTML.replace('去程出发地站点',list.start_res_name);
  355. tempHTML=tempHTML.replace('[去程目的地]',list.end_station);
  356. tempHTML=tempHTML.replace('去程目的地站点',list.end_res_name);
  357. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',list.run_time);
  358. tempHTML=tempHTML.replace('[座位等级]x[数量]',list.count);
  359. tempHTML=tempHTML.replace('[订单总额]',list.order_price);
  360. tempHTML=tempHTML.replace('[true]',orderId);
  361. tempHTML=tempHTML.replace('[0]',ifback);
  362. $('#refund_ticket_go').html(tempHTML);
  363. }
  364. //填充往返退单数据
  365. function refundOrderBack(data,orderId,ifback){
  366. var tempHTML = backHTML;
  367. var listgo = data.list.to;
  368. var listback = data.list.back;
  369. //去程
  370. tempHTML=tempHTML.replace('[去程出发地]',listgo.start_station);
  371. tempHTML=tempHTML.replace('去程出发地站点',listgo.start_res_name);
  372. tempHTML=tempHTML.replace('[去程目的地]',listgo.end_station);
  373. tempHTML=tempHTML.replace('去程目的地站点',listgo.end_res_name);
  374. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listgo.run_time);
  375. tempHTML=tempHTML.replace('[座位等级]x[数量]',listgo.count);
  376. //返程
  377. tempHTML=tempHTML.replace('[返程出发地]',listback.start_station);
  378. tempHTML=tempHTML.replace('返程出发地站点',listback.start_res_name);
  379. tempHTML=tempHTML.replace('[返程目的地]',listback.end_station);
  380. tempHTML=tempHTML.replace('返程目的地站点',listback.end_res_name);
  381. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listback.run_time);
  382. tempHTML=tempHTML.replace('[座位等级]x[数量]',listback.count);
  383. tempHTML=tempHTML.replace('[订单总额]',parseInt(listgo.order_price)+parseInt(listback.order_price)+'元');
  384. tempHTML=tempHTML.replace('[true]',orderId);
  385. tempHTML=tempHTML.replace('[0]',ifback);
  386. $('#refund_ticket_back').html(tempHTML);
  387. }
  388. //展示成功退单信息
  389. function showRefundOrderSuccess(back,data){
  390. if (back == 0) {
  391. //去程成功退票填充
  392. center_show($('.refund_ticket_go_success'));
  393. refundOrderGoSuccess(data);
  394. } else{
  395. //往返成功退票填充
  396. center_show($('.refund_ticket_back_success'));
  397. refundOrderBackSuccess(data);
  398. }
  399. }
  400. //去程成功退票填充
  401. function refundOrderGoSuccess(data){
  402. var tempHTML = gosuccessHTML;
  403. var list = data.list;
  404. tempHTML=tempHTML.replace('[去程出发地]',list.start_station);
  405. tempHTML=tempHTML.replace('去程出发地站点',list.start_res_name);
  406. tempHTML=tempHTML.replace('[去程目的地]',list.end_station);
  407. tempHTML=tempHTML.replace('去程目的地站点',list.end_res_name);
  408. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',list.run_time);
  409. tempHTML=tempHTML.replace('[座位等级]x[数量]',list.count);
  410. tempHTML=tempHTML.replace('[订单总额]',list.order_price);
  411. $('#refund_ticket_go_success').html(tempHTML);
  412. // location.replace(location.href);
  413. $('#order_pay_style'+data.order_id).html('已取消');
  414. $('#use'+data.order_id).html('-');
  415. if (data.back_order_id!=null) {
  416. $('#order_pay_style'+data.back_order_id).html('已取消');
  417. $('#use'+data.back_order_id).html('-');
  418. }
  419. }
  420. //往返成功退票填充
  421. function refundOrderBackSuccess(data){
  422. var tempHTML = backsuccessHTML;
  423. var listgo = data.list.to;
  424. var listback = data.list.back;
  425. //去程
  426. tempHTML=tempHTML.replace('[去程出发地]',listgo.start_station);
  427. tempHTML=tempHTML.replace('去程出发地站点',listgo.start_res_name);
  428. tempHTML=tempHTML.replace('[去程目的地]',listgo.end_station);
  429. tempHTML=tempHTML.replace('去程目的地站点',listgo.end_res_name);
  430. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listgo.run_time);
  431. tempHTML=tempHTML.replace('[座位等级]x[数量]',listgo.count);
  432. //返程
  433. tempHTML=tempHTML.replace('[返程出发地]',listback.start_station);
  434. tempHTML=tempHTML.replace('返程出发地站点',listback.start_res_name);
  435. tempHTML=tempHTML.replace('[返程目的地]',listback.end_station);
  436. tempHTML=tempHTML.replace('返程目的地站点',listback.end_res_name);
  437. tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listback.run_time);
  438. tempHTML=tempHTML.replace('[座位等级]x[数量]',listback.count);
  439. tempHTML=tempHTML.replace('[订单总额]',parseInt(listgo.order_price)+parseInt(listback.order_price)+'元');
  440. $('#refund_ticket_back_success').html(tempHTML);
  441. // location.replace(location.href);
  442. $('#order_pay_style'+data.order_id).html('已取消');
  443. $('#use'+data.order_id).html('-');
  444. if (data.back_order_id!=null) {
  445. $('#order_pay_style'+data.back_order_id).html('已取消');
  446. $('#use'+data.back_order_id).html('-');
  447. }
  448. }
  449. //居中显示
  450. var tempDiv = null;
  451. function center_show(show_div) {
  452. tempDiv = show_div;
  453. //显示蒙板
  454. show_div.css('display', 'block');
  455. show_div.css('z-index', 10);
  456. show_div.css('background-color', 'white');
  457. show_div.css('position', 'fixed');
  458. var w = show_div.css('width');
  459. var h = show_div.css('height');
  460. w = w.substr(0, w.length - 2);
  461. h = h.substr(0, h.length - 2);
  462. var s_left = (window.innerWidth - w) / 2 + 'px';
  463. var s_top = (window.innerHeight - h) / 2 + 'px';
  464. show_div.css('left', s_left);
  465. show_div.css('top', s_top);
  466. $('.mask').css('display', 'block');
  467. }
  468. //点击蒙板
  469. function hide_all() {
  470. $('.mask').css('display', 'none');
  471. tempDiv.css('display', 'none');
  472. }
  473. //点击已经有的按钮
  474. function click_show_div(objName, self_obj) {
  475. var obj = $(objName);
  476. if (obj.css('display') == 'none') {
  477. center_show(obj);
  478. } else {
  479. obj.css('display', 'none');
  480. }
  481. }
  482. //点击了第二级
  483. function click_two_show_div(father_name, self_name,self_id) {
  484. var back = $('#'+self_id).attr('back');
  485. var father = $(father_name);
  486. var self = $(self_name);
  487. father.css('display', 'none');
  488. //if代表是去程退单的确认
  489. // if (father_name=='.refund_ticket_go') {
  490. // var father = $(father_name);
  491. // var self = $(self_name);
  492. // father.css('display', 'none');
  493. //
  494. // } else{
  495. //
  496. // }
  497. $.ajax({
  498. url:'./zz-fx/control.php', //请求地址
  499. type: "post", //请求方式
  500. data:{
  501. type:"distribut_DropOrder",
  502. order_id:self_id,
  503. ifback:back,
  504. iffirst:0
  505. },
  506. async:false,
  507. dataType: "json",
  508. success: function (data) {
  509. if(data.code == 0){
  510. console.log(data);
  511. //展示成功退单信息
  512. showRefundOrderSuccess(data.ifback,data);
  513. }else{
  514. window.wxc.xcConfirm(data.massge, window.wxc.xcConfirm.typeEnum.info);
  515. }
  516. },
  517. fail: function (date) {
  518. window.wxc.xcConfirm("退单失败!", window.wxc.xcConfirm.typeEnum.info);
  519. }
  520. });
  521. }
  522. //点击了弹层关闭
  523. function click_cancel(father_name, self_name) {
  524. if (father_name) {
  525. var father = $(father_name);
  526. center_show(father);
  527. } else {
  528. $('.mask').css('display', 'none');
  529. }
  530. $(self_name).css('display', 'none');
  531. }
  532. //获取参数
  533. function getPar(par) {
  534. //获取当前URL
  535. var local_url = document.location.href;
  536. local_url = decodeURI(local_url);
  537. //获取要取得的get参数位置
  538. var get = local_url.indexOf(par + "=");
  539. if (get == -1) {
  540. return false;
  541. }
  542. //截取字符串
  543. var get_par = local_url.slice(par.length + get + 1);
  544. //判断截取后的字符串是否还有其他get参数
  545. var nextPar = get_par.indexOf("&");
  546. if (nextPar != -1) {
  547. get_par = get_par.slice(0, nextPar);
  548. }
  549. return get_par;
  550. }
  551. //获取时间
  552. function getDateTime(nTypeFlag) {
  553. var tNowTime = new Date();
  554. var myYear = ';' + tNowTime.getFullYear() + ';';
  555. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  556. var myDay = ';' + tNowTime.getDate() + ';';
  557. var myHour = ';' + tNowTime.getHours() + ';';
  558. var myMinu = ';' + tNowTime.getMinutes() + ';';
  559. var mySecond = ';' + tNowTime.getSeconds() + ';';
  560. if(myMonth.length < 4) myMonth = '0' + myMonth;
  561. if(myDay.length < 4) myDay = '0' + myDay;
  562. if(myHour.length < 4) myHour = '0' + myHour;
  563. if(myMinu.length < 4) myMinu = '0' + myMinu;
  564. if(mySecond.length < 4) mySecond = '0' + mySecond;
  565. var cNewTimeStr;
  566. switch(nTypeFlag + 1 - 1) {
  567. case 0:
  568. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  569. break;
  570. case 1:
  571. cNewTimeStr = myYear + myMonth + myDay;
  572. break;
  573. case 2:
  574. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  575. break;
  576. case 3:
  577. cNewTimeStr = myHour + myMinu + mySecond;
  578. break;
  579. case 4:
  580. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  581. break;
  582. case 5:
  583. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  584. break;
  585. case 6:
  586. cNewTimeStr = myYear;
  587. break;
  588. case 7:
  589. cNewTimeStr = myYear + '-' + myMonth;
  590. break;
  591. case 8: //得到上一个月的今天
  592. var date = getDateTime(0);
  593. var arr = date.split('-');
  594. var year = arr[0]; //获取当前日期的年份
  595. var month = arr[1]; //获取当前日期的月份
  596. var day = arr[2]; //获取当前日期的日
  597. var days = new Date(year, month, 0);
  598. days = days.getDate(); //获取当前日期中月的天数
  599. var year2 = year;
  600. var month2 = parseInt(month) - 1;
  601. if(month2 == 0) {
  602. year2 = parseInt(year2) - 1;
  603. month2 = 12;
  604. }
  605. var day2 = day;
  606. var days2 = new Date(year2, month2, 0);
  607. days2 = days2.getDate();
  608. if(day2 > days2) {
  609. day2 = days2;
  610. }
  611. if(month2 < 10) {
  612. month2 = '0' + month2;
  613. }
  614. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  615. break;
  616. case 9: //得到下一个月的今天
  617. var date = getDateTime(0);
  618. var arr = date.split('-');
  619. var year = arr[0]; //获取当前日期的年份
  620. var month = arr[1]; //获取当前日期的月份
  621. var day = arr[2]; //获取当前日期的日
  622. var days = new Date(year, month, 0);
  623. days = days.getDate(); //获取当前日期中的月的天数
  624. var year2 = year;
  625. var month2 = parseInt(month) + 1;
  626. if(month2 == 13) {
  627. year2 = parseInt(year2) + 1;
  628. month2 = 1;
  629. }
  630. var day2 = day;
  631. var days2 = new Date(year2, month2, 0);
  632. days2 = days2.getDate();
  633. if(day2 > days2) {
  634. day2 = days2;
  635. }
  636. if(month2 < 10) {
  637. month2 = '0' + month2;
  638. }
  639. var t2 = year2 + '-' + month2 + '-' + day2;
  640. return t2;
  641. break;
  642. default:
  643. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  644. break;
  645. }
  646. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  647. return cNewTimeStr;
  648. }
  649. //
  650. function before(str) {
  651. var dateStr = str;
  652. if (dateStr) {
  653. var now = ConvertDateFromString(dateStr);
  654. now.setDate(now.getDate() -1);
  655. var year = ";" + now.getFullYear() + ";";
  656. var month = ";" + now.getMonth() + ";";
  657. var day = ";" + now.getDate() + ";";
  658. if (year.length < 4) {
  659. year = "0" + year;
  660. }
  661. if (month.length < 4) {
  662. month = "0" + month;
  663. }
  664. if (day.length < 4) {
  665. day = "0" + day;
  666. }
  667. if(month == '0;0;'){
  668. month = '1;2;';
  669. year = parseInt(year.slice(1,5))-1;
  670. year = ';'+year+';';
  671. }
  672. var datestr = year + "-" + month + "-" + day;
  673. datestr = datestr.replace(/;/g, "");
  674. }
  675. return datestr;
  676. }
  677. function after(str) {
  678. var dateStr = str;
  679. if (dateStr) {
  680. var now = ConvertDateFromString(dateStr);
  681. now.setDate(now.getDate() - 0 + 1);
  682. var year = ";" + now.getFullYear() + ";";
  683. var month = ";" + now.getMonth() + ";";
  684. var day = ";" + now.getDate() + ";";
  685. if (year.length < 4) {
  686. year = "0" + year;
  687. }
  688. if (month.length < 4) {
  689. month = "0" + month;
  690. }
  691. if (day.length < 4) {
  692. day = "0" + day;
  693. }
  694. var datestr = year + "-" + month + "-" + day;
  695. datestr = datestr.replace(/;/g, "");
  696. }
  697. return datestr;
  698. }
  699. function ConvertDateFromString(dateString) {
  700. if (dateString) {
  701. var sdate = dateString.split('-');
  702. var date = new Date(parseInt(sdate[0]),parseInt(sdate[1]),parseInt(sdate[2]));
  703. return date;
  704. }
  705. }
  706. //进入详情页面
  707. function goToDetail(order_id){
  708. window.location.href = './order_details.html?order='+order_id;
  709. }