爱房JS脚本

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

当前为 2023-04-14 提交的版本,查看 最新版本

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