wangshan 6 years ago
parent
commit
1481014064

File diff suppressed because it is too large
+ 0 - 0
src/dataexport.json


+ 4 - 3
src/jfw/front/dataExport.go

@@ -190,7 +190,7 @@ func (d *DataExport) QueryOrder() error {
 	//开始下标索引
 	var start = (pageNum - 1) * order_pageSize
 	//总页数
-	totalPage := (count + int(order_pageSize) - 1) / int(order_pageSize)
+	//totalPage := (count + int(order_pageSize) - 1) / int(order_pageSize)
 	list := public.Mysql.Find(tableName_order, query, "", "create_time desc", start, order_pageSize)
 	if list != nil {
 		for _, v := range *list {
@@ -215,8 +215,9 @@ func (d *DataExport) QueryOrder() error {
 		}
 	}
 	d.ServeJson(map[string]interface{}{
-		"list":      list,
-		"totalPage": totalPage,
+		"list":     list,
+		"count":    count,
+		"pageSize": order_pageSize,
 	})
 	return nil
 }

+ 1 - 1
src/jfw/public/dataexport.go

@@ -333,7 +333,7 @@ func SendMailToPayUser(order *map[string]interface{}, order_money float64, pay_t
 	//
 	filter_id := util.ObjToString((*order)["filter_id"])
 	filter := util.ObjToString((*order)["filter"])
-	product_type := util.ObjToString((*order)["product_type"])
+	product_type := util.ObjToString((*order)["product_type"]) + "导出"
 	//
 	create_time := util.ObjToString((*order)["create_time"])
 	if create_time != "" {

+ 1 - 1
src/web/staticres/dataExport/css/payment_order.css

@@ -98,7 +98,7 @@ body { background-color: #F5F5FB !important; }
 
 #pay .inner .money > div:nth-of-type(2) span { font-size: 24px; font-weight: bold; color: #ff3a20; }
 
-#pay .inner .money > div:nth-of-type(3) { color: #1d1d1d; margin-top: -2px;font-size: 12px}
+#pay .inner .money > div:nth-of-type(3) { color: #1d1d1d; margin-top: -2px;font-size: 14px}
 
 #pay .inner .info .left { line-height: 20px; color: #888888; font-size: 12px;  margin-left: 20px;}
 

+ 246 - 0
src/web/staticres/dataExport/js/pageination.ie.js

@@ -0,0 +1,246 @@
+function _instanceof(left, right) {
+  if (
+    right != null &&
+    typeof Symbol !== "undefined" &&
+    right[Symbol.hasInstance]
+  ) {
+    return right[Symbol.hasInstance](left);
+  } else {
+    return left instanceof right;
+  }
+}
+
+function _classCallCheck(instance, Constructor) {
+  if (!_instanceof(instance, Constructor)) {
+    throw new TypeError("Cannot call a class as a function");
+  }
+}
+
+function _defineProperties(target, props) {
+  for (var i = 0; i < props.length; i++) {
+    var descriptor = props[i];
+    descriptor.enumerable = descriptor.enumerable || false;
+    descriptor.configurable = true;
+    if ("value" in descriptor) descriptor.writable = true;
+    Object.defineProperty(target, descriptor.key, descriptor);
+  }
+}
+
+function _createClass(Constructor, protoProps, staticProps) {
+  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+  if (staticProps) _defineProperties(Constructor, staticProps);
+  return Constructor;
+}
+
+/**
+ * @file pageination.js
+ * @author zhangyuhan2016 <hi_zhangyuhan@163.com>
+ */
+var Page =
+  /*#__PURE__*/
+  (function() {
+    "use strict";
+
+    function Page() {
+      var _ref =
+          arguments.length > 0 && arguments[0] !== undefined
+            ? arguments[0]
+            : {},
+        _ref$el = _ref.el,
+        el = _ref$el === void 0 ? ".pagination-box" : _ref$el,
+        _ref$now = _ref.now,
+        now = _ref$now === void 0 ? 1 : _ref$now,
+        _ref$show = _ref.show,
+        show = _ref$show === void 0 ? 5 : _ref$show,
+        _ref$total = _ref.total,
+        total = _ref$total === void 0 ? 1000 : _ref$total,
+        _ref$size = _ref.size,
+        size = _ref$size === void 0 ? 10 : _ref$size,
+        _ref$click = _ref.click,
+        click = _ref$click === void 0 ? null : _ref$click;
+
+      _classCallCheck(this, Page);
+
+      this.now = now;
+      this.show = show;
+      this.total = total;
+      this.size = size;
+      this.min = 1;
+      this.max = Math.ceil(total / size);
+      this.contentArr = [];
+      this.contentDom = [];
+      this.dom = document.querySelector(el);
+      this.abDom = [];
+      this.otherDom = [];
+      this.click = click;
+    }
+
+    _createClass(Page, [
+      {
+        key: "init",
+        value: function init() {
+          var _this = this;
+
+          // dom数组
+          var cArr = ["back", "prev", "next", "cont", "min", "max"];
+          cArr.forEach(function(v) {
+            _this.otherDom.push(
+              _this.dom.querySelector('button[name="'.concat(v, '"]'))
+            );
+          });
+          this.otherDom[4].innerText = this.min;
+          this.otherDom[5].innerText = this.max;
+
+          if (this.min === this.max) {
+            this.otherDom[5].style.display = "none";
+          } // 创建dom
+
+          this.getContent(); // 点击事件
+
+          this.dom.addEventListener("click", function(e) {
+            if (e.target.nodeName === "BUTTON") {
+              var type = e.target.getAttribute("name");
+              var tempNumber = 0;
+
+              switch (type) {
+                case "back": {
+                  tempNumber = -1;
+                  break;
+                }
+
+                case "cont": {
+                  tempNumber = 1;
+                  break;
+                }
+
+                case "prev": {
+                  tempNumber = -_this.show;
+                  break;
+                }
+
+                case "next": {
+                  tempNumber = _this.show;
+                  break;
+                }
+
+                default: {
+                  tempNumber = parseInt(e.target.innerText) - _this.now;
+                }
+              }
+
+              var tempNow = _this.now + tempNumber;
+
+              if (_this.min <= tempNow && tempNow <= _this.max) {
+                _this.now = tempNow;
+              }
+
+              typeof _this.click === "function"
+                ? _this.click(_this.now, type)
+                : null;
+
+              _this.getContent();
+
+              _this.upData();
+            }
+          });
+          var nextButton = this.otherDom[2];
+          this.abDom = this.otherDom.slice(-2);
+          this.contentArr.forEach(function(v) {
+            var b = document.createElement("button");
+            b.innerText = v;
+
+            _this.contentDom.push(b);
+
+            _this.dom.insertBefore(b, nextButton);
+          });
+          this.upData();
+        }
+      },
+      {
+        key: "upData",
+        value: function upData() {
+          var _this2 = this;
+
+          this.abDom.forEach(function(v) {
+            return (v.className = "");
+          });
+          this.otherDom[0].className = "";
+          this.otherDom[3].className = "";
+
+          if (this.now <= this.min) {
+            this.now = this.min;
+            this.abDom[0].className = "now";
+            this.otherDom[0].className = "stop";
+          }
+
+          if (this.now >= this.max) {
+            this.now = this.max;
+            this.abDom[1].className = "now";
+            this.otherDom[3].className = "stop";
+          }
+
+          this.contentDom.forEach(function(v, i) {
+            v.className = "";
+            var n = _this2.contentArr[i];
+
+            if (n === _this2.now) {
+              v.className = "now";
+            }
+
+            v.innerText = n;
+          });
+        }
+      },
+      {
+        key: "getContent",
+        value: function getContent() {
+          var _this3 = this;
+
+          var n = this.now;
+          var size = this.show;
+          var arr = [];
+
+          for (var i = 0; i < size; i++) {
+            arr[i] = i;
+          } // default
+
+          var content = Math.floor(arr.length / 2);
+          var show = [true, true];
+
+          var mapF = function mapF(v, i) {
+            var step = content - i;
+            return n - step;
+          }; // min
+
+          if (n <= size - this.min) {
+            mapF = function mapF(v, i) {
+              return _this3.min + 1 + i;
+            };
+
+            show[0] = false;
+          } // max
+
+          if (this.max - size < n) {
+            mapF = function mapF(v, i) {
+              return _this3.max - size + i;
+            };
+
+            show[1] = false;
+          }
+
+          if (this.max - this.min <= this.show) {
+            show = [false, false];
+          }
+
+          this.contentArr = arr.map(mapF).filter(function(v) {
+            return v > _this3.min && v < _this3.max;
+          });
+          show.forEach(function(v, i) {
+            _this3.otherDom[i + 1].style.display = v ? "inline-block" : "none";
+          });
+        }
+      }
+    ]);
+
+    return Page;
+  })();

+ 118 - 39
src/web/templates/pc/myOrder.html

@@ -43,38 +43,6 @@
             text-align: center;
             margin-top: 30px;
         }
-    </style>
-</head>
-<body style="background-color: #fff !important;">
-{{include "/common/pchead.html"}}
-<section id="drder" class="w">
-    <div class="tab-bar">
-        <ul class="tab clearfix">
-            <li class="active">全部</li>
-            <li>待付款</li>
-            <li>已完成</li>
-        </ul>
-    </div>
-    <div class="title-bar">
-        <ul class="clearfix">
-            <li>日期</li>
-            <li>关键词</li>
-            <li>数据量</li>
-            <li>数据规格</li>
-            <li>金额</li>
-            <li>状态</li>
-        </ul>
-    </div>
-    <div class="list">
-        <ul class="item clearfix">
-        </ul>
-        <ul class="item clearfix">
-        </ul>
-        <ul class="item clearfix">
-        </ul>
-    </div>
-	
-<style>
 	.pagination a {
 	    float: left;
 	    padding: 10px 9px;
@@ -105,21 +73,123 @@
 	.nbnext i{
 		margin-left: 5px;
 	}
+	/**/
+	.pagination-box{
+		float: right;
+    	margin-top: 20px;
+        user-select: none;
+    }
+    .pagination-box button {
+        padding: 0 4px;
+        vertical-align: top;
+        display: inline-block;
+        font-size: 14px;
+        height: 36px;
+        line-height: 36px;
+        cursor: pointer;
+        box-sizing: border-box;
+        text-align: center;
+        margin: 0 5px;
+        background-color: #fff;
+        color: #606266;
+        min-width: 36px;
+        border-radius: 4px;
+        border:none;
+        outline: none;
+    }
+    .pagination-box button.now {
+        background-color: #2cb7ca;
+        color: #fff;
+    }
+    .pagination-box button.stop {
+        background-color: #fff;
+        color: #aea79f;
+        cursor: not-allowed;
+    }
+	.pagination-box #prev{
+		    width: 78px;
+    		border: 1px solid #EBEBEB;
+	}
+	.pagination-box #prev i{
+		margin-right: 8px;
+	}
+	.pagination-box #next{
+		    width: 78px;
+    		border: 1px solid #EBEBEB;
+	}
+	.pagination-box #next i{
+		margin-left: 8px;
+	}
 </style>
-<!--分页-->
+</head>
+<body style="background-color: #fff !important;">
+{{include "/common/pchead.html"}}
+<section id="drder" class="w">
+    <div class="tab-bar">
+        <ul class="tab clearfix">
+            <li class="active">全部</li>
+            <li>待付款</li>
+            <li>已完成</li>
+        </ul>
+    </div>
+    <div class="title-bar">
+        <ul class="clearfix">
+            <li>日期</li>
+            <li>关键词</li>
+            <li>数据量</li>
+            <li>数据规格</li>
+            <li>金额</li>
+            <li>状态</li>
+        </ul>
+    </div>
+    <div class="list">
+        <ul class="item clearfix">
+        </ul>
+        <ul class="item clearfix">
+        </ul>
+        <ul class="item clearfix">
+        </ul>
+    </div>
+	
+<!--分页
 	<div class="pagination clearfix w">
 		<div class="pagination-inner fr" style="margin-right:3px;">
 			<a class="nbprev disabled"  id="previousPage"><i><</i>上一页</a>
 			<span class="page">1</span>
 			<a class="nbnext"  id="nextPage">下一页<i>></i></a>
 		</div>
+	</div>-->
+	<div class="pagination clearfix w">
+		<div class="pagination-box">
+		    
+		</div>
 	</div>
 </section>
+<script type="text/javascript" src="{{Msg "seo" "cdn"}}/dataExport/js/pageination.ie.js?v={{Msg "seo" "version"}}"></script>
 {{include "/common/pcbottom.html"}}
 {{include "/common/baiducc.html"}}
 <script>
 	var totalPage = 1;
 	var pageNum =1;
+	/*
+	* el Dom节点
+	* show 索引数量
+	* total 数据总数
+	* size 每页条数
+	* now 当前索引
+	* click 点击事件
+	* */
+	var pageHtml = "<button name=\"back\" id=\"prev\"><i><</i>上一页</button><button name=\"min\">1</button><button name=\"prev\">...</button><button name=\"next\">...</button><button name=\"max\">100</button><button name=\"cont\" id=\"next\">下一页<i>></i></button>";
+	var show = 5;
+	var total = 20;
+	var size = 2;
+	var clickF = function clickF(number, type) {
+		var $Index = $(".tab-bar .tab li.active").index();
+		var $list = $(".list .item");
+        queryOrder($Index,$list,number);
+	};
+	var pageFlag = true;
+	var p = null; 
     $(function () {
         selcetIndexNav(4);
         haslogin({{.T.logid}});
@@ -146,10 +216,13 @@
             var $list = $(".list .item");
             $list.eq($Index).show().siblings().hide();
 			pageNum = 1;
+			pageFlag= true;
+			p = null; 
 			$("#previousPage").addClass("disabled");
 			$("#nextPage").removeClass("disabled");
             queryOrder($Index,$list,pageNum);
         });
+		/*
 		//点击上下页
 		$("#previousPage").on("click",function () {
 			if($(this).hasClass("disabled")){
@@ -182,7 +255,7 @@
 			$("#previousPage").removeClass("disabled");
             queryOrder($Index,$list,pageNum);
         });
-
+		*/
 
     })
 
@@ -205,12 +278,18 @@
             dataType: 'json',
             success: function(data){
                 var temp = "";
-				totalPage = data.totalPage;
-				if(totalPage==1){
-					$("#nextPage").addClass("disabled");
-				}
-				$(".page").html(pageNum)
                 if (data.list && data.list.length>0){
+					if (pageFlag){
+						$(".pagination-box").html(pageHtml);
+					 	p = new Page({
+						  	show: show,
+						  	total: data.count,
+						  	size: data.pageSize,
+						  	click: clickF
+						});
+						p.init();
+						pageFlag= false;
+					}
 					$(".backTop").click();
                     for (var i=0;i<data.list.length;i++){
                         var obj = data.list[i];

Some files were not shown because too many files changed in this diff