var selTabName = ""; var addTabId = 100; var laterTipIdx = 0; //定时取提示的计时器 var intervalTime = 50 * 1000; //间隔时间 var afterSaleVerifyIdx = 0; //售后责任人剩余12 6小时 提醒 var intervalAftersale = 360; var isTipedAfterSale = 0; //是否提示过售后审核 function activeTab(item) { var tabs = mini.get("mainTabs"); var tab = tabs.getTab(item.id); if (!tab) { tab = { name: item.id, title: item.text, url: item.url, iconCls: item.iconCls, showCloseButton: true }; tab = tabs.addTab(tab); } tabs.activeTab(tab); bindMenuEvent(tab._id); //tabs.on("activechanged", function (d) { // alert('refresh'); //}); } function bindMenuEvent(tid) { var cell = document.getElementById("mini-1$" + tid); if (cell != undefined && cell != null) { cell.setAttribute("tn", cell.innerText); $(cell).bind("contextmenu", function (e) { selTabName = cell.getAttribute("tn"); var menu = mini.get("contextMenu"); menu.showAtPos(e.pageX, e.pageY); return false; }); } } function closeOtherFn() { var tabs = mini.get("mainTabs").tabs; for (var i = tabs.length - 1; i >= 0; i--) { if (tabs[i].title != selTabName) { mini.get("mainTabs").removeTab(i); } } } function closeAllFn() { var tabs = mini.get("mainTabs"); tabs.removeAll(); } function edit_pwd() { $("#txtNewPwd").val(""); mini.get("pwd_win_index").show(); } function savePwdFn() { var tbxOldPwd = $("#tbxOldPwd").val(); var tbxNewPwd = $("#tbxNewPwd").val(); var tbxRNewPwd = $("#tbxRNewPwd").val(); if (tbxOldPwd == "") { mini.alert("请输入原密码!"); return false; } if (tbxNewPwd == "") { mini.alert("请输入新密码!"); return false; } if (tbxRNewPwd != tbxNewPwd) { mini.alert("新密码与确认密码不一致!"); return false; } var pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{6,20}'); if (!pwdRegex.test(tbxNewPwd)) { mini.alert("您的密码复杂度太低(必须包含字母、数字、特殊字符),密码长度大于6位!"); return false; } var data = "tbxOldPwd=" + tbxOldPwd + "&tbxNewPwd=" + tbxNewPwd; getAjax("update_employee_pwd2", data, function (data) { resultShow(data, "mini.get('pwd_win_index').hide();"); }); } var mData = null; $(function () { //menu var menu = new Menu("#mainMenu", { itemclick: function (item) { if (item.children != null && item.children.length < 1) { activeTab(item); } } }); $(".sidebar").mCustomScrollbar({ autoHideScrollbar: true }); new MenuTip(menu); if (mData != null && mData.length > 0) { var data = mini.decode(mData); menu.loadData(data); } //$.ajax({ // url: "data/menu.txt", // success: function (text) { // var data = mini.decode(text); // menu.loadData(data); // } //}) //toggle $("#toggle, .sidebar-toggle").click(function () { $('body').toggleClass('compact'); mini.layout(); }); //dropdown $(".user-toggle").click(function (event) { $(this).parent().addClass("open"); return false; }); $(document).click(function (event) { $(".dropdown").removeClass("open"); }); bindMenuEvent("1"); initNet(); timeForShowTip(); }); function timeForShowTip() { setTimeout(function () { getMyTipOrder(); //checkIsAccLogin(); }, 30 * 1000); } function checkIsAccLogin() { postAjax("isAccLogin", "", function (data) { console.log("isAccLogin", data); if (data == 0) { var options = { title: "警告", message: "账号在其它地方登入或已过期!!", buttons: ["ok"], iconCls: "mini-messagebox-question", showCloseButton: false, callback: function (action) { if (action == "ok") { window.location = "Login.aspx"; } } } mini.showMessageBox(options); //mini.alert("账号在其它地方登入或已过期!!", "警告", function (action) { // if (action == "ok") { // window.location = "Login.aspx"; // } //}); return; } else { setTimeout(function () { checkIsAccLogin(); }, intervalTime) } }, null, false); } function getMyTipOrder() { if (laterTipIdx <= 0) { afterSaleVerifyIdx--; if (afterSaleVerifyIdx <= 0) { isTipedAfterSale = 0; afterSaleVerifyIdx = 0; } postAjax("get_erp_my_tiporder", "af=" + isTipedAfterSale, function (data) { var toOrderState = 0; if (data.length > 0) { var tStr = ""; var ids = ""; var userCode = $("#userPostCode").val(); if (userCode == "Supplier") { if (data[0]["VerifyState"] == undefined) { /*for (var item of data) { ids += item.ctid; ids += ","; }*/ ids = data[0]["ctid"]; mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["前往处理"], message: "有查货订单需要处理:" + ids, callback: function (action) { if (action == "前往处理") { goToCheckOrder(ids); } setTimeout(function () { getMyTipOrder(); }, 3 * 60000); } }); } else { for (var item of data) { if (item.VerifyState != undefined && (item.VerifyState == 0 || item.VerifyState == 3)) { tStr += (item.ctid + " 售后责任待审核。") toOrderState = 10; isTipedAfterSale = 1; afterSaleVerifyIdx = intervalAftersale; } else if (item.IsReadTag == 1) { tStr += (item.ctid + " 被打回。") toOrderState = item.OrderState; } ids += item.ctid; ids += ","; } if (tStr.length <= 0) return; tStr += " 请及时查看处理!!"; mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["前往处理", "稍后提醒"], message: tStr, callback: function (action) { if (action == "前往处理") { ids = ids.substring(0, ids.length - 1); goToHandleOrder(ids, toOrderState); } else if (action == "稍后提醒") { laterTipIdx = 30; } setTimeout(function () { getMyTipOrder(); }, intervalTime); } }); } } else { for (var item of data) { if (item.IsReadTag == 1) { tStr += (item.ctid + " 被打回。") toOrderState = item.OrderState; } else if (item.IsReadTag == 2) { tStr += (item.ctid + " 申请退款。") toOrderState = item.OrderState; } else if (item.IsReadTag == 3) { tStr += (item.ctid + "设计费被修改。"); toOrderState = item.OrderState; } else if (item.IsReadTag == 4) { tStr += (item.ctid + "售后单生成。"); toOrderState = item.OrderState; } else if (item.VerifyState != undefined && item.VerifyState == 0) { tStr += (item.ctid + " 售后责任待审核。") toOrderState = 10; isTipedAfterSale = 1; afterSaleVerifyIdx = intervalAftersale; } ids += item.ctid; ids += ","; } if (tStr.length <= 0) return; tStr += " 请及时查看处理!!"; mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["前往处理", "稍后提醒"], message: tStr, callback: function (action) { if (action == "前往处理") { ids = ids.substring(0, ids.length - 1); goToHandleOrder(ids, toOrderState); } else if (action == "稍后提醒") { laterTipIdx = 30; } setTimeout(function () { getMyTipOrder(); }, intervalTime); } }); } } else { setTimeout(function () { getMyTipOrder(); }, intervalTime); } }, function (data) { }, false); postAjax("back_supplier_audit", "", function (data) { if (data.length > 0) { mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["同意撤回订单", "不同意"], message: "有订单需要撤回处理:" + data[0]["tid"], callback: function (action) { if (action == "同意撤回订单") { mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["确认撤回订单", "不同意"], message: "有订单需要撤回处理:" + data[0]["tid"], callback: function (action) { if (action == "确认撤回订单") { postAjax("upd_supplier_audit", { ctid: data[0]["tid"], returnreason: "1" }, function (data) { resultShow(data); }); } else if (action == "不同意") { postAjax("upd_supplier_audit", { ctid: data[0]["tid"], returnreason: "2" }, function (data) { resultShow(data); }); } } }); } else if (action == "不同意") { postAjax("upd_supplier_audit", { ctid: data[0]["tid"], returnreason: "2" }, function (data) { resultShow(data); }); } } }); } }, function (data) { }, false); postAjax("verified_to_order", "", function (data) { if (data.length > 0) { mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", buttons: ["我知道了"], message: "您有订单未审核:" + data[0]["tid"], callback: function (action) { if (action == "我知道了") { postAjax("upd_supplier_audit", { ctid: data[0]["tid"], returnreason: "4" }, function (data) { resultShow(data); }); } } }); } }, function () { }, false); postAjax("refund_order_tip", "", function (data) { if (data.length > 0) { let content = ""; data.map(item => { content += item.content + "/n"; }) if (content != "") { mini.open({ url: "../" + "ECharts/TipRefundList.aspx?", title: "退款详情", width: 1500, height: 500, style: "border:0px", showCloseButton: true, allowResize: true, onload: function () { //var iframe = this.getIFrameEl(); //var data = { action: "new" }; //iframe.contentWindow.SetData(data); }, ondestroy: function (action) { } }); } } }, function (data) { }, false); postAjax("change_order_info", "", function (data) { if (data.length > 0) { let item = data[0]; mini.showMessageBox({ title: "提示", iconCls: "mini-messagebox-question", width: 700, height: 405, buttons: ["同意", "不同意", "稍后处理"], html: `