123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- var test = true;
- window.onload = function (ev) {
- init();
- }
- init = function () {
- getProductInfo("", 1, 10);
- }
- getProductInfo = function (judge, pageindex, pagesize) {
- var parameter = urlEncode(["SelectAllProduct", judge, pageindex, pagesize]);
- $.ajax({
- type: "post",
- url: "/taiwan/php/index.php",
- data: {mode: parameter},
- dataType: "json",
- success: function (data) {
- if (data.length == 0 || data == -1) {
- var th = '<th colspan="8" scope="col" class="text-c f-20" style="padding: 50px 0;">暂无数据</th>';
- $("#warp").html(th);
- $("#Page").html("");
- // $("#warp").append(th);
- return;
- }
- if (test) {
- test = false;
- var totalSize = data[0].allcount,
- totalPage = Math.ceil(totalSize / pagesize);
- $("#Page").html("");
- // $("#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"});
- getProductInfo(judge, currPage, pagesize);
- // test = true;
- // console.log('currPage:' + currPage + ' pageSize:' + pageSize);
- }
- });
- }
- printProductInfo(data);
- console.log(data);
- }
- });
- }
- printProductInfo = function (data) {
- var warp = $("#warp"),
- tr,
- href,
- title = "'查看商品信息'";
- 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].ProductId + '</td>' +
- '<td>' + data[i].ProductRemarks + '</td>' +
- '<td>' + data[i].ProductName + '</td>' +
- '<td>' + data[i].ProductPrimeCost + '</td>' +
- '<td>' + data[i].ProductPrice + '</td>' +
- // '<td>' + data[i].ProductIntroduce + '</td>' +
- '<td><a href="' + data[i].ProductIntroduce + '" target="_blank">' + data[i].ProductIntroduce + '</a></td>' +
- '<td>' + data[i].ProductAddTime + '</td>' +
- '<td>' +
- '<a class="btn btn-primary radius td-button" href="/taiwan/goods.html?pid=' + data[i].ProductId + '">查看H5页面</>' +
- '<a class="btn btn-primary radius td-button" onclick="product_add(' + title + ',' + href + ')">查看产品信息</a>' +
- '</td></tr>');
- warp.append(tr);
- }
- $("#loading").css({"display": "none"});
- $("#warp").css({"display": "table-row-group"});
- }
- keySearchProductInfo = function () {
- if (event.keyCode == 13) {
- searchProductInfo();
- }
- }
- searchProductInfo = function () {
- var _val = $("#SearchPlaceBtn").val().trim();
- if (_val == "") {
- layer.msg('请输入订单号、人名、地址、手机号其中一个', {icon: 1});
- }
- else {
- getProductInfo(_val, 1, 10);
- }
- }
- product_add = function (title, url) {
- var index = layer.open({
- type: 2,
- title: title,
- content: url
- });
- layer.full(index);
- }
- urlEncode = function (arr) {
- var i; //循环初始化
- for (i = 0; i < arr.length; i++) {
- arr[i] = encodeURIComponent(encodeURIComponent(arr[i]));
- }
- return arr.join();
- }
- toogle = function (cs) {
- var child = $(cs);
- for (var i = 0; i < child.length; i++) {
- if (child[i].style.display == "none") {
- child[i].style.display = "block";
- } else {
- child[i].style.display = "none";
- }
- }
- }
|