(function ($) {

    function getExpressData(orderId) {
        var url = '/API/VshopProcess.ashx';
        var expressData;
        $.ajax({
            type: "get",
            url: url,
            data: { action: 'Logistic', orderId: orderId },
            dataType: "json",
            async: false,
            success: function (data) {
                expressData = data;
            }
        });
        return expressData;
    }



    $.fn.expressInfo = function (orderId) {
        /// <param name="orderId" type="String">订单编号</param>
        debugger;
        var expressData = getExpressData(orderId);

        var html = '<table>';
        var data = expressData.data;
        if (expressData.message != "ok")
            html += '<tr><td>该单号暂无物流进展，请稍后再试，或检查公司和单号是否有误。</td></tr>';
        else {
            for (var i = 0; i < data.length; i++) {
                html += '<tr><td>' + data[i].time + '</td>\
                             <td>' + data[i].context + '</td>';
                html += '</tr>';
            }
        }
        html += '<tr><td><a href="http://www.kuaidi100.com" target="_blank" id="power" runat="server" style="color:Red;">此物流信息由快递100提供</a></td></tr>';

        html += '</table>';
        $(this).html(html);
        return $;

    }




})(jQuery);