portal html css js resource

sciresource.js 60KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659
  1. // JavaScript Document
  2. $(function(){
  3. //alert("sciresouser");
  4. loginStatus();//判断个人是否登录
  5. var userid = $.cookie("userid");
  6. var name = $.cookie("userName");
  7. var flag;
  8. ////发布资源发布及修改
  9. var resourceNamePass = true;
  10. //var professorPass=true;
  11. var supportedServicesPass=true;
  12. function resourceName()
  13. {
  14. var code = $("#resourceName").val();
  15. if(code.length==0||code==" ")
  16. {
  17. $(".workmsg1").text("发布资源名称不能为空");
  18. resourceNamePass = false;
  19. }
  20. else
  21. {
  22. $(".workmsg1").text("");
  23. resourceNamePass= true;
  24. }
  25. }
  26. $("#resourceName").blur(function(){
  27. resourceName();
  28. });
  29. //验证可提供服务
  30. function supportedServices()
  31. {
  32. var code = $("#supportedServices").val();
  33. if(code.length==0||code==" ")
  34. {
  35. $(".workmsg3").text("可提供服务不能为空");
  36. supportedServicesPass= false;
  37. }
  38. else
  39. {
  40. $(".workmsg3").text("");
  41. supportedServicesPass= true;
  42. }
  43. }
  44. $("#supportedServices").blur(function(){
  45. supportedServices();
  46. });
  47. function industryShow(data,industryList,deleteIndustry)
  48. {
  49. if(data != undefined && data.length != 0 )
  50. {
  51. var subs = new Array();
  52. if(data.indexOf(','))
  53. {
  54. subs = data.split(',');
  55. }
  56. else
  57. {
  58. subs[0] = data;
  59. }
  60. if(subs.length>0)
  61. {
  62. for (var i = 0; i < subs.length; i++)
  63. {
  64. $("#"+industryList+"").append("<div class='"+deleteIndustry+"'>"+ subs[i] +"<span class='removeNu'><img src='images/move.png'></span></div>");
  65. };
  66. }
  67. }
  68. }
  69. //添加或者删除应用行业及学术领域
  70. function addDele(){
  71. $("#industryList").on("click",".removeNu",function(){
  72. $(this).parent().remove();
  73. });
  74. $("#industryAdd").click(function(){
  75. var val=$("#industry").val();
  76. $("#industryList").append("<div class='deleteIndustry'>"+ val +"<span class='removeNu'><img src='images/move.png'></span></div>")
  77. });
  78. $("#SubjectList").on("click",".removeNu",function(){
  79. $(this).parent().remove();
  80. });
  81. $("#subjectAdd").click(function(){
  82. var val=$("#subject").val();
  83. $("#SubjectList").append("<div class='deleteSubject'>"+ val +"<span class='removeNu'><img src='images/move.png'></span></div>")
  84. });
  85. }
  86. //我的资源的删除,修改
  87. $("#workmysrc").on("click",".resoumag",function()
  88. {
  89. ResourceInfo();
  90. addDele()
  91. $(".limitBox").removeClass("limitBox");
  92. $(".limitwords").removeClass("limitwords");
  93. $(".limitwordbox").removeClass("limitwordbox");
  94. $(".respublisher").css("display","none");
  95. $(".stateinfor span").text("资源发布中");
  96. var resourceID=$(this).attr("resourceId");
  97. function delet(){
  98. $.ajax({
  99. "url" : "/ajax/resource/"+resourceID,
  100. "type" : "DELETE",
  101. "success" : function($data) {
  102. if ($data.success) {
  103. $(".blackcover").remove();
  104. $("body").css("position","");
  105. getDataResource();
  106. } else {
  107. $.MsgBox.Alert('message',$data.msg);
  108. }
  109. }
  110. })
  111. }
  112. if(resourceID){
  113. $("#deletedResource").on("click",function(){
  114. $(".blackcover").remove();
  115. $("body").css("position","");
  116. $.MsgBox.Confirm("消息", "执行删除后资源信息将无法恢复,确定继续吗?",delet)
  117. })
  118. $.ajax({
  119. "url":"/ajax/resource/"+resourceID,
  120. "type":"get",
  121. "async": true,
  122. "success":function(info){
  123. if(info.success)
  124. {
  125. //console.log(info);
  126. $("#resourceName").val(info.data.resourceName);
  127. $("#supportedServices").val(info.data.supportedServices);
  128. $("#hopePayMethod").val(info.data.hopePayMethod) ;
  129. $("#cooperationNotes").val(info.data.cooperationNotes) ;
  130. industryShow(info.data.subject,"SubjectList","deleteSubject");
  131. industryShow(info.data.industry,"industryList","deleteIndustry");
  132. $("#descp").val(info.data.descp);
  133. $("#professor").text(name);
  134. if(info.data.images.length) {
  135. var $liMages = $(
  136. '<div id="WU_FILE" class="file-item thumbnail">'+
  137. '<img src="/images/resource/'+resourceID+'.jpg">'+
  138. '</div>'
  139. )
  140. }
  141. else
  142. {
  143. var $liMages = $(
  144. '<div id="WU_FILE" class="file-item thumbnail">'+
  145. '<img src="/images/default-resource.jpg">'+
  146. '</div>'
  147. )
  148. }
  149. $("#fileList").append($liMages);
  150. }
  151. else
  152. {
  153. $.MsgBox.Alert('message',"系统异常!");
  154. }
  155. },
  156. "error":function(){$.MsgBox.Alert('message','failed')}
  157. });
  158. }
  159. function captiureSubInd(subIndu)
  160. {
  161. var industrys = $("#"+subIndu+"");
  162. var industryAll = "";
  163. if(industrys.size()>0){
  164. for (var i = 0; i <industrys.size(); i++) {
  165. industryAll += industrys[i].innerText;
  166. industryAll += ',';
  167. };
  168. industryAll = industryAll.substring(0, industryAll.length-1);
  169. }
  170. return industryAll;
  171. }
  172. $("#inputb").on("click",function()
  173. {
  174. var $data = {};
  175. $data.resourceName = $("#resourceName").val();
  176. $data.supportedServices = $("#supportedServices").val();
  177. $data.professorId = userid;
  178. $data.hopePayMethod = $("#hopePayMethod").val();
  179. $data.cooperationNotes = $("#cooperationNotes").val();
  180. $data.subject=captiureSubInd("SubjectList .deleteSubject");
  181. $data.industry=captiureSubInd("industryList .deleteIndustry");
  182. $data.descp=$("#descp").val();
  183. if(cacheImageKey){
  184. //console.log(cacheImageKey);
  185. $data.fn=cacheImageKey;
  186. }
  187. if (resourceID) {
  188. $data.resourceId = resourceID;
  189. }
  190. function getDataput(){
  191. $.ajax({"url" : "ajax/resource/updateResource",
  192. "type" : "post" ,
  193. "success" : function(rdata) {
  194. if (rdata.success){
  195. getDataResource();
  196. } else {
  197. $.MsgBox.Alert("消息","资源发布失败");
  198. }
  199. },
  200. "data" :$data,
  201. "beforeSend":function(){/*console.log(this.data)*/ },
  202. "contentType" : "application/x-www-form-urlencoded",
  203. dataType : "json"
  204. });
  205. }
  206. //console.log($data);
  207. resourceName();
  208. // professor();
  209. supportedServices();
  210. if(resourceNamePass && supportedServicesPass)
  211. {
  212. if(resourceID){
  213. $(".blackcover").remove();
  214. $("body").css("position","");
  215. $.MsgBox.Confirm("消息", "确定修改资源信息吗?", getDataput)
  216. $data.fn=cacheImageKey;
  217. }else{
  218. $.ajax({"url" : "/ajax/resource",
  219. "type" : "POST",
  220. "success" : function(rdata) {
  221. if (rdata.success)
  222. {
  223. $(".blackcover").remove();
  224. $("body").css("position","");
  225. getDataResource();
  226. $.MsgBox.Alert("消息","资源发布成功");
  227. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  228. }
  229. else
  230. {
  231. $.MsgBox.Alert("消息","资源发布失败");
  232. }
  233. },
  234. "data" : $data,
  235. "beforeSend":function(){/*console.log(this.data)*/ },
  236. "contentType" : "application/x-www-form-urlencoded",
  237. dataType : "json"
  238. });
  239. }
  240. }
  241. });
  242. });
  243. getDataResource();
  244. function getDataResource(){
  245. $.ajax({
  246. "url":"/ajax/resource/qapro",
  247. "type":"get",
  248. "async": true,
  249. "data":{"professorId":userid},
  250. "success":function(data){
  251. if(data.success)
  252. {
  253. var add='';
  254. var k=0;
  255. $("#consd").html("");
  256. for(var i=0;i<data.data.length;i++)
  257. {
  258. var add='<div class="maintab"><div class="lefttab fl"><table class="resoubrief"><tr><td><div class="resoimgbox"><div class="ResImgBox" style="max-width:160px;width:160px;height: 160px;"><img class="resImg headRadius resourceImg" src="" /></div></div></td>'
  259. add+='</tr><tr><td><ul><li>'+data.data[i].resourceName+'</li><li>'+data.data[i].supportedServices+'</li> '
  260. /*add+='<li class="li1">'+data.data[i].subject+'</li>' */
  261. add+='</ul></td></tr><tr>'
  262. add+='<td><span class="managebtn resoumag"">资源管理</span></td></tr></table></div>'
  263. add+='<div class="righttab fr"><table width="100%" class="worktab tablecon">'
  264. add+='<tr class="worktabtit"><th width="20%" height="40">申请时间</th><th width="20%">需求方</th>'
  265. add+='<th width="12%">联系人</th><th width="14%">交付时间</th>'
  266. add+='<th width="20%">付款进程</th><th width="12%">状态/操作</th></tr></table><div class="tcdPageCode tcdPageCod'+i+'"></div></div>';
  267. $add = $(add);
  268. $("#consd").append($add);
  269. if(data.data[i].subject==undefined){
  270. $(".li1").eq(i).css({"display":"none"});
  271. }
  272. $add.find('.resoumag').attr("resourceId",data.data[i].resourceId);
  273. //$('.resoumag').eq(i+1).attr("resourceId",data.data[i].resourceId);
  274. if(data.data[i].images.length){
  275. $add.find(".resourceImg").attr("src","/images/resource/"+data.data[i].resourceId+".jpg");
  276. }
  277. else
  278. {
  279. $add.find(".resourceImg").attr("src","/images/default-resource.jpg");
  280. }
  281. //console.log($('.resoumag').eq(i+1).attr("resourceId"));
  282. //资源所对应的记录
  283. (function(i){
  284. getPageResource(3,1,true,i,k)
  285. k++;
  286. })(i);
  287. add="";
  288. }
  289. }
  290. else
  291. {
  292. $.MsgBox.Alert('message',"系统异常!");
  293. }
  294. },
  295. "error":function(){$.MsgBox.Alert('message','failed')}
  296. });
  297. }
  298. function getPageResource(pageSize,pageNo,isbind,e,f)
  299. {
  300. $.ajax({
  301. "url":"/ajax/operation/pqres",
  302. "type":"get",
  303. "async": false,
  304. "data":{"resourceId":$('.resoumag').eq(e+1).attr("resourceId"),"pageSize":pageSize,"pageNo":pageNo},
  305. "success":function(data){
  306. if(data.success)
  307. {
  308. $(".maintab").eq(f).find(".workitem").remove();
  309. for(var j=0;j<data.data.data.length;j++)
  310. {
  311. if(data.data.data[j].dealPrice==undefined)
  312. {
  313. data.data.data[j].dealPrice=0;
  314. }
  315. if(data.data.data[j].payMethod==undefined){
  316. data.data.data[j].payMethod="";
  317. }
  318. data.data.data[j].deliverTime=changeTime(data.data.data[j].deliverTime);
  319. data.data.data[j].createTime=changeTime(data.data.data[j].createTime);
  320. var inquiry=inquiryGetPaidMoney(data.data.data[j].operationId);
  321. var addString='<tr class="workitem">'
  322. addString+='<td>'+data.data.data[j].createTime+'</td>'
  323. addString+='<td class="workitemsrc">'+data.data.data[j].applysquare+'</td>'
  324. addString+='<td> <span class="worktel">'+data.data.data[j].professor.name+'<!--<span class="worktelbtn"></span>--></span></td>'
  325. addString+='<td>'+data.data.data[j].deliverTime+'</td>'
  326. //addString+='<td class="price1'+e+'">'+data.data.data[j].dealPrice+'</td>'
  327. //addString+='<td>'+data.data.data[j].payMethod+'</td>'
  328. addString+='<td><span>'+inquiry+'</span>/<span>'+data.data.data[j].dealPrice+'</span><br></td>'
  329. addString+='<td><div class="modification'+e+'"></div></td> </tr>'
  330. $(".tablecon").eq(e).append(addString);
  331. //console.log($(".tablecon").eq(e));
  332. if($(".price1"+e+"").eq(j).text()==0){
  333. $(".price1"+e+"").eq(j).text("");
  334. }
  335. switch(data.data.data[j].operationStatus)
  336. {
  337. case 1:
  338. var string='<span>新的申请</span><br/>'
  339. string+='<a class="operatebtn">'
  340. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>回复申请</span><br />'
  341. string+='</a>'
  342. $(".modification"+e+"").eq(j).html(string);
  343. break;
  344. case 2:
  345. var string='<span>已发送报价待对方确认</span><br/>'
  346. string+='<a class="operatebtn">'
  347. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus="2" operationId='+data.data.data[j].operationId+'>修改报价</span><br />'
  348. string+='</a>'
  349. $(".modification"+e+"").eq(j).html(string);
  350. break;
  351. case 3:
  352. var string='<span>对方发来报价合作进行中</span><br/>'
  353. string+='<a class="operatebtn">'
  354. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>查看详情</span><br />'
  355. string+='<span class="drawback"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>退款</span><br />'
  356. string+='<span resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>投诉</span>'
  357. string+='</a>'
  358. $(".modification"+e+"").eq(j).html(string);
  359. break;
  360. case 4:
  361. var string='<span>对方拒绝报价合作结束</span><br/>'
  362. string+='<a class="operatebtn">'
  363. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>查看详情</span><br />'
  364. string+='</a>'
  365. $(".modification"+e+"").eq(j).html(string);
  366. break;
  367. case 5:
  368. var string='<span>本人拒绝合作</span><br/>'
  369. string+='<a class="operatebtn">'
  370. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>查看详情</span><br />'
  371. string+='</a>'
  372. $(".modification"+e+"").eq(j).html(string);
  373. break;
  374. case 6:
  375. var string='<span>对方中止合作合作结束</span><br/>'
  376. string+='<a class="operatebtn">'
  377. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>查看详情</span><br />'
  378. //string+='<span class="discuss" dataStatus="1"resourceId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>评价</span><br />'
  379. string+='<span class="drawback"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>退款</span><br />'
  380. string+='<span class="complain"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>投诉</span>'
  381. string+='</a>'
  382. $(".modification"+e+"").eq(j).html(string);
  383. break;
  384. case 7:
  385. var string='<span>合作进行中</span><br/>'
  386. string+='<a class="operatebtn">'
  387. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>查看详情</span><br />'
  388. //string+='<span class="acknowledgement"resourceId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>确认完成</span><br />'
  389. string+='<span class="complain"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>投诉</span>'
  390. string+='</a>'
  391. $(".modification"+e+"").eq(j).html(string);
  392. break;
  393. case 8:
  394. var string='<span>完成</span><br/>'
  395. string+='<a class="operatebtn">'
  396. string+='<span class="detailmess"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+' dealPrice='+data.data.data[j].dealPrice+'>查看详情</span><br />'
  397. //string+='<span class="discuss" dataStatus="1"resourceId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>评价</span><br />'
  398. string+='<span class="complain"resourId='+data.data.data[j].resource.resourceId+' operationStatus='+data.data.data[j].operationStatus+' operationId='+data.data.data[j].operationId+'>投诉</span>'
  399. string+='</a>'
  400. $(".modification"+e+"").eq(j).html(string);
  401. break;
  402. default:
  403. }
  404. addString="";
  405. }
  406. if(data.data.total == 0){
  407. }else{
  408. if(isbind == true)
  409. {
  410. $(".tcdPageCod"+e+"").createPage({
  411. pageCount:Math.ceil(data.data.total/pageSize),
  412. current:data.data.pageNo,
  413. backFn:function(p){
  414. getPageResource(3,p,false,e,f);
  415. }
  416. });
  417. }
  418. }
  419. }
  420. else
  421. {
  422. $.MsgBox.Alert("消息","系统异常!");
  423. }
  424. },
  425. "error":function(){$.MsgBox.Alert('message','failed')}
  426. });
  427. }
  428. //我的资源状态的回复
  429. $("#consd").on("click",".detailmess",function(){
  430. $(".stateinfor span").text("回复申请");
  431. var operationId=$(this).attr("operationId");
  432. var operationStatus=$(this).attr("operationStatus");
  433. var priceDifference=$(this).attr("dealPrice");
  434. opo=operationId;
  435. flag=0;
  436. if(flag==0&&operationStatus==1)
  437. { ResourceApply();
  438. //移出有textare标签的相关class
  439. $(".limitBox").eq(1).removeClass("limitBox");
  440. $(".limitwords").eq(1).removeClass("limitwords");
  441. $(".limitwordbox").eq(1).removeClass("limitwordbox");
  442. ajaxGet(operationId);
  443. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  444. $(".detail").replaceWith("<span class='detail'></span>");
  445. $("select").replaceWith("<span class='sname'></span>")
  446. $(".btnboxdown").css({"display":"none"});
  447. $(".applysure").css({"display":"none"});
  448. $("#nextStep").click(function(){
  449. $(".stateinfor span").text("报价中");
  450. $(".btnboxup").css({"display":"none"});
  451. $(".btnboxdown").css({"display":"block"});
  452. $(".applysure").css({"display":"block"});
  453. $(".bag").css("display","none");
  454. $("#reject").hide();
  455. $(".frm").click(function(){
  456. var $date = {};
  457. $date.detailDemand=$(".detail").text();
  458. $date.deliverTime=replaceStr($.trim($(".dealTime").text()));
  459. $date.dealPrice =$.trim($("#dealPrice").val());
  460. $date.payMethod = $.trim($("#payMethod").val());
  461. $date.replyNotes = $("#consultContent").val();
  462. $date.applysquare = $(".sname").text();
  463. $date.operationId=operationId;
  464. $date.operationStatus=2;
  465. $.ajax({
  466. "url" : "/ajax/operation",
  467. "type" : "put",
  468. "data" :JSON.stringify($date),
  469. "contentType" :"application/json",
  470. "success" : function(data) {
  471. if (data.success) {
  472. $(".blackcover").remove();
  473. $("body").css("position","");
  474. getDataResource();
  475. $.MsgBox.Alert('message',"报价成功");
  476. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  477. } else {
  478. $.MsgBox.Alert('message',data.msg);
  479. }
  480. },
  481. "beforeSend":function(){
  482. //console.log(this.data);
  483. },
  484. });
  485. })
  486. })
  487. $("#refuses").click(function(){
  488. ResourceApply();
  489. ajaxGet(operationId);
  490. n=5;
  491. $(".blackcover").remove();
  492. $("body").css("position","");
  493. $.MsgBox.Confirm("消息", "确定拒绝吗?",upStatus1);
  494. });
  495. }
  496. if(flag==0&&operationStatus==2){
  497. ResourceApply();
  498. //移出有textare标签的相关class
  499. $(".limitBox").eq(1).removeClass("limitBox");
  500. $(".limitwords").eq(1).removeClass("limitwords");
  501. $(".limitwordbox").eq(1).removeClass("limitwordbox");
  502. ajaxGet(operationId);
  503. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  504. $(".detail").replaceWith("<span class='detail'></span>");
  505. $("select").replaceWith("<span class='sname'></span>")
  506. $(".btnboxdown").css({"display":"none"});
  507. $(".applysure").css({"display":"none"});
  508. $(".stateinfor span").text("修改报价中");
  509. $(".btnboxup").css({"display":"none"});
  510. $(".btnboxdown").css({"display":"block"});
  511. $(".applysure").css({"display":"block"});
  512. $(".bag").css("display","none");
  513. $(".frm").click(function(){
  514. var $date = {};
  515. $date.detailDemand=$(".detail").text();
  516. $date.deliverTime=replaceStr($.trim($(".dealTime").text()));
  517. $date.dealPrice = $("#dealPrice").val();
  518. $date.payMethod = $("#payMethod").val();
  519. $date.replyNotes = $("#consultContent").val();
  520. $date.applysquare = $(".sname").text();
  521. $date.operationId=operationId;
  522. $date.operationStatus=2;
  523. $.ajax({
  524. "url" : "/ajax/operation",
  525. "type" : "put",
  526. "data" :JSON.stringify($date),
  527. "contentType" :"application/json",
  528. "success" : function(data) {
  529. if (data.success) {
  530. $(".blackcover").remove();
  531. $("body").css("position","");
  532. getDataResource();
  533. $.MsgBox.Alert('message',"报价成功");
  534. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  535. } else {
  536. $.MsgBox.Alert('message',data.msg);
  537. }
  538. },
  539. "beforeSend":function(){
  540. //console.log(this.data);
  541. },
  542. });
  543. })
  544. }
  545. if(flag==0&&operationStatus==3){
  546. DetailInfo();
  547. $("#totalPrice").text(priceDifference);
  548. $(".liuyaninfo").css("display","none");
  549. $(".pingjiainfo").css("display","none");
  550. $(".filebox").css("display","none");
  551. ajaxGet1(operationId);
  552. $(".payaddbox1").css("display","none");
  553. discussGetPaidMoney(operationId,priceDifference)
  554. }
  555. if(flag==0&&operationStatus==5){
  556. ResourceApply();
  557. ajaxGet(operationId);
  558. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  559. $(".detail").replaceWith("<span class='detail'></span>");
  560. $("select").replaceWith("<span class='sname'></span>")
  561. $(".btnboxdown").css({"display":"none"});
  562. $(".applysure").css({"display":"none"});
  563. $(".addrebtn").css("display","none");
  564. }
  565. if(flag==0&&operationStatus==4){
  566. ResourceApply();
  567. ajaxGet1(operationId);
  568. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  569. $(".detail").replaceWith("<span class='detail'></span>");
  570. $("select").replaceWith("<span class='sname'></span>")
  571. $(".btnboxdown").css({"display":"none"});
  572. $(".applysure").css({"display":"none"});
  573. $(".stateinfor span").text("详情");
  574. $(".btnboxup").css({"display":"none"});
  575. $(".btnboxdown").css({"display":"block"});
  576. $(".applysure").css({"display":"block"});
  577. $(".bag").css("display","none");
  578. $(".addrebtn").css("display","none");
  579. $("#payMethod").replaceWith("<span id='payMethod'><span>");
  580. $("#dealPrice").replaceWith("<span id='dealPrice'><span>");
  581. $("#consultContent").replaceWith("<span id='consultContent'><span>");
  582. }
  583. if(flag==0&&operationStatus==6){
  584. DetailInfo();
  585. $("#totalPrice").text(priceDifference);
  586. $(".liuyaninfo").css("display","none");
  587. $(".pingjiainfo").css("display","none");
  588. $(".filebox").css("display","none");
  589. ajaxGet1(operationId);
  590. $(".payaddbox1").css("display","none");
  591. discussGetPaidMoney(operationId,priceDifference)
  592. }
  593. if(flag==0&&operationStatus==7){
  594. DetailInfo();
  595. $("#totalPrice").text(priceDifference);
  596. $(".liuyaninfo").css("display","none");
  597. $(".pingjiainfo").css("display","none");
  598. $(".filebox").css("display","none");
  599. ajaxGet1(operationId);
  600. $(".payaddbox1").css("display","none");
  601. //根据内容的多少获取高度给父级设置高度
  602. limitHeight();
  603. discussGetPaidMoney(operationId,priceDifference)
  604. }
  605. if(flag==0&&operationStatus==8){
  606. DetailInfo();
  607. $("#totalPrice").text(priceDifference);
  608. $(".liuyaninfo").css("display","none");
  609. $(".pingjiainfo").css("display","none");
  610. $(".filebox").css("display","none");
  611. ajaxGet1(operationId);
  612. $(".payaddbox1").css("display","none");
  613. //根据内容的多少获取高度给父级设置高度
  614. limitHeight();
  615. discussGetPaidMoney(operationId,priceDifference)
  616. }
  617. })
  618. //我的需求查询
  619. function getPageData(pageSize,pageNo,isbind){
  620. $.ajax({
  621. "url":"/ajax/operation/pqdem",
  622. "type":"get",
  623. "async": true,
  624. "data":{"demandId":userid,"pageSize":pageSize,"pageNo":pageNo},
  625. "success":function(data){
  626. if(data.success)
  627. {
  628. $(".worktabb").html("");
  629. var stringTitle="";
  630. stringTitle +='<tr class="worktabtit"><th width="20%" height="40">申请时间</th><th width="22%">需求资源</th><th width="12%">发布者</th><th width="14%">交付时间</th><th width="22%">付款进程</th><th width="10%">状态/操作</th></tr>';
  631. $(".worktabb").append( stringTitle);
  632. //console.log(data);
  633. //alert(data.data.data.length);
  634. for(var i=0;i<data.data.data.length;i++)
  635. {
  636. var inq=inquiryGetPaidMoney(data.data.data[i].operationId);
  637. if(data.data.data[i].dealPrice==undefined){
  638. data.data.data[i].dealPrice=0;
  639. }
  640. if(data.data.data[i].payMethod==undefined){
  641. data.data.data[i].payMethod="";
  642. }
  643. data.data.data[i].deliverTime=changeTime(data.data.data[i].deliverTime);
  644. data.data.data[i].createTime=changeTime(data.data.data[i].createTime);
  645. var stringContent="";
  646. stringContent +='<tr class="workitem">'
  647. stringContent +='<td>'+data.data.data[i].createTime+'</td>'
  648. stringContent +='<td class="workitemsrc">'+data.data.data[i].resource.resourceName+'</td>'
  649. stringContent +='<td> <span class="worktel">'+data.data.data[i].resource.professor.name+'<!--<span class="worktelbtn"></span>--></span></td>'
  650. stringContent +='<td>'+data.data.data[i].deliverTime+'</td>'
  651. //stringContent +='<td class="price2">'+data.data.data[i].dealPrice+'</td>'
  652. //stringContent +='<td>'+data.data.data[i].payMethod+'</td>'
  653. stringContent +='<td><span>'+inq+'</span>/<span>'+data.data.data[i].dealPrice+'</span><br></td>'
  654. stringContent +='<td><div class="loginStatus"></div></td></tr>'
  655. $(".worktabb").append( stringContent);
  656. if($(".price2").eq(i).text()==0){
  657. $(".price2").eq(i).text("");
  658. }
  659. switch(data.data.data[i].operationStatus)
  660. {
  661. case 1:
  662. var string='<span>申请已发送待对方确认</span><br/>'
  663. string+='<a class="opbtn">'
  664. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>修改申请</span><br />'
  665. string+='</a>'
  666. $(".loginStatus").eq(i).html(string);
  667. break;
  668. case 2:
  669. var string='<span>对方发来报价</span><br/>'
  670. string+='<a class="opbtn">'
  671. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>回复报价</span><br />'
  672. string+='</a>'
  673. $(".loginStatus").eq(i).html(string);
  674. break;
  675. case 3:
  676. var string='<span>合作进行中</span><br/>'
  677. string+='<a class="opbtn">'
  678. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+' dealPrice='+data.data.data[i].dealPrice+'>查看详情</span><br />'
  679. string+='<span class="payMonety"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+' dealPrice='+data.data.data[i].dealPrice+'>付款</span><br />'
  680. string+='<span class="stopcoo"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>中止合作</span>'
  681. string+='</a>'
  682. $(".loginStatus").eq(i).html(string);
  683. break;
  684. case 4:
  685. var string='<span>本人拒绝合作</span><br/>'
  686. string+='<a class="opbtn">'
  687. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>查看详情</span><br />'
  688. string+='</a>'
  689. $(".loginStatus").eq(i).html(string);
  690. break;
  691. case 5:
  692. var string='<span>对方拒绝合作合作结束</span><br/>'
  693. string+='<a class="opbtn">'
  694. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>查看详情</span><br />'
  695. string+='</a>'
  696. $(".loginStatus").eq(i).html(string);
  697. break;
  698. case 6:
  699. var string='<span>本人中止合作</span><br/>'
  700. string+='<a class="opbtn">'
  701. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+' dealPrice='+data.data.data[i].dealPrice+'>查看详情</span><br />'
  702. //string+='<span class=" discuss"dataStatus="0"resourceId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>评价</span><br />'
  703. string+='<span class="complain"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>投诉</span>'
  704. string+='</a>'
  705. $(".loginStatus").eq(i).html(string);
  706. break;
  707. case 7:
  708. var string='<span>合作进行中</span><br/>'
  709. string+='<a class="opbtn">'
  710. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+' dealPrice='+data.data.data[i].dealPrice+'>查看详情</span><br />'
  711. string+='<span class="acknowledgement"resourceId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>确认完成</span><br />'
  712. string+='<span class="complain"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>投诉</span>'
  713. string+='</a>'
  714. $(".loginStatus").eq(i).html(string);
  715. break;
  716. case 8:
  717. var string='<span>完成</span><br/>'
  718. string+='<a class="opbtn">'
  719. string+='<span class="detailm"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+' dealPrice='+data.data.data[i].dealPrice+'>查看详情</span><br />'
  720. //string+='<span class="discuss"dataStatus="0"resourceId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>评价</span><br />'
  721. string+='<span class="complain"resourId='+data.data.data[i].resource.resourceId+' operationStatus='+data.data.data[i].operationStatus+' operationId='+data.data.data[i].operationId+'>投诉</span>'
  722. string+='</a>'
  723. $(".loginStatus").eq(i).html(string);
  724. break;
  725. default:
  726. }
  727. }
  728. if(data.data.total == 0){
  729. }else{
  730. if(isbind == true)
  731. {
  732. $(".tcdPageCode1").createPage({
  733. pageCount:Math.ceil(data.data.total/pageSize),
  734. current:data.data.pageNo,
  735. backFn:function(p){
  736. getPageData(pageSize,p,false);
  737. },
  738. });
  739. }
  740. }
  741. }
  742. else
  743. {
  744. $.MsgBox.Alert('message',"系统异常!");
  745. }
  746. },
  747. "error":function(){$.MsgBox.Alert('message','failddd')}
  748. });
  749. }
  750. getPageData(6,1,true);
  751. //确认完成
  752. $("#workmysrc2").on("click",".acknowledgement",function(){
  753. opo=$(this).attr("operationId");
  754. n=8;
  755. $.MsgBox.Confirm("消息", "确认合作完成?",upStatus);
  756. })
  757. //退款
  758. $(".workmysrc").on("click",".drawback",function(){
  759. DetailInfo();
  760. $(".resoubox").css("display","none");
  761. $(".liuyaninfo").css("display","none");
  762. $(".pingjiainfo").css("display","none");
  763. var op=$(this).attr("operationId");
  764. opo=op;
  765. var $price=$(this).attr("dealPrice");
  766. $("#totalPrice").text($price);
  767. discussGetPaidMoney(opo,$price);
  768. $("#paytit").on("click",".ret",function(){
  769. var payStatus=$(this).attr("payStatus");
  770. //console.log(payStatus);
  771. if(payStatus==0){
  772. payHistoryId=$(this).attr("payhistoryid");
  773. getPayhistoryData();
  774. }
  775. });
  776. function getPayhistoryData(){
  777. $.ajax({
  778. "url":"/ajax/payhistory/status",
  779. "type":"post",
  780. "async": true,
  781. "data":{"payHistoryId":payHistoryId,"payStatus":"1"},
  782. "success":function(data)
  783. {
  784. if(data.success)
  785. {
  786. $("#paytit").find(".payitem").remove();
  787. discussGetPaidMoney(opo,$price);
  788. }
  789. else
  790. {
  791. $.MsgBox.Alert('message',"系统异常!");
  792. }
  793. },
  794. "error":function(){$.MsgBox.Alert('message','failddd')}
  795. });
  796. }
  797. $(".panbtn").click(function(){
  798. var payed= Number($("#realCharge").text());//已经收到的付款
  799. var paying= Number($("#payMoney").val());//此次正在付入金额
  800. //alert(payed+","+paying);
  801. if(paying <= payed)
  802. {
  803. $.MsgBox.Confirm("消息", "确定退款吗?",getPay1)
  804. }
  805. if(paying > payed){
  806. $.MsgBox.Alert('消息',"您所退的款项有误,请核对您已经收到的款项");
  807. }
  808. });
  809. });
  810. //付款
  811. function getPay(){
  812. $.ajax({"url" : "/ajax/payhistory",
  813. "type" : "POST",
  814. "success" : function(rdata)
  815. {
  816. if (rdata.success)
  817. {
  818. $(".blackcover").remove();
  819. $("body").css("position","");
  820. getPageData(6,1,false);
  821. }
  822. else
  823. {
  824. $.MsgBox.Alert('消息',"付款失败!");
  825. }
  826. },
  827. "data" :{"operationId":opo,"paidMoney":$("#payMoney").val(),
  828. "remark":$("#payRemark").val(),"payStatus":$("#payStatus").val(),"professorId":userid,
  829. "isonline":$("#isOnline").find("option:selected").val()},
  830. "contentType" :"application/x-www-form-urlencoded",
  831. "beforeSend":function(){},
  832. dataType : "json"
  833. });
  834. }
  835. //退款
  836. function getPay1(){
  837. $.ajax({"url" : "/ajax/payhistory",
  838. "type" : "POST",
  839. "success" : function(rdata)
  840. {
  841. if (rdata.success)
  842. {
  843. $(".blackcover").remove();
  844. $("body").css("position","");
  845. getDataResource();
  846. }
  847. else
  848. {
  849. $.MsgBox.Alert('消息',"付款失败!");
  850. }
  851. },
  852. "data" :{"operationId":opo,"returnMoney":$("#payMoney").val(),
  853. "remark":$("#payRemark").val(),"payStatus":$("#payStatus").val(),"professorId":userid,
  854. "isonline":$("#isOnline").find("option:selected").val()},
  855. "contentType" :"application/x-www-form-urlencoded",
  856. "beforeSend":function(){},
  857. dataType : "json"
  858. });
  859. }
  860. $(".workmysrc").on("click",".payMonety",function(){
  861. DetailInfo();
  862. $(".resoubox").css("display","none");
  863. $(".liuyaninfo").css("display","none");
  864. $(".pingjiainfo").css("display","none");
  865. opo=$(this).attr("operationId");
  866. var $price=$(this).attr("dealPrice");
  867. $("#totalPrice").text($price);
  868. discussGetPaidMoney(opo,$price);
  869. $("#paytit").on("click",".ret",function(){
  870. var payStatus=$(this).attr("payStatus");
  871. //console.log(payStatus);
  872. if(payStatus==0){
  873. payHistoryId=$(this).attr("payhistoryid");
  874. getPayhistoryData();
  875. }
  876. });
  877. function getPayhistoryData(){
  878. $.ajax({
  879. "url":"/ajax/payhistory/status",
  880. "type":"post",
  881. "async": true,
  882. "data":{"payHistoryId":payHistoryId,"payStatus":"1"},
  883. "success":function(data)
  884. {
  885. if(data.success)
  886. {
  887. $("#paytit").find(".payitem").remove();
  888. discussGetPaidMoney(opo,$price);
  889. }
  890. else
  891. {
  892. $.MsgBox.Alert('message',"系统异常!");
  893. }
  894. },
  895. "error":function(){$.MsgBox.Alert('message','failddd')}
  896. });
  897. }
  898. $("#panaddbtn").click(function(){
  899. var aa= Number($("#payMoney").val());
  900. var bb=Number($("#balance").text());
  901. if(aa<bb){
  902. $.MsgBox.Confirm("消息", "确定支付吗?",getPay);
  903. $.MsgBox.Alert('消息',"此次付款成功!");
  904. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  905. }
  906. if(aa>bb){
  907. $.MsgBox.Alert('消息',"所付款项已经超出预计款项!");
  908. }
  909. if(aa==bb){
  910. $.MsgBox.Confirm("消息", "确定支付吗?",getPay);
  911. n=7;
  912. upStatus();
  913. $.MsgBox.Alert('消息',"款项已经全部付清!");
  914. }
  915. });
  916. });
  917. function inquiryGetPaidMoney(operationId){
  918. var realCharge=0,balance=0;
  919. $.ajax({
  920. "url":"/ajax/payhistory/qadetail",
  921. "type":"get",
  922. "async": false,
  923. "data":{"operationId":operationId},
  924. "success":function(data){
  925. if(data.success)
  926. {
  927. var $data=data.data;
  928. var m;
  929. for(var i=0;i<$data.length;i++)
  930. {
  931. if($data[i].paidMoney==undefined)
  932. {
  933. $data[i].paidMoney=0;
  934. }
  935. if($data[i].returnMoney==undefined)
  936. {
  937. $data[i].returnMoney=0;
  938. }
  939. m=$data[i].paidMoney-$data[i].returnMoney;
  940. realCharge+=m;
  941. }
  942. }
  943. else
  944. {
  945. //console.log("系统异常!");
  946. }
  947. },
  948. "error":function(){$.MsgBox.Alert('message','failddd')}
  949. });
  950. return realCharge;
  951. }
  952. //获取订单付款历史记录
  953. function discussGetPaidMoney(operationId,priceDifference){
  954. var realCharge=0,balance=0;
  955. $.ajax({
  956. "url":"/ajax/payhistory/qadetail",
  957. "type":"get",
  958. "async": true,
  959. "data":{"operationId":operationId},
  960. "success":function(data){
  961. if(data.success){
  962. //console.log(data);
  963. var popHtml="";
  964. var $data=data.data;
  965. var m;
  966. for(var i=0;i<$data.length;i++){
  967. if($data[i].paidMoney==undefined)
  968. {
  969. $data[i].paidMoney=0;
  970. }
  971. if($data[i].returnMoney==undefined)
  972. {
  973. $data[i].returnMoney=0;
  974. }
  975. if($data[i].remark==undefined)
  976. {
  977. $data[i].remark="--";
  978. }
  979. PopHtml = '<tr class="payitem">';
  980. PopHtml += '<td><div class="resouinforcon">'+changeTime($data[i].createTime)+'</div></td>';
  981. PopHtml += '<td><div class="resouinforcon">'+$data[i].professor.name+'</div></td>';
  982. PopHtml += '<td><div class="resouinforcon resou"></div></td>';
  983. PopHtml += '<td><div class="resouinforcon to"></div></td>';
  984. if(userid==$data[i].professor.id){
  985. PopHtml += '<td><div class="resouinforcon resta"></div></td>';
  986. }else{
  987. PopHtml += '<td><div class="resouinforcon resta ret"payHistoryId='+$data[i].payHistoryId+' payStatus='+$data[i].payStatus+'></div></td>';
  988. }
  989. PopHtml += '<td><div class="resouinforcon">'+$data[i].remark+'</div></td>';
  990. PopHtml += '</tr>';
  991. $("#paytit").append(PopHtml);
  992. m=$data[i].paidMoney-$data[i].returnMoney;
  993. $(".to").eq(i).text(m);
  994. if($data[i].isonline==0){
  995. $(".resou").eq(i).text("线上支付");
  996. }else{
  997. $(".resou").eq(i).text("线下支付");
  998. }
  999. if($data[i].payStatus==0){
  1000. $(".resta").eq(i).text("未确认");
  1001. }else{
  1002. $(".resta").eq(i).text("确认收款");
  1003. }
  1004. popHtml="";
  1005. realCharge+=m;
  1006. }
  1007. balance=priceDifference-realCharge;
  1008. $("#balance").text(balance);
  1009. $("#realCharge").text(realCharge);
  1010. }
  1011. else
  1012. {
  1013. //console.log("系统异常!");
  1014. }
  1015. },
  1016. "error":function(){$.MsgBox.Alert('message','failddd')}
  1017. });
  1018. }
  1019. //中止合作
  1020. $(".workmysrc").on("click",".stopcoo",function(){
  1021. opo=$(this).attr("operationId");
  1022. n=6;
  1023. $.MsgBox.Confirm("消息", "你确定要中止吗?",upStatus);
  1024. });
  1025. //评论
  1026. var start;
  1027. $(".workmysrc").on("click",".discuss",function(){
  1028. var resourceId=$(this).attr("resourceId");
  1029. var operationId=$(this).attr("operationId");
  1030. var dataStatus=$(this).attr("dataStatus");
  1031. getAssess1(operationId);
  1032. CommentInfo();
  1033. if(lengths==0&&dataStatus==0){
  1034. $(".sqlcomment").css("display","none");
  1035. $(".evastar2").click(function(){
  1036. $(".evastar2").removeClass('span');
  1037. start=$(this).index()+1;
  1038. for(var i=0;i<start;i++){
  1039. if(i<start){
  1040. $(".evastar2").eq(i).addClass("span");
  1041. }
  1042. else{
  1043. $(".evastar2").eq(i).removeClass('span');
  1044. }
  1045. }
  1046. });
  1047. $("#discuss").click(function(){
  1048. //discussContent(resourceId,operationId,start,userid);
  1049. $.ajax({
  1050. "url":"/ajax/assess",
  1051. "type":"post",
  1052. "async": true,
  1053. "data":{"operationId":operationId,"professorId":userid,"resourceId":resourceId,"starLevel":start,"descp":$("#discussContent").val()},
  1054. "success":function(data){
  1055. if(data.success)
  1056. {
  1057. location.reload(true);
  1058. }
  1059. else
  1060. {
  1061. //console.log("系统异常!");
  1062. }
  1063. },
  1064. "beforeSend":function(){/*console.log(this.data)*/},
  1065. "error":function(){$.MsgBox.Alert('message','failddd')}
  1066. });
  1067. })
  1068. }else if(lengths==0&&dataStatus==1){
  1069. $(".addcomment").css("display","none");
  1070. var string='<tr><td><div class="righteva"><div class="noconmment">对方还未评价</div></div></div></td></tr>';
  1071. $("#commbox").append(string);
  1072. }else if(lengths==1&&dataStatus==0){
  1073. $(".addcomment").css("display","none");
  1074. getAssess(operationId,1);
  1075. }else if(lengths==1&&dataStatus==1){
  1076. getAssess(operationId,1);
  1077. $(".evastar2").click(function(){
  1078. $(".evastar2").removeClass('span');
  1079. start=$(this).index()+1;
  1080. for(var i=0;i<start;i++){
  1081. if(i<start){
  1082. $(".evastar2").eq(i).addClass("span");
  1083. }
  1084. else{
  1085. $(".evastar2").eq(i).removeClass('span');
  1086. }
  1087. }
  1088. });
  1089. $("#discuss").click(function(){
  1090. //discussContent(resourceId,operationId,start,userid);
  1091. $.ajax({
  1092. "url":"/ajax/assess",
  1093. "type":"post",
  1094. "async": true,
  1095. "data":{"operationId":operationId,"professorId":userid,"resourceId":resourceId,"starLevel":start,"descp":$("#discussContent").val()},
  1096. "success":function(data){
  1097. if(data.success)
  1098. {
  1099. }
  1100. else
  1101. {
  1102. //console.log("系统异常!");
  1103. }
  1104. },
  1105. "beforeSend":function(){/*console.log(this.data)*/},
  1106. "error":function(){$.MsgBox.Alert('message','failddd')}
  1107. });
  1108. })
  1109. }else if(lengths==2){
  1110. $(".addcomment").css("display","none");
  1111. getAssess(operationId,2);
  1112. }
  1113. })
  1114. var lengths;
  1115. //获取每条记录的评论
  1116. function getAssess1(operationId){
  1117. $.ajax({"url" : "/ajax/assess/qaoper",
  1118. "type" : "get",
  1119. "async":false,
  1120. "success" : function(rdata)
  1121. {
  1122. if (rdata.success)
  1123. {
  1124. //console.log(rdata);
  1125. lengths=rdata.data.length;
  1126. }
  1127. else
  1128. {
  1129. //alert("jjj");
  1130. }
  1131. },
  1132. "data" :{"operationId":operationId},
  1133. "contentType" :"application/x-www-form-urlencoded",
  1134. dataType : "json"
  1135. });
  1136. }
  1137. function getAssess(operationId,le){
  1138. $.ajax({"url" : "/ajax/assess/qaoper",
  1139. "type" : "get",
  1140. "async":true,
  1141. "success" : function(rdata)
  1142. {
  1143. if (rdata.success)
  1144. {
  1145. $data=rdata.data;
  1146. if(le==1){
  1147. var string="";
  1148. string+='<div class="ass"><tr><td><div class="teamwork"><div class="lefteva"><a href="" class="evaimg"><img src="images/default-photo.jpg" width="100%" height="100%"></a>'
  1149. string+='<p>'+ $data[0].professor.name +'</p></div>'
  1150. string+='<div class="righteva"><ul class="evasort">'
  1151. string+='<li class="teamname"><span>'+$data[0].resource.resourceName+'资源的合作</span><span class="teamtime">2016-09-06</span></li></ul>'
  1152. string+='<div class="evastarbox"><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span></div>'
  1153. string+='<p class="evabrief">'+$data[0].descp+'</p>'
  1154. string+='</div></div></td></tr>'
  1155. string+='<tr><td><div class="righteva"><div class="noconmment">对方还未评价</div></div></div></td></tr></div>'
  1156. $("#commbox").append(string);
  1157. //console.log($data[0].starLevel);
  1158. for(var i=0;i<$data[0].starLevel;i++)
  1159. {
  1160. //console.log(i);
  1161. $(".evastar1").eq(i).addClass('span');
  1162. }
  1163. }else if(le==2){
  1164. for(var j=0;j<2;j++){
  1165. var string="";
  1166. string+='<div class="ass"><tr><td><div class="teamwork"><div class="lefteva"><a href="" class="evaimg"><img src="images/default-photo.jpg" width="100%" height="100%"></a>'
  1167. string+='<p>'+ $data[j].professor.name +'</p></div>'
  1168. string+='<div class="righteva"><ul class="evasort">'
  1169. string+='<li class="teamname"><span>'+$data[j].resource.resourceName+'资源的合作</span><span class="teamtime">2016-09-06</span></li></ul>'
  1170. string+='<div class="evastarbox"><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span><span class="evastar evastar1"></span></div>'
  1171. string+='<p class="evabrief">'+$data[j].descp+'</p>'
  1172. string+='</div></div></td></tr></div>'
  1173. $("#commbox").append(string);
  1174. if(j==0)
  1175. {
  1176. for(var i=0;i<$data[j].starLevel;i++)
  1177. {
  1178. //console.log(i);
  1179. $(".evastar1").eq(i).addClass('span');
  1180. }
  1181. }
  1182. else{
  1183. for(var i=0;i<$data[j].starLevel;i++)
  1184. {
  1185. //console.log(i);
  1186. $(".evastar1").eq(i+5).addClass('span');
  1187. }
  1188. }
  1189. string="";
  1190. }
  1191. }
  1192. }
  1193. else
  1194. {
  1195. //alert("jjj");
  1196. }
  1197. },
  1198. "data" :{"operationId":operationId},
  1199. "contentType" :"application/x-www-form-urlencoded",
  1200. dataType : "json"
  1201. });
  1202. }
  1203. function discussContent(){
  1204. $.ajax({
  1205. "url":"/ajax/assess",
  1206. "type":"post",
  1207. "async": true,
  1208. "data":{"operationId":operationId,"professorId":userid,"resourceId":resourceId,"starLeval":start,"descp":$("#discussContent").val()},
  1209. "success":function(data){
  1210. if(data.success)
  1211. {
  1212. location.reload(true);
  1213. }
  1214. else
  1215. {
  1216. //console.log("系统异常!");
  1217. }
  1218. },
  1219. "error":function(){$.MsgBox.Alert('message','failddd')}
  1220. });
  1221. }
  1222. //我的需求中修改申请,对方已经回复(合作),我拒绝合作或者约对方合作
  1223. function getIdentity(professorId){
  1224. $.ajax({
  1225. "url":"ajax/professor/"+professorId,
  1226. "type":"get",
  1227. "async": false,
  1228. "success":function(data){
  1229. if(data.success)
  1230. {
  1231. $("option")[0].value=data.data.name;
  1232. $("option")[1].value=data.data.organization.name;
  1233. }
  1234. else
  1235. {
  1236. $.MsgBox.Alert("消息","系统异常!");
  1237. }
  1238. },
  1239. "error":function(){$.MsgBox.Alert('message','failddd')}
  1240. })
  1241. }
  1242. $(".workmysrc").on("click",".detailm",function(){
  1243. var resourceId=$(this).attr("resourId");
  1244. var operationStatus=$(this).attr("operationStatus");
  1245. var operationId=$(this).attr("operationId");
  1246. var priceDifference=$(this).attr("dealPrice");
  1247. flag=1;
  1248. opo=operationId;
  1249. if(flag==1&&operationStatus==1)
  1250. {
  1251. ResourceApply();
  1252. $(".limitBox").removeClass("limitBox");
  1253. $(".limitwords").removeClass("limitwords");
  1254. $(".limitwordbox").removeClass("limitwordbox");
  1255. $( "#datepicker" ).datepicker({ "dateFormat":" yy-mm-dd"});
  1256. $(".stateinfor span").text("修改申请中");
  1257. $(".btnboxup").css({"display":"none"});
  1258. $(".applysure").css({"display":"none"});
  1259. ajaxGet(operationId,1,1);
  1260. getIdentity(userid);
  1261. //if($(".dealTime").val()!=""&&$(".detail").val()!="")
  1262. //{
  1263. $("#deliver").on("click",function()
  1264. {
  1265. var $data = {};
  1266. $data.demandId = userid;
  1267. $data.resourceId = resourceId;
  1268. $data.operationId=operationId;
  1269. $data.detailDemand=$(".detail").val();
  1270. $data.deliverTime=replaceStr($.trim($("#datepicker").val()));
  1271. $data.applysquare=$("select option:selected").val();
  1272. $data.operationStatus=1;
  1273. $.ajax({
  1274. "url" : "/ajax/operation",
  1275. "type" : "put",
  1276. "success" : function(rdata) {
  1277. if (rdata.success){
  1278. getPageData(6,1,false);
  1279. $(".blackcover").remove();
  1280. $("body").css("position","");
  1281. $.MsgBox.Alert('消息',"资源申请信息修改成功");
  1282. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  1283. } else {
  1284. $.MsgBox.Alert('消息',"资源申请信息修改失败");
  1285. }
  1286. },
  1287. "data" : JSON.stringify($data) ,
  1288. "contentType" :"application/json",
  1289. dataType : "json"
  1290. });
  1291. });
  1292. //}
  1293. }
  1294. if(flag==1&&operationStatus==2)
  1295. {
  1296. ResourceApply();
  1297. ajaxGet1(operationId);
  1298. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  1299. $(".detail").replaceWith("<span class='detail'></span>");
  1300. $("select").replaceWith("<span class='sname'></span>")
  1301. $(".btnboxdown").css({"display":"none"});
  1302. $(".applysure").css({"display":"none"});
  1303. $(".stateinfor span").text("回复报价中");
  1304. $(".btnboxup").css({"display":"none"});
  1305. $(".btnboxdown").css({"display":"block"});
  1306. $(".applysure").css({"display":"block"});
  1307. $(".bag").css("display","none");
  1308. $(".sendpri").text("");
  1309. $("#payMethod").replaceWith("<span id='payMethod'><span>");
  1310. $("#dealPrice").replaceWith("<span id='dealPrice'><span>");
  1311. $("#consultContent").replaceWith("<span id='consultContent'><span>");
  1312. $("#del")[0].value="合作";
  1313. $("#reject")[0].value="直接拒绝";
  1314. $("#reject").click(function(){
  1315. n=4;
  1316. $(".blackcover").remove();
  1317. $("body").css("position","");
  1318. $.MsgBox.Confirm("消息", "确定继续吗?",upStatus);
  1319. })
  1320. $("#del").click(function(){
  1321. n=3;
  1322. $(".blackcover").remove();
  1323. $("body").css("position","");
  1324. upStatus();
  1325. })
  1326. }
  1327. if(flag==1&&operationStatus==3){
  1328. DetailInfo();
  1329. $("#totalPrice").text(priceDifference);
  1330. $(".liuyaninfo").css("display","none");
  1331. $(".pingjiainfo").css("display","none");
  1332. $(".filebox").css("display","none");
  1333. ajaxGet1(operationId);
  1334. $(".payaddbox1").css("display","none");
  1335. discussGetPaidMoney(operationId,priceDifference);
  1336. }
  1337. if(flag==1&&operationStatus==4){
  1338. ResourceApply();
  1339. ajaxGet1(operationId);
  1340. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  1341. $(".detail").replaceWith("<span class='detail'></span>");
  1342. $("select").replaceWith("<span class='sname'></span>")
  1343. $(".btnboxdown").css({"display":"none"});
  1344. $(".applysure").css({"display":"none"});
  1345. $(".sendpri").text("");
  1346. $(".stateinfor span").text("详情");
  1347. $(".resde").text("详情页面");
  1348. $(".btnboxup").css({"display":"none"});
  1349. $(".btnboxdown").css({"display":"block"});
  1350. $(".applysure").css({"display":"block"});
  1351. $(".bag").css("display","none");
  1352. $(".addrebtn").css("display","none");
  1353. $("#payMethod").replaceWith("<span id='payMethod'><span>");
  1354. $("#dealPrice").replaceWith("<span id='dealPrice'><span>");
  1355. $("#consultContent").replaceWith("<span id='consultContent'><span>");
  1356. }
  1357. if(flag==1&&operationStatus==5){
  1358. ResourceApply();
  1359. ajaxGet(operationId);
  1360. $(".stateinfor").find("span").text("合作结束");
  1361. $(".dealTime").replaceWith("<span class='dealTime'></span>");
  1362. $(".detail").replaceWith("<span class='detail'></span>");
  1363. $("select").replaceWith("<span class='sname'></span>")
  1364. $(".btnboxdown").css({"display":"none"});
  1365. $(".applysure").css({"display":"none"});
  1366. //$(".resouinfotype2").text("");
  1367. $(".addrebtn").css("display","none");
  1368. }
  1369. if(flag==1&&operationStatus==6){
  1370. DetailInfo();
  1371. $("#totalPrice").text(priceDifference);
  1372. $(".filebox").css("display","none");
  1373. $(".liuyaninfo").css("display","none");
  1374. $(".pingjiainfo").css("display","none");
  1375. $(".filebox").css("display","none");
  1376. ajaxGet1(operationId);
  1377. $(".payaddbox1").css("display","none");
  1378. discussGetPaidMoney(operationId,priceDifference)
  1379. }
  1380. if(flag==1&&operationStatus==7){
  1381. DetailInfo();
  1382. $("#totalPrice").text(priceDifference);
  1383. $(".liuyaninfo").css("display","none");
  1384. $(".pingjiainfo").css("display","none");
  1385. $(".filebox").css("display","none");
  1386. ajaxGet1(operationId);
  1387. $(".payaddbox1").css("display","none");
  1388. discussGetPaidMoney(operationId,priceDifference)
  1389. }
  1390. if(flag==1&&operationStatus==8){
  1391. DetailInfo();
  1392. $("#totalPrice").text(priceDifference);
  1393. $(".liuyaninfo").css("display","none");
  1394. $(".pingjiainfo").css("display","none");
  1395. $(".filebox").css("display","none");
  1396. ajaxGet1(operationId);
  1397. $(".payaddbox1").css("display","none");
  1398. discussGetPaidMoney(operationId,priceDifference)
  1399. }
  1400. })
  1401. //获取评论
  1402. function discussGetContent(operationId){
  1403. $.ajax({
  1404. "url":"/ajax/assess/qaoper",
  1405. "type":"get",
  1406. "async": true,
  1407. "data":{"operationId":operationId},
  1408. "success":function(data){
  1409. if(data.success){
  1410. //console.log(data);
  1411. }
  1412. else
  1413. {
  1414. //console.log("系统异常!");
  1415. }
  1416. },
  1417. "error":function(){$.MsgBox.Alert('message','failddd')}
  1418. });
  1419. }
  1420. //更新状态
  1421. function upStatus(){
  1422. $.ajax({"url" : "/ajax/operation/operationStatus",
  1423. "type" : "POST",
  1424. "success" : function(rdata)
  1425. {
  1426. if (rdata.success)
  1427. {
  1428. getPageData(6,1,false);
  1429. }
  1430. else
  1431. {
  1432. $.MsgBox.Alert('message','状态更新失败');
  1433. }
  1434. },
  1435. "data" :{"operationId":opo,"operationStatus":n},
  1436. "beforeSend":function(){/*console.log(this.data)*/},
  1437. "contentType" :"application/x-www-form-urlencoded",
  1438. dataType : "json"
  1439. });
  1440. }
  1441. function upStatus1(){
  1442. $.ajax({"url" : "/ajax/operation/operationStatus",
  1443. "type" : "POST",
  1444. "success" : function(rdata)
  1445. {
  1446. if (rdata.success)
  1447. {
  1448. getDataResource();
  1449. }
  1450. else
  1451. {
  1452. $.MsgBox.Alert('message','状态更新失败');
  1453. }
  1454. },
  1455. "data" :{"operationId":opo,"operationStatus":n},
  1456. "beforeSend":function(){/*console.log(this.data)*/},
  1457. "contentType" :"application/x-www-form-urlencoded",
  1458. dataType : "json"
  1459. });
  1460. }
  1461. //我的需求,获取每条记录的数据根据合作id
  1462. function ajaxGet(operationId,o,p){
  1463. $.ajax({
  1464. "url":"/ajax/operation/"+operationId,
  1465. "type":"get",
  1466. "async": true,
  1467. "success":function(data){
  1468. if(data.success)
  1469. {
  1470. //console.log(data);
  1471. $(".log").text(data.data.resource.resourceName);
  1472. $(".timelog").text(changeTime(data.data.createTime));
  1473. $(".contration").text(data.data.operationId);
  1474. $(".detail").text(data.data.detailDemand);
  1475. if(o==1&&p==1){
  1476. $(".dealTime").val(changeTime(data.data.deliverTime));
  1477. }else{
  1478. $(".dealTime").text(changeTime(data.data.deliverTime));
  1479. }
  1480. if(data.data.professor.name==data.data.applysquare){
  1481. $("select").find("option[title=个人]").attr("selected",true);
  1482. }else{
  1483. $("select").find("option[title=所属机构]").attr("selected",true);
  1484. }
  1485. $(".sname").text(data.data.applysquare);
  1486. $(".namecon").text(data.data.resource.professor.name);
  1487. $(".resouImage").attr("src","/images/resource/"+data.data.resource.resourceId+".jpg");
  1488. $(".resouImage").load(function(){})
  1489. .error(function(){
  1490. $(this).attr("src","/images/default-resource.jpg");
  1491. });
  1492. if(data.data.payMethod){
  1493. $("#payMethod").val(data.data.payMethod);
  1494. }
  1495. if(data.data.dealPrice){
  1496. $("#dealPrice").val(data.data.dealPrice);
  1497. }
  1498. if(data.data.replyNotes){
  1499. $("#consultContent").val(data.data.replyNotes);
  1500. }
  1501. //根据内容的多少获取高度给父级设置高度
  1502. limitHeight();
  1503. }
  1504. else
  1505. {
  1506. //console.log("系统异常!");
  1507. }
  1508. },
  1509. "error":function(){$.MsgBox.Alert('message','failddd')}
  1510. });
  1511. }
  1512. function ajaxGet1(operationId){
  1513. $.ajax({
  1514. "url":"/ajax/operation/"+operationId,
  1515. "type":"get",
  1516. "async": true,
  1517. "success":function(data){
  1518. if(data.success)
  1519. {//console.log(data);
  1520. $(".log").text(data.data.resource.resourceName);
  1521. $(".timelog").text(changeTime(data.data.createTime));
  1522. $(".contration").text(data.data.operationId);
  1523. $(".detail").text(data.data.detailDemand);
  1524. $(".dealTime").text(changeTime(data.data.deliverTime));
  1525. $(".namecon").text(data.data.resource.professor.name);
  1526. $(".sname").text(data.data.applysquare);
  1527. $(".resouImage").attr("src","/images/resource/"+data.data.resource.resourceId+".jpg");
  1528. $(".resouImage").load(function(){})
  1529. .error(function(){
  1530. $(this).attr("src","/images/default-resource.jpg");
  1531. });
  1532. if(data.data.payMethod){
  1533. $("#payMethod").text(data.data.payMethod);
  1534. }
  1535. if(data.data.dealPrice){
  1536. $("#dealPrice").text(data.data.dealPrice);
  1537. }
  1538. if(data.data.replyNotes){
  1539. $("#consultContent").text(data.data.replyNotes);
  1540. }
  1541. //根据内容的多少获取高度给父级设置高度
  1542. limitHeight();
  1543. }
  1544. else
  1545. {
  1546. //console.log("系统异常!");
  1547. }
  1548. },
  1549. "error":function(){$.MsgBox.Alert('message','failddd')}
  1550. });
  1551. }
  1552. /*科研资源菜单点击切换*/
  1553. $(".worksamlltit1").click(function(){
  1554. var index = $(this).index();
  1555. $(this).addClass("worksamlltitnow").siblings().removeClass("worksamlltitnow");
  1556. $(".workmysrc1").eq(index).show().siblings().hide();
  1557. });
  1558. });