var test_mode = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; //水费查询 function water_fee() { if ($("#usernum").val().length != 11) { layer.msg("请输入正确的11位数字编号!", { icon: 7 }); return false; } else { $.ajax({ type: "post", datatype: "json", url: "service.aspx/rsapulic", contenttype: "application/json", data: "{num:'" + $("#usernum").val() + "',year:'" + $("#year").val() + "'}", layerindex: -1, beforesend: function () { this.layerindex = layer.msg('查询中...', { icon: 16, shade: 0.01 }); }, complete: function () { layer.close(this.layerindex); }, success: function (data) { var d = eval("(" + data.d + ")"); if (d.s ==0) { water_search(d.t, d.v, d.p); } } }); } } //水费列表--http://220.166.57.233:20201/wywgservice/chargeservice function water_search(t,v,p) { $.ajax({ type: "post", url: "https://service.scmywater.com.cn:20202/wywgservice/chargeservice", contenttype: "application/x-www-form-urlencoded", data: { "trnno": t, "verify": v, "parameter": p }, layerindex: -1, beforesend: function () { this.layerindex = layer.msg('账单获取中...', { icon: 16, shade: 0.01 }); }, complete: function () { layer.close(this.layerindex); }, success: function (data) { if (data.code == 0) { var d = data.data; //用户信息 $("#userinfo").show(); $("#userinfo_tr").html("" + d.userno + "" + d.username + "" + d.addr + "" + d.prepayamt + "") //水费信息 var usertinfo = ""; $("#waterfee_info").show(); $(d.rcvbldet).each(function () { usertinfo += ""; usertinfo += "" + this.rcvblyear + ""; usertinfo += "" + this.rcvblmonth + ""; usertinfo += "" + this.bgnqt + ""; usertinfo += "" + this.endqt + ""; usertinfo += "" + this.rcvblqt + ""; usertinfo += "" + this.rcvblamt + ""; usertinfo += "" + this.state + ""; usertinfo += ""; }); $("#waterfeehtml").html(usertinfo); } else { layer.msg(data.msg, { icon: 7 }); return false; } } }); } //电子发票 function fpsearch() { if ($("#fp_usernum").val().length != 11) { layer.msg("请输入正确的12位数字编号!", { icon: 7 }); return false; } if ($("#tqm").val() == "") { layer.msg("请输入发票提取码!", { icon: 7 }); return false; } if ($("#email").val().length > 30) { layer.msg("请输入电子邮箱!", { icon: 7 }); return false; } if ($("#code").val().length != 4) { layer.msg("请输入验证码!", { icon: 7 }); return false; } } //网上咨询、报修、投诉 function zx_submit() { if ($("#zxname").val() == "") { layer.msg("请填写姓名!", { icon: 7 }); return false; } if (!test_mode.test($("#zxtel").val())) { layer.msg("手机号格式不正确!", { icon: 7 }); return false; } if ($("#zxaddress").val() == "") { layer.msg("请填写联系地址!", { icon: 7 }); return false; } if ($("#zxcontents").val().length == 0) { layer.msg("请填写内容!", { icon: 7 }); return false; } if ($("#zxcode").val().length != 4) { layer.msg("请输入正确的验证码!", { icon: 7 }); return false; } else { $("#zxform").submit(); } } //底部栏目 $(".pservice-process a").click(function () { $.ajax({ type: "post", datatype: "json", url: "service.aspx/get_contents", contenttype: "application/json", data: "{id:'" + $(this).attr("id") + "'}", layerindex: -1, beforesend: function () { this.layerindex = layer.msg('加载中', { icon: 16, shade: 0.01 }); }, complete: function () { layer.close(this.layerindex); }, success: function (data) { layer.open({ type: 1, skin: 'layui-layer-rim', //加上边框 area: ['40%', '80%'], //宽高 content: data.d }); } }); }) //报装-个人时隐藏单位资料 function granddw() { if ($(':radio[name="filelx"]:checked').val() == "个人用户") { $(".grisok").each(function () { $(this).hide(); }) } else { $(".grisok").each(function () { $(this).show(); }) } } //户名变更用户性质 function hm_dw(it) { if ($("#htisok").is(':checked') == false) { layer.msg("还未同意声明业务须知与合同条款,无法进行下一步!", { icon: 7 }); return false; } else { $("#hmtype").val(it); if (it == "d") { $(".d").each(function () { $(this).show(); $(this).find($('input[type="text"]')).attr("required", "true"); }); $(".g").each(function () { $(this).hide(); $(this).find($('input[type="text"]')).removeattr("required"); }); } else { $(".d").each(function () { $(this).hide(); $(this).find($('input[type="text"]')).removeattr("required"); }); $(".g").each(function () { $(this).show(); $(this).find($('input[type="text"]')).attr("required", "true"); }); } $(".phone-changetable").show(); } } //工单进度查询 function gd_search() { $.ajax({ type: "post", datatype: "json", url: "service.aspx/get_gdtype", contenttype: "application/json", data: "{num:'" + $("#gdnum").val() + "'}", layerindex: -1, beforesend: function () { this.layerindex = layer.msg('工单进度获取中...', { icon: 16, shade: 0.01 }); }, complete: function () { layer.close(this.layerindex); }, success: function (data) { var a = eval("(" + data.d + ")");; if (a.s == 0) { var info = ""; info += "" + a.bzname + ""; info += "" + a.bztel + ""; info += "" + a.types + ""; $(".jdinfo").html(info); $(".bzjdinfo").show(); } } }); } //上传文件 function setimg(type) { var formdata = new formdata(); formdata.append("myfile", document.getelementbyid("files_" + type + "").files[0]); $.ajax({ url: "/control/upload.ashx", type: "post", data: formdata, contenttype: false, processdata: false, layerindex: -1, beforesend: function () { this.layerindex = layer.msg('加载中', { icon: 16, shade: 0.01 }); }, complete: function () { layer.close(this.layerindex); }, success: function (data) { if (data.status == "true") { layer.msg("上传成功,请稍等!", { icon: 1 }); var filename = getfilename(data.msg); if (type == "hkb") {//阶梯 var html = "

" + filename + "删除

"; $("#hkblist").append(html); $("#hkb_file_url").val($("#hkb_file_url").val() == "" ? data.msg : $("#hkb_file_url").val() + "|" + data.msg); } else if (type == "hmg1") {//户名 var html = "

" + filename + "删除

"; $("#hmg1list").append(html); $("#hmg1_file_url").val($("#hmg1_file_url").val() == "" ? data.msg : $("#hmg1_file_url").val() + "|" + data.msg); } else if (type == "g2") {//个人产权 var html = "

" + filename + "删除

"; $("#g2list").append(html); $("#g2_file_url").val($("#g2_file_url").val() == "" ? data.msg : $("#g2_file_url").val() + "|" + data.msg); } else if (type == "d2") {//单位产权 var html = "

" + filename + "删除

"; $("#d2list").append(html); $("#d2_file_url").val($("#d2_file_url").val() == "" ? data.msg : $("#d2_file_url").val() + "|" + data.msg); }else { $("#" + type + "").attr("src", data.msg); $("#" + type + "_file_url").val(data.msg); } } if (data.status == "error") { alert(data.msg); } }, error: function () { alert("上传失败!"); } }); }; //文件名 function getfilename(file) {//通过第一种方式获取文件名 var pos = file.lastindexof("/");//查找最后一个/的位置 return file.substring(pos + 1, file.length); //截取最后一个/位置到字符长度,也就是截取文件名 } //删除指定上传文件 function removeimg(it,ty) { $(it).parents("p").remove(); $("#" + ty + "_file_url").val(""); $("#" + ty + "list p").each(function () { var imgurl = $(this).attr("date"); $("#" + ty + "_file_url").val($("#" + ty + "_file_url").val() == "" ? imgurl : $("#" + ty + "_file_url").val() + "|" + imgurl); }) }; //增加人口数所填资料 function addsignrow() { //读取最后一行的行号,存放在txttrlastindex文本框中 var rowid = parseint($("#txttrlastindex").val()); var signframe = findobj("signframe", document); ////添加行 //var newtr = signframe.insertrow(signframe.rows.length); //newtr.id = "add" + (rowid + 1); ////添加列:证件名称 //var newnametd = newtr.insertcell(0); ////添加列内容 //newnametd.innerhtml = "身份证"; ////添加列:上传控件 //var newfiletd = newtr.insertcell(1); ////添加列内容 //newfiletd.innerhtml = "
点击这里上传文件
"; ////将行号推进下一行 //$("#txttrlastindex").val((rowid + 1)); //添加第二行 var rowid2 = parseint($("#txttrlastindex").val()); //添加行 var newtr2 = signframe.insertrow(signframe.rows.length); newtr2.id = "add" + (rowid2 + 1); //添加列:证件名称 var newnametd2 = newtr2.insertcell(0); //添加列内容 newnametd2.innerhtml = "暂住证/居住证/结婚证"; //添加列:上传控件 var newfiletd2 = newtr2.insertcell(1); //添加列内容 newfiletd2.innerhtml = "
点击这里上传文件
"; $("#txttrlastindex").val((rowid2 + 1)); //第一行添加列:操作 var newcztd = newtr2.insertcell(2); //第一行添加列内容 //newcztd.rowspan = "2"; newcztd.innerhtml = ""; } //删除增加行 function deleterow(id2) { //$("#txttrlastindex").val(parseint($("#txttrlastindex").val()) - 1); $("#" + id2).remove(); } function findobj(theobj, thedoc) { var p, i, foundobj; if (!thedoc) thedoc = document; if ((p = theobj.indexof("?")) > 0 && parent.frames.length) { thedoc = parent.frames[theobj.substring(p + 1)].document; theobj = theobj.substring(0, p); } if (!(foundobj = thedoc[theobj]) && thedoc.all) foundobj = thedoc.all[theobj]; for (i = 0; !foundobj && i < thedoc.forms.length; i++) foundobj = thedoc.forms[i][theobj]; for (i = 0; !foundobj && thedoc.layers && i < thedoc.layers.length; i++) foundobj = findobj(theobj, thedoc.layers[i].document); if (!foundobj && document.getelementbyid) foundobj = document.getelementbyid(theobj); return foundobj; }