Files

370 lines
13 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<script type='text/javascript' src="../officecontrol/jquery.js"></script>
<head>
<meta charset="UTF-8">
<title>开标倒计时-招标采购中心</title>
<link href="css/countDown.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--内容区-->
<div>
<!--红头-->
<div class="headerArea">
<img src="images/logo.svg" alt="" width="30" class="headerPic" />
<h2>中远海运集团采购信息系统 招标采购中心</h2>
</div>
<!--//红头-->
<!--倒计时区-->
<div class="countDownBlock">
<div class="timeNow" id="dateTime">
<span>00</span>/
<span>00</span>/
<span>00</span>
<span>00</span>:
<span>00</span>:
<span>00</span>
</div>
<!--主区域-->
<!--天数三位数时请引用在countDownArea后加countDownSpe即可-->
<div class="countDownArea countDownSpe">
<h2 id="deptName"></h2>
<table class="countTable" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10%" />
<col width="40%" />
<col width="10%" />
<col width="*" />
</colgroup>
<tbody>
<tr>
<td>项目名称:</td>
<td colspan="3" id="projectName"></td>
</tr>
<tr>
<td>项目编号:</td>
<td id="projectNumber"></td>
<td>标段名称:</td>
<td id="sectionName"></td>
</tr>
<tr>
<td>标段编号:</td>
<td id="sectionNumber"></td>
<td>开标时间:</td>
<td id="openTime"></td>
</tr>
</tbody>
</table>
<div class="countDownTime">
<p>距开标还有:</p>
<div class="showTime">
<span class="timeType01" id="dd">000</span><i></i>
<span class="timeType01" id="hh">00</span><i></i>
<span class="timeType01" id="mm">00</span><i></i>
<span class="timeType01" id="ss">00</span><i></i>
</div>
<!--到开标时间(可点击)样式为countBtn02未到开标时间不可点击样式为countBtn01-->
<button type="button" id="openButton" class="countBtn countBtn01"></button>
</div>
</div>
<!--//主区域-->
</div>
<!--//倒计时区-->
</div>
<!--//内容区-->
<script>
var getDescOpenRoomTimer = "";//剩余时间修正定时
var getTimer = "";//开标时间修正定时
var systemTimer = "";//系统时间计算
var aa = getQueryVariable("aa");
var bb = getQueryVariable("bb");
var roomType = getQueryVariable("roomType");
var openRoomId = getQueryVariable("cc");
var token = sessionStorage.getItem('Authorization');
var userData = sessionStorage.getItem('userData');
var obj = JSON.parse(userData);
var roleData = sessionStorage.getItem('roleData');
var role = JSON.parse(roleData);
var roleCode = role.roleCode;
$("#deptName").html(obj.deptName);
var service_opentime = "";//开标时间
var openState = 0;//未开
var projectId = "";
var sectionId = "";
var oping_n = 0;
var oping_y = 0;
var oping_t = 0;
var oping_h = 0;
var oping_m = 0;
var oping_s = 0;
function getOpening() {
$.ajax({
url: "/api/biz-service-ebtp-opening/v1/bizbidopenroom/getOpenRoomById/" + openRoomId,
headers: {
"Authorization": token
},
type: "GET",
success: function (re) {
var data = re.data;
$("#projectName").html(data.projectName);
$("#projectNumber").html(data.ebpProjectNumber);
$("#sectionName").html(data.sectionName);
$("#sectionNumber").html(data.sectionNo);
openState = data.roomState;
projectId = data.projectId;
sectionId = data.sectionId;
if (data.opingTime != null && data.opingTime != "") {
service_opentime = data.opingTime;
$("#openTime").html(data.opingTime);
var openTime = data.opingTime.split(" ");
var date = openTime[0].split("-");
oping_n = date[0];
oping_y = date[1];
oping_t = date[2];
var time = openTime[1].split(":");
oping_h = time[0];
oping_m = time[1];
oping_s = time[2];
getTime();
getTimer = setInterval(getTime, 30000);//开标时间修正
getDescOpenRoomTime();
getDescOpenRoomTimer = setInterval(getDescOpenRoomTime, 30000);//剩余时间修正
systemTimer = setInterval(systemTime, 1000);//系统时间计算
} else {
$("#openTime").html("开标日期异常")
}
}
});
}
getOpening();
var n = 0;
var y = 0;
var t = 0;
var h = 0;
var m = 0;
var s = 0;
//获取开标时间
function getTime() {
$.ajax({
url: "/api/biz-service-ebtp-extend/v1/timeService/getServiceSystemTime",
headers: {
"Authorization": token
},
async: true,
type: "GET",
success: function (re) {
n = re.data.year;
y = re.data.month;
t = re.data.date;
h = re.data.hour;
m = re.data.minute;
s = re.data.second;
}
});
}
var dd = 0;
var hh = 0;
var mm = 0;
var ss = 0;
//获取剩余时间差
function getDescOpenRoomTime() {
$.ajax({
url: "/api/biz-service-ebtp-extend/v1/timeService/getDescOpenRoomTime",
data: {
openTime: service_opentime
},
headers: {
"Authorization": token
},
async: true,
type: "GET",
success: function (re) {
dd = re.data.date;
hh = re.data.hour;
mm = re.data.minute;
ss = re.data.second;
}
});
}
var timeover = false;
//系统时间定时更新
function systemTime() {
s = s + 1;
if (s == 60) {
s = 1;
m = m + 1;
}
if (m == 60) {
m = 1;
h = h + 1;
}
if (h == 24) {
h = 0;
t = t + 1;
}
$('#dateTime span').eq(0).html(n);
$('#dateTime span').eq(1).html(y < 10 ? "0" + y : y);
$('#dateTime span').eq(2).html(t < 10 ? "0" + t : t);
$('#dateTime span').eq(3).html(h < 10 ? "0" + h : h);
$('#dateTime span').eq(4).html(m < 10 ? "0" + m : m);
$('#dateTime span').eq(5).html(s < 10 ? "0" + s : s);
for (var i = 0; i < $('#dateTime').length; i++) {
if ($('div').eq(i).text().length == 1) {
$('div').eq(i).html(function (index, html) {
return 0 + html;
});
}
}
if (!timeover) {
openJsystemTime();
}
}
//剩余时间定时
function openJsystemTime() {
ss = ss - 1;
if (ss < 0) {
if (mm > 0 && hh > 0 && dd > 0) {
mm = mm - 1;
ss = 59;
} else {
ss = 0;
}
}
if (mm < 0) {
if (hh > 0 && dd > 0) {
hh = hh - 1;
mm = 59;
} else {
mm = 0
}
}
if (hh < 0) {
if (dd > 0) {
dd = dd - 1;
hh = 23;
} else {
dd = 0;
}
}
if (dd < 0) {
dd = 0;
}
if (roleCode == "ebtp-agency-project-manager" || roleCode == "ebtp-purchase") {
$("#openButton").text('开 标');
} else {
$("#openButton").text('进入开标大厅');
if (openState == 0) {
$("#openButton").hide();
} else {
$("#openButton").show();
}
}
if (ss <= 0 && mm <= 0 && hh <= 0 && dd <= 0) {
dd = 0;
hh = 0;
mm = 0;
ss = 0;
//可以开标
$("#openButton").removeClass("countBtn01").attr("class", "countBtn countBtn02");
$("#openButton").bind("click", function () {
if (openState == 0) {
if (roleCode == "ebtp-agency-project-manager" || roleCode == "ebtp-purchase") {
opening();//未开标先开标
} else {
supplierOpening();//供应商进入开标室
}
} else {//否则直接进入
onClickToOpenRoom();
}
})
//可以开标后 结束除系统时间更新外所有定时
clearInterval(getTimer);
clearInterval(getDescOpenRoomTimer);
timeover = true;
}
$("#dd").html(dd < 10 ? "00" + dd : dd < 100 ? "0" + dd : dd);
$("#hh").html(hh < 10 ? "0" + hh : hh);
$("#mm").html(mm < 10 ? "0" + mm : mm);
$("#ss").html(ss < 10 ? "0" + ss : ss);
}
function opening() {
var puData = { "projectId": projectId, "sectionId": sectionId, "id": openRoomId, "roomState": "1" };
$.ajax({
url: "/api/biz-service-ebtp-opening/v1/bizbidopenroom/updateOpenRoom",
data: JSON.stringify(puData),
contentType: 'application/json',
dataType: "json",
headers: {
"Authorization": token,
"token": token
},
type: "POST",
success: function (re) {
//开标成功进入开标室
if (re.success) {
onClickToOpenRoom();
} else {
alert(re.message);
}
},
error: function (re) {
alert(re.message);
}
});
}
function supplierOpening() {
//重新获取开标室信息
getOpening();
if (openState == 0) {
alert("请等待业务经理开标");
} else {
onClickToOpenRoom();
}
}
function onClickToOpenRoom() {
window.location.href = "/room/index?aa=" + aa + "&bb=" + bb + "&roomType=" + roomType;
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) { return pair[1]; }
}
return (false);
}
</script>
</body>
</html>