//点击列表弹出框
function contentHide(obj){
if($(obj).find(".hide_content").hasClass("show_content")){
init();
} else {
init();
$(obj).find(".hide_content").addClass("show_content");
$(obj).find("i").addClass("layui-icon-triangle-d");
$(obj).find(".content_div_input").addClass("content_div_input_click");
}
}
//列表恢复初始化
function init(){
$(".hide_content").removeClass("show_content");
$(".content_div_input i").removeClass("layui-icon-triangle-d");
$(".content_column i").addClass("layui-icon-triangle-r");
$(".content_div_input").removeClass("content_div_input_click");
}
//查询报价单
function getQuotation(page, limit, startTime, endTime, destination){
layer.load(3);
$.ajax({
url: "/privateOrder/getPrivateOrder",
type: "get",
data: {
"page": page,
"limit": limit,
"startTime": startTime,
"endTime": endTime,
"destination": destination,
"orderType": idVal
},
headers: {"token": token},
dataType: "json",
success: (data) => {
if(data.msg == "200"){
$(".content_div div").remove();
$.each(data.data, (index, item) => {
var type = "待回答";
var buttonElem = "\n" +
"\n"
if(item.orderType == 0){
type = "待回答";
}else if(item.orderType == 1){
type = "已回答";
buttonElem = "\n";
}else if(item.orderType == 5){
type = "已完成";
buttonElem = "\n";
}else if(item.orderType == 3){
type = "行程开始";
buttonElem = "\n" +
"\n";
}else if(item.orderType == 2){
type = "已付费";
buttonElem = "\n" +
"\n";
}else if(item.orderType == 4){
type = "行程结束";
buttonElem = "\n" +
"\n";
}else if(item.orderType == 6){
type = "不感兴趣";
}else if(item.orderType == 9){
type = "取消行程";
buttonElem = "\n";
} else if(item.orderType == 12){
type = "已上传交通信息";
buttonElem = "\n" +
"\n";
}
$(".content_div").append("
\n" +
"
\n" +
"
"+ (index + 1) +"
\n" +
// "
\n" +
// "\n" +
// "
\n" +
"
"+ item.origin +"
\n" +
"
"+ item.destination +"
\n" +
"
"+ item.startTime +" - "+ item.endTime +"
\n" +
"
"+ item.peopleNum +"
\n" +
"
"+ item.budgetMin +" - "+ item.budgetMax +"
\n" +
"
"+ type +"
\n" +
"
\n" +
buttonElem +
"
\n" +
"
\n" +
"
")
});
//自定义样式分页
laypage.render({
elem: 'demo2'
,count: data.count
,theme: '#1E9FFF'
, limit: limit
, curr: page
, jump: function (obj,first) {
if (!first) {
getQuotation(obj.curr,obj.limit, startTime, endTime);
}
}
, prev: ''
, next: ''
});
if(data.count != 0){
parent.$(".layui-nav-child .message_num").html(data.count).show();
} else {
parent.$(".layui-nav-child .message_num").html(0).hide();
}
}
layer.closeAll("loading");
},
error: () => {
layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
layer.closeAll("loading");
}
});
}
//忽略
function ignoreClick(obj){
var uuid = $(obj).parent().parent().parent().attr("uuid");
window.event.cancelBubble = true;//阻止冒泡
layer.confirm('确认忽略吗?', function (index) {
layer.load(3);
$.ajax({
url: "/privateOrder/addIgnore",
type: "post",
data: {
"orderingUuid": uuid
},
headers: {"token": token},
dataType: "json",
success: (data) => {
layer.msg(paramReturn("忽略成功", parent.type), {icon: 1});
getQuotation(0, 7, startTime, endTime);//查询报价单数据渲染
layer.closeAll("loading");
},
error: () => {
layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
layer.closeAll("loading");
}
});
})
}
//提供报价
function offerClick(obj){
var uuid = $(obj).parent().parent().parent().attr("uuid");
var name = $(obj).attr("name");
if(idVal == "2" && name != "交通信息"){
window.location.href="planLook?uuid=" + uuid
} else if(idVal == "2" && name == "交通信息"){
window.location.href="trafficUpload?uuid=" + uuid
} else {
var count = getDemandCount(uuid);
if(count >= 11){
layer.msg("此订单已超出最大报价次数", {icon: 2});
return false;
}
window.location.href="demandForSingleOffer?uuid=" + uuid
}
}
//查询当前定制单是否超过十个人报价
function getDemandCount(uuid){
var count = 0;
$.ajax({
async: false,
url: "/privateOrder/getDemandCount",
type: "get",
data: {
"uuid": uuid
},
headers: {"token": token},
dataType: "json",
success: (data) => {
count = data.data;
},
error: () => {
layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
layer.closeAll("loading");
}
});
return count;
}