博e百

博e百

包裹查詢

  • 注:每行輸入一個單號,最多支持40個.
刪除全部
篩選單號

官網查詢

  • 中國Fedex
  • 中國EMS
  • 香港EMS
  • 香港DHL
  • 中國DHL
  • 台灣DHL
  • 中國UPS
  • 香港UPS
  • 中歐專線
  • 中澳專線
  • 中國郵政
  • 中國郵政小包
  • 英國郵政小包
  • 香港郵政小包
  • 新加坡郵政小包
  • 瑞士郵政小包
  • 德國挂號
\n' + '
  • SFC收貨({#sfcReceivingCount#})
  • \n' + '
  • SFC出庫({#sfcDeliveryCount#})
  • \n' + '
  • 運輸中({#halfwayCount#})
  • \n' + '
  • 到達待取({#deliveredCount#})
  • \n' + '
  • 運輸過久({#longCount#})
  • \n' + '
  • 退件({#canceledCount#})
  • \n' + '
  • 完成({#completeCount#})
  • \n' + ''; var trackTpl = '' + '
    \n' + '
    \n' + '
    \n' + '
      \n' + '
    • \n' + ' \n' + ' 三態單號:\n' + ' {#orderCode#} ({#weight#}KG)\n' + ' \n' + '
    • \n' + '
    • \n' + ' \n' + ' 參考號:\n' + ' {#customerNo#}\n' + ' \n' + ' {#senderCountry#} 一 {#country#}          {#statusLabel#}' + ' '+ ' {#lastTrackStatu#}'+ ' \n' + '
      \n' + ' \n' + ' \n' + ' \n' + ' \n' + '
      \n' + '
      \n' + ' '+ '
      \n' + '
    • \n' + '
    • {#trackContent#}{#shipType#}
    • \n' + '
    \n' + '
    \n' + '
    {#table#}
    \n' + '
    \n' + '
    '; var replaceAll = function(search,replacement,str){ var reg = new RegExp(search,'g'); return str.replace(reg,replacement); } var data = new Object(); var resetData = function(){ data.allCount = 0; data.sfcReceicedCount = 0; data.sfcDeliveryCount = 0; data.halfwayCount = 0; data.deliveredCount = 0; data.longCount = 0; data.canceledCount = 0; data.completeCount = 0; data.allItems = new Array; } var generateTrackHtml = function (item) { if(item.count == 0){ return '' + '
    \n' + '
    \n' + '
    \n' + '
      \n' + '
    • '+item.order_code+' 查詢不到訂單信息!
    • \n' + '
    \n' + '
    \n' + '
    \n' + '
    '; } var order = item.orderInfo; var orderCode = order.order_code; var status = getStatus(item); var customerNo = order.customer_order_code; var shipType = order.ship_type_code; var country = order.country.cn_name; var weight = order.weight; var qty = order.numbers; var lastTracking; var lastTrackingStatu; //显示转单号的方式 var show_tracking_number_usps = new Array('HKFEDEX', 'HKSFEDEX', 'CNFEDEX', 'CNSFEDEX', 'CNDHL', 'TWDHL', 'MXEXP', 'MXEXPB', 'MXEXPIE'); //优先显示转单号的方式 var priority_show_tracking_number_usps = new Array('DGEMS', 'WWETK'); var html; var trackContent; if (item.show == 'no') { trackContent = ''; } else { if (in_array(order.ship_type_code, show_tracking_number_usps)) { trackContent = '跟蹤號:' + order.tracking_number_usps + ''; }else if (in_array(order.ship_type_code, priority_show_tracking_number_usps)) { if(order.tracking_number_usps !=''){ trackContent = '跟蹤號:' + order.tracking_number_usps + ''; }else{ trackContent = '跟蹤號:' + order.tracking_number + ''; } } else { trackContent = '跟蹤號:' + order.tracking_number + ''; } } /*** 开始拼接table内容 ***/ var tableContent; var trContent = ''; var preDateStr = ''; var preLocationStr = ''; var preStatuStr = ''; var tableTpl = '' + '\n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' {#trContent#}' + ' \n' + '
    時間地點跟蹤進度
    '; if(item.count == 1 && !$.isEmptyObject(item.trackingList)){ for (i in item.trackingList) { if (i == 'track_status') { continue; } trContent += ' \n' + ' ' + item.trackingList[i].date + '\n' + ' ' + item.trackingList[i].location + '\n' + ' ' + item.trackingList[i].statu + ' '+( i == 0 ? '' : '')+'\n' + ' \n'; preDateStr += ';'+item.trackingList[i].date; preLocationStr += ';'+item.trackingList[i].location; preStatuStr += ';'+ item.trackingList[i].statu; } lastTracking = item.trackingList[0];//最新物流信息 lastTrackingStatu = lastTracking.date+' '+lastTracking.location+','+lastTracking.statu; tableContent = tableTpl.replace('{#trContent#}', trContent); }else{ lastTrackingStatu = '没有任何记录'; tableContent = ''; } console.log(status); /*** 替换模板数据 ***/ html = replaceAll('{#orderCode#}',orderCode,trackTpl); html = replaceAll('{#status#}',status.key,html); html = replaceAll('{#statusLabel#}',status.label,html); html = replaceAll('{#customerNo#}',customerNo,html); html = replaceAll('{#shipType#}',shipType,html); html = replaceAll('{#senderCountry#}',order.sender_country.cn_name,html); html = replaceAll('{#country#}',country,html); html = replaceAll('{#qty#}',qty,html); html = replaceAll('{#weight#}',weight,html); html = replaceAll('{#trackContent#}',trackContent,html); html = replaceAll('{#lastTrackStatu#}',lastTrackingStatu,html); html = html.replace('{#dateStr#}',preDateStr.replace(';','')); html = html.replace('{#locationStr#}',preLocationStr.replace(';','')); html = html.replace('{#statuStr#}',preStatuStr.replace(';','')); html = html.replace('{#table#}',tableContent); return html; } var generateExportHidden = function(){ var hidden = ''; var dateStr; var locationStr; var statuStr; var orderCode; for(i in data.allItems){ var item = data.allItems[i]; dateStr = ''; locationStr = ''; statuStr = ''; if(item.count == 1){ for(j in item.trackingList){ if(j == 'track_status'){ continue; } dateStr += ';'+item.trackingList[j].date; locationStr += ';'+item.trackingList[j].location; statuStr += ';'+item.trackingList[j].statu; } orderCode = item.orderInfo.order_code; }else{ orderCode = item.order_code; } var status = getStatus(item); hidden += '' + '\n' + ''+ '\n' + '\n' + ''; } hidden += ''; return hidden; } var getStatus = function(item){ var status = item.track_status; var res = new Object(); switch(status){ case 1: res.key = 'halfway'; res.label = '运输中'; break; case 2: res.key = 'long'; res.label = '运输过久'; break; case 3: res.key = 'complete'; res.label = '完成'; break; case 4: res.key = 'canceled'; res.label = '退件'; break; case 5: res.key = 'delivered'; res.label = '到达待取'; break; case 6: res.key = 'sfc-receiving'; res.label = 'SFC收货'; break; case 7: res.key = 'sfc-delivery'; res.label = 'SFC出库'; break; default://默认运输中 res.key = 'halfway'; res.label = '运输中'; break; } return res; } var updateTab = function() { var html = ''; for(i in data.allItems){ html += generateTrackHtml(data.allItems[i]); } $('#trackList').html(html); $('#exportTrackAll_hidden').html(generateExportHidden()); } var updateNav = function(){ var navContent = navTpl.replace('{#allCount#}',data.allCount); navContent = navContent.replace('{#sfcReceivingCount#}',data.sfcReceicedCount); navContent = navContent.replace('{#sfcDeliveryCount#}',data.sfcDeliveryCount); navContent = navContent.replace('{#halfwayCount#}',data.halfwayCount); navContent = navContent.replace('{#deliveredCount#}',data.deliveredCount); navContent = navContent.replace('{#longCount#}',data.longCount); navContent = navContent.replace('{#canceledCount#}',data.canceledCount); navContent = navContent.replace('{#completeCount#}',data.completeCount); $('#sfc_bp_menu').html(navContent); } var search = function(){ var orderRow = $("#textarea").val(); var orderArr = orderRow.split("\n"); var orderCode; resetData(); $('#status_list').show(); for(i in orderArr){ orderCode = orderArr[i]; $.ajax({ type: "post", url: "/track/track/get-track", data:{tracknumber:orderCode}, dataType: "json", success: function (result) { data.allCount++; data.allItems.push(result); //1:运输途中 2:运输过久 3:完成 4:退件 5:到达待取 if(typeof(result.track_status) != "undefined"){ console.log(result.track_status); switch (result.track_status) { case 1://运输中 data.halfwayCount++; break; case 2://运输过久 data.longCount++; break; case 3://完成 data.completeCount++; break; case 4://退件 data.canceledCount++; break; case 5://到达待取 data.deliveredCount++; break; case 6: //SFC收货 data.sfcReceicedCount++; break; case 7: //SFC发货 data.sfcDeliveryCount++; break; default://默认运输中 data.halfwayCount++; break; } } console.log('AJAX'); console.log(data); /*var trackInfo = generateTrackHtml(result); console.log(trackInfo);*/ updateNav(); updateTab(); } }) } console.log(data) } /** 事件 **/ $('body').on('click','#sfc_bp_menu .menu li',function(){ //物流状态切换 $(this).siblings().removeClass('active'); $(this).addClass('active'); var id = $(this).attr('id'); console.log(id); if(id == 'all'){ $('#trackList > div').show(); }else{ $('#trackList > div').hide(); $('#trackList > div.'+id).show(); } $('#exportTrackAll input[name="export_status"]').val(id); }).on('click','button.info-btn',function(){ // 展示 / 隐藏 当前订单的物流详情 var table = $(this).parents('.type_cxm').find('.type_cxmm'); var removeClass; var addClass; if(table.is(':hidden')){ table.show(); removeClass = 'fa-angle-double-down'; addClass = 'fa-angle-double-up'; }else{ table.hide(); removeClass = 'fa-angle-double-up'; addClass = 'fa-angle-double-down'; } $(this).find('i.fa').removeClass(removeClass); $(this).find('i.fa').addClass(addClass); }).on('click','#show_is_hide',function(){ //展示 / 隐藏 全部订单物流详情 var type = $(this).data('type'); var removeClass; var addClass; if(type == 'hide'){ $('.type_cxm .type_cxmm').hide(); $(this).data('type','show'); $(this).find('a').html('展開'); removeClass = 'fa-angle-double-up'; addClass = 'fa-angle-double-down'; }else{ $('.type_cxm .type_cxmm').show(); $(this).data('type','hide'); $(this).find('a').html('隐藏'); removeClass = 'fa-angle-double-down'; addClass = 'fa-angle-double-up'; } $('.type_cxm i.'+removeClass).each(function(){ $(this).removeClass(removeClass); $(this).addClass(addClass); }); }) $(function () { showNumber(); showDetele(); }); function checkText() { var orderRow = $("#textarea").val(); var orderArr = orderRow.split("\n"); if(orderRow == '' || orderRow == '请在此输入您的运单号'){ alert('请输入您的运单号'); $("#textarea").focus(); return false; } if (orderArr.length > 40) { orderArr.splice(40, orderArr.length - 40); var orderHtml = orderArr.join("\n"); $("#textarea").val(orderHtml); } return true; } function showNumber() { var numberHtml = ''; for (var i = 1; i <= 40; i++) { numberHtml += '
    ' + i + "." + '
    '; } $("#number").html(numberHtml); } function showDetele() { var deteleHtml = ''; for (var i = 1; i <= 40; i++) { deteleHtml += '
    '; } $("#detele_img").html(deteleHtml); } function deletaAll() { $("#textarea").val(''); } function checkOrderCode() { var order_row = $("#textarea").val(); $.ajax({ url: "/track/track/check-order-code", data:{orders:order_row}, type: 'post', success: function (order) { if (order != '') { $("#textarea").val(order); } }, }); } function submitTracknumber() { if(!checkText()){ return false; } $("#trackList").html(''); $("[name='TrackAll[]']").remove(); search();return false; } function in_array(str, array) { for (var i in array) { if (array[i] == str) { return true; } } return false; } /*导航栏操作*/ function updateTrack() { submitTracknumber(); } function exportTrackList() { $("#exportTrackAll").submit(); } /*导航栏操作end*/