12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- var test = true;
- window.onload = function (ev) {
- init();
- }
- init = function () {
- getOrderInfo(1, 10);
- }
- getOrderInfo = function (pageindex, pagesize) {
- var parameter = urlEncode(["SelectIpAddress", pageindex, pagesize]);
- $.ajax({
- type: "post",
- url: "/taiwan/php/index.php",
- data: {mode: parameter},
- dataType: "json",
- success: function (data) {
- if (data.length == 0 || data == -1) {
- $("#loading").css({"display": "none"});
- $("#warp").css({"display": "table-row-group"});
- var th = '<th colspan="10" scope="col" class="text-c f-20" style="padding: 50px 0;">暂无数据</th>';
- $("#warp").html(th);
- $("#Page").html("");
- // $("#warp").append(th);
- return;
- }
- printOrderInfo(data);
- if (test) {
- test = false;
- var totalSize = data[0].allcount,
- totalPage = Math.ceil(totalSize / pagesize);
- // $("#Page").whjPaging("setPage", {currPage: pageindex, totalPage: totalPage, totalSize: totalSize});
- $("#Page").whjPaging({
- currPage: pageindex,
- totalSize: totalSize,//可选,总条数
- totalPage: totalPage,//可选,总页数
- isShowRefresh: false,//可选,是否展示刷新,默认true
- isShowPageSizeOpt: false,//可选,是否展示每页条数下拉框,默认true,如果设置显示,总条数必须设置
- // isResetPage:true,
- callBack: function (currPage) {
- $("#loading").css({display: "block"});
- $("#warp").css({display: "none"});
- getOrderInfo(currPage, pagesize);
- // console.log('currPage:' + currPage + ' pageSize:' + pageSize);
- }
- });
- }
- }
- });
- }
- printOrderInfo = function (data) {
- var warp = $("#warp"),
- tr;
- warp.html("");
- for (var i = 0; i < data.length; i++) {
- href = "'product-add.html?pid=" + data[i].ProductId + "'";
- tr = '<tr class="text-c">' +
- '<td>' + data[i].OrderNum + '</td>' +
- '<td>' + data[i].IPAddress + '</td>' +
- '<td>' + data[i].Country + '</td>' +
- '<td>' + data[i].City + '</td>' +
- '<td>' + data[i].AddTime + '</td>' +
- '</tr>';
- warp.append(tr);
- }
- $("#loading").css({"display": "none"});
- $("#warp").css({"display": "table-row-group"});
- }
- urlEncode = function (arr) {
- var i; //循环初始化
- for (i = 0; i < arr.length; i++) {
- arr[i] = encodeURIComponent(encodeURIComponent(arr[i]));
- }
- return arr.join();
- }
|