浏览代码

需求列表

wangshan 9 年之前
父节点
当前提交
c6697d977e
共有 3 个文件被更改,包括 106 次插入3 次删除
  1. 26 0
      core/src/qfw/searchmarket/demand.go
  2. 1 1
      core/src/timetask.json
  3. 79 2
      core/src/web/templates/service/viewsingledemand.html

+ 26 - 0
core/src/qfw/searchmarket/demand.go

@@ -32,6 +32,32 @@ type Demand struct {
 	getpcode    xweb.Mapper `xweb:"POST /market/pcode"`
 	quote       xweb.Mapper `xweb:"POST /market/quote"` //查询服务商报价
 	blogin      xweb.Mapper `xweb:"/market/demand/blogin"`
+	demandList  xweb.Mapper `xweb:"/market/demand/list"`
+}
+
+//需求列表
+func (d *Demand) DemandList() error {
+	id := d.GetString("id")
+	if d.Is("GET") {
+		return d.Render("/market/demandview/" + id + ".html")
+	} else {
+		limit, _ := d.GetInteger("pageSize")
+		currentPage, _ := d.GetInteger("currentPage")
+		start := (currentPage - 1) * limit
+		var count int
+		var r []map[string]interface{}
+		searchtype := "demand"
+		tempQuery := `{"query":{"bool":{"must":[{"term":{"s_enterpriseid":"` + id + `"}}],"must_not": { "terms" : {"i_status":[4]}}}}}`
+		sort := `{"l_createdate":"desc"}`
+		if currentPage == 1 {
+			count = int(Count(searchtype, searchtype, tempQuery))
+		}
+		//
+		query := `{"query":{"bool":{"must":[{"term":{"s_enterpriseid":"` + id + `"}}],"must_not": { "terms" : {"i_status":[4]}}}},"from":` + fmt.Sprintf("%v", start) + `,"size":` + fmt.Sprintf("%v", limit) + `,"sort":[` + sort + `]}`
+		r = *Get(searchtype, searchtype, query)
+		d.ServeJson(M{"list": r, "count": count})
+		return nil
+	}
 }
 
 func (d *Demand) Index(id string) error {

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-05-26 13:34:30"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-05-26 13:34:30"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-06-06 15:49:24"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-06-06 15:49:24"}},"marketisstart":true,"marketrate":300}

+ 79 - 2
core/src/web/templates/service/viewsingledemand.html

@@ -27,12 +27,12 @@
 			}
 			.a-bg-gray-new{
 				display:inline-block;
-				height:21px;
+				height:22px;
 				width:81px;
 				background:#FFF;
 				background-image:url({{Msg "seo" "cdn"}}/images/tbn9.png);
 				position: relative;
-			  	  top: -4px;
+			  	/*top: -4px;*/
 			}
 			.d-bg-green, .d-bg-gray,.d-bg-blue{
 				width:81px;
@@ -52,6 +52,39 @@
 			.a-c-right>.a-com-title {
 				margin-top:10px !important;
 			}
+			.xq-introduction{
+				height:38px;overflow: hidden;text-overflow: ellipsis;margin-top: 10px;
+			}
+			.xq-introduction p{
+				font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif  !important;
+				line-height:20px !important;
+				color:#999 !important; 
+			}
+			.xq-introduction span{
+				font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif  !important;
+				line-height:20px !important;
+				color:#999 !important; 
+			}
+			.xq-img{
+				float:left;width:15%;
+			}
+			.xq-img img{
+				width:100px;
+			}
+			.xq-intro{
+				float:left;width:84%;
+			}
+			.xq-title{
+				float:left;width: 70%;font-size: 16px;height: 45px;line-height: 20px;padding-top: 5px;overflow: hidden;text-overflow: ellipsis;
+			}
+			.xq-state{
+				float:left;padding-top:5px;margin-left:20px;
+			}
+			.xq-list {
+				height: 120px;
+				border-bottom: 1px solid #f0f0f0;
+				margin: 20px 0px;
+			}
 		</style>
 		    {{include "/common/inc.html"}}
     <!-- extra CSS -->
@@ -209,6 +242,7 @@
 			<div class="m-title">
 				<span class="f-d u-focus">需求描述</span>
 				<span class="f-s">服务商报价</span>
+				<span class="f-s">需求列表</span>
 			{{if eq 1 2}}	<span class="f-s">评价详情</span>{{end}}
 			</div>
 			<div class="m-content">
@@ -242,6 +276,18 @@
 				
 				</div>
 				{{end}}
+				<div class="f-s f-display">
+					<div class="table a-table margin-t-20" id="demandList">
+						<div id="tableTitle">
+							
+							
+						</div>
+						
+						<div>
+							<div class="text-center" id="demandPaging"></div>
+						</div>
+					</div>
+				</div>
 			</div>
 		</div>
       </div>
@@ -251,6 +297,37 @@
     </div>
 	{{include "/service/bid.html"}}
 	<script charset="utf-8" src="/js/paging.js"></script>
+	<script>
+	
+	var paging;
+	$(function(){
+		 paging = new Paging("demandPaging","/market/demand/list",{id:{{.T.demandInfo.s_enterpriseid}}},5,function(r){
+			var html = '';
+			for(var i=0; i< r.length;i++){
+				var status = "";
+				if (r[i].i_status == 1){
+					status = "<img src='/images/u288.png'/>"
+				}else if(r[i].i_status == 2){
+					status = "<img src='/images/u252.png'/>"
+				}else{
+					status = "<span class='a-bg-gray-new'>任务超时</span>"
+				}
+				html +='<div  data-id="'+r[i]._id+'" class="xq-list">'
+						+'<div class="xq-img"><img src="'+r[i].s_image+'"></div>'
+						+'<div class="xq-intro"><div>'
+						+'<div class="xq-title"><a href="/market/demandview/'+r[i]._id+'.html">'+r[i].s_name+'</a></div>'
+						+'<div class="xq-state">'+status+'</div>'
+						+'<div style="clear:both;"></div></div>'
+						+'<div class="xq-introduction">'+r[i].s_introduction+'</div></div>'
+						+'<div style="clear:both;"></div></div>';
+			}
+			$("#demandList #tableTitle").nextAll("[data-id]").remove();
+			$("#demandList #tableTitle").after(html);
+		
+		});
+	});
+
+	</script>
 	<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdPic":"http://test.qimingxing.info/upload/2015/10/27/2015102708191301041479.jpg","bdStyle":"0","bdSize":"16","onAfterClick":function(){$.post("/member/credit/inCreditAjx",{"param":"fx"},function(r){})}},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
 	<script>