123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- var test = true;
- window.onload = function (ev) {
- init();
- }
- init = function () {
- getOrderInfo(1, 10);
- test();
- }
- test = function () {
- $.ajax({
- url: "/new/php/ip.php",
- success: function (data) {
- console.log(data);
- // console.log(JSON.parse(data).sGeobytesCountryTitle);
- // console.log(JSON.parse(data).sGeobytesCity);
- // console.log(JSON.parse(data).sGeobytesIpAddress);
- }
- })
- }
- getOrderInfo = function (pageindex, pagesize) {
- var parameter = urlEncode(["SelectIpAddress", pageindex, pagesize]);
- $.ajax({
- type: "post",
- url: "/new/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="5" 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();
- }
|