| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- var isOnDuty = null;
- var postCode = null;
- var userId = null;
- var curDateType = 1;
- var noticeData = null;
- window.onload = function () {
- postAjax("get_user_info", "", function (data) {
- $("#userIcon").attr("src", data[0]["Picture"] != "" ? data[0]["Picture"] : "images/userCenter/user.png");
- $("#userName").text(data[0]["Name"]);
- $("#depName").text(data[0]["OrgName"]);
- $("#postName").text(data[0]["PostName"]);
- isOnDuty = data[0]["OnDuty"];
- isBeOnDuty = data[0]["BeOnDuty"];
- postCode = data[0]["PostCode"];
- userId = data[0]["ID"];
- userPostCode = postCode;
- $("#id_customer1").show();
- $("#id_all1").hide();
- mini.get()
- //设计
- if (postCode == "Designer" || postCode == "Designerhd" || postCode == "DesignerMr" || postCode == "wxDesigner" || postCode == "wxDesignerMr") {
- $("#dutyState").text(isOnDuty == 1 ? (isBeOnDuty == 1 ? "(值班)接单中" : "(上班)接单中") : "未到岗");
- $("#dutyState").css("color", isOnDuty == 1 ? "green" : "red");
- mini.get("btnOnduty").setEnabled(isOnDuty != 1);
- mini.get("cmbSearchDate").setValue(1);
- //$("#userOnduty").css('visibility', 'visible');
- //$("#id_design1").css('visibility', 'visible');
- //$("#id_design2").css('visibility', 'visible');
- $("#id_all1").show();
- $("#id_all2").show();
- $("#userOnduty").show();
- $("#id_design1").show();
- $("#id_design2").show();
- $("#id_design3").show();
- $("#id_design4").show();
- getDesignerDataList(1);
- $("#dataDesignCount").show();
- $("#dataBackCount").show();
- getCenterDataList(0)
- }
- //客服
- if (postCode == "CustomerService" || postCode == "Director") {
- $("#id_all1").show();
- $("#id_all2").show();
- mini.get("cmbSearchDate").setValue(1);
- $("#id_customer1").show();
- $("#id_customer2").show();
- $("#id_customer3").show();
- getCustomerDataList(1);
- $("#dataDesignCount").show();
- $("#dataOrderCount").show();
- $("#dataSendCount").show();
- $("#dataBackCount").show();
- $("#dataRefundCount").show();
- getCenterDataList(0)
- }
- //售后
- if (postCode == "AfterSale" || postCode == "AfterSaleMaster") {
- $("#dataSendCount").show();
- $("#dataRefundCount").show();
- $("#dataCheckCount").show();
- getCenterDataList(2)
- }
- //下单部
- if (postCode == "Place" || postCode == "PlaceMr") {
- $("#dataOrderCount").show();
- $("#dataSendCount").show();
- getCenterDataList(1)
- }
- //车间
- if (postCode == "Supplier") {
- $("#dataCheckCount").show();
- getCenterDataList(5)
- }
- });
- postAjax("get_center_data", "", function (data) {
- if (data && data.length > 0) {
- let info = data[0];
- $("#designCountText").text(`(${info.designCount || 0})`)
- $("#orderCountText").text(`(${info.orderCount || 0})`)
- $("#sendCountText").text(`(${info.sendCount || 0})`)
- $("#backCountText").text(`(${info.backCount || 0})`)
- $("#refundCountText").text(`(${info.refundCount || 0})`)
- $("#checkCountText").text(`(${info.checkCount || 0})`)
- }
- })
- if (noticeData != null && noticeData.length > 0) {
- //console.log("noticedata", noticeData);
- var wt = this.document.body.clientWidth;
- var ht = this.document.body.clientHeight;
- mini.open({
- url: "../" + "ENotice/Notice_win.aspx?",
- title: "公告栏", width: wt - 100, height: ht - 200, style: "border:0px",
- showCloseButton: false,
- allowResize: true,
- onload: function () {
- //var iframe = this.getIFrameEl();
- //var data = { action: "new" };
- //iframe.contentWindow.SetData(data);
- },
- ondestroy: function (action) {
- }
- });
- //openWin("订单详情", "EOrder/Order_Detail.aspx?ctid=" + ctid + "&tid=" + tid + "", 1000, 500);
- //var ahtml = "";
- //var ids = "";
- //for (var item of noticeData) {
- // ids += item.ID;
- // ids += ",";
- // ahtml += ("<div style=\"font-size:20px;color:#000000; margin-top:15px;line-height:25px; \">标题:" + item.Title + "</div>")
- // ahtml += ("<div style=\"font-size:10px;color:lightgray; margin-top:5px;line-height:15px; \">来自:" + item.senderName + " " + formatCommonDate(item.CreatedTime) + "</div>")
- // ahtml += ("<div style=\"font-size:14px;color:#3C3C3C; margin-top:5px;line-height:25px;overflow:hidden;word-break:break-all; \">内容:" + item.Con + "</div>")
- //}
- //ahtml += ("<a style=\"width:100px;height:30px;text-align:center;line-height:30px;margin-left:400px;margin-top:20px;\" class=\"mini-button mini-button-primary\" iconcls=\"icon-ok\" onclick=\"clickToRead('" + ids + "')\">已读通知</a>");
- //$("#notice_con").html(ahtml);
- //mini.get("notice_win").show();
- }
- };
- //function clickToRead(ids) {
- // postAjax("set_erp_readnotice", "ids=" + ids, function (data) {
- // mini.get("notice_win").hide();
- // });
- //}
- function getCenterDataList(order_type) {
- let data_grid = mini.get("data_grid");
- let title = "";
- switch (order_type) {
- case 0:
- title = "设计超时";
- break;
- case 1:
- title = "下单超时";
- break;
- case 2:
- title = "发货超时";
- break;
- case 3:
- title = "打回订单";
- break;
- case 4:
- title = "退款订单";
- break;
- case 5:
- title = "查货超时";
- break;
- default:
- break;
- }
- $("#center_data_layout .mini-panel-title").text(title);
- data_grid.load({ order_type });
- }
- function userOnDuty() {
- mini.showMessageBox({
- title: "请选择是“上班”还是“值班”",
- iconCls: "mini-messagebox-question",
- buttons: ["上班", "值班", "晚班", "取消"],
- message: "选择:上班,值班,晚班,取消。",
- callback: function (action) {
- if (action == "上班" || action == "值班" || action == "晚班") {
- postAjax("upd_user_onduty", "duty=" + action, function (data) {
- $("#dutyState").text("(" + action + ")接单中");
- $("#dutyState").css("color", "green");
- mini.get("btnOnduty").setEnabled(false);
- });
- }
- }
- });
- }
- function userOffDuty() {
- postAjax("upd_user_offduty", "", function (data) {
- $("#dutyState").text("未到岗");
- $("#dutyState").css("color", "red");
- mini.get("btnOnduty").setEnabled(true);
- });
- }
- function dispatchDTRenderer(e) {
- var record = e.record;
- var html = "<div>" + formatCommonDate(record.WaitDesignTime) + "</div>";
- return html;
- }
- function overtimeDTRenderer(e) {
- var record = e.record;
- var html = "<div>接单:" + formatCommonDate(record.WaitDesignTime) + "</div>";
- html += "<div>超时:" + formatCommonDate(record.WaitDesignTime) + "</div>";
- return html;
- }
- function isAutoDispatchRenderer(e) {
- var record = e.record;
- var html = "<div>" + record.IsAutoDispatch ? "是" : "否" + "</div>";
- return html;
- }
- function getDesignerDataList(dateType) {
- if (dateType == 3) {
- postAjax("get_total_data", "", function (data) {
- $("#_totalCount").text(data[0]["orderCount"]);
- $("#_totalAmount").text(data[0]["orderAmount"]);
- $("#_refundCount").text(data[0]["refundCount"]);
- $("#_refundAmount").text(data[0]["refundAmount"]);
- $("#_unBeginAmount").text(data[0]["orderBeginAmount"]);
- $("#_unBeginCount").text(data[0]["orderBeginCount"]);
- $("#_unFinishAmount").text(data[0]["orderFinishAmount"]);
- $("#_unFinishCount").text(data[0]["orderFinishCount"]);
- var per = Math.floor(parseInt(data[0]["refundCount"]) / parseInt(data[0]["orderCount"]) * 100);
- if (parseInt(data[0]["orderCount"]) == 0) {
- per = 0;
- }
- $("#_refundCountPer").text(per + "%");
- });
- } else {
- postAjax("get_date_area_total_data", "timetype=" + dateType, function (data) {
- var strData = data.data;
- var dataList = strData.split(",");
- $("#_unBeginCount").text(dataList[2]);
- $("#_unBeginAmount").text(dataList[3]);
- $("#_unFinishCount").text(dataList[4]);
- $("#_unFinishAmount").text(dataList[5]);
- $("#_totalCount").text(dataList[0]);
- $("#_totalAmount").text(dataList[1]);
- $("#_refundCount").text(dataList[6]);
- $("#_refundAmount").text(dataList[7]);
- var per = Math.floor(parseInt(dataList[6]) / (parseInt(dataList[0])) * 100);
- if (parseInt(dataList[0]) == 0) {
- per = 0;
- }
- $("#_refundCountPer").text("率:" + per + "%");
- });
- }
- var timearr = [];
- if (dateType == 0) {
- var day = getCurDate();
- timearr.push(day);
- timearr.push(day);
- }
- else if (dateType == 1) {
- timearr = getWeekStartAndEnd();
- }
- else if (dateType == 2) {
- timearr = getMonthStartAndEnd();
- }
- wait_grid = mini.get("wait_grid");
- wait_grid.load({
- paraFields: "ctid, WaitDesignTime,payment,IsAutoDispatch",
- paraOrder: "WaitDesignTime asc",
- paraWhere: "OrderState = 3 and DesignUserId = " + userId + " and WaitDesignTime >= '" + timearr[0] + "' and WaitDesignTime <= '" + timearr[1] + "'",
- paraPageSize: 1000
- });
- design_grid = mini.get("design_grid");
- design_grid.load({
- paraFields: "ctid, WaitDesignTime,payment,IsAutoDispatch",
- paraOrder: "WaitDesignTime asc",
- paraWhere: "OrderState = 4 and DesignUserId = " + userId + " and WaitDesignTime >= '" + timearr[0] + "' and WaitDesignTime <= '" + timearr[1] + "'",
- paraPageSize: 1000
- });
- unusual_grid = mini.get("unusual_grid");
- unusual_grid.load({
- paraFields: "ctid, WaitDesignTime,UnusualTime,payment,IsAutoDispatch",
- paraOrder: "WaitDesignTime asc",
- paraWhere: "OvertimeUserId = " + userId + " and WaitDesignTime >= '" + timearr[0] + "' and WaitDesignTime <= '" + timearr[1] + "'",
- paraPageSize: 1000
- });
- //wait_grid = mini.get("wait_grid");
- //wait_grid.load({ date_type: dateType });
- order_grid = mini.get("order_grid");
- order_grid.load({ date_type: dateType });
- amount_grid = mini.get("amount_grid");
- amount_grid.load({ date_type: dateType });
- refundOrder_grid = mini.get("refundOrder_grid");
- refundOrder_grid.load({ date_type: dateType });
- refundAmount_grid = mini.get("refundAmount_grid");
- refundAmount_grid.load({ date_type: dateType });
- }
- function getCustomerDataList(dateType) {
- if (dateType == 3) {
- postAjax("get_total_data", "", function (data) {
- $("#_totalCount").text(data[0]["orderCount"]);
- $("#_totalAmount").text(data[0]["orderAmount"]);
- $("#_afterCount").text(data[0]["afterCount"]);
- $("#_afterAmount").text(data[0]["afterAmount"]);
- $("#_refundCount").text(data[0]["refundCount"]);
- $("#_refundAmount").text(data[0]["refundAmount"]);
- var per = Math.floor(parseInt(data[0]["refundCount"]) / parseInt(data[0]["orderCount"]) * 100);
- if (parseInt(data[0]["orderCount"]) == 0) {
- per = 0;
- }
- $("#_refundCountPer").text(per + "%");
- });
- } else {
- postAjax("get_date_area_total_data", "timetype=" + dateType, function (data) {
- var strData = data.data;
- var dataList = strData.split(",");
- $("#_afterCount").text(dataList[2]);
- $("#_afterAmount").text(dataList[3]);
- $("#_totalCount").text(dataList[0]);
- $("#_totalAmount").text(dataList[1]);
- $("#_refundCount").text(dataList[4]);
- $("#_refundAmount").text(dataList[5]);
- var per = Math.floor(parseInt(dataList[4]) / (parseInt(dataList[0])) * 100);
- if (parseInt(dataList[0]) == 0) {
- per = 0;
- }
- $("#_refundCountPer").text("率:" + per + "%");
- });
- }
- }
- function changeDateAreaFn() {
- curDateType = mini.get("cmbSearchDate").getValue();
- if (postCode == "Designer" || postCode == "DesignerMr") {
- getDesignerDataList(curDateType);
- }
- else {
- getCustomerDataList(curDateType);
- }
- }
- function openItemTab(name, parms) {
- if (parent != null) parent.openItemTab(name, parms);
- }
- function openOrderTab(parms) {
- if (parent != null) parent.openItemTab("订单列表", parms);
- }
- function openMyOrderTab(name, parms) {
- if (parent != null) parent.openItemTab("我的订单", parms);
- }
- function clickToMyDesignList(state) {
- if (parent != null) parent.openItemTab("我的设计", state);
- }
- function clickToMyRefund(tType) {
- if (tType == 1) {
- var timetype = "time=" + curDateType;
- if (parent != null) parent.openItemTab("退款确认", timetype);
- }
- else {
- if (parent != null) parent.openItemTab("退款确认", "");
- }
- }
|