// JavaScript Document $(function(){ //alert("sciresouser"); loginStatus();//判断个人是否登录 var userid = $.cookie("userid"); var name = $.cookie("userName"); var flag; ////发布资源发布及修改 var resourceNamePass = true; //var professorPass=true; var supportedServicesPass=true; function resourceName() { var code = $("#resourceName").val(); if(code.length==0||code==" ") { $(".workmsg1").text("发布资源名称不能为空"); resourceNamePass = false; } else { $(".workmsg1").text(""); resourceNamePass= true; } } $("#resourceName").blur(function(){ resourceName(); }); //验证可提供服务 function supportedServices() { var code = $("#supportedServices").val(); if(code.length==0||code==" ") { $(".workmsg3").text("可提供服务不能为空"); supportedServicesPass= false; } else { $(".workmsg3").text(""); supportedServicesPass= true; } } $("#supportedServices").blur(function(){ supportedServices(); }); function industryShow(data,industryList,deleteIndustry) { if(data != undefined && data.length != 0 ) { var subs = new Array(); if(data.indexOf(',')) { subs = data.split(','); } else { subs[0] = data; } if(subs.length>0) { for (var i = 0; i < subs.length; i++) { $("#"+industryList+"").append("
"+ subs[i] +"
"); }; } } } //添加或者删除应用行业及学术领域 function addDele(){ $("#industryList").on("click",".removeNu",function(){ $(this).parent().remove(); }); $("#industryAdd").click(function(){ var val=$("#industry").val(); $("#industryList").append("
"+ val +"
") }); $("#SubjectList").on("click",".removeNu",function(){ $(this).parent().remove(); }); $("#subjectAdd").click(function(){ var val=$("#subject").val(); $("#SubjectList").append("
"+ val +"
") }); } //我的资源的删除,修改 $("#workmysrc").on("click",".resoumag",function() { ResourceInfo(); addDele() $(".limitBox").removeClass("limitBox"); $(".limitwords").removeClass("limitwords"); $(".limitwordbox").removeClass("limitwordbox"); $(".respublisher").css("display","none"); $(".stateinfor span").text("资源发布中"); var resourceID=$(this).attr("resourceId"); function delet(){ $.ajax({ "url" : "/ajax/resource/"+resourceID, "type" : "DELETE", "success" : function($data) { if ($data.success) { $(".blackcover").remove(); $("body").css("position",""); getDataResource(); } else { $.MsgBox.Alert('message',$data.msg); } } }) } if(resourceID){ $("#deletedResource").on("click",function(){ $(".blackcover").remove(); $("body").css("position",""); $.MsgBox.Confirm("消息", "执行删除后资源信息将无法恢复,确定继续吗?",delet) }) $.ajax({ "url":"/ajax/resource/"+resourceID, "type":"get", "async": true, "success":function(info){ if(info.success) { //console.log(info); $("#resourceName").val(info.data.resourceName); $("#supportedServices").val(info.data.supportedServices); $("#hopePayMethod").val(info.data.hopePayMethod) ; $("#cooperationNotes").val(info.data.cooperationNotes) ; industryShow(info.data.subject,"SubjectList","deleteSubject"); industryShow(info.data.industry,"industryList","deleteIndustry"); $("#descp").val(info.data.descp); $("#professor").text(name); if(info.data.images.length) { var $liMages = $( '
'+ ''+ '
' ) } else { var $liMages = $( '
'+ ''+ '
' ) } $("#fileList").append($liMages); } else { $.MsgBox.Alert('message',"系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failed')} }); } function captiureSubInd(subIndu) { var industrys = $("#"+subIndu+""); var industryAll = ""; if(industrys.size()>0){ for (var i = 0; i
  • '+data.data[i].supportedServices+'
  • ' /*add+='
  • '+data.data[i].subject+'
  • ' */ add+='' add+='资源管理' add+='
    ' add+='' add+='' add+='
    申请时间需求方联系人交付时间付款进程状态/操作
    '; $add = $(add); $("#consd").append($add); if(data.data[i].subject==undefined){ $(".li1").eq(i).css({"display":"none"}); } $add.find('.resoumag').attr("resourceId",data.data[i].resourceId); //$('.resoumag').eq(i+1).attr("resourceId",data.data[i].resourceId); if(data.data[i].images.length){ $add.find(".resourceImg").attr("src","/images/resource/"+data.data[i].resourceId+".jpg"); } else { $add.find(".resourceImg").attr("src","/images/default-resource.jpg"); } //console.log($('.resoumag').eq(i+1).attr("resourceId")); //资源所对应的记录 (function(i){ getPageResource(3,1,true,i,k) k++; })(i); add=""; } } else { $.MsgBox.Alert('message',"系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failed')} }); } function getPageResource(pageSize,pageNo,isbind,e,f) { $.ajax({ "url":"/ajax/operation/pqres", "type":"get", "async": false, "data":{"resourceId":$('.resoumag').eq(e+1).attr("resourceId"),"pageSize":pageSize,"pageNo":pageNo}, "success":function(data){ if(data.success) { $(".maintab").eq(f).find(".workitem").remove(); for(var j=0;j' addString+=''+data.data.data[j].applysquare+'' addString+=' '+data.data.data[j].professor.name+'' addString+=''+data.data.data[j].deliverTime+'' //addString+=''+data.data.data[j].dealPrice+'' //addString+=''+data.data.data[j].payMethod+'' addString+=''+inquiry+'/'+data.data.data[j].dealPrice+'
    ' addString+='
    ' $(".tablecon").eq(e).append(addString); //console.log($(".tablecon").eq(e)); if($(".price1"+e+"").eq(j).text()==0){ $(".price1"+e+"").eq(j).text(""); } switch(data.data.data[j].operationStatus) { case 1: var string='新的申请
    ' string+='' string+='回复申请
    ' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 2: var string='已发送报价待对方确认
    ' string+='' string+='修改报价
    ' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 3: var string='对方发来报价合作进行中
    ' string+='' string+='查看详情
    ' string+='退款
    ' string+='投诉' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 4: var string='对方拒绝报价合作结束
    ' string+='' string+='查看详情
    ' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 5: var string='本人拒绝合作
    ' string+='' string+='查看详情
    ' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 6: var string='对方中止合作合作结束
    ' string+='' string+='查看详情
    ' //string+='评价
    ' string+='退款
    ' string+='投诉' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 7: var string='合作进行中
    ' string+='' string+='查看详情
    ' //string+='确认完成
    ' string+='投诉' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; case 8: var string='完成
    ' string+='' string+='查看详情
    ' //string+='评价
    ' string+='投诉' string+='
    ' $(".modification"+e+"").eq(j).html(string); break; default: } addString=""; } if(data.data.total == 0){ }else{ if(isbind == true) { $(".tcdPageCod"+e+"").createPage({ pageCount:Math.ceil(data.data.total/pageSize), current:data.data.pageNo, backFn:function(p){ getPageResource(3,p,false,e,f); } }); } } } else { $.MsgBox.Alert("消息","系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failed')} }); } //我的资源状态的回复 $("#consd").on("click",".detailmess",function(){ $(".stateinfor span").text("回复申请"); var operationId=$(this).attr("operationId"); var operationStatus=$(this).attr("operationStatus"); var priceDifference=$(this).attr("dealPrice"); opo=operationId; flag=0; if(flag==0&&operationStatus==1) { ResourceApply(); //移出有textare标签的相关class $(".limitBox").eq(1).removeClass("limitBox"); $(".limitwords").eq(1).removeClass("limitwords"); $(".limitwordbox").eq(1).removeClass("limitwordbox"); ajaxGet(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $("#nextStep").click(function(){ $(".stateinfor span").text("报价中"); $(".btnboxup").css({"display":"none"}); $(".btnboxdown").css({"display":"block"}); $(".applysure").css({"display":"block"}); $(".bag").css("display","none"); $("#reject").hide(); $(".frm").click(function(){ var $date = {}; $date.detailDemand=$(".detail").text(); $date.deliverTime=replaceStr($.trim($(".dealTime").text())); $date.dealPrice =$.trim($("#dealPrice").val()); $date.payMethod = $.trim($("#payMethod").val()); $date.replyNotes = $("#consultContent").val(); $date.applysquare = $(".sname").text(); $date.operationId=operationId; $date.operationStatus=2; $.ajax({ "url" : "/ajax/operation", "type" : "put", "data" :JSON.stringify($date), "contentType" :"application/json", "success" : function(data) { if (data.success) { $(".blackcover").remove(); $("body").css("position",""); getDataResource(); $.MsgBox.Alert('message',"报价成功"); $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain'); } else { $.MsgBox.Alert('message',data.msg); } }, "beforeSend":function(){ //console.log(this.data); }, }); }) }) $("#refuses").click(function(){ ResourceApply(); ajaxGet(operationId); n=5; $(".blackcover").remove(); $("body").css("position",""); $.MsgBox.Confirm("消息", "确定拒绝吗?",upStatus1); }); } if(flag==0&&operationStatus==2){ ResourceApply(); //移出有textare标签的相关class $(".limitBox").eq(1).removeClass("limitBox"); $(".limitwords").eq(1).removeClass("limitwords"); $(".limitwordbox").eq(1).removeClass("limitwordbox"); ajaxGet(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $(".stateinfor span").text("修改报价中"); $(".btnboxup").css({"display":"none"}); $(".btnboxdown").css({"display":"block"}); $(".applysure").css({"display":"block"}); $(".bag").css("display","none"); $(".frm").click(function(){ var $date = {}; $date.detailDemand=$(".detail").text(); $date.deliverTime=replaceStr($.trim($(".dealTime").text())); $date.dealPrice = $("#dealPrice").val(); $date.payMethod = $("#payMethod").val(); $date.replyNotes = $("#consultContent").val(); $date.applysquare = $(".sname").text(); $date.operationId=operationId; $date.operationStatus=2; $.ajax({ "url" : "/ajax/operation", "type" : "put", "data" :JSON.stringify($date), "contentType" :"application/json", "success" : function(data) { if (data.success) { $(".blackcover").remove(); $("body").css("position",""); getDataResource(); $.MsgBox.Alert('message',"报价成功"); $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain'); } else { $.MsgBox.Alert('message',data.msg); } }, "beforeSend":function(){ //console.log(this.data); }, }); }) } if(flag==0&&operationStatus==3){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference) } if(flag==0&&operationStatus==5){ ResourceApply(); ajaxGet(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $(".addrebtn").css("display","none"); } if(flag==0&&operationStatus==4){ ResourceApply(); ajaxGet1(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $(".stateinfor span").text("详情"); $(".btnboxup").css({"display":"none"}); $(".btnboxdown").css({"display":"block"}); $(".applysure").css({"display":"block"}); $(".bag").css("display","none"); $(".addrebtn").css("display","none"); $("#payMethod").replaceWith(""); $("#dealPrice").replaceWith(""); $("#consultContent").replaceWith(""); } if(flag==0&&operationStatus==6){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference) } if(flag==0&&operationStatus==7){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); //根据内容的多少获取高度给父级设置高度 limitHeight(); discussGetPaidMoney(operationId,priceDifference) } if(flag==0&&operationStatus==8){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); //根据内容的多少获取高度给父级设置高度 limitHeight(); discussGetPaidMoney(operationId,priceDifference) } }) //我的需求查询 function getPageData(pageSize,pageNo,isbind){ $.ajax({ "url":"/ajax/operation/pqdem", "type":"get", "async": true, "data":{"demandId":userid,"pageSize":pageSize,"pageNo":pageNo}, "success":function(data){ if(data.success) { $(".worktabb").html(""); var stringTitle=""; stringTitle +='申请时间需求资源发布者交付时间付款进程状态/操作'; $(".worktabb").append( stringTitle); //console.log(data); //alert(data.data.data.length); for(var i=0;i' stringContent +=''+data.data.data[i].resource.resourceName+'' stringContent +=' '+data.data.data[i].resource.professor.name+'' stringContent +=''+data.data.data[i].deliverTime+'' //stringContent +=''+data.data.data[i].dealPrice+'' //stringContent +=''+data.data.data[i].payMethod+'' stringContent +=''+inq+'/'+data.data.data[i].dealPrice+'
    ' stringContent +='
    ' $(".worktabb").append( stringContent); if($(".price2").eq(i).text()==0){ $(".price2").eq(i).text(""); } switch(data.data.data[i].operationStatus) { case 1: var string='申请已发送待对方确认
    ' string+='' string+='修改申请
    ' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 2: var string='对方发来报价
    ' string+='' string+='回复报价
    ' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 3: var string='合作进行中
    ' string+='' string+='查看详情
    ' string+='付款
    ' string+='中止合作' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 4: var string='本人拒绝合作
    ' string+='' string+='查看详情
    ' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 5: var string='对方拒绝合作合作结束
    ' string+='' string+='查看详情
    ' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 6: var string='本人中止合作
    ' string+='' string+='查看详情
    ' //string+='评价
    ' string+='投诉' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 7: var string='合作进行中
    ' string+='' string+='查看详情
    ' string+='确认完成
    ' string+='投诉' string+='
    ' $(".loginStatus").eq(i).html(string); break; case 8: var string='完成
    ' string+='' string+='查看详情
    ' //string+='评价
    ' string+='投诉' string+='
    ' $(".loginStatus").eq(i).html(string); break; default: } } if(data.data.total == 0){ }else{ if(isbind == true) { $(".tcdPageCode1").createPage({ pageCount:Math.ceil(data.data.total/pageSize), current:data.data.pageNo, backFn:function(p){ getPageData(pageSize,p,false); }, }); } } } else { $.MsgBox.Alert('message',"系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } getPageData(6,1,true); //确认完成 $("#workmysrc2").on("click",".acknowledgement",function(){ opo=$(this).attr("operationId"); n=8; $.MsgBox.Confirm("消息", "确认合作完成?",upStatus); }) //退款 $(".workmysrc").on("click",".drawback",function(){ DetailInfo(); $(".resoubox").css("display","none"); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); var op=$(this).attr("operationId"); opo=op; var $price=$(this).attr("dealPrice"); $("#totalPrice").text($price); discussGetPaidMoney(opo,$price); $("#paytit").on("click",".ret",function(){ var payStatus=$(this).attr("payStatus"); //console.log(payStatus); if(payStatus==0){ payHistoryId=$(this).attr("payhistoryid"); getPayhistoryData(); } }); function getPayhistoryData(){ $.ajax({ "url":"/ajax/payhistory/status", "type":"post", "async": true, "data":{"payHistoryId":payHistoryId,"payStatus":"1"}, "success":function(data) { if(data.success) { $("#paytit").find(".payitem").remove(); discussGetPaidMoney(opo,$price); } else { $.MsgBox.Alert('message',"系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } $(".panbtn").click(function(){ var payed= Number($("#realCharge").text());//已经收到的付款 var paying= Number($("#payMoney").val());//此次正在付入金额 //alert(payed+","+paying); if(paying <= payed) { $.MsgBox.Confirm("消息", "确定退款吗?",getPay1) } if(paying > payed){ $.MsgBox.Alert('消息',"您所退的款项有误,请核对您已经收到的款项"); } }); }); //付款 function getPay(){ $.ajax({"url" : "/ajax/payhistory", "type" : "POST", "success" : function(rdata) { if (rdata.success) { $(".blackcover").remove(); $("body").css("position",""); getPageData(6,1,false); } else { $.MsgBox.Alert('消息',"付款失败!"); } }, "data" :{"operationId":opo,"paidMoney":$("#payMoney").val(), "remark":$("#payRemark").val(),"payStatus":$("#payStatus").val(),"professorId":userid, "isonline":$("#isOnline").find("option:selected").val()}, "contentType" :"application/x-www-form-urlencoded", "beforeSend":function(){}, dataType : "json" }); } //退款 function getPay1(){ $.ajax({"url" : "/ajax/payhistory", "type" : "POST", "success" : function(rdata) { if (rdata.success) { $(".blackcover").remove(); $("body").css("position",""); getDataResource(); } else { $.MsgBox.Alert('消息',"付款失败!"); } }, "data" :{"operationId":opo,"returnMoney":$("#payMoney").val(), "remark":$("#payRemark").val(),"payStatus":$("#payStatus").val(),"professorId":userid, "isonline":$("#isOnline").find("option:selected").val()}, "contentType" :"application/x-www-form-urlencoded", "beforeSend":function(){}, dataType : "json" }); } $(".workmysrc").on("click",".payMonety",function(){ DetailInfo(); $(".resoubox").css("display","none"); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); opo=$(this).attr("operationId"); var $price=$(this).attr("dealPrice"); $("#totalPrice").text($price); discussGetPaidMoney(opo,$price); $("#paytit").on("click",".ret",function(){ var payStatus=$(this).attr("payStatus"); //console.log(payStatus); if(payStatus==0){ payHistoryId=$(this).attr("payhistoryid"); getPayhistoryData(); } }); function getPayhistoryData(){ $.ajax({ "url":"/ajax/payhistory/status", "type":"post", "async": true, "data":{"payHistoryId":payHistoryId,"payStatus":"1"}, "success":function(data) { if(data.success) { $("#paytit").find(".payitem").remove(); discussGetPaidMoney(opo,$price); } else { $.MsgBox.Alert('message',"系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } $("#panaddbtn").click(function(){ var aa= Number($("#payMoney").val()); var bb=Number($("#balance").text()); if(aabb){ $.MsgBox.Alert('消息',"所付款项已经超出预计款项!"); } if(aa==bb){ $.MsgBox.Confirm("消息", "确定支付吗?",getPay); n=7; upStatus(); $.MsgBox.Alert('消息',"款项已经全部付清!"); } }); }); function inquiryGetPaidMoney(operationId){ var realCharge=0,balance=0; $.ajax({ "url":"/ajax/payhistory/qadetail", "type":"get", "async": false, "data":{"operationId":operationId}, "success":function(data){ if(data.success) { var $data=data.data; var m; for(var i=0;i<$data.length;i++) { if($data[i].paidMoney==undefined) { $data[i].paidMoney=0; } if($data[i].returnMoney==undefined) { $data[i].returnMoney=0; } m=$data[i].paidMoney-$data[i].returnMoney; realCharge+=m; } } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); return realCharge; } //获取订单付款历史记录 function discussGetPaidMoney(operationId,priceDifference){ var realCharge=0,balance=0; $.ajax({ "url":"/ajax/payhistory/qadetail", "type":"get", "async": true, "data":{"operationId":operationId}, "success":function(data){ if(data.success){ //console.log(data); var popHtml=""; var $data=data.data; var m; for(var i=0;i<$data.length;i++){ if($data[i].paidMoney==undefined) { $data[i].paidMoney=0; } if($data[i].returnMoney==undefined) { $data[i].returnMoney=0; } if($data[i].remark==undefined) { $data[i].remark="--"; } PopHtml = ''; PopHtml += '
    '+changeTime($data[i].createTime)+'
    '; PopHtml += '
    '+$data[i].professor.name+'
    '; PopHtml += '
    '; PopHtml += '
    '; if(userid==$data[i].professor.id){ PopHtml += '
    '; }else{ PopHtml += '
    '; } PopHtml += '
    '+$data[i].remark+'
    '; PopHtml += ''; $("#paytit").append(PopHtml); m=$data[i].paidMoney-$data[i].returnMoney; $(".to").eq(i).text(m); if($data[i].isonline==0){ $(".resou").eq(i).text("线上支付"); }else{ $(".resou").eq(i).text("线下支付"); } if($data[i].payStatus==0){ $(".resta").eq(i).text("未确认"); }else{ $(".resta").eq(i).text("确认收款"); } popHtml=""; realCharge+=m; } balance=priceDifference-realCharge; $("#balance").text(balance); $("#realCharge").text(realCharge); } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } //中止合作 $(".workmysrc").on("click",".stopcoo",function(){ opo=$(this).attr("operationId"); n=6; $.MsgBox.Confirm("消息", "你确定要中止吗?",upStatus); }); //评论 var start; $(".workmysrc").on("click",".discuss",function(){ var resourceId=$(this).attr("resourceId"); var operationId=$(this).attr("operationId"); var dataStatus=$(this).attr("dataStatus"); getAssess1(operationId); CommentInfo(); if(lengths==0&&dataStatus==0){ $(".sqlcomment").css("display","none"); $(".evastar2").click(function(){ $(".evastar2").removeClass('span'); start=$(this).index()+1; for(var i=0;i' string+='
      ' string+='
    • '+$data[0].resource.resourceName+'资源的合作2016-09-06
    ' string+='
    ' string+='

    '+$data[0].descp+'

    ' string+='
    ' string+='
    对方还未评价
    ' $("#commbox").append(string); //console.log($data[0].starLevel); for(var i=0;i<$data[0].starLevel;i++) { //console.log(i); $(".evastar1").eq(i).addClass('span'); } }else if(le==2){ for(var j=0;j<2;j++){ var string=""; string+='
    ' string+='

    '+ $data[j].professor.name +'

    ' string+='
      ' string+='
    • '+$data[j].resource.resourceName+'资源的合作2016-09-06
    ' string+='
    ' string+='

    '+$data[j].descp+'

    ' string+='
    ' $("#commbox").append(string); if(j==0) { for(var i=0;i<$data[j].starLevel;i++) { //console.log(i); $(".evastar1").eq(i).addClass('span'); } } else{ for(var i=0;i<$data[j].starLevel;i++) { //console.log(i); $(".evastar1").eq(i+5).addClass('span'); } } string=""; } } } else { //alert("jjj"); } }, "data" :{"operationId":operationId}, "contentType" :"application/x-www-form-urlencoded", dataType : "json" }); } function discussContent(){ $.ajax({ "url":"/ajax/assess", "type":"post", "async": true, "data":{"operationId":operationId,"professorId":userid,"resourceId":resourceId,"starLeval":start,"descp":$("#discussContent").val()}, "success":function(data){ if(data.success) { location.reload(true); } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } //我的需求中修改申请,对方已经回复(合作),我拒绝合作或者约对方合作 function getIdentity(professorId){ $.ajax({ "url":"ajax/professor/"+professorId, "type":"get", "async": false, "success":function(data){ if(data.success) { $("option")[0].value=data.data.name; $("option")[1].value=data.data.organization.name; } else { $.MsgBox.Alert("消息","系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }) } $(".workmysrc").on("click",".detailm",function(){ var resourceId=$(this).attr("resourId"); var operationStatus=$(this).attr("operationStatus"); var operationId=$(this).attr("operationId"); var priceDifference=$(this).attr("dealPrice"); flag=1; opo=operationId; if(flag==1&&operationStatus==1) { ResourceApply(); $(".limitBox").removeClass("limitBox"); $(".limitwords").removeClass("limitwords"); $(".limitwordbox").removeClass("limitwordbox"); $( "#datepicker" ).datepicker({ "dateFormat":" yy-mm-dd"}); $(".stateinfor span").text("修改申请中"); $(".btnboxup").css({"display":"none"}); $(".applysure").css({"display":"none"}); ajaxGet(operationId,1,1); getIdentity(userid); //if($(".dealTime").val()!=""&&$(".detail").val()!="") //{ $("#deliver").on("click",function() { var $data = {}; $data.demandId = userid; $data.resourceId = resourceId; $data.operationId=operationId; $data.detailDemand=$(".detail").val(); $data.deliverTime=replaceStr($.trim($("#datepicker").val())); $data.applysquare=$("select option:selected").val(); $data.operationStatus=1; $.ajax({ "url" : "/ajax/operation", "type" : "put", "success" : function(rdata) { if (rdata.success){ getPageData(6,1,false); $(".blackcover").remove(); $("body").css("position",""); $.MsgBox.Alert('消息',"资源申请信息修改成功"); $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain'); } else { $.MsgBox.Alert('消息',"资源申请信息修改失败"); } }, "data" : JSON.stringify($data) , "contentType" :"application/json", dataType : "json" }); }); //} } if(flag==1&&operationStatus==2) { ResourceApply(); ajaxGet1(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $(".stateinfor span").text("回复报价中"); $(".btnboxup").css({"display":"none"}); $(".btnboxdown").css({"display":"block"}); $(".applysure").css({"display":"block"}); $(".bag").css("display","none"); $(".sendpri").text(""); $("#payMethod").replaceWith(""); $("#dealPrice").replaceWith(""); $("#consultContent").replaceWith(""); $("#del")[0].value="合作"; $("#reject")[0].value="直接拒绝"; $("#reject").click(function(){ n=4; $(".blackcover").remove(); $("body").css("position",""); $.MsgBox.Confirm("消息", "确定继续吗?",upStatus); }) $("#del").click(function(){ n=3; $(".blackcover").remove(); $("body").css("position",""); upStatus(); }) } if(flag==1&&operationStatus==3){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference); } if(flag==1&&operationStatus==4){ ResourceApply(); ajaxGet1(operationId); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); $(".sendpri").text(""); $(".stateinfor span").text("详情"); $(".resde").text("详情页面"); $(".btnboxup").css({"display":"none"}); $(".btnboxdown").css({"display":"block"}); $(".applysure").css({"display":"block"}); $(".bag").css("display","none"); $(".addrebtn").css("display","none"); $("#payMethod").replaceWith(""); $("#dealPrice").replaceWith(""); $("#consultContent").replaceWith(""); } if(flag==1&&operationStatus==5){ ResourceApply(); ajaxGet(operationId); $(".stateinfor").find("span").text("合作结束"); $(".dealTime").replaceWith(""); $(".detail").replaceWith(""); $("select").replaceWith("") $(".btnboxdown").css({"display":"none"}); $(".applysure").css({"display":"none"}); //$(".resouinfotype2").text(""); $(".addrebtn").css("display","none"); } if(flag==1&&operationStatus==6){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".filebox").css("display","none"); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference) } if(flag==1&&operationStatus==7){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference) } if(flag==1&&operationStatus==8){ DetailInfo(); $("#totalPrice").text(priceDifference); $(".liuyaninfo").css("display","none"); $(".pingjiainfo").css("display","none"); $(".filebox").css("display","none"); ajaxGet1(operationId); $(".payaddbox1").css("display","none"); discussGetPaidMoney(operationId,priceDifference) } }) //获取评论 function discussGetContent(operationId){ $.ajax({ "url":"/ajax/assess/qaoper", "type":"get", "async": true, "data":{"operationId":operationId}, "success":function(data){ if(data.success){ //console.log(data); } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } //更新状态 function upStatus(){ $.ajax({"url" : "/ajax/operation/operationStatus", "type" : "POST", "success" : function(rdata) { if (rdata.success) { getPageData(6,1,false); } else { $.MsgBox.Alert('message','状态更新失败'); } }, "data" :{"operationId":opo,"operationStatus":n}, "beforeSend":function(){/*console.log(this.data)*/}, "contentType" :"application/x-www-form-urlencoded", dataType : "json" }); } function upStatus1(){ $.ajax({"url" : "/ajax/operation/operationStatus", "type" : "POST", "success" : function(rdata) { if (rdata.success) { getDataResource(); } else { $.MsgBox.Alert('message','状态更新失败'); } }, "data" :{"operationId":opo,"operationStatus":n}, "beforeSend":function(){/*console.log(this.data)*/}, "contentType" :"application/x-www-form-urlencoded", dataType : "json" }); } //我的需求,获取每条记录的数据根据合作id function ajaxGet(operationId,o,p){ $.ajax({ "url":"/ajax/operation/"+operationId, "type":"get", "async": true, "success":function(data){ if(data.success) { //console.log(data); $(".log").text(data.data.resource.resourceName); $(".timelog").text(changeTime(data.data.createTime)); $(".contration").text(data.data.operationId); $(".detail").text(data.data.detailDemand); if(o==1&&p==1){ $(".dealTime").val(changeTime(data.data.deliverTime)); }else{ $(".dealTime").text(changeTime(data.data.deliverTime)); } if(data.data.professor.name==data.data.applysquare){ $("select").find("option[title=个人]").attr("selected",true); }else{ $("select").find("option[title=所属机构]").attr("selected",true); } $(".sname").text(data.data.applysquare); $(".namecon").text(data.data.resource.professor.name); $(".resouImage").attr("src","/images/resource/"+data.data.resource.resourceId+".jpg"); $(".resouImage").load(function(){}) .error(function(){ $(this).attr("src","/images/default-resource.jpg"); }); if(data.data.payMethod){ $("#payMethod").val(data.data.payMethod); } if(data.data.dealPrice){ $("#dealPrice").val(data.data.dealPrice); } if(data.data.replyNotes){ $("#consultContent").val(data.data.replyNotes); } //根据内容的多少获取高度给父级设置高度 limitHeight(); } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } function ajaxGet1(operationId){ $.ajax({ "url":"/ajax/operation/"+operationId, "type":"get", "async": true, "success":function(data){ if(data.success) {//console.log(data); $(".log").text(data.data.resource.resourceName); $(".timelog").text(changeTime(data.data.createTime)); $(".contration").text(data.data.operationId); $(".detail").text(data.data.detailDemand); $(".dealTime").text(changeTime(data.data.deliverTime)); $(".namecon").text(data.data.resource.professor.name); $(".sname").text(data.data.applysquare); $(".resouImage").attr("src","/images/resource/"+data.data.resource.resourceId+".jpg"); $(".resouImage").load(function(){}) .error(function(){ $(this).attr("src","/images/default-resource.jpg"); }); if(data.data.payMethod){ $("#payMethod").text(data.data.payMethod); } if(data.data.dealPrice){ $("#dealPrice").text(data.data.dealPrice); } if(data.data.replyNotes){ $("#consultContent").text(data.data.replyNotes); } //根据内容的多少获取高度给父级设置高度 limitHeight(); } else { //console.log("系统异常!"); } }, "error":function(){$.MsgBox.Alert('message','failddd')} }); } /*科研资源菜单点击切换*/ $(".worksamlltit1").click(function(){ var index = $(this).index(); $(this).addClass("worksamlltitnow").siblings().removeClass("worksamlltitnow"); $(".workmysrc1").eq(index).show().siblings().hide(); }); });