|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775 |
- /**
- * Created by Administrator on 2016/10/11.
- */
- var httpData;
-
- var pagesize = 10;
- var click_type_id = "0";
- var order_from_id = '-1';
-
- if(window.ActiveXObject) {
- var myreq = new ActiveXObject("Microsoft.XMLHTTP");
- } else {
- var myreq = new XMLHttpRequest();
- }
- var sourceText = '';
- var tableText = '';
- var ticketText = '';
- window.onload = function() {
-
- sourceText = document.getElementById("ordersource").innerHTML;
- tableText = document.getElementById("tableOrder").innerHTML;
- document.getElementById("tableOrder").innerHTML = "";
- // ticketText = document.getElementById("ticketText").innerHTML;
- ticketText = "<div>普通成人票 </div>";
-
- var currpage = getPar('currpage');
- if(!currpage) {
- $('#starttime').val(getDateTime(0));
- $('#endtime').val(getDateTime(0));
- getList(145);
- } else {
- var currpage = getPar("currpage");
- var billingstatus = '';
- var mealbounce = '';
- var refund = '';
- var timelimit = getPar('timelimit');
- var starttime = getPar('starttime');
- var endtime = getPar('endtime');
- var ordersource = getPar('ordersource');
- var orderstatus = getPar('orderstatus');
- var paystatus = getPar('paystatus');
- var moresearch = getPar('moresearch');
- //2016-07-15 新增参数
- var start_area = getPar('start_area');
- var end_area = getPar('end_area');
- var line = getPar('line');
-
- var tnowtime = getDateTime(4);
- if(!timelimit) {
- timelimit = "";
- } else {
- $('#timelimit').val(timelimit);
- }
- if(!starttime) {
- starttime = "";
- } else {
- $('#starttime').val(starttime);
- }
- if(!endtime) {
- endtime = "";
- } else {
- $('#endtime').val(endtime);
- }
- if(!ordersource) {
- ordersource = "";
- } {
- $('#ordersource').val(ordersource);
- }
- if(!paystatus) {
- paystatus = "";
- } else {
- $('#paystatus').val(paystatus);
- }
- if(!moresearch) {
- moresearch = "";
- } else {
- $('#moresearch').val(moresearch);
- }
- if(!start_area) {
- start_area = "";
- } else {
- $('#start_area').val(start_area);
- }
- if(!end_area) {
- end_area = "";
- } else {
- $('#end_area').val(end_area);
- }
- if(!line) {
- line = "";
- } else {
- $('#line').val(line);
- }
- var myURL =
- "./st-xm/Api/order_list_jiuhs.php?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + orderstatus +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line +
- "&currpage=" + currpage +
- "&pagesize=" + pagesize;
- var myURL2 = "./order_list_jiuhs.html?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + orderstatus +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line
- // +"&currpage="+currpage
- +
- "&pagesize=" + pagesize;
- method(myURL, myURL2);
- }
- }
-
- function getList(index) {
- // $("#minus").children().children().removeClass("addbackground");
- $("#add" + index).addClass("addbackground");
- click_type_id = index;
- var timelimit = $('#timelimit').val(); //时间类型
- var starttime = $('#starttime').val(); //开始时间
- var endtime = $('#endtime').val(); //结束时间
- //var ordersource=$('#ordersource').val();//订单渠道
- var ordersource = order_from_id; //订单渠道
- order_from_id = ordersource;
- var paystatus = $('#paystatus').val(); //支付状态
-
- /*以下三个条件暂时隐藏,''代替传入参数
- var billingstatus=document.getElementById("billingstatus").value;
- var mealbounce=document.getElementById("mealbounce").value;
- var refund=document.getElementById("refund").value;
- */
- var billingstatus = '';
- var mealbounce = '';
- var refund = '';
- var moresearch = document.getElementById("moresearch").value;
-
- //2016-07-15新增参数
- var start_area = $('#start_area').val();
- var end_area = $('#end_area').val();
- var line = $('#line').val();
-
- var tnowtime = getDateTime(4);
- var myURL =
- "./st-xm/Api/order_list_jiuhs.php?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + index +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line +
- "&currpage=1" +
- "&pagesize=" + pagesize;
- var myURL2 = "./order_list_jiuhs.html?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + index +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line
- // +"&currpage="+currpage
- +
- "&pagesize=" + pagesize;
- method(myURL, myURL2);
- $('#ordersource').val(order_from_id);
- }
-
- function cancel(orderNumber) {
- var cancel = window.prompt("请输入取消原因","");
- if(cancel){ //点击的是确定
- cancel_temp();
- }else if(cancel === ""){ //没有输入内窝 点击了取消
- cancel_temp();
- }else{ //点击了取消
-
- }
- function cancel_temp(){
- var url = "./st-xm/Api/order_list_jiuhs.php?method=cancelOrder&reason="+cancel+"&clock="+CurrentTime()+"&order_id=" + orderNumber;
- $.getJSON(url, function(res_data) {
- if(res_data['code'] != "0") {
- alert(res_data['info']);
- return;
- }
- alert('取消成功');
- // getList(0);
- location.replace(location.href); //刷新当前页面
- })
- }
- }
-
- function meal(orderNumber) {
- alert("改签订单:编号为" + orderNumber);
- }
-
- function refund(orderNumber) {
- alert("退票订单:编号为" + orderNumber);
- }
- // 复选框事件
- function select_checked(index) {
- //index=0最上面的全选 index=1表示的是下面所有的
- var cur_check = $('.ace')[0];
- var checkList = $('.ace');
- var checkCount = checkList.length - 1;
- var true_count = 0;
- for(var i = 1; i < checkList.length; i++) {
- if(index == '0') {
- checkList[i].checked = cur_check.checked;
- } else {
- if(checkList[i].checked == false) {
- cur_check.checked = false
- } else {
- true_count = true_count + 1;
- }
- }
- }
- //判断下面是否选中完
- if(checkCount == true_count) {
- cur_check.checked = true;
- }
- }
-
- function method(myURL, myURL2) {
- $.getJSON(myURL, function(res_data) {
-
- $(".filter-item").click(function() {
- order_from_id = $(this).val();
- });
- $('#tableOrder').css('display', '');
- $('#test').html('');
- console.log(myURL);
- console.log(res_data);
- setStorJson("res_data", res_data);
- httpData = res_data;
- var code = httpData.code;
- if(code != "0") {
- alert(httpData.info);
- return;
- }
- //..显示 类型上面的数字
- if(httpData['orderStatus']) {
- var orderStatus = httpData['orderStatus'][0];
- if(click_type_id == "0" || click_type_id == 0) {
- $('#orderAll').html(orderStatus['status_all']);
- }
- if(httpData['orderPaid']='0'){
- $("#orderPaid").text("0");
- }
- if(httpData['orderIssued']='0'){
- $("#orderIssued").text("0");
- }
- if(httpData['orderCompleted']='0'){
- $("#orderCompleted").text("0");
- }
- if(httpData['orderCanceled']='0'){
- $("#orderCanceled").text("0");
- }
- $('#orderPaid').html(orderStatus['145']);
- $('#orderIssued').html(orderStatus['146']);
- $('#orderCompleted').html(orderStatus['147']);
- $('#orderCanceled').html(orderStatus['148']);
-
- }else{
- $("#orderAll").text("0");
- $("#orderPaid").text("0");
- $("#orderIssued").text("0");
- $("#orderCompleted").text("0");
- $("#orderCanceled").text("0");
- }
- var orderAll = document.getElementById("orderAll");
- var orderPaid = document.getElementById("orderPaid");
- var orderIssued = document.getElementById("orderIssued");
- var orderCompleted = document.getElementById("orderCompleted");
- var orderCanceled = document.getElementById("orderCanceled");
- var all = '';
- var paid = '';
- var issued = '';
- var completed = '';
- var canceled = '';
- //订单来源下拉框
- //var orderSource = document.getElementById("ordersource");
- // var newHtml = '';
- // newHtml = sourceText;
- // if(httpData.orderSource){
- // for (var i = 0;i<httpData.orderSource.length;i++) {
- // var source = sourceText;
- // // source = source.replace('selected="selected"','');
-
- // source = source.replace('-1',httpData.orderSource[i].org_id);
- // source = source.replace('item_1',httpData.orderSource[i].soure);
- // source = source.replace('请选择', httpData.orderSource[i].soure);
- // newHtml += source;
- // }
- // }
- // orderSource.innerHTML=newHtml;
- //表格
- orderSource = document.getElementById("tableOrder");
- newHtml = ""
- if(httpData.orderList) {
- for(var i = 0; i < httpData.orderList.length; i++) {
- var dict=httpData.orderList[i];
- var source = tableText;
- source = source.replace('[oneCheck]',dict['parent_orderNo']);
- source = source.replace('[order_id]', dict['parent_orderNo']);
- source = source.replace('订单编号', dict['parent_orderNo']);
- source = source.replace('下单时间', dict['create_time']);
- if(dict['org_name']==""){
- source = source.replace('订单来源', '-');
- }else{
- source = source.replace('订单来源', dict['org_name']);
- }
-
- source = source.replace('渠道订单号', dict['outside_order_no']);
- source = source.replace('line', dict['line']);
- var tt="("+dict['start_station']+")"+"-"+"("+dict['end_station']+")";
- source = source.replace('预订产品', tt);
- source = source.replace('<div>普通成人票 </div>', dict['seat'].replace('[br /]','<br />'));
- // var tk = '';
- // tk = httpData.orderList[i].predeterminedProduct.ticket;
- // for(var item1 in httpData.orderList[i].predeterminedProduct.ticket){
- // var text=ticketText;
- //// tk += text.replace('普通成人票', item1+' × '+httpData.orderList[i].predeterminedProduct.ticket[item1]);
- // tk += text.replace('普通成人票',item1);
- // }
- // source = source.replace('<div>普通成人票 </div>', tk);
- // if(httpData.orderList[i].predeterminedProduct.ordinary){
- // source = source.replace('普通成人票', '普通成人票 × '+httpData.orderList[i].predeterminedProduct.ordinary);
- // }else{
- // source = source.replace('普通成人票', '');
- // }
- // if(httpData.orderList[i].predeterminedProduct.vip){
- // source = source.replace('贵宾成人票', '贵宾成人票 × '+httpData.orderList[i].predeterminedProduct.vip);
- // }else{
- // source = source.replace('贵宾成人票', '');
- // }
- source = source.replace('出发时间', dict['travel_time']);
- source = source.replace('name', dict['contacts']);
- source = source.replace('phone', dict['tel']);
- var start_time = dict['travel_time'];
- var cur_time = getDateTime(0) + " " + getDateTime(2);
- // 判断日期是否合理
- var date1 = new Date(start_time.replace(/\-/g, '/'));
- var date2 = new Date(cur_time.replace(/\-/g, '/'));
- if(date2 > date1) {
- source = source.replace('cancelOrder', '');
- // source = source.replace('mealOrder', '');
- // source = source.replace('refundOrder', '');
- }
- if(httpData.orderList[i].run_status != "138") {
- source = source.replace('cancelOrder', '');
- }
- var or_st=dict['order_status'];
- if(or_st == "145") {
- source = source.replace('状态', '待支付');
- //paid = paid - 0 + 1;
- //all = all - 0 + 1;
- source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
- source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
- source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
- source = source.replace('cancelOrder', '取消 ');
- source = source.replace('mealOrder', '');
- source = source.replace('refundOrder', '');
- } else if(or_st == "146") {
- source = source.replace('状态', '已出票');
- //issued = issued - 0 + 1;
- //all = all - 0 + 1;
- source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
- source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
- source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
- source = source.replace('cancelOrder', '取消');
- source = source.replace('mealOrder', ' ');
- source = source.replace('refundOrder', ' ');
- } else if(or_st == "147") {
- source = source.replace('状态', '已完成');
- //completed = completed - 0 + 1;
- //all = all - 0 + 1;
- source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
- source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
- source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
- source = source.replace('cancelOrder', '');
- source = source.replace('mealOrder', '');
- source = source.replace('refundOrder', '');
- } else if(or_st == "148") {
- source = source.replace('状态', '已取消');
- //canceled = canceled - 0 + 1;
- //all = all - 0 + 1;
- source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
- source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
- source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
- source = source.replace('cancelOrder', '');
- source = source.replace('mealOrder', '');
- source = source.replace('refundOrder', '');
- } else {
- source = source.replace('状态', '待支付');
- //all = all - 0 + 1;
- source = source.replace('cancel(0)', 'cancel(' + dict['parent_orderNo'] + ')');
- source = source.replace('meal(0)', 'meal(' + dict['parent_orderNo'] + ')');
- source = source.replace('refund(0)', 'refund(' + dict['parent_orderNo'] + ')');
- source = source.replace('cancelOrder', '取消');
- source = source.replace('mealOrder', '');
- source = source.replace('refundOrder', '');
- }
- newHtml += source;
- }
- }
- if(newHtml) {
- orderSource.innerHTML = newHtml;
- var currpage = getPar("currpage");
- if(currpage) {} else {
- currpage = 1;
- }
- $('#page').html('');
- var sum = httpData.totalTickets;
- var tag = "page";
- getPager(myURL2, sum, currpage, pagesize, tag, 'currpage');
- document.getElementById("sum").innerHTML = "共"+sum+"条数据";
-
-
- }else {
- $('#page').html('');
- document.getElementById("sum").innerHTML = "共0条数据";
- orderSource.innerHTML = "";
- }
-
-
- // if(all){
- // orderAll.style.display="inline";
- // orderAll.innerText=all
- // }
- // if(paid){
- // orderPaid.style.display="inline";
- // orderPaid.innerText=paid
- // }
- // if(issued){
- // orderIssued.style.display="inline";
- // orderIssued.innerText=issued
- // }
- // if(completed){
- // orderCompleted.style.display="inline";
- // orderCompleted.innerText=completed
- // }
- // if(canceled){
- // orderCanceled.style.display="inline";
- // orderCanceled.innerText=canceled
- // }
- });
- }
-
- //.. 导出游客信息
- function exportToExcel(obj_this) {
- var btn_obj=$(obj_this);
- if(btn_obj.html()=="正在导出中。。。"){
- return;
- }
- btn_obj.html('正在导出中。。。');
- var starttime = $("#starttime").val();
- var endtime = $('#endtime').val();
- // if(!starttime) {
- // alert('请输入日期!!!');
- // return;
- // } else {
- // endtime = $('#endtime').val();
- // if(endtime == "") {
- // endtime = starttime;
- // }
- // }
- var timelimit = $('#timelimit').val(); //时间类型
- var ordersource = order_from_id; //订单渠道
- var paystatus = $('#paystatus').val(); //支付状态
- var billingstatus = '';
- var mealbounce = '';
- var refund = '';
- var moresearch = document.getElementById("moresearch").value;
-
- //2016-07-15新增参数
- var start_area = $('#start_area').val();
- var end_area = $('#end_area').val();
- var line = $('#line').val();
- var url =
- "./st-xm/Api/order_list2_limited.php?tt=" + getDateTime(4) +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + click_type_id +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line +
- "&currpage=1" +
- "&pagesize=999999";
- var listURL = url;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- btn_obj.html('导出游客信息');
- }
-
- function getDateTime(nTypeFlag) {
- var tNowTime = new Date();
- var myYear = ';' + tNowTime.getFullYear() + ';';
- var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
- var myDay = ';' + tNowTime.getDate() + ';';
- var myHour = ';' + tNowTime.getHours() + ';';
- var myMinu = ';' + tNowTime.getMinutes() + ';';
- var mySecond = ';' + tNowTime.getSeconds() + ';';
-
- if(myMonth.length < 4) myMonth = '0' + myMonth;
- if(myDay.length < 4) myDay = '0' + myDay;
- if(myHour.length < 4) myHour = '0' + myHour;
- if(myMinu.length < 4) myMinu = '0' + myMinu;
- if(mySecond.length < 4) mySecond = '0' + mySecond;
-
- var cNewTimeStr;
- //alert(tNowTime);
- switch(nTypeFlag + 1 - 1) {
- case 0:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
- break;
- case 1:
- cNewTimeStr = myYear + myMonth + myDay;
- break;
- case 2:
- cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
- break;
- case 3:
- cNewTimeStr = myHour + myMinu + mySecond;
- break;
- case 4:
- cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
- break;
- case 5:
- cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
- break;
- case 6:
- cNewTimeStr = myYear;
- break;
- case 7:
- cNewTimeStr = myYear + '-' + myMonth;
- break;
- case 8: //得到上一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中月的天数
- var year2 = year;
- var month2 = parseInt(month) - 1;
- if(month2 == 0) {
- year2 = parseInt(year2) - 1;
- month2 = 12;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
- cNewTimeStr = year2 + '-' + month2 + '-' + day2;
- break;
- case 9: //得到下一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中的月的天数
- var year2 = year;
- var month2 = parseInt(month) + 1;
- if(month2 == 13) {
- year2 = parseInt(year2) + 1;
- month2 = 1;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
-
- var t2 = year2 + '-' + month2 + '-' + day2;
- return t2;
- break;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
- }
-
- cNewTimeStr = cNewTimeStr.replace(/;/g, "");
-
- return cNewTimeStr;
-
- }
-
- function getPar(par) {
- //获取当前URL
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- //获取要取得的get参数位置
- var get = local_url.indexOf(par + "=");
- if(get == -1) {
- return "";
- }
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1) {
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
-
- //设置字符串类型的本地缓存
- function setStorage(objName, objValue) {
- var sto = window.localStorage;
- if(sto)
- sto.setItem(objName, objValue);
- }
- //读取字符串类型的本地缓存
- function getStorage(objName) {
- var ret = '';
- var sto = window.localStorage;
- if(sto)
- ret = sto.getItem(objName);
- return ret;
- }
-
- //清除本地缓存,如没指定名称则为清空所有缓存
- function clearStorage(objName) {
- var sto = window.localStorage;
- if(sto) {
- if(objName)
- sto.removeItem(objName);
- else
- sto.clear();
- }
- }
- //设置Json类型的本地缓存
- function setStorJson(objName, json) {
- if(json)
- setStorage(objName, JSON.stringify(json));
- }
- //读取Json类型的本地缓存
- function getStorJson(objName) {
- var ret = null;
- var str = getStorage(objName);
- if(str)
- ret = JSON.parse(str);
- return ret;
- }
-
-
- //获取当前时间
- function CurrentTime() {
- var now = new Date();
-
- var year = now.getFullYear(); //年
- var month = now.getMonth() + 1; //月
- var day = now.getDate(); //日
-
- var hh = now.getHours(); //时
- var mm = now.getMinutes(); //分
- var ss = now.getSeconds(); //秒
-
- var clock = year + "-";
-
- if (month < 10)
- clock += "0";
-
- clock += month + "-";
-
- if (day < 10)
- clock += "0";
-
- clock += day + " ";
-
- if (hh < 10)
- clock += "0";
-
- clock += hh + ":";
- if (mm < 10) clock += '0';
- clock += mm + ":";
-
- if (ss < 10) clock += '0';
- clock += ss;
- return (clock);
- }
-
- //复选框判断
- function select_checked(index) {
- //index=0最上面的全选 index=1表示的是下面所有的
- var cur_check = $('.ace_check')[0];
- var checkList = $('.ace_check');
- var checkCount = checkList.length - 1;
- var true_count = 0;
- for (var i = 1; i < checkList.length; i++) {
- if (index == '0') {
- checkList[i].checked = cur_check.checked;
- } else {
- if (checkList[i].checked == false) {
- cur_check.checked = false
- } else {
- true_count = true_count + 1;
- }
- }
- }
- //判断下面是否选中完
- if (checkCount == true_count) {
- cur_check.checked = true;
- }
- }
-
- //打印功能
- function printInfo(){
- var str = '';
- $('.ace_check').each(function(index, item) {
- if (this.checked && index != 0) {
- var stopid = $(this).attr('checkid');
- //改变账号状态
- str = str + stopid +',';
- }
- });
- order_id = str.substring(0,str.length-1);
- window.open("./jqprint.html?order_id="+order_id)
-
- }
-
-
- /**
- * Created by Administrator on 2016/9/29.
- */
-
|