爱房JS脚本

可以跳转项目页,打开合同扫描件,一键下载订单明细

目前为 2023-03-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 爱房JS脚本
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description 可以跳转项目页,打开合同扫描件,一键下载订单明细
  6. // @author 熊伟良
  7. // @match https://daiketong.58corp.com/*
  8. // @match https://max.58corp.com/*
  9. // @icon https://pages.anjukestatic.com/fe/ifang_node_admin_web/favicon.ico
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13. var currentUrl = 1;
  14. window.onload = function(){
  15.  
  16. setInterval(function() {
  17.  
  18. if (window.location.href != currentUrl) {
  19. // URL地址发生变化,触发事件
  20.  
  21. if (window.location.href.indexOf("commissionall") > -1) {
  22.  
  23. setTimeout(function () {
  24. let el_col = document.querySelectorAll(".el-col-22")[5]
  25. console.log(el_col)
  26. let btn = document.createElement("div")
  27. btn.innerHTML = `<button id="关闭暗佣" class="el-button el-button--default el-button--small" style="margin-left:20px">关闭暗佣</button>`
  28. el_col.appendChild(btn)
  29. console.log(btn)
  30. console.log(typeof (el_col), typeof (btn))
  31. document.querySelector("#关闭暗佣").addEventListener("click", function () {
  32. let fontColorList = document.querySelectorAll(".fontColor")
  33. if (fontColorList.length > 0) {
  34. fontColorList.forEach(function (item) {
  35. if (item.innerText == "关闭暗佣") {
  36. console.log(item.innerHTML)
  37. item.click()
  38. }
  39. })
  40. } else {
  41. console.log("待加载")
  42. // guanbianyong()
  43. }
  44. }, false)
  45. console.log(el_col)
  46. }, 2000)
  47.  
  48. }
  49. else if (window.location.href.indexOf("approvalStatus" && document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") > -1) {
  50. const cookie = document.cookie;
  51. var bc_id = "1"
  52. setTimeout(function () {
  53. let contentList = document.querySelectorAll(".section-content-item-value")
  54. contentList.forEach(function (contract, contractindex) {
  55. let reg = /^B/
  56. if (reg.test(contract.innerText) == true) {
  57. var buildingId = contract.innerText.substring(3, 8).toString();
  58. var bc_code = contract.innerText;
  59. contentList[0].onclick = function () {
  60. let win = window.open(`https://daiketong.58corp.com/#/refactorProject/projectManager/projectManagerIndex/projectManagerDetail?building_id=${buildingId}&active=4&city_id=362`)
  61. }
  62. fetch("https://daiketong.58corp.com/japi/buildings/contract/list", {
  63. "headers": {
  64. "accept": "application/json, text/plain, */*",
  65. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  66. "authorization": "",
  67. "content-type": "application/json;charset=UTF-8",
  68. "login-type": "pc",
  69. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  70. "sec-ch-ua-mobile": "?0",
  71. "sec-ch-ua-platform": "\"Windows\"",
  72. "sec-fetch-dest": "empty",
  73. "sec-fetch-mode": "cors",
  74. "sec-fetch-site": "same-origin",
  75. "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  76. "sw8-correlation": "c291cmNl:YmVpZG91",
  77. "timestamp": "1665145024"
  78. },
  79. "referrer": "https://daiketong.58corp.com/",
  80. "referrerPolicy": "strict-origin-when-cross-origin",
  81. "body": "{\"building_id\":\"" + buildingId + "\"}",
  82. "method": "POST",
  83. "mode": "cors",
  84. "credentials": "include"
  85. }).then(res => {
  86. return res.json()
  87. }).then(json => {
  88. // console.log(json)
  89. json["data"].forEach(function (item, index) {
  90. if (item["bc_code"] == bc_code) {
  91. let bc_id = item["bc_id"]
  92. // console.log(bc_id)
  93. fetch("https://daiketong.58corp.com/japi/buildings/contract/get-packing-list", {
  94. "headers": {
  95. "accept": "application/json, text/plain, */*",
  96. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  97. "authorization": "",
  98. "content-type": "application/json;charset=UTF-8",
  99. "login-type": "pc",
  100. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  101. "sec-ch-ua-mobile": "?0",
  102. "sec-ch-ua-platform": "\"Windows\"",
  103. "sec-fetch-dest": "empty",
  104. "sec-fetch-mode": "cors",
  105. "sec-fetch-site": "same-origin",
  106. "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  107. "sw8-correlation": "c291cmNl:YmVpZG91",
  108. "timestamp": "1665146852"
  109. },
  110. "referrer": "https://daiketong.58corp.com/",
  111. "referrerPolicy": "strict-origin-when-cross-origin",
  112. "body": "{\"contract_id\":" + bc_id.toString() + ",\"contract_type\":\"1\",\"status\":\"\"}",
  113. "method": "POST",
  114. "mode": "cors",
  115. "credentials": "include"
  116. }).then(res => {
  117. return res.json()
  118. }).then(json => {
  119. json["data"].forEach(function (item, index) {
  120. contract.addEventListener("click", function () {
  121. // console.log("qwwqqwqw")
  122. window.open(item["url"])
  123. }, false)
  124. // console.log(item["url"])
  125. })
  126. })
  127. }
  128. })
  129. });
  130. }
  131. })
  132.  
  133.  
  134.  
  135.  
  136.  
  137. if (document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
  138.  
  139. let re = setInterval(function () {
  140. let viewerHalf = document.querySelector(".viewerHalf")
  141. if (viewerHalf) {
  142. viewerHalf.className = "viewer-container viewer-backdrop viewer-fixed viewer-fade viewer-transition viewer-in"
  143. clearInterval(re)
  144. } else {
  145. // console.log(1)
  146. }
  147. }, 1000)
  148.  
  149. // let select = setInterval(function () {
  150. // var currentSelect = document.querySelectorAll('div[aria-selected="true"]')[1].innerText;
  151. // console.log(currentSelect)
  152. // if(currentSelect=="草签合同关键页"){
  153. // let viewer_move = document.querySelector(".viewer-move")
  154. // if (viewer_move) {
  155. // console.log(234,viewer_move)
  156. // }
  157. // }
  158. //
  159. // }, 500)
  160. document.onkeyup = function (event) {
  161. let viewer_move = document.querySelector(".viewer-move")
  162. if (viewer_move) {
  163. let a = document.documentElement.clientWidth / 2
  164. let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
  165. viewer_move.style["margin-left"] = (a - b) + "px"
  166. }
  167. }
  168. document.onmousewheel = function (event) {
  169. let viewer_move = document.querySelector(".viewer-move")
  170. if (viewer_move) {
  171. let a = document.documentElement.clientWidth / 2
  172. let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
  173. viewer_move.style["margin-left"] = (a - b) + "px"
  174. }
  175. }
  176. }
  177. }, 500)
  178.  
  179.  
  180. } else if (window.location.href.indexOf("max") > -1) {
  181. function getSystemTime(timeFormat) {
  182. // 实例化日期类
  183. var time = new Date();
  184. // 获取完整的年份(4位)
  185. var year = time.getFullYear();
  186. // 获取月份(0-11,0代表1月)
  187. var month = time.getMonth() + 1;
  188. month = month < 10 ? '0' + month : month;
  189. // 获取日期(1-31)
  190. var day = time.getDate();
  191. dd = day < 10 ? '0' + day : day;
  192. yd = day - 1 < 10 ? '0' + (day - 1).toString() : day - 1;
  193. // 获取小时
  194. var h = time.getHours();
  195. hh = h < 10 ? '0' + h : h;
  196. // 获取分钟
  197. var m = time.getMinutes();
  198. mm = m < 10 ? '0' + m : m;
  199. // 获取秒钟
  200. var s = time.getSeconds();
  201. ss = s < 10 ? '0' + s : s;
  202. console.log(timeFormat);
  203. if (timeFormat == "today") {
  204. var date = `${year}-${month}-${dd}`
  205. } else if (timeFormat == "yesterday") {
  206. var date = `${year}-${month}-${yd}`
  207. } else if (timeFormat == "mm-dd hhmm") {
  208. var date = `${month}-${dd} ${hh}${mm}`
  209. }
  210. console.log(date);
  211. return (date);
  212. }
  213.  
  214. getSystemTime("today")
  215. let nav_topNav = document.querySelector(".topNav")
  216. let list = ["订单明细认购不含退户", "订单明细认购含退户", "资金流水"]
  217. list.forEach(element => {
  218. let li = document.createElement("li")
  219. li.innerHTML = `<button id="${element}">${element}</button>`
  220. nav_topNav.appendChild(li)
  221. });
  222.  
  223. async function getToken() {
  224. let res = await fetch("https://max.58corp.com/chart/view/4257", {
  225. "headers": {
  226. "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
  227. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  228. "cache-control": "max-age=0",
  229. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  230. "sec-ch-ua-mobile": "?0",
  231. "sec-ch-ua-platform": "\"Windows\"",
  232. "sec-fetch-dest": "document",
  233. "sec-fetch-mode": "navigate",
  234. "sec-fetch-site": "same-origin",
  235. "sec-fetch-user": "?1",
  236. "upgrade-insecure-requests": "1"
  237. },
  238. "referrer": "https://max.58corp.com/chart/view/4493",
  239. "referrerPolicy": "strict-origin-when-cross-origin",
  240. "body": null,
  241. "method": "GET",
  242. "mode": "cors",
  243. "credentials": "include"
  244. })
  245. let text = await res.text()
  246. var token = text.match(/Token=(.*?),/)[1]
  247. console.log(token)
  248.  
  249. function download(id, fileName) {
  250. fetch("https://datamap.58.com/report/order/download?downloadId=" + id + "&fileName=" + fileName + "", {
  251. "headers": {
  252. "accept": "*/*",
  253. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  254. "content-type": "application/json",
  255. "responsetype": "blob",
  256. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  257. "sec-ch-ua-mobile": "?0",
  258. "sec-ch-ua-platform": "\"Windows\"",
  259. "sec-fetch-dest": "empty",
  260. "sec-fetch-mode": "cors",
  261. "sec-fetch-site": "cross-site",
  262. "token": token
  263. },
  264. "referrer": "https://max.58corp.com/",
  265. "referrerPolicy": "strict-origin-when-cross-origin",
  266. "body": null,
  267. "method": "GET",
  268. "mode": "cors",
  269. "credentials": "omit"
  270. }).then(res => res.blob().then(blob => {
  271. let url = window.URL.createObjectURL(blob)
  272. let a = document.createElement('a')
  273. a.style.display = 'none'
  274. a.href = url
  275. a.download = fileName + ".xlsx"
  276. document.body.appendChild(a)
  277. a.click()
  278. document.body.removeChild(a)
  279. window.URL.revokeObjectURL(url)
  280. }))
  281. }
  282.  
  283. function getExcelId(fileName) {
  284. fetch("https://datamap.58.com/report/order/list?page=1&limit=1000&key=" + fileName + "&menuId=1154", {
  285. "headers": {
  286. "accept": "*/*",
  287. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  288. "content-type": "application/json",
  289. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  290. "sec-ch-ua-mobile": "?0",
  291. "sec-ch-ua-platform": "\"Windows\"",
  292. "sec-fetch-dest": "empty",
  293. "sec-fetch-mode": "cors",
  294. "sec-fetch-site": "cross-site",
  295. "token": token
  296. },
  297. "referrer": "https://max.58corp.com/",
  298. "referrerPolicy": "strict-origin-when-cross-origin",
  299. "body": null,
  300. "method": "GET",
  301. "mode": "cors",
  302. "credentials": "omit"
  303. }).then(res => {
  304. return res.json()
  305. }).then(json => {
  306. let id = json["page"]["list"][0]["id"].toString()
  307. let status = json["page"]["list"][0]["status"]
  308. console.log(status)
  309. console.log(json)
  310. if (status != 2) {
  311. getExcelId(fileName)
  312. } else {
  313. download(id, fileName)
  314. }
  315.  
  316. });
  317.  
  318. }
  319.  
  320. function getExcel(fileName, body) {
  321. fetch("https://datamap.58.com/report/order/export", {
  322. "headers": {
  323. "accept": "*/*",
  324. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  325. "content-type": "application/json",
  326. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  327. "sec-ch-ua-mobile": "?0",
  328. "sec-ch-ua-platform": "\"Windows\"",
  329. "sec-fetch-dest": "empty",
  330. "sec-fetch-mode": "cors",
  331. "sec-fetch-site": "cross-site",
  332. "token": token
  333. },
  334. "referrer": "https://max.58corp.com/",
  335. "referrerPolicy": "strict-origin-when-cross-origin",
  336. "body": body,
  337. "method": "POST",
  338. "mode": "cors",
  339. "credentials": "omit"
  340. }).then(res => {
  341. return res.json()
  342. }).then(json => {
  343. console.log(json.msg)
  344. if (json.msg != "success") {
  345. getExcel(fileName, body.replace(today, yesterday))
  346. } else {
  347. getExcelId(fileName)
  348. }
  349. }
  350. );
  351. }
  352.  
  353.  
  354. var queryColumns = `[1, 3, 5, 7, 2, 4, 323, 324, 1085, 964, 6, 325, 8, 9, 10, 11, 12, 13, 730, 1025, 14, 15, 326, 16, 17, 18, 19, 20, 21, 22, 23, 24, 528, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 731, 732, 733, 734, 735, 736, 737, 757, 39, 761, 40, 43, 121, 122, 899, 900, 902, 1242, 901, 1088, 1087, 44, 762, 45, 46, 1022, 327, 328, 47, 329, 48, 49, 50, 1080, 51, 763, 965, 966, 967, 1029, 1030, 1278, 1277, 960, 961, 962, 963, 58, 336, 59, 60, 61, 337, 62, 63, 64, 65, 66, 67, 1023, 68, 69, 1024, 70, 691, 71, 1063, 1279, 1280, 1281, 72, 73, 74, 75, 76, 320, 77, 78, 79, 321, 80, 81, 82, 83, 84, 85, 93, 94, 95, 96, 97, 322, 98, 99, 100, 101, 102, 103, 104, 105, 107, 109, 110, 111, 112, 113, 114, 115, 116, 330, 331, 332, 333, 334, 335, 898, 1216, 1217, 1218, 1219, 1220, 1221, 334, 760, 1029, 1237, 1250, 1258, 328, 329, 334, 757, 760, 1029, 1244, 1237, 1250, 1258]`
  355. var refundStatus = `[0,1,2,3]`
  356. var today = getSystemTime("today")
  357. var yesterday = getSystemTime("yesterday")
  358. let rengoubutui = document.querySelector("#订单明细认购不含退户")
  359. rengoubutui.onclick = function () {
  360. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购)"
  361. var refundStatus = `[0,1,2]`
  362. var body = "{\"fileName\":\"" + fileName +
  363. "\",\"calDt\":\"" + today + "\",\"buildingRegionId\":-1,\"buildingCityId\":-1,\"orderStatus\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14],\"ssStatus\":[0,2,3,1,4,5],\"refundStatus\":" + refundStatus + ",\"receivableStatus\":[0,1,2],\"settlementType\":[1,2,0,3,-99],\"prepaidType\":[1,-99,0],\"queryColumns\":" + queryColumns + ",\"menuId\":1153,\"cusErr\":true,\"subscribeTime\": [\"2021-01-01\", \"2023-01-01\"]}"
  364. console.log(body)
  365. getExcel(fileName = fileName, body = body)
  366. }
  367. let rengoutui = document.querySelector("#订单明细认购含退户")
  368. rengoutui.onclick = function () {
  369. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购含退户)"
  370. var refundStatus = `[0,1,2,3]`
  371. var body = "{\"fileName\":\"" + fileName +
  372. "\",\"calDt\":\"" + today + "\",\"buildingRegionId\":-1,\"buildingCityId\":-1,\"orderStatus\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14],\"ssStatus\":[0,2,3,1,4,5],\"refundStatus\":" + refundStatus + ",\"receivableStatus\":[0,1,2],\"settlementType\":[1,2,0,3,-99],\"prepaidType\":[1,-99,0],\"queryColumns\":" + queryColumns + ",\"menuId\":1153,\"cusErr\":true,\"subscribeTime\": [\"2021-01-01\", \"2023-01-01\"]}"
  373. console.log(body)
  374. getExcel(fileName = fileName, body = body)
  375. }
  376.  
  377.  
  378. }
  379.  
  380. getToken()
  381.  
  382.  
  383. } else if (window.location.href.indexOf("masterContractSee") > -1 && document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
  384. async function getData() {
  385. let res = await fetch("https://daiketong.58corp.com/japi/buildings/contract/detail?contract_type=1&building_id=125429&contract_id=76673&active=4&renew=0&hiddenEdit=1&bc_status=2&isDraft=false", {
  386. "headers": {
  387. "accept": "application/json, text/plain, */*",
  388. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7,eu;q=0.6",
  389. "authorization": "",
  390. "cache-control": "no-cache",
  391. "login-type": "pc",
  392. "pragma": "no-cache",
  393. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  394. "sec-ch-ua-mobile": "?0",
  395. "sec-ch-ua-platform": "\"Windows\"",
  396. "sec-fetch-dest": "empty",
  397. "sec-fetch-mode": "cors",
  398. "sec-fetch-site": "same-origin",
  399. "sw8": "1-ZjRkMWNhZDIzYzYzNDA0ODk0Yzc5YmVlMjBkMjIyNzg=-NzBiOGNmNWM0Yjg2NGUyM2EyZTE1MzhjOGZkYjNjM2Y=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2RldGFpbA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  400. "sw8-correlation": "c291cmNl:YmVpZG91",
  401. "timestamp": "1665834595"
  402. },
  403. "referrer": "https://daiketong.58corp.com/",
  404. "referrerPolicy": "strict-origin-when-cross-origin",
  405. "body": null,
  406. "method": "GET",
  407. "mode": "cors",
  408. "credentials": "include"
  409. });
  410. let json = await res.json()
  411. console.table(json.data);
  412.  
  413.  
  414. }
  415.  
  416. getData()
  417. } else if (window.location.href.indexOf("evidenceChainList") > -1) {
  418. // location.reload()
  419.  
  420. let timer1 = setInterval(function checkElement() {
  421. // 获取元素
  422. var element = document.querySelector(".is-plain");
  423. // 如果元素存在,打印它的文本内容,并清除定时器
  424. if (element) {
  425. element.addEventListener('click', function () {
  426. console.log('绑定成功')
  427. var timer = setInterval(() => {
  428. // 获取表格行集合
  429. var rows = document.querySelectorAll(".el-table__row")
  430. console.log(rows.length);
  431.  
  432. // 如果表格行存在,执行addChild函数,并清除定时器
  433. if (rows.length > 0) {
  434. addChild(rows)
  435. clearInterval(timer);
  436. }
  437. }, 1000);
  438. })
  439.  
  440. clearInterval(timer1);
  441. }
  442.  
  443. }, 500);
  444.  
  445.  
  446. // 添加订单审核链接到每一行
  447. function addChild() {
  448. let nav_topNav = document.querySelectorAll(".el-table__row")
  449. nav_topNav.forEach((nav) => {
  450. let idNode = nav.querySelectorAll("td")[4]
  451. let ID = idNode.querySelector(".cell").innerHTML
  452. let handleNode = nav.querySelectorAll("td")[12]
  453. let aList = nav.querySelectorAll("a")
  454. console.log(ID,aList)
  455. if (aList.length > 0) {
  456. aList.forEach((c) => {
  457. if (c) {
  458. // console.log("123", a)
  459. handleNode.removeChild(c)
  460. console.log(c, '删除成功')
  461. }
  462. })
  463. }
  464. let a = document.createElement("a")
  465. a.href = `https://daiketong.58corp.com/#/orderManagementFolder/transactionInformationAudit/transactionAudit/transactionAuditBase/transactionAuditDetail?order_id=${ID}&examineNode=SIGNED&approvalStatus=PASSED`
  466. a.textContent='订单审核界面'
  467. a.target="_Blank"
  468. handleNode.appendChild(a)
  469.  
  470. // console.log(ID, handleNode)
  471.  
  472. async function getData() {
  473. let res = await fetch(`https://daiketong.58corp.com/daiketong/v1/success-sale/audit-list?page=1&status=PASSED&order_id=${ID}`, {
  474. "headers": {
  475. "accept": "application/json, text/plain, */*",
  476. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  477. "authorization": "",
  478. "cache-control": "no-cache",
  479. "login-type": "pc",
  480. "pragma": "no-cache",
  481. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  482. "sec-ch-ua-mobile": "?0",
  483. "sec-ch-ua-platform": "\"Windows\"",
  484. "sec-fetch-dest": "empty",
  485. "sec-fetch-mode": "cors",
  486. "sec-fetch-site": "same-origin",
  487. "sw8": "1-YjQyNzY4ZDFiMDM0NGRlZjg2NTI2NmFhYmM0Njc2YzU=-Y2I2YTg3YzM1MmZiNGVlN2JiMTM5ODgyYmFkZGQyMDc=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9zdWNjZXNzLXNhbGUvYXVkaXQtbGlzdA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  488. "sw8-correlation": "c291cmNl:YmVpZG91",
  489. "timestamp": "1679399184"
  490. },
  491. "referrer": "https://daiketong.58corp.com/",
  492. "referrerPolicy": "strict-origin-when-cross-origin",
  493. "body": null,
  494. "method": "GET",
  495. "mode": "cors",
  496. "credentials": "include"
  497. });
  498. let json = await res.json()
  499. if (json.data.data[0]) {
  500. // console.log(ID, json.data.data[0])
  501. return json.data.data[0]['batch_id']
  502. }
  503.  
  504. }
  505.  
  506. async function useData() {
  507. let value = await getData(); // value等于data.data的值
  508. if (value) {
  509. let a = document.createElement("a")
  510. a.href = `https://daiketong.58corp.com/#/salesManagement/examine/examineDetails?isExamine=false&batch_id=${value}`
  511. a.textContent=' | 成销界面'
  512. a.target="_Blank"
  513. handleNode.appendChild(a)
  514. }
  515. }
  516.  
  517. useData()
  518.  
  519. })
  520. }
  521.  
  522.  
  523. } else if (window.location.href.indexOf("orderFolderList") > -1) {
  524.  
  525. async function getData(name) {
  526. let res = fetch(`https://daiketong.58corp.com/daiketong/v1/order/order-customer-list?page=1&customer_name_or_telephone=${name.trim()}`, {
  527. "headers": {
  528. "accept": "application/json, text/plain, */*",
  529. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  530. "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjo0MjcyMTksImV4cCI6MTY4MDcwMDgxNiwiaWF0IjoxNjc5NDA0ODE2LCJqdGkiOiI0MjcyMTk6YzA5MWYwOTQtOTQwMy00NjAzLTgzOWItMGU0YTQ1Njg1OGEyOjIwMjMwMzIxMTAwNjM4NTg5In0.kYgJNKMyTukRTDICB29Zf_vasX5Hbl2kmDRXwlRZFpqIoli_1vdS14wBuaK2Hdf6xiOyS3a-CAq7RR7HO96nJm9zuo2YwJMcONy5t_XZTWppB1ob6-y97ZyCFVUBqpyFtys42a_nB89jBJ-1atCbzWdiMc0W-CDBdpBflPdNh8_w5NcB7MvA4UGhRhXlc2ADuNF-D7gEMyW5FvFRvGhbYQfmGYeM4k2xMhQ2wUiYlXiTi4R6MqJXV2E0cwl342B0dFN-Narbijr3hRhlPeETmNhjtB188s7jkG-mqzcjuORSupJRayqKwr7aqg-3owNpPLzrs2qzFyrn8dPUnIp2cQ",
  531. "cache-control": "no-cache",
  532. "login-type": "pc",
  533. "pragma": "no-cache",
  534. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  535. "sec-ch-ua-mobile": "?0",
  536. "sec-ch-ua-platform": "\"Windows\"",
  537. "sec-fetch-dest": "empty",
  538. "sec-fetch-mode": "cors",
  539. "sec-fetch-site": "same-origin",
  540. "sw8": "1-YzY1NmJiMDg1NTAyNDJmY2JiNzgwZjM5ZjZkOGJmMTc=-ZDUwY2YzMzkxZDBkNDAwMmIzNjgwM2QzM2MyNzJlMWE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9vcmRlci9vcmRlci1jdXN0b21lci1saXN0-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  541. "sw8-correlation": "c291cmNl:YmVpZG91",
  542. "timestamp": "1679407390"
  543. },
  544. "referrer": "https://daiketong.58corp.com/",
  545. "referrerPolicy": "strict-origin-when-cross-origin",
  546. "body": null,
  547. "method": "GET",
  548. "mode": "cors",
  549. "credentials": "include"
  550. });
  551. let json = (await res).json()
  552. return json.then(
  553. function (a) {
  554. var list = a.data.data
  555. console.log(list)
  556. var newlist = list.filter((b) => {
  557. return b.order_invalid_time == '' && b.order_status.indexOf("INVALID") == -1 && b.order_status.indexOf("REPORTED") == -1 && b.order_status.indexOf("VISITED") == -1 && b.order_status.indexOf("INITIALIZED") == -1
  558. })
  559. return newlist
  560. }
  561. )
  562. }
  563.  
  564.  
  565. async function useData(name) {
  566. let value = await getData(name); // value等于data.data的值
  567. if (value) {
  568. console.log(value)
  569. let ID = value[0].order_id
  570. console.log(ID)
  571. var input = document.querySelector('input[placeholder="请输入订单ID"]');
  572. let name = document.querySelector('#consumerName')
  573. var inputEvent = new Event('input', {bubbles: true});
  574. input.value = ID;
  575. input.dispatchEvent(inputEvent);
  576. name.value = ''
  577. var element = document.querySelector(".is-plain span");
  578. console.log(element);
  579. element.click()
  580. alert("查询成功")
  581.  
  582. }
  583. }
  584.  
  585. let timer = setInterval(function checkElement() {
  586. // 获取元素
  587. var element = document.querySelector(".is-plain");
  588. // 如果元素存在,打印它的文本内容,并清除定时器
  589. if (element) {
  590. let querycriteria = document.querySelector('.query-criteria')
  591. let div = document.createElement("div")
  592. div.innerHTML = `<div data-v-652f0c2c="" class="el-input el-input--small el-input--suffix"><!----><input type="text" id="consumerName" autocomplete="off" placeholder="请输入客户姓名" maxlength="20" class="el-input__inner"><!----><!----><!----><!----></div>`
  593. querycriteria.appendChild(div)
  594. let input = document.querySelector('input[placeholder="请输入订单ID"]');
  595. let name = document.querySelector('#consumerName')
  596. element.addEventListener('click', function () {
  597. console.log("绑定成功");
  598. if (name.value != "") {
  599. // console.log(2323232323)
  600. useData(name.value)
  601. }
  602. })
  603.  
  604.  
  605. clearInterval(timer);
  606. }
  607.  
  608. }, 1000);
  609.  
  610. }
  611.  
  612.  
  613.  
  614.  
  615. // 更新当前URL地址
  616. currentUrl = window.location.href;
  617. }
  618. }, 500);
  619.  
  620. };