www.gusucode.com > 2030网博士成品网站管理系统 PHP网站源码程序 > 2030/dingcan/admin/js/dingcan.js
//自选餐品管理全选 $(document).ready(function() { $("#cpselall").click(function(){ var getObj = $('.cpcheckbox'); getObj.each(function(id) { if($("#cpselall")[0].checked==true){ this.checked=true; }else{ this.checked=false; } }); }); }); //配送中心设置 function centerCheckform(theform){ if(theform.name.value.length < 1 || theform.name.value=='请填写配送中心名称'){ alert("请填写配送中心名称"); theform.name.focus(); return false; } if(theform.address.value.length < 1 || theform.address.value=='请填写配送中心地址'){ alert("请填写配送中心地址"); theform.address.focus(); return false; } return true; } //配送中心设置-添加调度员 $(document).ready(function(){ $("input.ddinput").click(function(){ var ddid=this.id; var str_id=ddid.split('_'); var pscid=str_id[1]; var ddidhid="ddid_"+pscid; $.ajax({ type: "POST", url:"post.php", data: "act=diaoduyuanset&pscid="+pscid, success: function(msg){ $('div#esetDialog').remove(); $('html').append(msg); $.blockUI({message: $('div#esetDialog'),css:{width:'600px'}}); $('.pwClose').click(function() { $.unblockUI(); $('div#msnDialog').remove(); }); $('#esetForm').submit(function(){ $('#esetForm').ajaxSubmit({ target: 'div#esetnotice', url: 'post.php', success: function(msg) { var str_msg=msg.split("_"); if(str_msg[0]=="OK"){ $('#'+ddidhid)[0].value=str_msg[1]; $('#'+ddid)[0].value=str_msg[2]; //$().alertwindow("添加成功",""); $.unblockUI(); }else{ $('div#esetnotice').show(); } } }); return false; }); } }); }); }); //配送中心设置-添加送餐员 $(document).ready(function(){ $("input.scinput").click(function(){ var scid=this.id; var str_id=scid.split('_'); var pscid=str_id[1]; $.ajax({ type: "POST", url:"post.php", data: "act=songcanyuanset&pscid="+pscid, success: function(msg){ $('div#esetDialog').remove(); $('html').append(msg); $.blockUI({message: $('div#esetDialog'),css:{width:'400px'}}); $('.pwClose').click(function() { $.unblockUI(); $('div#msnDialog').remove(); }); $('#esetForm').submit(function(){ $('#esetForm').ajaxSubmit({ target: 'div#esetnotice', url: 'post.php', success: function(msg) { var str_msg=msg.split("_"); if(str_msg[0]=="OK"){ $('#'+scid)[0].value=str_msg[1]; //$().alertwindow("添加成功",""); $.unblockUI(); }else{ $('div#esetnotice').show(); } } }); return false; }); } }); }); }); //送餐时段设置 function sctimeCheckform(theform){ if(theform.sctime.value.length < 1 || theform.sctime.value=='请填写送餐时间,如10:30'){ alert("请填写送餐时间,如10:30"); theform.sctime.focus(); return false; } return true; } //弹出对话框 function Dpop(url,w,h){ res = showModalDialog(url, null, 'dialogWidth: '+w+'px; dialogHeight: '+h+'px; center: yes; resizable: no; scroll: no; status: no;'); if(res=="ok"){window.location.reload();} } //图片预览 $(document).ready(function(){ $('.preview').click(function(id){ var src=$("input#previewsrc_"+this.id.substr(8))[0].value; if(src==""){ return false; } $("body").append("<img id='pre' src='../../"+src+"'>"); var w=$("#pre")[0].offsetWidth; var h=$("#pre")[0].offsetHeight; $.blockUI({ message: "<img src='../../"+src+"' class='closeit'>", css: { top: ($(window).height() - h) /2 + 'px', left: ($(window).width() - w/2) /2 + 'px', width: $("#pre")[0].offsetWidth + 'px', backgroundColor: '#fff', borderWidth:'3px', borderColor:'#fff' } }); $("#pre").remove(); $(".closeit").click(function(){ $.unblockUI(); }); setTimeout($.unblockUI, 2000); }); }); //实时自动填写剩余份数 $(document).ready(function(){ $('#percopy').keyup(function(){ var pc=this.value; $("input#sparecopy")[0].value=pc; }); }); //自选餐品发布表单提交 $(document).ready(function(){ $('#canpinAddForm').submit(function(){ $('#canpinAddForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("餐品添加成功","canpin_zixuan_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //自选餐品修改表单提交 $(document).ready(function(){ $('#canpinModForm').submit(function(){ $('#canpinModForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("餐品修改成功","canpin_zixuan_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //自选餐品管理-修改剩余份数 $(document).ready(function(){ $('input.zxinput').click(function(){ var zxid_str=this.id; var zxid_arr=zxid_str.split('_'); var zxid=zxid_arr[1]; $('#'+zxid_str)[0].readOnly=false; $('#'+zxid_str)[0].select(); $('#'+zxid_str).blur(function(){ var zxsc=$('#'+zxid_str)[0].value; $.ajax({ type: "POST", url:"post.php", data: "act=modisparecopy&id="+zxid+"&zxsc="+zxsc, success: function(msg){ if(msg=="OK"){ $('span#sp_'+zxid)[0].innerHTML="<img src='images/toolbar_ok.gif' border='0' />"; }else{ $().alertwindow("填写不正确,请重新填写",""); } } }); }); return false; }); }); //固定套餐管理-发布表单提交 $(document).ready(function(){ $('#gdtaocanAddForm').submit(function(){ $('#gdtaocanAddForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("套餐添加成功","canpin_guding_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //固定套餐管理-修改表单提交 $(document).ready(function(){ $('#gdtaocanModForm').submit(function(){ $('#gdtaocanModForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("套餐修改成功","canpin_guding_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //固定套餐管理-修改剩余份数 $(document).ready(function(){ $('input.gdinput').click(function(){ var zxid_str=this.id; var zxid_arr=zxid_str.split('_'); var zxid=zxid_arr[1]; $('#'+zxid_str)[0].readOnly=false; $('#'+zxid_str)[0].select(); $('#'+zxid_str).blur(function(){ var zxsc=$('#'+zxid_str)[0].value; $.ajax({ type: "POST", url:"post.php", data: "act=modisparecopygd&id="+zxid+"&zxsc="+zxsc, success: function(msg){ if(msg=="OK"){ $('span#sp_'+zxid)[0].innerHTML="<img src='images/toolbar_ok.gif' border='0' />"; }else{ $().alertwindow("填写不正确,请重新填写",""); } } }); }); return false; }); }); //组合餐品管理-发布表单提交 $(document).ready(function(){ $('#zhcanpinAddForm').submit(function(){ $('#zhcanpinAddForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("组合餐品添加成功","canpin_zuhe_cpcon.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //组合餐品管理-修改表单提交 $(document).ready(function(){ $('#zhcanpinModForm').submit(function(){ $('#zhcanpinModForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("组合餐品修改成功","canpin_zuhe_cpcon.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //组合套餐管理-发布表单提交 $(document).ready(function(){ $('#zhtaocanAddForm').submit(function(){ $('#zhtaocanAddForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("组合套餐添加成功","canpin_zuhe_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //组合套餐管理-修改表单提交 $(document).ready(function(){ $('#zhtaocanModForm').submit(function(){ $('#zhtaocanModForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("组合套餐修改成功","canpin_zuhe_con.php"); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); }); //菜谱管理-提交处理 $(document).ready(function(){ $('#caipuAddForm').submit(function(){ var month=$('#addmonth')[0].value; var day=$('#addday')[0].value; $('#caipuAddForm').ajaxSubmit({ target: 'div#notice', url: 'post.php', success: function(msg) { if(msg=="OK"){ $('div#notice').hide(); $().alertwindow("菜谱发布成功","canpin_caipu_con.php?month="+month+"&day="+day); }else{ $('div#notice').hide(); $().alertwindow(msg,""); } } }); return false; }); });