'
stringContent +=''+data.data.data[i].createTime+' | '
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+=' '+ $data[0].professor.name +' '
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();
});
});