爱房JS脚本

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

目前为 2023-04-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 爱房JS脚本
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4
  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.  
  15. async function getyushou(id) {
  16. let result = await fetch(`https://daiketong.58corp.com/japi/buildings/up-off-detail/${id}`, {
  17. "headers": {
  18. "accept": "application/json, text/plain, */*",
  19. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  20. "authorization": "",
  21. "cache-control": "no-cache",
  22. "login-type": "pc",
  23. "pragma": "no-cache",
  24. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  25. "sec-ch-ua-mobile": "?0",
  26. "sec-ch-ua-platform": "\"Windows\"",
  27. "sec-fetch-dest": "empty",
  28. "sec-fetch-mode": "cors",
  29. "sec-fetch-site": "same-origin",
  30. "sw8": "1-MmE5ZTU5Yjc1MmMwNDRjOThlODRjYmIwNmFjZTUyOTg=-YjRjNTA5NTY5Y2E1NDBjNzg2NmIwNWQ0NmFlYWNmZjk=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL3VwLW9mZi1kZXRhaWwvMTIwMzI5-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  31. "sw8-correlation": "c291cmNl:YmVpZG91",
  32. "timestamp": "1681199724"
  33. },
  34. "referrer": "https://daiketong.58corp.com/",
  35. "referrerPolicy": "strict-origin-when-cross-origin",
  36. "body": null,
  37. "method": "GET",
  38. "mode": "cors",
  39. "credentials": "include"
  40. });
  41. let resultData = await result.json()
  42. let data = resultData.data
  43. let range = data.presale_license_range
  44.  
  45. // 查找 detail 类中的第二个 section-content 类
  46. const sectionContentElement = document.querySelector('.detail > :nth-child(5)');
  47.  
  48. // 如果找到了该元素,则向其中追加新的 <div> 元素
  49. if (sectionContentElement) {
  50. // 创建新的 <div> 元素
  51. const newDiv = document.createElement('div');
  52. newDiv.setAttribute('data-v-7bf5ef12', '');
  53. newDiv.className = 'section-content-item';
  54.  
  55. // 在新的 <div> 元素中添加 <span> 元素
  56. const labelSpan = document.createElement('span');
  57. labelSpan.setAttribute('data-v-7bf5ef12', '');
  58. labelSpan.className = 'section-content-item-label';
  59. labelSpan.innerText = '预售范围:';
  60.  
  61. if (["xiongweiliang", "zhanghui54"].includes(document.querySelector(".header-menu").childNodes[2].innerText)) {
  62. const companyName = document.querySelector('.detail > .section-content > :nth-child(2) > :nth-child(2)').innerText;
  63. const encodedCompanyName = encodeURIComponent(companyName);
  64. const url = `https://fsfc.fszj.foshan.gov.cn/loupan/xuke/c${encodedCompanyName}_f-1/`;
  65. // console.log(url)
  66. labelSpan.addEventListener('click', function () {
  67. window.open(url, '_blank');
  68. });
  69. }
  70.  
  71. const valueSpan = document.createElement('span');
  72. valueSpan.setAttribute('data-v-7bf5ef12', '');
  73. valueSpan.className = 'section-content-item-value';
  74. valueSpan.innerText = range;
  75.  
  76. newDiv.appendChild(labelSpan);
  77. newDiv.appendChild(valueSpan);
  78.  
  79. // 在第二个 section-content 元素的第三个子元素后面插入新的 <div> 元素
  80. const thirdChild = sectionContentElement.children[2];
  81. sectionContentElement.insertBefore(newDiv, thirdChild.nextSibling);
  82. }
  83.  
  84.  
  85. }
  86.  
  87.  
  88. window.onload = function () {
  89.  
  90. setInterval(function () {
  91.  
  92. if (window.location.href != currentUrl) {
  93. // URL地址发生变化,触发事件
  94.  
  95. if (window.location.href.indexOf("commissionall") > -1) {
  96.  
  97. setTimeout(function () {
  98. let el_col = document.querySelectorAll(".el-col-22")[5]
  99. console.log(el_col)
  100. let btn = document.createElement("div")
  101. btn.innerHTML = `<button id="关闭暗佣" class="el-button el-button--default el-button--small" style="margin-left:20px">关闭暗佣</button>`
  102. el_col.appendChild(btn)
  103. console.log(btn)
  104. console.log(typeof (el_col), typeof (btn))
  105. document.querySelector("#关闭暗佣").addEventListener("click", function () {
  106. let fontColorList = document.querySelectorAll(".fontColor")
  107. if (fontColorList.length > 0) {
  108. fontColorList.forEach(function (item) {
  109. if (item.innerText == "关闭暗佣") {
  110. console.log(item.innerHTML)
  111. item.click()
  112. }
  113. })
  114. } else {
  115. console.log("待加载")
  116. // guanbianyong()
  117. }
  118. }, false)
  119. console.log(el_col)
  120. }, 2000)
  121.  
  122. } else if (window.location.href.indexOf("approvalStatus")) {
  123.  
  124.  
  125. // 监听文档的 keyup 事件,当松开键盘上的 a 键时执行处理函数
  126. document.addEventListener('keyup', (event) => {
  127. if (event.code === 'KeyA') {
  128. document.querySelector('.viewer-rotate-left').click();
  129. } else if (event.code === 'KeyD') {
  130. document.querySelector('.viewer-rotate-right').click();
  131. } else if (event.code === 'KeyQ') {
  132. // 获取所有类名包含 el-button 的元素
  133. const elButtonElements = document.querySelectorAll('[class*=el-button]');
  134.  
  135. // 遍历所有元素,找出内部包含 <span>通过</span> 的按钮
  136. for (const elButtonElement of elButtonElements) {
  137. // 获取元素内部所有 <span> 元素
  138. const spanElements = elButtonElement.querySelectorAll('span');
  139.  
  140. // 遍历所有 <span> 元素,找出包含文本“通过”的元素
  141. for (const spanElement of spanElements) {
  142. if (spanElement.innerText === '通过') {
  143. // 如果找到了包含文本“通过”的元素,就打印该元素
  144. elButtonElement.click();
  145. break;
  146. }
  147. }
  148. }
  149.  
  150. }
  151. });
  152.  
  153. const cookie = document.cookie;
  154. var bc_id = "1"
  155. setTimeout(function () {
  156. // 获取第一个类名为 el-tabs__nav is-top 的元素
  157. const elTabsNavElement = document.querySelector('.el-tabs__nav.is-top');
  158.  
  159. // 如果找到了该元素,则点击其最后一个子元素
  160. if (elTabsNavElement) {
  161. elTabsNavElement.lastElementChild.click();
  162. }
  163. let contentList = document.querySelectorAll(".section-content-item-value")
  164. contentList.forEach(function (contract, contractindex) {
  165. let reg = /^B/
  166. if (reg.test(contract.innerText) == true) {
  167. var buildingId = contract.innerText.substring(3, 8).toString();
  168. var bc_code = contract.innerText;
  169. contentList[0].onclick = function () {
  170. let win = window.open(`https://daiketong.58corp.com/#/refactorProject/projectManager/projectManagerIndex/projectManagerDetail?building_id=${buildingId}&active=4&city_id=362`)
  171. }
  172.  
  173.  
  174. fetch("https://daiketong.58corp.com/japi/buildings/contract/list", {
  175. "headers": {
  176. "accept": "application/json, text/plain, */*",
  177. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  178. "authorization": "",
  179. "content-type": "application/json;charset=UTF-8",
  180. "login-type": "pc",
  181. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  182. "sec-ch-ua-mobile": "?0",
  183. "sec-ch-ua-platform": "\"Windows\"",
  184. "sec-fetch-dest": "empty",
  185. "sec-fetch-mode": "cors",
  186. "sec-fetch-site": "same-origin",
  187. "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  188. "sw8-correlation": "c291cmNl:YmVpZG91",
  189. "timestamp": "1665145024"
  190. },
  191. "referrer": "https://daiketong.58corp.com/",
  192. "referrerPolicy": "strict-origin-when-cross-origin",
  193. "body": "{\"building_id\":\"" + buildingId + "\"}",
  194. "method": "POST",
  195. "mode": "cors",
  196. "credentials": "include"
  197. }).then(res => {
  198. return res.json()
  199. }).then(json => {
  200. // console.log(json)
  201. json["data"].forEach(function (item, index) {
  202. if (item["bc_code"] == bc_code) {
  203. let bc_id = item["bc_id"]
  204. // console.log(bc_id)
  205. fetch("https://daiketong.58corp.com/japi/buildings/contract/get-packing-list", {
  206. "headers": {
  207. "accept": "application/json, text/plain, */*",
  208. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  209. "authorization": "",
  210. "content-type": "application/json;charset=UTF-8",
  211. "login-type": "pc",
  212. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  213. "sec-ch-ua-mobile": "?0",
  214. "sec-ch-ua-platform": "\"Windows\"",
  215. "sec-fetch-dest": "empty",
  216. "sec-fetch-mode": "cors",
  217. "sec-fetch-site": "same-origin",
  218. "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  219. "sw8-correlation": "c291cmNl:YmVpZG91",
  220. "timestamp": "1665146852"
  221. },
  222. "referrer": "https://daiketong.58corp.com/",
  223. "referrerPolicy": "strict-origin-when-cross-origin",
  224. "body": "{\"contract_id\":" + bc_id.toString() + ",\"contract_type\":\"1\",\"status\":\"\"}",
  225. "method": "POST",
  226. "mode": "cors",
  227. "credentials": "include"
  228. }).then(res => {
  229. return res.json()
  230. }).then(json => {
  231. json["data"].forEach(function (item, index) {
  232. contract.addEventListener("click", function () {
  233. // console.log("qwwqqwqw")
  234. window.open(item["url"])
  235. }, false)
  236. // console.log(item["url"])
  237. })
  238. })
  239. }
  240. })
  241. });
  242.  
  243. console.log(buildingId)
  244. let result = getyushou(buildingId)
  245. console.log(result)
  246.  
  247.  
  248. }
  249. })
  250.  
  251.  
  252. if (document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
  253.  
  254. let re = setInterval(function () {
  255. let viewerHalf = document.querySelector(".viewerHalf")
  256. if (viewerHalf) {
  257. viewerHalf.className = "viewer-container viewer-backdrop viewer-fixed viewer-fade viewer-transition viewer-in"
  258. clearInterval(re)
  259. } else {
  260. // console.log(1)
  261. }
  262. }, 1000)
  263.  
  264. // let select = setInterval(function () {
  265. // var currentSelect = document.querySelectorAll('div[aria-selected="true"]')[1].innerText;
  266. // console.log(currentSelect)
  267. // if(currentSelect=="草签合同关键页"){
  268. // let viewer_move = document.querySelector(".viewer-move")
  269. // if (viewer_move) {
  270. // console.log(234,viewer_move)
  271. // }
  272. // }
  273. //
  274. // }, 500)
  275. document.onkeyup = function (event) {
  276. let viewer_move = document.querySelector(".viewer-move")
  277. if (viewer_move) {
  278. let a = document.documentElement.clientWidth / 2
  279. let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
  280. viewer_move.style["margin-left"] = (a - b) + "px"
  281. }
  282. }
  283. document.onmousewheel = function (event) {
  284. let viewer_move = document.querySelector(".viewer-move")
  285. if (viewer_move) {
  286. let a = document.documentElement.clientWidth / 2
  287. let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
  288. viewer_move.style["margin-left"] = (a - b) + "px"
  289. }
  290. }
  291. }
  292. }, 500)
  293.  
  294.  
  295. } else if (window.location.href.indexOf("max") > -1) {
  296. function getSystemTime(timeFormat) {
  297. // 实例化日期类
  298. var time = new Date();
  299. // 获取完整的年份(4位)
  300. var year = time.getFullYear();
  301. // 获取月份(0-11,0代表1月)
  302. var month = time.getMonth() + 1;
  303. month = month < 10 ? '0' + month : month;
  304. // 获取日期(1-31)
  305. var day = time.getDate();
  306. dd = day < 10 ? '0' + day : day;
  307. yd = day - 1 < 10 ? '0' + (day - 1).toString() : day - 1;
  308. // 获取小时
  309. var h = time.getHours();
  310. hh = h < 10 ? '0' + h : h;
  311. // 获取分钟
  312. var m = time.getMinutes();
  313. mm = m < 10 ? '0' + m : m;
  314. // 获取秒钟
  315. var s = time.getSeconds();
  316. ss = s < 10 ? '0' + s : s;
  317. console.log(timeFormat);
  318. if (timeFormat == "today") {
  319. var date = `${year}-${month}-${dd}`
  320. } else if (timeFormat == "yesterday") {
  321. var date = `${year}-${month}-${yd}`
  322. } else if (timeFormat == "mm-dd hhmm") {
  323. var date = `${month}-${dd} ${hh}${mm}`
  324. }
  325. console.log(date);
  326. return (date);
  327. }
  328.  
  329. getSystemTime("today")
  330. let nav_topNav = document.querySelector(".topNav")
  331. let list = ["订单明细认购不含退户", "订单明细认购含退户", "资金流水"]
  332. list.forEach(element => {
  333. let li = document.createElement("li")
  334. li.innerHTML = `<button id="${element}">${element}</button>`
  335. nav_topNav.appendChild(li)
  336. });
  337.  
  338. async function getToken() {
  339. let res = await fetch("https://max.58corp.com/chart/view/4257", {
  340. "headers": {
  341. "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",
  342. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  343. "cache-control": "max-age=0",
  344. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  345. "sec-ch-ua-mobile": "?0",
  346. "sec-ch-ua-platform": "\"Windows\"",
  347. "sec-fetch-dest": "document",
  348. "sec-fetch-mode": "navigate",
  349. "sec-fetch-site": "same-origin",
  350. "sec-fetch-user": "?1",
  351. "upgrade-insecure-requests": "1"
  352. },
  353. "referrer": "https://max.58corp.com/chart/view/4493",
  354. "referrerPolicy": "strict-origin-when-cross-origin",
  355. "body": null,
  356. "method": "GET",
  357. "mode": "cors",
  358. "credentials": "include"
  359. })
  360. let text = await res.text()
  361. var token = text.match(/Token=(.*?),/)[1]
  362. console.log(token)
  363.  
  364. function download(id, fileName) {
  365. fetch("https://datamap.58.com/report/order/download?downloadId=" + id + "&fileName=" + fileName + "", {
  366. "headers": {
  367. "accept": "*/*",
  368. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  369. "content-type": "application/json",
  370. "responsetype": "blob",
  371. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  372. "sec-ch-ua-mobile": "?0",
  373. "sec-ch-ua-platform": "\"Windows\"",
  374. "sec-fetch-dest": "empty",
  375. "sec-fetch-mode": "cors",
  376. "sec-fetch-site": "cross-site",
  377. "token": token
  378. },
  379. "referrer": "https://max.58corp.com/",
  380. "referrerPolicy": "strict-origin-when-cross-origin",
  381. "body": null,
  382. "method": "GET",
  383. "mode": "cors",
  384. "credentials": "omit"
  385. }).then(res => res.blob().then(blob => {
  386. let url = window.URL.createObjectURL(blob)
  387. let a = document.createElement('a')
  388. a.style.display = 'none'
  389. a.href = url
  390. a.download = fileName + ".xlsx"
  391. document.body.appendChild(a)
  392. a.click()
  393. document.body.removeChild(a)
  394. window.URL.revokeObjectURL(url)
  395. }))
  396. }
  397.  
  398. function getExcelId(fileName) {
  399. fetch("https://datamap.58.com/report/order/list?page=1&limit=1000&key=" + fileName + "&menuId=1154", {
  400. "headers": {
  401. "accept": "*/*",
  402. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  403. "content-type": "application/json",
  404. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  405. "sec-ch-ua-mobile": "?0",
  406. "sec-ch-ua-platform": "\"Windows\"",
  407. "sec-fetch-dest": "empty",
  408. "sec-fetch-mode": "cors",
  409. "sec-fetch-site": "cross-site",
  410. "token": token
  411. },
  412. "referrer": "https://max.58corp.com/",
  413. "referrerPolicy": "strict-origin-when-cross-origin",
  414. "body": null,
  415. "method": "GET",
  416. "mode": "cors",
  417. "credentials": "omit"
  418. }).then(res => {
  419. return res.json()
  420. }).then(json => {
  421. let id = json["page"]["list"][0]["id"].toString()
  422. let status = json["page"]["list"][0]["status"]
  423. console.log(status)
  424. console.log(json)
  425. if (status != 2) {
  426. getExcelId(fileName)
  427. } else {
  428. download(id, fileName)
  429. }
  430.  
  431. });
  432.  
  433. }
  434.  
  435. function getExcel(fileName, body) {
  436. fetch("https://datamap.58.com/report/order/export", {
  437. "headers": {
  438. "accept": "*/*",
  439. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  440. "content-type": "application/json",
  441. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  442. "sec-ch-ua-mobile": "?0",
  443. "sec-ch-ua-platform": "\"Windows\"",
  444. "sec-fetch-dest": "empty",
  445. "sec-fetch-mode": "cors",
  446. "sec-fetch-site": "cross-site",
  447. "token": token
  448. },
  449. "referrer": "https://max.58corp.com/",
  450. "referrerPolicy": "strict-origin-when-cross-origin",
  451. "body": body,
  452. "method": "POST",
  453. "mode": "cors",
  454. "credentials": "omit"
  455. }).then(res => {
  456. return res.json()
  457. }).then(json => {
  458. console.log(json.msg)
  459. if (json.msg != "success") {
  460. getExcel(fileName, body.replace(today, yesterday))
  461. } else {
  462. getExcelId(fileName)
  463. }
  464. }
  465. );
  466. }
  467.  
  468.  
  469. 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]`
  470. var refundStatus = `[0,1,2,3]`
  471. var today = getSystemTime("today")
  472. var yesterday = getSystemTime("yesterday")
  473. let rengoubutui = document.querySelector("#订单明细认购不含退户")
  474. rengoubutui.onclick = function () {
  475. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购)"
  476. var refundStatus = `[0,1,2]`
  477. var body = "{\"fileName\":\"" + fileName +
  478. "\",\"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\"]}"
  479. console.log(body)
  480. getExcel(fileName = fileName, body = body)
  481. }
  482. let rengoutui = document.querySelector("#订单明细认购含退户")
  483. rengoutui.onclick = function () {
  484. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购含退户)"
  485. var refundStatus = `[0,1,2,3]`
  486. var body = "{\"fileName\":\"" + fileName +
  487. "\",\"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\"]}"
  488. console.log(body)
  489. getExcel(fileName = fileName, body = body)
  490. }
  491.  
  492.  
  493. }
  494.  
  495. getToken()
  496.  
  497.  
  498. } else if (window.location.href.indexOf("masterContractSee") > -1 && document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
  499. async function getData() {
  500. 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", {
  501. "headers": {
  502. "accept": "application/json, text/plain, */*",
  503. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7,eu;q=0.6",
  504. "authorization": "",
  505. "cache-control": "no-cache",
  506. "login-type": "pc",
  507. "pragma": "no-cache",
  508. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  509. "sec-ch-ua-mobile": "?0",
  510. "sec-ch-ua-platform": "\"Windows\"",
  511. "sec-fetch-dest": "empty",
  512. "sec-fetch-mode": "cors",
  513. "sec-fetch-site": "same-origin",
  514. "sw8": "1-ZjRkMWNhZDIzYzYzNDA0ODk0Yzc5YmVlMjBkMjIyNzg=-NzBiOGNmNWM0Yjg2NGUyM2EyZTE1MzhjOGZkYjNjM2Y=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2RldGFpbA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  515. "sw8-correlation": "c291cmNl:YmVpZG91",
  516. "timestamp": "1665834595"
  517. },
  518. "referrer": "https://daiketong.58corp.com/",
  519. "referrerPolicy": "strict-origin-when-cross-origin",
  520. "body": null,
  521. "method": "GET",
  522. "mode": "cors",
  523. "credentials": "include"
  524. });
  525. let json = await res.json()
  526. console.table(json.data);
  527.  
  528.  
  529. }
  530.  
  531. getData()
  532. } else if (window.location.href.indexOf("evidenceChainList") > -1) {
  533. // location.reload()
  534.  
  535. let timer1 = setInterval(function checkElement() {
  536. // 获取元素
  537. var element = document.querySelector(".is-plain");
  538. // 如果元素存在,打印它的文本内容,并清除定时器
  539. if (element) {
  540. element.addEventListener('click', function () {
  541. console.log('绑定成功')
  542. var timer = setInterval(() => {
  543. // 获取表格行集合
  544. var rows = document.querySelectorAll(".el-table__row")
  545. console.log(rows.length);
  546.  
  547. // 如果表格行存在,执行addChild函数,并清除定时器
  548. if (rows.length > 0) {
  549. addChild(rows)
  550. clearInterval(timer);
  551. }
  552. }, 1000);
  553. })
  554.  
  555. clearInterval(timer1);
  556. }
  557.  
  558. }, 500);
  559.  
  560.  
  561. // 添加订单审核链接到每一行
  562. function addChild() {
  563. let nav_topNav = document.querySelectorAll(".el-table__row")
  564. nav_topNav.forEach((nav) => {
  565. let idNode = nav.querySelectorAll("td")[4]
  566. let ID = idNode.querySelector(".cell").innerHTML
  567. let handleNode = nav.querySelectorAll("td")[12]
  568. let aList = nav.querySelectorAll("a")
  569. console.log(ID, aList)
  570. if (aList.length > 0) {
  571. aList.forEach((c) => {
  572. if (c) {
  573. // console.log("123", a)
  574. handleNode.removeChild(c)
  575. console.log(c, '删除成功')
  576. }
  577. })
  578. }
  579. let a = document.createElement("a")
  580. a.href = `https://daiketong.58corp.com/#/orderManagementFolder/transactionInformationAudit/transactionAudit/transactionAuditBase/transactionAuditDetail?order_id=${ID}&examineNode=SIGNED&approvalStatus=PASSED`
  581. a.textContent = '订单审核界面'
  582. a.target = "_Blank"
  583. handleNode.appendChild(a)
  584.  
  585. // console.log(ID, handleNode)
  586.  
  587. async function getData() {
  588. let res = await fetch(`https://daiketong.58corp.com/daiketong/v1/success-sale/audit-list?page=1&status=PASSED&order_id=${ID}`, {
  589. "headers": {
  590. "accept": "application/json, text/plain, */*",
  591. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  592. "authorization": "",
  593. "cache-control": "no-cache",
  594. "login-type": "pc",
  595. "pragma": "no-cache",
  596. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  597. "sec-ch-ua-mobile": "?0",
  598. "sec-ch-ua-platform": "\"Windows\"",
  599. "sec-fetch-dest": "empty",
  600. "sec-fetch-mode": "cors",
  601. "sec-fetch-site": "same-origin",
  602. "sw8": "1-YjQyNzY4ZDFiMDM0NGRlZjg2NTI2NmFhYmM0Njc2YzU=-Y2I2YTg3YzM1MmZiNGVlN2JiMTM5ODgyYmFkZGQyMDc=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9zdWNjZXNzLXNhbGUvYXVkaXQtbGlzdA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  603. "sw8-correlation": "c291cmNl:YmVpZG91",
  604. "timestamp": "1679399184"
  605. },
  606. "referrer": "https://daiketong.58corp.com/",
  607. "referrerPolicy": "strict-origin-when-cross-origin",
  608. "body": null,
  609. "method": "GET",
  610. "mode": "cors",
  611. "credentials": "include"
  612. });
  613. let json = await res.json()
  614. if (json.data.data[0]) {
  615. // console.log(ID, json.data.data[0])
  616. return json.data.data[0]['batch_id']
  617. }
  618.  
  619. }
  620.  
  621. async function useData() {
  622. let value = await getData(); // value等于data.data的值
  623. if (value) {
  624. let a = document.createElement("a")
  625. a.href = `https://daiketong.58corp.com/#/salesManagement/examine/examineDetails?isExamine=false&batch_id=${value}`
  626. a.textContent = ' | 成销界面'
  627. a.target = "_Blank"
  628. handleNode.appendChild(a)
  629. }
  630. }
  631.  
  632. useData()
  633.  
  634. })
  635. }
  636.  
  637.  
  638. } else if (window.location.href.indexOf("orderFolderList") > -1) {
  639.  
  640. async function getData(name) {
  641. let res = fetch(`https://daiketong.58corp.com/daiketong/v1/order/order-customer-list?page=1&customer_name_or_telephone=${name.trim()}`, {
  642. "headers": {
  643. "accept": "application/json, text/plain, */*",
  644. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  645. "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjo0MjcyMTksImV4cCI6MTY4MDcwMDgxNiwiaWF0IjoxNjc5NDA0ODE2LCJqdGkiOiI0MjcyMTk6YzA5MWYwOTQtOTQwMy00NjAzLTgzOWItMGU0YTQ1Njg1OGEyOjIwMjMwMzIxMTAwNjM4NTg5In0.kYgJNKMyTukRTDICB29Zf_vasX5Hbl2kmDRXwlRZFpqIoli_1vdS14wBuaK2Hdf6xiOyS3a-CAq7RR7HO96nJm9zuo2YwJMcONy5t_XZTWppB1ob6-y97ZyCFVUBqpyFtys42a_nB89jBJ-1atCbzWdiMc0W-CDBdpBflPdNh8_w5NcB7MvA4UGhRhXlc2ADuNF-D7gEMyW5FvFRvGhbYQfmGYeM4k2xMhQ2wUiYlXiTi4R6MqJXV2E0cwl342B0dFN-Narbijr3hRhlPeETmNhjtB188s7jkG-mqzcjuORSupJRayqKwr7aqg-3owNpPLzrs2qzFyrn8dPUnIp2cQ",
  646. "cache-control": "no-cache",
  647. "login-type": "pc",
  648. "pragma": "no-cache",
  649. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  650. "sec-ch-ua-mobile": "?0",
  651. "sec-ch-ua-platform": "\"Windows\"",
  652. "sec-fetch-dest": "empty",
  653. "sec-fetch-mode": "cors",
  654. "sec-fetch-site": "same-origin",
  655. "sw8": "1-YzY1NmJiMDg1NTAyNDJmY2JiNzgwZjM5ZjZkOGJmMTc=-ZDUwY2YzMzkxZDBkNDAwMmIzNjgwM2QzM2MyNzJlMWE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9vcmRlci9vcmRlci1jdXN0b21lci1saXN0-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  656. "sw8-correlation": "c291cmNl:YmVpZG91",
  657. "timestamp": "1679407390"
  658. },
  659. "referrer": "https://daiketong.58corp.com/",
  660. "referrerPolicy": "strict-origin-when-cross-origin",
  661. "body": null,
  662. "method": "GET",
  663. "mode": "cors",
  664. "credentials": "include"
  665. });
  666. let json = (await res).json()
  667. return json.then(
  668. function (a) {
  669. var list = a.data.data
  670. console.log(list)
  671. var newlist = list.filter((b) => {
  672. 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
  673. })
  674. return newlist
  675. }
  676. )
  677. }
  678.  
  679.  
  680. async function useData(name) {
  681. let value = await getData(name); // value等于data.data的值
  682. if (value) {
  683. console.log(value)
  684. let ID = value[0].order_id
  685. console.log(ID)
  686. var input = document.querySelector('input[placeholder="请输入订单ID"]');
  687. let name = document.querySelector('#consumerName')
  688. var inputEvent = new Event('input', {bubbles: true});
  689. input.value = ID;
  690. input.dispatchEvent(inputEvent);
  691. name.value = ''
  692. var element = document.querySelector(".is-plain span");
  693. console.log(element);
  694. element.click()
  695. alert("查询成功")
  696.  
  697. }
  698. }
  699.  
  700. let timer = setInterval(function checkElement() {
  701. // 获取元素
  702. var element = document.querySelector(".is-plain");
  703. // 如果元素存在,打印它的文本内容,并清除定时器
  704. if (element) {
  705. let querycriteria = document.querySelector('.query-criteria')
  706. let div = document.createElement("div")
  707. 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>`
  708. querycriteria.appendChild(div)
  709. let input = document.querySelector('input[placeholder="请输入订单ID"]');
  710. let name = document.querySelector('#consumerName')
  711. element.addEventListener('click', function () {
  712. console.log("绑定成功");
  713. if (name.value != "") {
  714. // console.log(2323232323)
  715. useData(name.value)
  716. }
  717. })
  718.  
  719.  
  720. clearInterval(timer);
  721. }
  722.  
  723. }, 1000);
  724.  
  725. }
  726.  
  727.  
  728. // 更新当前URL地址
  729. currentUrl = window.location.href;
  730. }
  731. }, 500);
  732.  
  733. };