소스 검색

pc订单时间显示

zhangxinlei1996 6 년 전
부모
커밋
e7b6f93811
2개의 변경된 파일28개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      src/jfw/front/dataExport.go
  2. 24 2
      src/web/templates/pc/myOrder.html

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

@@ -290,6 +290,10 @@ func (d *DataExport) ToOrderDetail(orderCode string) error {
 					end, erro := strconv.ParseInt(timeArr[1], 10, 64)
 					if err == nil && erro == nil {
 						filter.PublishTime = util.FormatDateByInt64(&start, layout_date) + "-" + util.FormatDateByInt64(&end, layout_date)
+					} else if err == nil && erro != nil {
+						filter.PublishTime = util.FormatDateByInt64(&start, layout_date) + "-"
+					} else if err != nil && erro == nil {
+						filter.PublishTime = "-" + util.FormatDateByInt64(&end, layout_date)
 					}
 				}
 			}

+ 24 - 2
src/web/templates/pc/myOrder.html

@@ -326,7 +326,21 @@
 									publishTime = "全部";
 									publishTimeHtml = "<span style=\"margin-left: 118px;\">" + publishTime + "</span>";
 								} else {
-									publishTimeHtml = "<span>" + publishTime + "</span>";
+									if(publishTime.length==11){
+										if(publishTime.slice(0,1)!="_"){
+		                        	 		var publishtime_=publishTime.slice(0,10);
+		                        	 		publishTime=timestampToTime(publishtime_);
+		                        	 		publishTime=publishTime+"-";
+		                        	 	}else{
+		                        	 		var publishtime_=publishTime.slice(1,11);
+		                        	 		publishTime=timestampToTime(publishtime_);
+		                        	 		publishTime="&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp-"+publishTime;
+		                        	 	}
+										publishTimeHtml = "<span>" + publishTime + "</span>";
+									}else{
+										publishTimeHtml = "<span>" + publishTime + "</span>";
+									}
+									
 								}
 								if (!orderMoney) {
 									orderMoney = 0;
@@ -375,7 +389,6 @@
 									keysHtml += "<li class=\"gjc\" style=\"height: 66px; line-height: 66px;\">";
 									keysHtml += "</li>";
 								}
-
 								temp += "<li>" +
 									"<div class=\"info " + cla + "\">" +
 									"<span>" + obj.create_time + "</span>" +
@@ -624,6 +637,15 @@
 				$("#myModal").modal("hide");
 				clearInterval(interval);
 			});
+			
+			//时间格式化
+		    function timestampToTime(timestamp) {
+		        var date = new Date(timestamp * 1000);
+		        Y = date.getFullYear() + '.';
+		        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '.';
+		        D = date.getDate();
+		        return Y+M+D;
+		    }
 		</script>
 	</body>
 </html>