How to use StateText method in tracetest

Best JavaScript code snippet using tracetest

sj_index.js

Source:sj_index.js Github

copy

Full Screen

1function initPageMain() {2 var indexObj;3 initIndexVar();4 initIndexListener();5 initIndexView();6 function initIndexVar() {7 if(!indexObj) {8 indexObj = new Index();9 }10 }11 function initIndexListener() {12 if(indexObj) {13 indexObj.setOnIndexClickListener();14 }15 }16 function initIndexView(){17 indexObj.getAjaxForSJList();18 }19}20function Index() {21 var thisObj = this;22 var getZSFListUrl = SERVER_URL+"ex/stay/list"; //住宿费23 var getGQFListUrl = SERVER_URL+"ex/bridge/list"; //过桥费24 var getNSFFListUrl = SERVER_URL+"ex/urea/list"; //尿素费25 var getSGListUrl = SERVER_URL+"ex/hAccidentApplication/list"; //事故26 var userInfo = JSON.parse(sessionStorage.getItem("user_info")); //获取用户数据27 var jobInfo = JSON.parse(sessionStorage.getItem("user_jobInfo")); //获取用户数据28 var state = parseInt(publicObj.getUrlParameter("state"));29 var typeNum = sessionStorage.getItem("typeNum")30 this.setOnIndexClickListener = function() {31 //顶部选项卡选中样式32 var $tab = $(".topTabBar").children();33 $tab.on("click", function() {34 var $this = $(this);35 $tab.removeClass("topTabBar_select");36 $this.addClass("topTabBar_select");37 });38 $(".tab2").click(function() {39 $(".tab2 i").addClass("public-iconListWhite");40 $(".tab1 i").addClass("public-iconApplyBlack");41 $(".list").show();42 $(".apply").hide();43 })44 $(".tab1").click(function() {45 $(".tab1 i").removeClass("public-iconApplyBlack");46 $(".tab2 i").removeClass("public-iconListWhite");47 $(".apply").show();48 $(".list").hide();49 })50 $(".listItem").click(function(_event){51 if($(this).attr("data-page")){52 location.href = "../html/"+$(this).attr("data-page")+"?type=-3";53 }else{54 publicObj.openDingdingPopup("该功能还在开发中");55 }56 });57 $("#select1").change(function(){58 thisObj.getAjaxForSJList();59 });60 };61 //获取司机订单列表62 this.getAjaxForSJList = function(){63 $(".listContent>.listItem:not([id])").remove();64 console.log(state)65 console.log(state, typeNum)66 switch (typeNum) {67 case "1":68 if ( state == "-9") {69 $.get(getZSFListUrl, { userId: jobInfo.structureUserId, isSend: "1,2", limit: 10000, page: 1, order: "ecs", state: "3,8" }, function (_data) {70 if(_data.data.records.length==0){71 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");72 }73 for (var i in _data.data.records) {74 var thisItem = _data.data.records[i];75 var $listItemClone = $("#listItem").clone();76 $listItemClone.removeAttr("id");77 $listItemClone.attr("data-id", thisItem.id);78 $listItemClone.find(".listName").text(thisItem.number);79 $listItemClone.find(".money").text("¥" + thisItem.money);80 $listItemClone.find("#sj").text(thisItem.driverName);81 $listItemClone.find("#bxdType").text("住宿费报销单");82 var stateText;83 switch (parseInt(thisItem.isSend)) {84 case 1:85 stateText = "未寄";86 break;87 case 2:88 stateText = "已寄";89 break;90 default:91 break;92 }93 $listItemClone.find("#state").text(stateText);94 var thisDate = new Date();95 thisDate.setTime(thisItem.declarationTime * 1000);96 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));97 $listItemClone.click(function (_event) {98 location.href = "hotelbx.html?id=" + $(this).attr("data-id");99 });100 $(".listContent").append($listItemClone.show());101 }102 });103 break;104 }else if(state == 20 || state == "20"){105 $.get(getZSFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: "2,3,6,8" }, function (_data) {106 if(_data.data.records.length==0){107 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");108 }109 for (var i in _data.data.records) {110 var thisItem = _data.data.records[i];111 var $listItemClone = $("#listItem").clone();112 $listItemClone.removeAttr("id");113 $listItemClone.attr("data-id", thisItem.id);114 $listItemClone.find(".listName").text(thisItem.number);115 $listItemClone.find(".money").text("¥" + thisItem.money);116 $listItemClone.find("#sj").text(thisItem.driverName);117 $listItemClone.find("#bxdType").text("住宿费报销单");118 var stateText;119 switch (thisItem.state) {120 case -2:121 stateText = "未过审";122 break;123 case -1:124 stateText = "未过审";125 break;126 case 0:127 stateText = "待审批";128 break;129 case 1:130 stateText = "待审核";131 break;132 case 2:133 stateText = "待报销";134 break;135 case 3:136 stateText = "待打款";137 break;138 case 4:139 stateText = "待处理";140 break;141 case 5:142 stateText = "在处理";143 break;144 case 6:145 stateText = "已完成";146 break;147 case 7:148 stateText = "已过审批";149 break;150 }151 $listItemClone.find("#state").text(stateText);152 var thisDate = new Date();153 thisDate.setTime(thisItem.declarationTime * 1000);154 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));155 $listItemClone.click(function (_event) {156 location.href = "hotelbx.html?id=" + $(this).attr("data-id");157 });158 $(".listContent").append($listItemClone.show());159 }160 });161 break;162 }else{163 console.log("出现了状态");164 console.log(state);165 $.get(getZSFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: state }, function (_data) {166 if(_data.data.records.length==0){167 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");168 }169 for (var i in _data.data.records) {170 var thisItem = _data.data.records[i];171 var $listItemClone = $("#listItem").clone();172 $listItemClone.removeAttr("id");173 $listItemClone.attr("data-id", thisItem.id);174 $listItemClone.find(".listName").text(thisItem.number);175 $listItemClone.find(".money").text("¥" + thisItem.money);176 $listItemClone.find("#sj").text(thisItem.driverName);177 $listItemClone.find("#bxdType").text("住宿费报销单");178 var stateText;179 switch (thisItem.state) {180 case -2:181 stateText = "未过审";182 break;183 case -1:184 stateText = "未过审";185 break;186 case 0:187 stateText = "待审批";188 break;189 case 1:190 stateText = "待审核";191 break;192 case 2:193 stateText = "待报销";194 break;195 case 3:196 stateText = "待打款";197 break;198 case 4:199 stateText = "待处理";200 break;201 case 5:202 stateText = "在处理";203 break;204 case 6:205 stateText = "已完成";206 break;207 case 7:208 stateText = "已过审批";209 break;210 }211 $listItemClone.find("#state").text(stateText);212 var thisDate = new Date();213 thisDate.setTime(thisItem.declarationTime * 1000);214 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));215 $listItemClone.click(function (_event) {216 location.href = "hotelbx.html?id=" + $(this).attr("data-id");217 });218 $(".listContent").append($listItemClone.show());219 }220 });221 break;222 }223 224 case "2":225 if (state == "-9") {226 $.get(getGQFListUrl, { userId: jobInfo.structureUserId, isSend:"1,2", limit: 10000, page: 1, order: "ecs", state: "3,8" }, function (_data) {227 console.log(_data)228 if(_data.data.records.length==0){229 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");230 }231 for (var i in _data.data.records) {232 var thisItem = _data.data.records[i];233 var $listItemClone = $("#listItem").clone();234 $listItemClone.removeAttr("id");235 $listItemClone.attr("data-id", thisItem.id);236 $listItemClone.find(".listName").text(thisItem.number);237 $listItemClone.find(".money").text("¥" + thisItem.money);238 $listItemClone.find("#sj").text(thisItem.driverName);239 $listItemClone.find("#bxdType").text("过桥费报销单");240 var stateText;241 switch (parseInt(thisItem.isSend)) {242 case 1:243 stateText = "未寄";244 break;245 case 2:246 stateText = "已寄";247 break;248 default:249 break;250 }251 $listItemClone.find("#state").text(stateText);252 var thisDate = new Date();253 thisDate.setTime(thisItem.declarationTime * 1000);254 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));255 $listItemClone.click(function (_event) {256 location.href = "pontage.html?id=" + $(this).attr("data-id");257 });258 $(".listContent").append($listItemClone.show());259 }260 });261 break;262 }else if(state == 20||state == "20"){ //20的时候应该查询状态为2,3,6,8263 console.log("是20 ");264 $.get(getGQFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: "2,3,6,8" }, function (_data) {265 console.log(_data)266 if(_data.data.records.length==0){267 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");268 }269 for (var i in _data.data.records) {270 var thisItem = _data.data.records[i];271 var $listItemClone = $("#listItem").clone();272 $listItemClone.removeAttr("id");273 $listItemClone.attr("data-id", thisItem.id);274 $listItemClone.find(".listName").text(thisItem.number);275 $listItemClone.find(".money").text("¥" + thisItem.money);276 $listItemClone.find("#sj").text(thisItem.driverName);277 $listItemClone.find("#bxdType").text("过桥费报销单");278 var stateText;279 switch (thisItem.state) {280 case -2:281 stateText = "未过审";282 break;283 case -1:284 stateText = "未过审";285 break;286 case 0:287 stateText = "待审批";288 break;289 case 1:290 stateText = "待审核";291 break;292 case 2:293 stateText = "待报销";294 break;295 case 3:296 stateText = "待打款";297 break;298 case 4:299 stateText = "待处理";300 break;301 case 5:302 stateText = "在处理";303 break;304 case 6:305 stateText = "已完成";306 break;307 case 7:308 stateText = "已审批";309 break;310 }311 $listItemClone.find("#state").text(stateText);312 var thisDate = new Date();313 thisDate.setTime(thisItem.declarationTime * 1000);314 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));315 $listItemClone.click(function (_event) {316 location.href = "pontage.html?id=" + $(this).attr("data-id");317 });318 $(".listContent").append($listItemClone.show());319 }320 });321 break;322 }else{323 $.get(getGQFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: state }, function (_data) {324 console.log(_data)325 if(_data.data.records.length==0){326 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");327 }328 for (var i in _data.data.records) {329 var thisItem = _data.data.records[i];330 var $listItemClone = $("#listItem").clone();331 $listItemClone.removeAttr("id");332 $listItemClone.attr("data-id", thisItem.id);333 $listItemClone.find(".listName").text(thisItem.number);334 $listItemClone.find(".money").text("¥" + thisItem.money);335 $listItemClone.find("#sj").text(thisItem.driverName);336 $listItemClone.find("#bxdType").text("过桥费报销单");337 var stateText;338 switch (thisItem.state) {339 case -2:340 stateText = "未过审";341 break;342 case -1:343 stateText = "未过审";344 break;345 case 0:346 stateText = "待审批";347 break;348 case 1:349 stateText = "待审核";350 break;351 case 2:352 stateText = "待报销";353 break;354 case 3:355 stateText = "待打款";356 break;357 case 4:358 stateText = "待处理";359 break;360 case 5:361 stateText = "在处理";362 break;363 case 6:364 stateText = "已完成";365 break;366 case 7:367 stateText = "已审批";368 break;369 }370 $listItemClone.find("#state").text(stateText);371 var thisDate = new Date();372 thisDate.setTime(thisItem.declarationTime * 1000);373 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));374 $listItemClone.click(function (_event) {375 location.href = "pontage.html?id=" + $(this).attr("data-id");376 });377 $(".listContent").append($listItemClone.show());378 }379 });380 break;381 }382 case "3":383 if (state == "-9") {384 $.get(getNSFFListUrl, { userId: jobInfo.structureUserId, isSend: "1,2", limit: 10000, page: 1, order: "ecs", state: "8" }, function (_data) {385 console.log(_data);386 if(_data.page.records.length==0){387 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");388 }389 for (var i in _data.page.records) {390 var thisItem = _data.page.records[i];391 var $listItemClone = $("#listItem").clone();392 $listItemClone.removeAttr("id");393 $listItemClone.attr("data-id", thisItem.id);394 $listItemClone.find(".listName").text(thisItem.number);395 $listItemClone.find(".money").text((thisItem.money == null ? "暂无" : ("¥" + thisItem.money)));396 $listItemClone.find("#sj").text(thisItem.driverName);397 $listItemClone.find("#bxdType").text("尿素费报销单");398 var stateText;399 switch (parseInt(thisItem.isSend)) {400 case 1:401 stateText = "未寄";402 break;403 case 2:404 stateText = "已寄";405 break;406 default:407 break;408 }409 $listItemClone.find("#state").text(stateText);410 var thisDate = new Date();411 thisDate.setTime(thisItem.declarationTime * 1000);412 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));413 $listItemClone.click(function (_event) {414 location.href = "ureadeclare.html?id=" + $(this).attr("data-id");415 });416 $(".listContent").append($listItemClone.show());417 }418 });419 break;420 } else if(state == 20 || state == "20"){421 $.get(getNSFFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: "1,2,3,6,8" }, function (_data) {422 console.log(_data);423 if(_data.page.records.length==0){424 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");425 }426 for (var i in _data.page.records) {427 var thisItem = _data.page.records[i];428 var $listItemClone = $("#listItem").clone();429 $listItemClone.removeAttr("id");430 $listItemClone.attr("data-id",thisItem.id);431 $listItemClone.find(".listName").text(thisItem.number);432 $listItemClone.find(".money").text((thisItem.money == null ? "暂无" : ("¥" + thisItem.money)));433 $listItemClone.find("#sj").text(thisItem.driverName);434 $listItemClone.find("#bxdType").text("尿素费报销单");435 var stateText;436 switch (thisItem.state) {437 case -2:438 stateText = "未过审";439 break;440 case -1:441 stateText = "未过审";442 break;443 case 0:444 stateText = "待审批";445 break;446 case 1:447 stateText = "待审核";448 break;449 case 2:450 stateText = "待报销";451 break;452 case 3:453 stateText = "待打款";454 break;455 case 4:456 stateText = "待处理";457 break;458 case 5:459 stateText = "在处理";460 break;461 case 6:462 stateText = "已完成";463 break;464 case 7:465 stateText = "已审批";466 break;467 }468 $listItemClone.find("#state").text(stateText);469 var thisDate = new Date();470 thisDate.setTime(thisItem.declarationTime * 1000);471 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));472 $listItemClone.click(function (_event) {473 location.href = "ureadeclare.html?id=" + $(this).attr("data-id");474 });475 $(".listContent").append($listItemClone.show());476 }477 });478 break;479 }else {480 $.get(getNSFFListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: state }, function (_data) {481 console.log(_data);482 if(_data.page.records.length==0){483 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");484 }485 for (var i in _data.page.records) {486 var thisItem = _data.page.records[i];487 var $listItemClone = $("#listItem").clone();488 $listItemClone.removeAttr("id");489 $listItemClone.attr("data-id",thisItem.id);490 $listItemClone.find(".listName").text(thisItem.number);491 $listItemClone.find(".money").text((thisItem.money == null ? "暂无" : ("¥" + thisItem.money)));492 $listItemClone.find("#sj").text(thisItem.driverName);493 $listItemClone.find("#bxdType").text("尿素费报销单");494 var stateText;495 switch (thisItem.state) {496 case -2:497 stateText = "未过审";498 break;499 case -1:500 stateText = "未过审";501 break;502 case 0:503 stateText = "待审批";504 break;505 case 1:506 stateText = "待审核";507 break;508 case 2:509 stateText = "待报销";510 break;511 case 3:512 stateText = "待打款";513 break;514 case 4:515 stateText = "待处理";516 break;517 case 5:518 stateText = "在处理";519 break;520 case 6:521 stateText = "已完成";522 break;523 case 7:524 stateText = "已审批";525 break;526 }527 $listItemClone.find("#state").text(stateText);528 var thisDate = new Date();529 thisDate.setTime(thisItem.declarationTime * 1000);530 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));531 $listItemClone.click(function (_event) {532 location.href = "ureadeclare.html?id=" + $(this).attr("data-id");533 });534 $(".listContent").append($listItemClone.show());535 }536 });537 break;538 }539 case "4":540 console.log("是第四个流程");541 $.get(getSGListUrl, { userId: jobInfo.structureUserId, limit: 10000, page: 1, order: "ecs", state: "1,2,3,4,5" }, function (_data) {542 console.log(_data);543 if(_data.page.records.length==0){544 $(".listContent").append("<p style='text-align:center;font-size:20px;'>暂时没有数据!</p>");545 }546 for (var i in _data.page.records) {547 var thisItem = _data.page.records[i];548 var $listItemClone = $("#listItem").clone();549 $listItemClone.removeAttr("id");550 $listItemClone.attr("data-id",thisItem.id);551 console.log(thisItem);552 switch(thisItem.natureAccident){553 case 1:554 $listItemClone.find(".money").text("装卸事故");555 break;556 case 2:557 $listItemClone.find(".money").text("新车检查");558 break;559 case 3:560 $listItemClone.find(".money").text("交通事故");561 break;562 case 4:563 $listItemClone.find(".money").text("新车装卸");564 break;565 }566 $listItemClone.find(".listName").text(thisItem.number);567 $listItemClone.find("#sj").text(thisItem.name);568 $listItemClone.find("#bxdType").text("事故申报");569 var stateText;570 switch (thisItem.start) {571 case 1:572 stateText = "未处理";573 break;574 case 2:575 stateText = "未调度";576 break;577 case 3:578 stateText = "已调度";579 break;580 case 4:581 stateText = "继续跑";582 break;583 case 5:584 stateText = "已完成";585 break;586 }587 $listItemClone.find("#state").text(stateText);588 if(thisItem.declarationTime==null){589 $listItemClone.find(".time").text("暂未处理");590 }else{591 var thisDate = new Date();592 thisDate.setTime(thisItem.declarationTime * 1000);593 $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));594 }595 $listItemClone.click(function (_event) {596 location.href = "accidentdeclare.html?id=" + $(this).attr("data-id");597 });598 $(".listContent").append($listItemClone.show());599 }600 });601 break;602 }603 // switch($("#select1").val()){604 // case "住宿费":605 // $.get(getZSFListUrl,{declarationUserId:userInfo.id,limit:10000,page:1,order:"ecs"},function(_data){606 // for(var i in _data.data.records){607 // var thisItem = _data.data.records[i];608 // var $listItemClone = $("#listItem").clone();609 // $listItemClone.removeAttr("id");610 // $listItemClone.attr("data-id",thisItem.id);611 // $listItemClone.find(".listName").text(thisItem.number);612 // $listItemClone.find(".money").text("¥"+thisItem.money);613 // $listItemClone.find("#sj").text(thisItem.driverName);614 // $listItemClone.find("#bxdType").text("住宿费报销单");615 // var stateText;616 // switch(thisItem.state){617 // case -2:618 // stateText = "未过审";619 // break;620 // case -1:621 // stateText = "未过审";622 // break;623 // case 0:624 // stateText = "待审批";625 // break;626 // case 1:627 // stateText = "待审核";628 // break;629 // case 2:630 // stateText = "待报销";631 // break;632 // case 3:633 // stateText = "待打款";634 // break;635 // case 4:636 // stateText = "待处理";637 // break;638 // case 5:639 // stateText = "在处理";640 // break;641 // case 6:642 // stateText = "已完成";643 // break;644 // case 7:645 // stateText = "已过审批";646 // break;647 // }648 // $listItemClone.find("#state").text(stateText);649 // var thisDate = new Date();650 // thisDate.setTime(thisItem.declarationTime*1000);651 // $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));652 // $listItemClone.click(function(_event){653 // location.href = "hotelbx.html?id="+$(this).attr("data-id");654 // });655 // $(".listContent").append($listItemClone.show());656 // }657 // });658 // break;659 // case "过桥费":660 // $.get(getGQFListUrl,{declarationUserId:userInfo.id,limit:10000,page:1,order:"ecs"},function(_data){661 // for(var i in _data.data.records){662 // var thisItem = _data.data.records[i];663 // var $listItemClone = $("#listItem").clone();664 // $listItemClone.removeAttr("id");665 // $listItemClone.attr("data-id",thisItem.id);666 // $listItemClone.find(".listName").text(thisItem.number);667 // $listItemClone.find(".money").text("¥"+thisItem.money);668 // $listItemClone.find("#sj").text(thisItem.driverName);669 // $listItemClone.find("#bxdType").text("过桥费报销单");670 // var stateText;671 // switch(thisItem.state){672 // case -2:673 // stateText = "未过审";674 // break;675 // case -1:676 // stateText = "未过审";677 // break;678 // case 0:679 // stateText = "待审批";680 // break;681 // case 1:682 // stateText = "待审核";683 // break;684 // case 2:685 // stateText = "待报销";686 // break;687 // case 3:688 // stateText = "待打款";689 // break;690 // case 4:691 // stateText = "待处理";692 // break;693 // case 5:694 // stateText = "在处理";695 // break;696 // case 6:697 // stateText = "已完成";698 // break;699 // case 7:700 // stateText = "已审批";701 // break;702 // }703 // $listItemClone.find("#state").text(stateText);704 // var thisDate = new Date();705 // thisDate.setTime(thisItem.declarationTime*1000);706 // $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));707 // $listItemClone.click(function(_event){708 // location.href = "pontage.html?id="+$(this).attr("data-id");709 // });710 // $(".listContent").append($listItemClone.show());711 // }712 // });713 // break;714 // case "尿素费":715 // $.get(getNSFFListUrl,{declarationUserId:userInfo.id,limit:10000,page:1,order:"ecs"},function(_data){716 // for(var i in _data.page.records){717 // var thisItem = _data.page.records[i];718 // var $listItemClone = $("#listItem").clone();719 // $listItemClone.removeAttr("id");720 // $listItemClone.attr("data-id",thisItem.id);721 // $listItemClone.find(".listName").text(thisItem.number);722 // $listItemClone.find(".money").text("¥"+(thisItem.money==null?"暂无":thisItem.money));723 // $listItemClone.find("#sj").text(thisItem.driverName);724 // $listItemClone.find("#bxdType").text("尿素费报销单");725 // var stateText;726 // switch(thisItem.state){727 // case -2:728 // stateText = "未过审";729 // break;730 // case -1:731 // stateText = "未过审";732 // break;733 // case 0:734 // stateText = "待审批";735 // break;736 // case 1:737 // stateText = "待审核";738 // break;739 // case 2:740 // stateText = "待报销";741 // break;742 // case 3:743 // stateText = "待打款";744 // break;745 // case 4:746 // stateText = "待处理";747 // break;748 // case 5:749 // stateText = "在处理";750 // break;751 // case 6:752 // stateText = "已完成";753 // break;754 // case 7:755 // stateText = "已过审";756 // break;757 // }758 // $listItemClone.find("#state").text(stateText);759 // var thisDate = new Date();760 // thisDate.setTime(thisItem.declarationTime*1000);761 // $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));762 // $listItemClone.click(function(_event){763 // location.href = "ureadeclare.html?id="+$(this).attr("data-id");764 // });765 // $(".listContent").append($listItemClone.show());766 // }767 // });768 // break;769 // case "事故申报":770 // $.get(getSGListUrl,{declarationUserId:userInfo.id,limit:10000,page:1,order:"ecs"},function(_data){771 // for(var i in _data.page.records){772 // var thisItem = _data.page.records[i];773 // var $listItemClone = $("#listItem").clone();774 // $listItemClone.removeAttr("id");775 // $listItemClone.attr("data-id",thisItem.id);776 // $listItemClone.find(".listName").text(thisItem.number);777 // $listItemClone.find(".money").hide();778 // $listItemClone.find("#sj").text(thisItem.driverName);779 // $listItemClone.find("#bxdType").text("事故申请单");780 // var stateText;781 // switch(thisItem.state){782 // case -2:783 // stateText = "未过审";784 // break;785 // case -1:786 // stateText = "未过审";787 // break;788 // case 0:789 // stateText = "待审批";790 // break;791 // case 1:792 // stateText = "待审核";793 // break;794 // case 2:795 // stateText = "待报销";796 // break;797 // case 3:798 // stateText = "待打款";799 // break;800 // case 4:801 // stateText = "待处理";802 // break;803 // case 5:804 // stateText = "在处理";805 // break;806 // case 6:807 // stateText = "已完成";808 // break;809 // case 7:810 // stateText = "已过审";811 // break;812 // }813 // $listItemClone.find("#state").text(stateText);814 // var thisDate = new Date();815 // thisDate.setTime(thisItem.declarationTime*1000);816 // $listItemClone.find(".time").text(thisDate.Format("yyyy-MM-dd hh:mm"));817 // $listItemClone.click(function(_event){818 // location.href = "accidentdeclare.html?id="+$(this).attr("data-id");819 // });820 // $(".listContent").append($listItemClone.show());821 // }822 // });823 // break;824 // }825 }...

Full Screen

Full Screen

FriendState.js

Source:FriendState.js Github

copy

Full Screen

1import React, { useRef, useState, useEffect } from "react";2import { useSelector } from "react-redux";3import styled from "styled-components";4import { updateUser } from "../../../util/firebase";5import { friendStateObj } from "../../../util/friendStateObj";6const RequestBtnDiv = styled.div`7 display: flex;8 flex-direction: column;9 align-items: center;10 position: absolute;11 bottom: 0px;12 left: 620px;13 @media (max-width: 1180px) {14 left: 500px;15 }16 @media (max-width: 932px) {17 left: calc(56% + 80px);18 }19 @media (max-width: 500px) {20 left: calc(56% + 20px);21 }22`;23const RequestBtn = styled.div`24 width: 70px;25 height: 70px;26 font-size: 36px;27 border-radius: 50%;28 display: flex;29 cursor: pointer;30 @media (max-width: 500px) {31 width: 50px;32 height: 50px;33 font-size: 20px;34 }35`;36const FontIcon = styled.i`37 margin: auto;38`;39const StateText = styled.div`40 width: 125px;41 text-align: center;42 font-size: 16px;43 margin-top: 2px;44 color: white;45`;46const RemoveRequest = styled.div`47 font-size: 20px;48 position: absolute;49 right: 0;50 bottom: 20px;51 cursor: pointer;52 :hover {53 color: #ae0000;54 }55`;56export default function FriendState({ userInfo }) {57 const requestBtnRef = useRef();58 const stateTextRef = useRef();59 const [friendState, setFriendState] = useState("none");60 const myInfo = useSelector((state) => state.userInfo);61 const { friends: myFriends } = myInfo;62 useEffect(() => {63 if (myFriends) {64 const friendObj = myFriends.filter(({ id }) => id === userInfo.id);65 setFriendState(66 friendObj.length &&67 Object.keys(friendStateObj).includes(friendObj[0].condition)68 ? friendObj[0].condition69 : "none"70 );71 }72 }, [myFriends, userInfo.id]);73 function handleRequestBtn(e, type) {74 const btnStyle = requestBtnRef.current.style;75 const stateText = stateTextRef.current;76 const stateChange = friendStateObj[friendState].state_change.my_state;77 if (type === "leave") {78 btnStyle.color = friendStateObj[friendState].style.color;79 btnStyle.backgroundColor =80 friendStateObj[friendState].style.backgroundColor;81 btnStyle.outline = friendStateObj[friendState].style.outline;82 stateText.innerText = friendStateObj[friendState].text;83 stateText.style.color = "white";84 } else if (type === "enter") {85 btnStyle.color = friendStateObj[stateChange].style.color;86 btnStyle.backgroundColor = friendStateObj[friendState].color_change;87 btnStyle.outline = friendStateObj[stateChange].style.outline;88 stateText.innerText = friendStateObj[friendState].text_change;89 stateText.style.color = friendStateObj[friendState].color_change;90 }91 }92 const createUpdateBody = (myInfo, friendInfo, friendCondition, stateFrom) => [93 ...myInfo.friends.filter((friend) => friend.id !== friendInfo.id),94 {95 id: friendInfo.id,96 condition: friendStateObj[friendCondition].state_change[stateFrom],97 },98 ];99 function handleFriendState() {100 const style = requestBtnRef.current.style;101 const stateText = stateTextRef.current;102 const stateChange = friendStateObj[friendState].state_change.my_state;103 style.color = friendStateObj[stateChange].style.color;104 style.backgroundColor = friendStateObj[stateChange].style.backgroundColor;105 style.outline = friendStateObj[stateChange].style.outline;106 stateText.style.color = "white";107 setFriendState(stateChange);108 updateUser(myInfo.id, {109 friends: createUpdateBody(myInfo, userInfo, friendState, "my_state"),110 });111 updateUser(userInfo.id, {112 friends: createUpdateBody(userInfo, myInfo, friendState, "friend_state"),113 });114 }115 function handleRemoveRequesState() {116 const stateText = stateTextRef.current;117 stateText.style.color = "white";118 setFriendState("none");119 updateUser(myInfo.id, {120 friends: createUpdateBody(myInfo, userInfo, "remove", "my_state"),121 });122 updateUser(userInfo.id, {123 friends: createUpdateBody(userInfo, myInfo, "remove", "friend_state"),124 });125 }126 function handleRemoveRequest(e, type) {127 const stateText = stateTextRef.current;128 if (type === "enter") {129 stateText.innerText = "remove request";130 stateText.style.color = "#AE0000";131 }132 }133 return (134 <RequestBtnDiv>135 <RequestBtn136 ref={requestBtnRef}137 style={friendStateObj[friendState].style}138 onMouseEnter={(e) => handleRequestBtn(e, "enter")}139 onMouseLeave={(e) => handleRequestBtn(e, "leave")}140 onClick={handleFriendState}141 >142 {friendState === "confirmed" ? (143 <FontIcon className="fas fa-user-friends" />144 ) : (145 <FontIcon className="fas fa-user-plus" />146 )}147 </RequestBtn>148 <StateText ref={stateTextRef}>149 {friendStateObj[friendState].text}150 </StateText>151 {friendState === "get_request" ? (152 <RemoveRequest153 onMouseEnter={(e) => handleRemoveRequest(e, "enter")}154 onMouseLeave={(e) => handleRequestBtn(e, "leave")}155 onClick={handleRemoveRequesState}156 >157 <i className="fas fa-minus-circle" />158 </RemoveRequest>159 ) : (160 <></>161 )}162 </RequestBtnDiv>163 );...

Full Screen

Full Screen

order.js

Source:order.js Github

copy

Full Screen

1/*2* addOrder3* getOrderById4* getOrdersByUserId5*/6var db = require('../db/db.js');7var moment = require('moment');8module.exports = function (router) {9 //获取用户默认地址10 router.get('/order/getNewestAddress',function (req,res,next) {11 var userId = req.query.userId;12 db.getDefaultAddr(userId,function (address) {13 if(address == null){14 res.send({code:1});15 }else{16 res.send({17 code:0,18 data:address19 })20 }21 })22 });23 //向数据库添加订单24 router.post('/order/createOrder',function (req,res,next) {25 var order = req.body.order;26 order.state = 3; //设置订单的状态27 db.addOrder(order,function (result) {28 res.send({29 code:0,30 data:result31 })32 })33 });34 //订单完成页面35 router.get('/order/detail/:id',function (req,res,next) {36 var id = req.params.id;37 console.log(id);38 db.getOrderById(id,function (order) {39 var stateText = null;40 switch(order.state) {41 case 0:42 stateText = '待支付';43 break;44 case 1:45 stateText = '已付款';46 break;47 case 2:48 stateText = '';49 break;50 case 3:51 stateText = '已完成';52 break;53 case 4:54 stateText = '店铺拒单';55 break;56 case 5:57 stateText = ' 商家已接单';58 break;59 case 6:60 stateText = '已退单';61 break;62 case 7:63 stateText = '未支付的取消订单';64 break;65 case 8:66 stateText = '订单异常';67 break;68 case 9:69 stateText = '退单中';70 break;71 case 10:72 stateText = '商家拒绝退单';73 }74 //添加一个属性,在页面中显示75 order.stateText = stateText;76 //修改一个已有的属性值(必须通过_doc属性操作)77 order._doc.arrive_time = moment(order.arrive_time).format('YYYY-MM-DD HH:mm');78 order._doc.detail = JSON.parse(order.detail);79 res.render('orderDetail',{data:order});80 })81 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('./tracetest.js');2tracetest.StateText("Hello World");3exports.StateText = function(text) {4 console.log(text);5}6var tracetest = require('./tracetest.js');7tracetest.StateText("Hello World");8var tracetest = require('./tracetest.js');9tracetest.StateText("Hello World");10var tracetest = require('./tracetest.js');11tracetest.StateText("Hello World");

Full Screen

Using AI Code Generation

copy

Full Screen

1var trace = require('./tracetest');2trace.StateText('Hello World');3exports.StateText = function (text) {4 console.log(text);5}6var trace = require('./tracetest.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2tracetest.StateText('test.js is running');3console.log('test.js is running');4var tracetest = require('tracetest');5tracetest.StateText('test2.js is running');6console.log('test2.js is running');7var tracetest = require('tracetest');8tracetest.StateText('test3.js is running');9console.log('test3.js is running');10var tracetest = require('tracetest');11tracetest.StateText('test4.js is running');12console.log('test4.js is running');13var tracetest = require('tracetest');14tracetest.StateText('test5.js is running');15console.log('test5.js is running');16var tracetest = require('tracetest');17tracetest.StateText('test6.js is running');18console.log('test6.js is running');19var tracetest = require('tracetest');20tracetest.StateText('test7.js is running');21console.log('test7.js is running');22var tracetest = require('tracetest');23tracetest.StateText('test8.js is running');24console.log('test8.js is running');25var tracetest = require('tracetest');26tracetest.StateText('test9.js is running');27console.log('test9.js is running');28var tracetest = require('tracetest');29tracetest.StateText('test10.js is running');30console.log('test10.js is running');

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var stateText = tracetest.stateText(2);3console.log(stateText);4module.exports = {5 stateText: function(state) {6 switch (state) {7 return 'Start';8 return 'Middle';9 return 'End';10 return 'Unknown';11 }12 }13};14Operator Description = Used to assign a value to a variable. + Used to add together two values. - Used to subtract one value from another. * Used to multiply two values. / Used to divide one value by another. % Used to find the remainder of a division operation. ++ Used to increment a variable by 1. -- Used to decrement a variable by 1. == Used to compare two values (equal to). === Used to compare two values, including type (equal value and equal type). != Used to compare two values (not equal to). !== Used to compare two values

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var tracetestObj = new tracetest();3tracetestObj.StateText('test', function(err, data) {4 if (err) {5 console.log(err);6 }7 else {8 console.log(data);9 }10});11var tracetest = require('tracetest');12var tracetestObj = new tracetest();13tracetestObj.StateText('test', function(err, data) {14 if (err) {15 console.log(err);16 }17 else {18 console.log(data);19 }20});21var tracetest = require('tracetest');22var tracetestObj = new tracetest();23tracetestObj.StateText('test', function(err, data) {24 if (err) {25 console.log(err);26 }27 else {28 console.log(data);29 }30});31var tracetest = require('tracetest');32var tracetestObj = new tracetest();33tracetestObj.StateText('test', function(err, data) {34 if (err) {35 console.log(err);36 }37 else {38 console.log(data);39 }40});41var tracetest = require('tracetest');42var tracetestObj = new tracetest();43tracetestObj.StateText('test', function(err, data) {44 if (err) {45 console.log(err);46 }47 else {48 console.log(data);49 }50});51var tracetest = require('tracetest');52var tracetestObj = new tracetest();53tracetestObj.StateText('test', function(err, data) {54 if (err) {55 console.log(err);56 }57 else {58 console.log(data);59 }60});61var tracetest = require('tracetest');62var tracetestObj = new tracetest();

Full Screen

Using AI Code Generation

copy

Full Screen

1var tracetest = require('tracetest');2var st = tracetest.StateText;3console.log('StateText: ' + st);4var StateText = 'Ready';5exports.StateText = StateText;6exports.StateText = 'Ready';7exports.LogMessage = function(msg) {8 console.log(msg);9}10var tracetest = require('tracetest');11var st = tracetest.StateText;12var lm = tracetest.LogMessage;13console.log('StateText: ' + st);14lm('LogMessage called');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tracetest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful