yzms/show/qc_cm.php

833 lines
33 KiB
PHP
Raw 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.

<?
require_once(dirname(__FILE__)."/common.php");
$act = $_GET['act'];
function get_today_dates($dining_hall_id)
{
global $db;
$data = $db->get_all("select * from tb_date where dining_hall_id={$dining_hall_id} and dc_date = '".date("Y-m-d")."'");
$nowtime = date('H:i');
$all = array();
//foreach($data as $item) {
//
//}
return $data;
}
function get_take_info($dining_hall_id, $userid)
{
global $db;
$today = time();
$dates = get_today_dates($dining_hall_id);
$take_codes = array();
$uInfo = $db->get_one("select * from tb_user where id=".intval($userid));
$user_type = $uInfo['type_id'];
foreach($dates as $date) {
$dc_type = $date['dc_type'];
$meal_info = $db->get_one("select * from tb_meal_type where status=1 and id=".intval($dc_type));
$start_time = $meal_info['start_time'];
$end_time = $meal_info['end_time'];
$nowtime = date('H:i');
$meal_info2 = $db->get_one("select * from tb_meal_type_user_time where meal_type_id={$dc_type} and user_type_id=".intval($user_type));
if($meal_info2) {
$start_time = $meal_info2['start_time'];
$end_time = $meal_info2['end_time'];
}
if( $nowtime >= $start_time && $nowtime < $end_time) {
$order = $db->get_one("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (6)");
if(!$order) $order = $db->get_one("select a.* from tb_order a where uid = {$userid} and type=1 and date_id=".$date['id']." and state_id in (3)");
if ($order) {
$take_code = $order['take_food_code'];
$take_codes[] = $take_code;
}
}
}
return $take_codes;
}
if($act == 'get_takecode') {
$icid = trim($_POST['icid']);
$ftid = trim($_POST['ftid']);
if(!$icid || !$ftid) exit;
$uInfo = $db->get_one("select a.id,a.username,a.cellphone,a.deptname,a.area_id from tb_user a,tb_user_idcard b where b.user_id=a.id and cardno='{$icid}' and a.enabled not in (0, -99) and b.state=1");
if(!$uInfo) {
echoRs(0, 'nouser');
}
$take_codes = get_take_info($ftid, $uInfo['id']);
$info = array('user' => $uInfo);
if($take_codes) $info['take_code'] = implode(",", $take_codes);
echoRs(1, 'ok', $info);
exit;
}
$ftid = intval($_GET['ftid']);
$channelid = intval($_GET['channelid']);
if(!$ftid) {
die("no ftid!");
}
$ftInfo = $db->get_one("select * from tb_dining_hall where id=".$ftid);
if(!$ftInfo) {
die("no ftid dining_hall!");
}
$company_id = intval($ftInfo['company_id']);
$companyInfo = $db->get_one("select * from tb_company where id=".$company_id);
//传媒集团临时改增加 +号,为免影响其他在用用户,做临时跳转
if($company_id == 34) {
$pay_url = "qc_pay_cm.php";
} else {
$pay_url = "qc_pay.php";
}
$qs = $_SERVER['QUERY_STRING'];
$qs = preg_replace('/&ftid=[^&]+/', '', $qs);
$qs = preg_replace('/ftid=[^&]+(&|$)/', '', $qs);
$qs = preg_replace('/&channelid=[^&]+/', '', $qs);
$qs = preg_replace('/channelid=[^&]+(&|$)/', '', $qs);
$iscomplete = $_GET['iscomplete'];
if(!$iscomplete && !$_GET['code']) {
/*if($ftid >= 1000) {
require_once(dirname(__FILE__)."/common.php");
$row = $db->get_one("select * from tb_goods_place where code = '{$ftid}'");
if(!$row) {
die("ftid err!");
}
if($row['type'] == 1) { //付款码
header("Location: qc_pay.php?".$_SERVER['QUERY_STRING']."&iscomplete=1&notshowbt=1");
exit;
} else if($row['type'] == 2) { //取货
header("Location: qc_mall.php?".$_SERVER['QUERY_STRING']."&iscomplete=1");
exit;
}
}
$time = date("Hi");
if($time >= '0600' && $time <= '0830') { //早餐
header("Location: qc_pay.php?".$_SERVER['QUERY_STRING']."&iscomplete=1");
exit;
}*/
header("Location: ?".$_SERVER['QUERY_STRING']."&iscomplete=1");
exit;
}
//增加判断是否显示取货码入口
$showqh = false;
$rs = $db->get_one("select * from tb_goods_place where code= '".$ftid."_".$channelid."' and enabled = 1");
if($rs) {
$showqh = true;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>取餐</title>
<style type="text/css">
html, body {
border: none;
/*cursor: none;*/
}
<? include("css/normalize.css");?>
.take_meals_blue{
background: #1E9FFF!important;
color: #fff!important;
float: left;
}
</style>
<script type="text/javascript" src="js/func.js"></script>
</head>
<body>
<script type="text/javascript">
var isGetting = false;
function test(code) {
if(code.toLowerCase().indexOf("shift") != -1) return ;
//code = code.replace("Num ", "").replace("num ", "");
if(code.toLowerCase() == 'backspace') code = '[back]';
if(code.toLowerCase() == 'enter') code = '[enter]';
dealKey('2', code);//document.getElementById("div1").innerHTML = code;
//tt += code+"";
}
function fromKeyCode(code) {
if((code >= 48 && code <= 57) || (code >= 65 && code <= 90)) return String.fromCharCode(code);
var keys = {186: ';', 188: ',', 189: '-', 190: '.', 191: '/', 222: "'", 219: '[', 221: ']', 187: '=',
96:'Num 0', 97:'Num 1', 98:'Num 2', 99:'Num 3', 100:'Num 4', 101:'Num 5', 102:'Num 6', 103:'Num 7', 104:'Num 8', 105:'Num 9',
111:'Num /', 106:'Num *', 109:'Num -', 111:'Num /', 107:'Num +',13:'[enter]',8:'[back]',110:'Num .'
//,45:'0', 35:'1', 40:'2', 34:'3', 37:'4', 12:'5', 39:'6', 36:'7', 38:'8', 33:'9'
};
if(keys[code]) return keys[code];
return '*err*';
}
function hashCode(strKey)
{
var hash = 0;
if(strKey != null && strKey != "")
{
for (var i = 0; i < strKey.length; i++)
{
hash = hash * 31 + strKey.charCodeAt(i);
hash = intValue(hash);
}
}
return hash;
}
function intValue(num)
{
var MAX_VALUE = 0x7fffffff;
var MIN_VALUE = -0x80000000;
if(num > MAX_VALUE || num < MIN_VALUE)
{
return num &= 0xFFFFFFFF;
}
return num;
}
document.onkeydown = function() {
var code = event.keyCode; //alert(code+","+fromKeyCode(code));return;
//[st]sduf87fjsdfysd78,526976123;
if(code == 16) return ;
dealKey('1', fromKeyCode(code));//document.getElementById("div1").innerHTML += fromKeyCode(code);
//document.getElementById("div1").innerHTML += fromKeyCode(code)+"|";
}
var maxInputTime = 10;
var kb_status = {'1':'1','2':'1'};
var kb_readStr = {'1':'','2':''};
var kb_timeOut = {'1':'','2':''};
var last1time = 0;
var nowInput = false;
var inputCode = '';
var closeTime = 0;
var closeItv;
var nowInputFrom = '1';
var nowLaseInput = 0;
var lastCloseInput = 0;
var lastInput1 = 0;
var lastSucTime = 0;
var lastErrTime = 0;
var lastddh = '';
var lastdctype = '';
// 是否有人在取餐
var is_take_meals = 0;
var wait_sweep_code_txt = '待扫码';
var take_meals_txt = '确认取餐';
//[st]a7nd823sd,-235435454;
function dealInput(c) {
if(new Date().getTime() - lastInput1 < 50) return ;
lastInput1 = new Date().getTime();
c = c.replace("Num ", "").replace("num ", "");
if(c.toLowerCase() == 'enter') c = '[enter]';
if(c >= '0' && c <= '9') {
inputCode += c;
$("qcm_"+inputCode.length).innerHTML = c;
if(inputCode.length >= 8) {
nowInput = false;
kb_status['1'] = '1';
kb_status['2'] = '1';
getOrderInfo(inputCode, <?=$ftid?>, <?=$channelid?>);
closeInput();
return ;
}
closeTime = maxInputTime;
$("close_time").innerHTML = closeTime;
return ;
} else if(c == '[back]') {
if(inputCode != '') {
$("qcm_"+inputCode.length).innerHTML = '&nbsp;';
inputCode = inputCode.substr(0, inputCode.length-1);
}
return ;
} else if(c == '/' || c == '*' || c == '-' || c == '+' || c == '[enter]' || c == '.'){
closeInput();
return ;
}
//alert(c+","+c.length);
}
function showCloseTime() {
closeTime--;
if(closeTime <= 0) {
closeInput();
return ;
}
$("close_time").innerHTML = closeTime;
}
function startInput() {
nowInput = true;
closeTime = maxInputTime;
$("close_time").innerHTML = maxInputTime;
try{clearInterval(closeItv);}catch(e){}
closeItv = setInterval(showCloseTime, 1000);
showInput();
}
function dealKey(from, c) {
if(isGetting) {
kb_status[from] = '1';
readErr(from, 9);
return ;
}
if(nowInput) {
if(from == nowInputFrom) dealInput(c);
return ;
}
if(from == '1') last1time = new Date().getTime();//alert(from);
if(kb_status[from] == '1') { //开始
<? if($companyInfo['nokeybord'] == 0) { ?>
if(c.substr(0, 4) == 'Num ' && (new Date().getTime() - lastCloseInput > 200)) {
if(from == '1') {
nowInputFrom = '1';
nowLaseInput = new Date().getTime();
startInput();
if(c.match(/^Num \d$/)) dealInput(c);
} else if(from == '2') {
setTimeout(function() {
if(new Date().getTime() - nowLaseInput > 500) {
nowInputFrom = '2';
startInput();
if(c.match(/^Num \d$/)) dealInput(c);
}
}, 200);
}
return ;
}
<? } ?>
if(c == '[') {
kb_timeOut[from] = setTimeout("readErr('"+from+"', 1);", 2000);
kb_status[from] = '2';
} else if(c == ';') { //IC卡
kb_timeOut[from] = setTimeout("readErr('"+from+"', 1);", 2000);
kb_status[from] = '6';
}
else readErr(from, 2);
} else if(kb_status[from] == '2') { //读取s
if(c == 'S') kb_status[from] = '3';
else {
kb_status[from] = '1';
readErr(from, 3);
}
} else if(kb_status[from] == '3') { //读取t
if(c == 'T') kb_status[from] = '4';
else {
kb_status[from] = '1';
readErr(from, 4);
}
} else if(kb_status[from] == '4') { //读取]
if(c == ']') {
kb_status[from] = '5';
kb_readStr[from] = '';
} else {
kb_status[from] = '1';
readErr(from, 5);
}
} else if(kb_status[from] == '5') { //读取内容
if(c == ';') {
try{clearTimeout(kb_timeOut[from]);} catch(e){}
kb_status[from] = '1';
var a = kb_readStr[from].split(",");
if(a.length == 2) {
var s1 = a[0].toLowerCase();
var hcode = a[1];
hcode = hcode.replace("Num ", "");
if(hashCode(s1) == hcode) {
if(from == '1') {
readContent(from, s1, 'qr');
} else {
setTimeout(function() {
if(new Date().getTime() - last1time > 1000) {
readContent(from, s1, 'qr');
}
}, 300);
}
} else {
//alert(s1+","+hcode+","+hashCode(s1));
readErr(from, 6);
}
} else {
readErr(from, 7);
}
kb_readStr[from] = '';
} else {
if(c == '*err*') {
kb_status[from] = '1';
readErr(from, 8);
} else {
kb_readStr[from] += c;
}
}
} else if(kb_status[from] == '6') { //IC卡读取内容
if(c == '/' || c == '[enter]') {
try{clearTimeout(kb_timeOut[from]);} catch(e){}
kb_status[from] = '1';
var s1 = kb_readStr[from].toLowerCase();
if(from == '1') {
readContent(from, s1, 'ic');
} else {
setTimeout(function() {
if(new Date().getTime() - last1time > 1000) {
readContent(from, s1, 'ic');
}
}, 300);
}
kb_readStr[from] = '';
} else {
if(c >= '0' && c <= '9') {
kb_readStr[from] += c;
} else {
kb_status[from] = '1';
readErr(from, 8, 'ic');
}
}
}
//document.getElementById("div1").innerHTML += c+"|"+kb_status[from]+"$";
}
function readErr(from, rs, type) {
kb_status[from] = '1';
kb_readStr[from] = '';
try{clearTimeout(kb_timeOut[from]);} catch(e){}
//alert(from+":读取错误!"+rs);
var tname = '二维码';
if(type && type == 'ic') {
tname = 'IC卡';
}
if(rs != 9 && new Date().getTime() - lastErrTime > 1000 && new Date().getTime() - lastSucTime > 1000) {
/*lastErrTime = new Date().getTime();
lastddh = '';
lastdctype = '';
$("hasDiv").style.display = 'none';
setMsg('<div style="text-align:center;font-size:50px;color:red">无效'+tname+'</div>');*/
}
}
function setMsg(str) {
$('div2_title').style.display='none';
$("div1").style.display='block';
$("div1").innerHTML = str;
// 刷卡后,更新
getRestInfo();
}
function setMsg2(str) {
// 初始进入,或者每调用一次更新渲染
$('div2_content').innerHTML = str;
}
function readContent(from, str, type) {
//document.getElementById("div1").innerHTML += from+": "+str + '<br />';
if(lastddh == str && lastdctype != '2' && new Date().getTime() - lastSucTime < 30000) return ;
// 判断是否已经按 确认配餐按钮
if(is_take_meals == 1){
myalert("请等待工作人员配餐完成");
return ;
}
lastSucTime = new Date().getTime();
if(type && type == 'ic') {
$G.ajax("?act=get_takecode", {"ftid": "<?=$ftid?>", "icid": str}, function(rs) {
if(rs.status == 1) {
//alert(rs.user.username);
var take_code = rs.take_code;
//alert(take_code);return ;
if(take_code && take_code != '') {
readContent('1', take_code);
} else {
flashPage('err');
setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">'+rs.user.username+', 没有符合的订餐记录!</div>');
}
} else {
if(rs.message == 'nouser') {
setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">无效ic卡</div>');
}
}
}, 'json', 'POST');
} else {
getOrderInfo(str, <?=$ftid?>, <?=$channelid?>);
}
//alert(str);
//document.getElementById("div1").innerHTML += str;
}
function isnull(s) {
return (typeof(s) == 'undefined');
}
function getOrderInfo(oid, fid, channelid) {
setMsg("正在查询..");
$("hasDiv").style.display = 'none';
isGetting = true;
lastddh = '';
lastdctype = '';
$G.ajax("/api/order/take", {'take_code': oid, 'dining_hall_id': fid, 'channelid': channelid}, function(rs) {
try {
if(isnull(rs) || isnull(rs.status)) {
setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">系统错误!</div>');
} else if(rs.status == '1') {
if(isnull(rs.data) || isnull(rs.data.list)) {
setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">未知错误</div>');
} else {
var issg = (rs.data.issg && rs.data.issg==1); //韶关
lastddh = oid;
lastdctype = 1;
var str = '';
var ustr = '';
if(rs.data.user) ustr = '<span style="font-size:30px; color:#666666">'+rs.data.user.deptname+'/'+rs.data.user.username+"/"+rs.data.user.cellphone+'</span>';
str += '<h1 style="font-size:40px">'+(ustr+"<br />")+'</h1>';
var list = rs.data.list;
var dtlist = [];
var color = '';
var reststr = '';
for(var ai = 0; ai < list.length; ai++) {
for(var ai2 = 0; ai2 < list[ai].order_detail.length; ai2++) {
var info = list[ai].order_detail[ai2];
info.meal_name = list[ai].meal_name;
dtlist.push(info);
}
if(!isnull(list[ai].take_status) && list[ai].take_status == 0) {
$("hasDiv").style.display = '';
color = 'color:red;';
}
try {
if(!isnull(list[ai].rest_info)) {
var reststr2 = '';
for(var i in list[ai].rest_info) {
if(reststr2 != '') reststr += '&nbsp;&nbsp;';
var item = list[ai].rest_info[i];
reststr2 += item.dish_name + ':<span style="color:#009900">' + item.rest_num + '</span>';
}
// reststr += '<div style="width:90%; text-align:left; margin-top:20px;font-size:25px; line-height:1.8">'+ reststr2 +'</div>';
}
} catch (e){}
}
//str += "取餐类型: "+(rs.data.type=='2'?'<span style="color:blue">工作餐</span>':'普通餐'+"<br />");
// 修改确认取餐 文字
if($("hasDiv").style.display == 'none'){
// 表示已经扫码,未去过餐(状态改为:确认取餐)
is_take_meals = 1;
// document.getElementsByClassName("take_meals")[0].value = take_meals_txt;
// document.getElementsByClassName("take_meals")[0].classList.add('take_meals_blue');
// $("take_meals").value = take_meals_txt;
// $("take_meals").classList.add('take_meals_blue');
$("take_meals").style.display='';
}else{
$("take_meals").style.display='none';
}
str += '<table border="2" width="90%" bgcolor="#ffffff"><tbody><tr><th class="x2">类型</th><th class="x3">菜名</th>'+(issg?'':'<th class="x2">价格</th>')+'<th class="x2">份数</th></tr>';
var len = dtlist.length;
var height = 120;
if(len > 3) height = 50;
if(len > 6) height = 25;
for(var i = 0; i < len; i++) {
var info = dtlist[i];
//str += '<tr bgcolor="#ffffff"><td width="150">'+info.type_name + '</td><td width="300">' + info.dish_name + '</td><td width="200">' + info.dish_price + '元</td><td width="100">' + info.dish_amount + "</td></tr>"
str += '<tr><td class="x2"><nobr>'+info.meal_name + '</nobr></td><td class="x3">' + info.dish_name + '</td>'+(issg?'':('<td class="x2"><nobr>' + info.dish_price + '元</nobr></td>'))+'<td class="x2"><nobr>' + info.dish_amount + '</nobr></td></tr>';
}
str += '</tbody></table>';
str += reststr;
}
// 刷卡显示
setMsg(str);
flashPage(color==''?'suc':'err');
} else {
if(rs.message) setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">'+rs.message+'</div>');
else setMsg('<div style="text-align:center;font-size:50px;padding-top:200px; color:red">未知错误</div>');
}
} catch (e){}
isGetting = false;
}, 'json', 'POST');
}
function showInput() {
inputCode = '';
for(var i = 1; i <= 8; i++) {
$("qcm_" + i).innerHTML = '&nbsp;';
}
$G.show_div("fdiv", 500, 150);
}
function closeInput() {
lastCloseInput = new Date().getTime();
try{clearInterval(closeItv);}catch(e){}
nowInput = false;
kb_status['1'] = '1';
kb_status['2'] = '1';
inputCode = '';
for(var i = 1; i <= 8; i++) {
$("qcm_" + i).innerHTML = '&nbsp;';
}
$G.hide_div("fdiv");
}
function playVoice() {
try {
$("voice").URL = "images/di.mp3";
$("voice").controls.play();
} catch (e) {
}
}
var flashN = 0;
var flashColor = 0;
function flashPage(type) {
flashN = 3;
if(type == 'err') flashColor = '#E27A7B';
else flashColor = "#DFEFD9";
doFlashPage();
}
function doFlashPage() {
document.body.style.backgroundColor = flashN%2==0?"#ffffff":flashColor;
flashN--;
if(flashN<0) {
document.body.style.backgroundColor = "#ffffff";
return ;
}
setTimeout(doFlashPage, 100);
}
window.onload = function() {
<? if($_GET['code']) { ?>
var s = '<?=$_GET['code']?>';//[st]40440368,1620547585;
for(var i = 0; i < s.length; i++) {
dealKey('1', s.substr(i, 1).toUpperCase());
}
<? } ?>
//
//alert(hashCode("80438842"));
//getOrderInfo('72899475', '1');
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
var owidth = $("qiehuan").offsetWidth;
var oheight = $("qiehuan").offsetHeight;
$("qiehuan").style.top = (height - oheight - 10) + 'px';
$("qiehuan").style.left = (width - owidth - 10) + 'px';
// $("qiehuan2").style.top = (height - oheight - 10 - oheight - 10) + 'px';
//$("qiehuan2").style.left = (width - owidth - 10) + 'px';
//readContent('1', '3084614373', 'ic');
getRestInfo();
}
//function getRestInfo() {
// $G.ajax("/api/order/get_rest_info", {'dining_hall_id': '<?//=$ftid?>//'}, function(rs) {
// try{
// if(rs.data.rest_info) {
// var reststr = '<span style="color:red">剩余数量</span>';
// for(var i in rs.data.rest_info) {
// if(reststr != '') reststr += '&nbsp;&nbsp;';
// var item = rs.data.rest_info[i];
// reststr += item.dish_name + ':<span style="color:#009900">' + item.rest_num + '</span>';
// }
// reststr = '<div style="width:90%; text-align:center; margin-top:20px;font-size:25px; line-height:1.8">'+ reststr +'</div>';
// setMsg('<div style="text-align:center;font-size:50px;padding-top:200px">请刷取餐二维码</div>'+reststr);
// }
// }catch (e) {}
// }, 'json', 'POST');
//}
function getRestInfo() {
$G.ajax("/show/get.php?act=get_rest&ftid=<?=$ftid?>", {}, function(rs) {
try{
if(rs.restList) {
var restList = rs.restList;
var data = []; // 总的数据
for (x in restList){
if(x == 0){
data = restList[x].rest_info;
continue;
}
// 如果有重新的ID 则rest_num叠加
// 判断的数组 restList[x]['rest_info'];
var info__ = restList[x]['rest_info'];
for (z in info__){
for(y in data){
if(info__[z]['id'] == data[y]['id']){
data[y]['rest_num'] = parseInt(data[y]['rest_num'])+parseInt(info__[z]['rest_num']);
break;
}else{
// 循环最后一次 也没匹配上,(新菜式,添加!)
if(data.length-1 == y){
data.push(info__[z]);
}
}
}
}
}
// console.log(data);
var reststr = '<span style="color:red">剩余数量</span>';
for(var i in data) {
if(reststr != '') reststr += '&nbsp;&nbsp;';
var item = data[i];
reststr += item.dish_name + ':<span style="color:#009900">' + item.rest_num + '</span>';
}
reststr = '<div style="width:90%; text-align:center; margin-top:20px;font-size:25px; line-height:1.8">'+ reststr +'</div>';
setMsg2(reststr);
// setMsg2('<div style="text-align:center;font-size:50px;padding-top:200px">请刷取餐二维码</div>'+reststr);
}
}catch (e) {}
}, 'json', 'GET');
}
// 一分钟执行一次 getRestInfo();
var t1 = window.setInterval('getRestInfo()',60000);
</script>
<div id="div1" style="font-size:30px; font-weight:bold; text-align:center">
<!-- <div style="text-align:center;font-size:50px;padding-top:200px">请刷取餐二维码</div>-->
</div>
<div id="div2" style="font-size:30px; font-weight:bold; text-align:center">
<div id="div2_title" style="text-align:center;font-size:50px;padding-top:200px">请刷取餐二维码</div>
<div id="div2_content"></div>
</div>
<div id="hasDiv" style="position:absolute; left:40% ; top:100px; display:none"><img src="images/has.png?r=<?=time()?>" /></div>
<div id="fdiv" style="position:absolute; z-index:15; width:500px; height:150px; display:none; background:#FFF; border:1px solid #dddddd;">
<div style="border-bottom:1px solid #dddddd; height:28px; background:#f5f5f5">
<div style="float:left; padding:5px 5px"><span style="color:#666666">输入取餐码</span></div>
<div style="float:right; padding:5px 5px; font-size:13px; color:#666666"><span id="close_time" style="color:#666666"></span>&nbsp;秒后或按*号关闭</div>
</div>
<div style="height:110px; overflow:hidden;text-align:center">
<div style="border:1px solid #dddddd;width:330px; height:40px; font-size:30px; margin-top:30px; padding:0px">
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_1">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_2">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_3">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_4">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_5">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_6">&nbsp;</div>
<div style="border-right:1px solid #dddddd; width:40px; height:40px; float:left;text-align:center" id="qcm_7">&nbsp;</div>
<div style=" width:40px; height:40px; float:left;text-align:center" id="qcm_8">&nbsp;</div>
</div>
</div>
</div><!-- fdiv -->
<div id="msgDiv" style="position:absolute; left:10px ; top:200px;">
</div>
<?if($showqh) {?>
<div id="qiehuan2" style="position:absolute; z-index:4;width:150px; height:60px; top:500px; left:700px"><input type="button" style="width:150px; height:60px;font-size:25px;font-weight:bold;color:blue" value="取货" onclick="location.href = 'qc_mall.php?<?=$qs?>&ftid=<?=$ftid?>_<?=$channelid?>';" /></div>
<?}?>
<div id="qiehuan" style="position:absolute; z-index:4;width:330px; height:60px; top:500px; left:700px">
<input type="button" style="width:150px; height:60px;font-size:25px;font-weight:bold;color:blue;margin-right: 25px;vertical-align: bottom;display: none;" id="take_meals" class="take_meals take_meals_blue" value="确认取餐" onclick="take_meals()" />
<input type="button" style="width:150px; height:60px;font-size:25px;font-weight:bold;color:blue;float: right" value="付款码支付" onclick="location.href = '<?=$pay_url?>?<?=$_SERVER['QUERY_STRING']?>';" />
</div>
<div id="fdiv_alert" style="position:absolute; z-index:15; width:600px; height:250px; display:none; background:#FFFFFF; border:1px solid #dddddd;">
<div style="border-bottom:1px solid #dddddd; height:28px; background:#f5f5f5">
<div style="float:left; padding:5px 5px"><span style="color:#666666">提示</span></div>
<div style="float:right; padding:5px 5px; font-size:13px; color:#666666"><span id="alert_close_time" style="color:#666666"></span>&nbsp;秒后关闭</div>
</div>
<div style="height:410px; overflow:hidden;text-align:center">
<div id="alert_msg" style="font-size:50px; color:red;font-weight:bold; text-align:center;height:115px;padding-top:30px"></div>
<div style="text-align:center;margin-top:5px"><input type="button" style="width:140px; height:50px; font-size:30px;" value="关闭" onclick="closeAlert()" /></div>
</div>
</div>
<script>
// var tm = document.getElementsByClassName("take_meals")[0];
var tm = $("take_meals");
if(is_take_meals == 0){
// 等待扫码
// tm.value = wait_sweep_code_txt;
// tm.classList.remove('take_meals_blue');
// $("take_meals").style.display='none';
}else{
// 确认取餐
tm.value = take_meals_txt;
// tm.classList.add('take_meals_blue');
// $("take_meals").style.display='initial';
}
// 点击取餐,后切换 等待扫码状态
function take_meals() {
is_take_meals = 0;
// 等待扫码
// tm.value = wait_sweep_code_txt;
// tm.classList.remove('take_meals_blue');
// 还原初始状态
$("div1").innerHTML="";
$("div1").style.display='none';
$("div2_title").style.display='block';
$("take_meals").style.display='none';
}
function closeAlert() {
if(itvList['fdiv_alert']) { try{clearInterval(itvList['fdiv_alert']);} catch(e){} delete(itvList['fdiv_alert']); }
$G.hide_div("fdiv_alert");
}
function myalert(str) {
$("alert_msg").innerHTML = str;
$G.show_div("fdiv_alert", 600, 250);
showDjs('fdiv_alert', 'alert_close_time', 5, closeAlert);
}
var itvList = {};
var djsNow = {};
function showDjs(id, tid, time, func) {
if(itvList[id]) return ;
djsNow[id] = time;
$(tid).innerHTML = djsNow[id];
itvList[id] = setInterval(function() {
djsNow[id]--;
if(djsNow[id] <= 0) {
try{clearInterval(itvList[id]);} catch(e){}
delete(itvList[id]);
func();
return ;
}
$(tid).innerHTML = djsNow[id];
}, 1000);
}
</script>
</body>
</html>