| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- 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);
- setTimeout(function () {
- getMyTipOrder();
- }, intervalTime);
- }
- 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);
- setTimeout(function () {
- getMyTipOrder();
- }, intervalTime);
- }
- 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: `<div style="display:flex;font-size:16px;flex-direction: column;font-weight: 600;justify-content: center;"><span style="padding:5px 0">订单编号为:${item?.tid} 申请改价</span><span style="padding:5px 0">备注:${item?.seller_memo}</span><span style="color: #fb0606;padding:5px 0">同意后内容将替换订单备注</span><span style="display:flex;align-items: center; text-align: center;padding:5px 0">修改内容:<textarea id="passChangeInpupt" style="width:400px;height:100px" >${item?.content}</textarea></span></div>`,
- callback: function (action) {
- let params = { ctid: item.tid, id: item.ID }
- if (action == "同意") {
- params.type = 0;
- } else if (action == "不同意") {
- params.type = 1;
- }
- params.content = $("#passChangeInpupt").val();
- if (action == "同意" || action == "不同意") {
- postAjax("change_win_mome", params, function (e) {
- resultShow(e);
- })
- }
- }
- });
- }
- }, function (data) { }, false)
- }
- else {
- laterTipIdx--;
- afterSaleVerifyIdx--;
- if (afterSaleVerifyIdx <= 0) {
- isTipedAfterSale = 0;
- afterSaleVerifyIdx = 0;
- }
- setTimeout(function () {
- getMyTipOrder();
- }, intervalTime);
- }
- }
- function goToHandleOrder(ids, toOrderState) {
- postAjax("reset_erp_tiporder", "ids=" + ids, function (data) {
- });
- if (toOrderState == 0) {
- openNewSearchTab("打回订单", "EOrder/ReturnOrder.aspx", "");
- }
- else if (toOrderState == 10) {
- openNewSearchTab("待审核售后", "EAfterSale/WaitingVerify.aspx", "");
- }
- else if (toOrderState == 8) {
- openNewSearchTab("我的设计费", "EDesign/MyDesignBill.aspx", "");
- }
- else {
- openNewSearchTab("我的设计", "EDesign/MyDesignList.aspx", "");
- }
- }
- function openUserCenter() {
- var item = new Object();
- item.id = "1";
- item.text = "个人中心";
- item.url = "Center.aspx";
- item.iconCls = "";
- activeTab(item);
- }
- function openNewSearchTab(name, page, parms) {
- //console.log("parms", parms);
- var item = new Object();
- item.id = addTabId.toString();
- item.text = name;
- item.url = getTabUrl(page, parms);
- item.iconCls = "";
- activeTab(item);
- addTabId += 1;
- }
- function openItemTab(name, parms) {
- //console.log("parms", parms);
- var m_tabs = mini.get("mainTabs");
- var tabLsts = m_tabs.tabs;
- for (var i = tabLsts.length - 1; i >= 0; i--) {
- if (tabLsts[i].title == name) {
- //alert(JSON.stringify(tabLsts[i]));
- var tab = m_tabs.getTab(tabLsts[i].name);
- tab.url = getTabUrl(tab.url, parms);
- m_tabs.activeTab(tab);
- m_tabs.reloadTab(tab);
- return;
- }
- }
- if (mData != null && mData.length > 0) {
- for (var i = 0; i < mData.length; i++) {
- for (var j = 0; j < mData[i].children.length; j++) {
- if (mData[i].children[j].text == name) {
- mData[i].children[j].url = getTabUrl(mData[i].children[j].url, parms);
- activeTab(mData[i].children[j]);
- return;
- }
- }
- }
- }
- }
- function getTabUrl(url, parms) {
- if (url.indexOf("?") != -1) {
- var eIdx = url.indexOf("?");
- url = url.substr(0, eIdx);
- }
- return url + "?" + parms;
- }
- function transRole(r) {
- //if (!confirm("确认切换?")) return;
- //postAjax("trans_user_role", "r=" + r, function (data) {
- // window.location.href = "index.aspx?sys=" + data;
- //});
- if (r == 1) {
- window.open("http://47.114.150.226/quote_price/");
- }
- else
- window.open("https://www.baidu.com");
- }
- function initNet() {
- var il = getCookie("islocal");
- if (il != null && il == "1") {
- $(".net_span").html("访问内网");
- } else {
- $(".net_span").html("访问外网");
- }
- }
- function transnet(r) {
- var txt = "";
- switch (r) {
- case 1: txt = "访问内网"; break;
- default: txt = "访问外网";
- }
- if (!confirm("确认切换为[" + txt + "]?")) return;
- if (r == 1) {
- setCookie("islocal", "1");
- $(".net_span").html("访问内网");
- }
- else {
- setCookie("islocal", "0");
- $(".net_span").html("访问外网");
- }
- mini.alert("切换网络成功,已打开的页面需要刷新或重新打开");
- }
- function goToCheckOrder(ctid) {
- var sData = { "tid": ctid };
- sData = JSON.stringify(sData);
- sData = "sData=" + sData;
- console.log(sData);
- openNewSearchTab("查货列表", "EAfterSale/CheckOrderList.aspx", sData);
- }
|