ssh js

function dingcan(){

var tabId=$("#tabId").val();

if(tabId==""){

alert("请书订餐号!");

}else{

$.post(rt+"/Cash/orderInfo_getOrderInfoByAjax.action",{"tabId":tabId},function(data){

if(data==""){

alert("此餐台不需要结账!");

window.location.href = rt+"/Cash/orderInfo_toPayMoney.action";

}

var o=$.parseJSON(data);

$("#orderId").text(o.orderId);

$("#totalMoney").text(o.totalMoney);

$("#ysMoney").text(o.totalMoney);

$("#ssMoney").text(o.totalMoney);

$.post(rt+"/Cash/orderDetail_getOrderDetailByAjax.action",{"orderInfo.orderId":o.orderId},function(data){

var list=$.parseJSON(data);

var i=0;

$("#infoTab tr:gt(1)").remove();

for(i=0;i<list.length;i++){

$("#infoTab").append("<tr class='content'>" +

"<td>"+list[i].foodInfo.foodId+"</td>" +

"<td>"+list[i].foodInfo.foodName+"</td>" +

"<td>"+list[i].foodInfo.foodPrice+"</td>" +

"<td>"+list[i].foodCount+"</td>" +

"<td>"+list[i].foodInfo.foodDiscount+"</td>" +

"<td>"+list[i].foodInfo.foodPrice*list[i].foodCount*list[i].foodInfo.foodDiscount+"</td>" +

"</tr>");

}


});

});

}

}

/**

 * 查询餐台信息

 */

function checkctinfo(){

var cttxt=$("#ctname").val();

if(cttxt==""){

alert("请输入消费订单号!");

$("#ctname").val("").focus();

}else{

$.post(rt+"/Cash/orderInfo_checkctOrderId.action",{"orderInfo.orderId":cttxt},function(data){

if(data==1){

window.location.href=rt+"/Cash/orderInfo_getOrderInfoByAjax.action?cttxt="+cttxt+"";

}

else{

alert("未查到相关数据!");

$("#ctname").val("").focus();

return false;

}

});


}


}


function getctinfo(ctid){

$.post(rt+"/Cash/orderInfo_checkOrderStats.action",{"cttxt":ctid},function(data){

if(data==1){

$.post(rt+"/Cash/orderInfo_checkctEmpty.action",{"cttxt":ctid},function(data){

$("#pc_main").load(rt+"/Cash/orderInfo_checkctEmpty.action",{"cttxt":ctid});

$('#showct').hide();

$('#pc_main').show();

});

}

if(data==0){

alert(ctid+"餐桌可以开台使用!");

}

});

}



/**

 * 双击处理信息

 */

function dealwict(ctid){


alert(ctid);

}



function huiyuan(){

var totalMoney=$("#totalMoney").text().trim();

if(totalMoney=="00.00"){

alert("请选择结账桌台!");

}else{

var associator=$("#associator").val();

if(associator==""){

alert("请输入会员号!");

}else{

$.post(rt+"/Cash/associator_getAssociatorByAjax.action",{"associator.assocCard":associator},function(data){

if(data==""){

alert("没有此会员号,请重新输入!");

$("#associator").val("");

}else{

var ysMoney=$("#ysMoney").text().trim();

$("#yhMoney").text(ysMoney*0.1);

$("#ssMoney").text(ysMoney*0.9);

}

});

}

}

}

/**

 * 实现找零

 * @param luojin

 */


function countMoney(moneys){

if(moneys==""){

$("#assountmsg").html("实收金额不能为空!").show().fadeOut(5000).css({ color: "yellow"});

return false;

}else{

var rvsPrice=$("#yingshou").text();

rvsPrice=rvsPrice.substring(1,rvsPrice.length-1);

var savePrice=Math.round((parseFloat(moneys)-parseFloat(rvsPrice))*100)/100;

if(savePrice<0){

alert("实收金额不能小于应收金额,请再次输入金额!");

$("#getMomery").val("").focus();

return false;

}else{

/* $("#pc_main").show();

$("#pc_mains").hide();*/

//找零啊:

//$("#countPrice").html("¥"+savePrice+"元");

}

}

}

/**

 * 实现结算

 * @param luojin

 */

function resultMoney(){

var insertPrice=$("#getMomery").val();

var yingshou=$("#yingshou").text();

var rvsPrice=yingshou.substring(1,yingshou.length-1);

var assouid=$("#assouid").val();

var orderId=$("#orderId").text();

var ctid=$("#ctid").val();

var zkl=$("#countPrice").text();

var zks=zkl.substring(1,zkl.length-1);

if(insertPrice==""){

alert("实收金额不能为空,请输入金额!");

return false;

}

else{

var savePrice=Math.round((parseFloat(insertPrice)-parseFloat(rvsPrice))*100)/100;

if(savePrice<0){

alert("实收金额不能小于应收金额,请再次输入金额!");

$("#getMomery").val("").focus();

return false;

}else{

$.post(rt+"/Cash/orderInfo_CountPayMoney.action",{"orderInfo.totalMoney":rvsPrice,"orderInfo.orderId":orderId,"Tel":assouid,"diningTable.dinTabId":ctid,"yingshou":rvsPrice,"insertPrice":insertPrice,"savePrice":savePrice,"zks":zks},function(data){

if(data=="1"){

   $('#pc_main').hide();

$("#pc_mains").hide();

$("#changMoney").show();

$("#changctId").html(ctid+"号餐桌结算成功!");

$("#pc_centers").find("dd").html("消费订单号:"+orderId);

$("#pc_yinshoumonery").find("span").html(yingshou);

$("#pc_insertonery").find("span").html("¥"+insertPrice+"元");

$("#pc_cgmoney").find("span").html("¥"+savePrice+"元整");

}else{

  alert("结算失败!");

  }

});

//$("#accountForm").submit();

//window.location.href =rt+"/Cash/orderInfo_toPayMoney.action";

}

}

}

/**

 * 完成找零结算

 */

function finshMoney(){

$("#changMoney").hide();

window.location.href =rt+"/Cash/orderInfo_toPayMoney.action";

}


/**

 * 检查会员实现折扣

 */

function checkAssouit(asid){

$.post(rt+"/Cash/associator_checkAssouId.action",{"Associator.assocTel":asid},function(data){

if(data!=0){

var assarr=data.split("|");

var assName=assarr[0];

var assIntegs=assarr[1];

$("#assNameinfo").html("会员:"+assName+"&nbsp"+"原积分:"+assIntegs+"分");

$("#assountmsg").html("欢迎会员:"+assName+"折扣消费!").show().fadeOut(5000).css({ color: "yellow"});

var strPrice=$("#yingshou").text();

var costPrice=strPrice.substring(1,strPrice.length-1);

var tol=0;

$("#ctTab tr:gt(0)").each(function(){

var danjia = parseInt($(this).find("td:eq(2)").text());

var zhekao = $(this).find("td:eq(3)").attr("id");

var count = parseInt($(this).find("td:eq(4)").attr("id"));

var sigprice=danjia*zhekao*count;

var sigprices=Math.round((parseFloat(sigprice)*10))/10;

$(this).find("td:eq(4)").text(sigprices+"元");

$(this).find("td:eq(3)").text(zhekao*100+"%");

tol+=parseFloat($(this).find("td:eq(4)").text());

   var totalzhek=Math.round((parseFloat(costPrice)-parseFloat(tol))*10)/10;

   $("#countPrice").text("¥"+totalzhek+"元");

});

var total=Math.round(parseFloat(tol)*10)/10;

$("#yingshou").text("¥"+total+"元");

}

if(data==0){

$("#assountmsg").html("会员号不存在!").show().fadeOut(5000).css({ color: "yellow"});

}

});

}

/**

 * 积分兑换

 * @param e

 */

function intergschagns(){

if($("#assouid").val()==""){

alert("请输入会员号!");

}

if($("#assouid").val()!=""){

var assId=$("#assouid").val();

var orderId=$("#orderId").text();

var yingshou=$("#yingshou").text();

var rvsPrice=yingshou.substring(1,yingshou.length-1);

var rvsPrices=Math.round(parseFloat(rvsPrice)*1)/1;

$.post(rt+"/Cash/associator_checkAssouId.action",{"Associator.assocTel":assId},function(data){

if(data==0){

alert("会员号不存在,请重输!");

$("#assouid").val("").focus();

}

if(data!=0){

var assarr=data.split("|");

var assName=assarr[0];

var assIntegs=assarr[1];

if(assIntegs<rvsPrices){

alert("您的积分不够,请现金结算!");

return false;

}else{

$.post(rt+"/Cash/associator_reduceIntegs.action",{"Associator.assocIntegral":rvsPrices,"Associator.assocTel":assId,"orId":orderId},function(data){

var xfIntegs=assIntegs-rvsPrices;

var ogf=$("#assNameinfo").text();

var ogfIntegs=ogf.substring(10,ogf.length-1);

   var insertPrice=0;

var yingshou=$("#yingshou").text();

var rvsPrice=yingshou.substring(1,yingshou.length-1);

var assouid=$("#assouid").val();

var ctid=$("#ctid").val();

var zks=0.00;

$.post(rt+"/Cash/orderInfo_CountPayMoney.action",{"orderInfo.totalMoney":rvsPrice,"OrderInfo.orderId":orderId,"Tel":assouid,"diningTable.dinTabId":ctid,"yingshou":rvsPrice,"insertPrice":insertPrice,"savePrice":0.0,"zks":zks,"rvsPrices":rvsPrices,"ogfIntegs":ogfIntegs},function(data){

if(data=="1"){

  alert("积分兑换成功!尊敬的"+assName+"会员您当前消费积分:"+rvsPrices+"分!");

  $('#pc_main').hide();

  $("#pc_mains").hide();

  window.location.href =rt+"/Cash/orderInfo_toPayMoney.action";

  }else{

  alert("积分兑换失败!");

  return false;

  }

//$("#accountForm").submit();

});

//$("#accountForm").submit();

//window.location.href =rt+"/Cash/orderInfo_toPayMoney.action";

});

}

}

});

}

}

function fukuan(e){

var ssMoney=$("#ssMoney").text().trim();

var fukuan=$("#fukuan").val();

$("#zhaolin").text(fukuan-ssMoney);


}


function payMoney(){

var ssMoney=$("#ssMoney").text().trim();

var zhaolin=$("#zhaolin").text().trim();

var fukuan=$("#fukuan").val();

if(ssMoney=="00.00"||zhaolin<0||fukuan==""){

alert("结账失败!");

}

else{

alert("结账成功!");

var orderId=$("#orderId").text().trim();

$.post(rt+"/Cash/orderInfo_updateOrderStatus.action",{"orderInfo.orderId":orderId},function(data){

window.location.href = rt+"/Cash/orderInfo_toPayMoney.action";

});

}


}

//返回

function backMoney(){

  $('#pc_main').hide();

  $("#pc_mains").hide();

  window.location.href =rt+"/Cash/orderInfo_toPayMoney.action";

}


function accountFinsh(){

$.post(rt+"/Cash/orderInfo_accountFinsh.action",function(data){

//window.location.href = rt+"/Cash/orderInfo_toPayMoney.action";

});

}



/**

 * 退出系统

 */

function finshexit(){

$( "#dialog-confirm" ).dialog({

resizable: false,

height:240,

width:370,

modal: true,

buttons: {

"否": function() {

$( this ).dialog( "close" );

},

"是": function() {

//window.location.href = rt+"/Cash/orderInfo_exit.action";

$("#exitform").submit();

}

}

});

}



你可能感兴趣的:(ssh js)