爱房JS脚本

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

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

  1. // ==UserScript==
  2. // @name 爱房JS脚本
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  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("masterContractSee")>-1 && ["xiongweiliang", "zhanghui54"].includes(document.querySelector(".header-menu").childNodes[2].innerText)) {
  302.  
  303. let viewlist=document.querySelectorAll('.file-preview--wrapper')
  304. viewlist.forEach(
  305. function(itme,index){
  306. itme.onclick=function(){
  307. let re = setInterval(function () {
  308. let pdfurl=document.querySelector(".preview-canvas--iframe")
  309.  
  310.  
  311. if (pdfurl) {
  312.  
  313. window.open(pdfurl.src, '_blank');
  314. clearInterval(re)
  315. } else {
  316. // console.log(1)
  317. }
  318. }, 1000)}})
  319.  
  320.  
  321. }
  322. else if (window.location.href.indexOf("max") > -1) {
  323. function getSystemTime(timeFormat) {
  324. // 实例化日期类
  325. var time = new Date();
  326. // 获取完整的年份(4位)
  327. var year = time.getFullYear();
  328. // 获取月份(0-11,0代表1月)
  329. var month = time.getMonth() + 1;
  330. month = month < 10 ? '0' + month : month;
  331. // 获取日期(1-31)
  332. var day = time.getDate();
  333. dd = day < 10 ? '0' + day : day;
  334. yd = day - 1 < 10 ? '0' + (day - 1).toString() : day - 1;
  335. // 获取小时
  336. var h = time.getHours();
  337. hh = h < 10 ? '0' + h : h;
  338. // 获取分钟
  339. var m = time.getMinutes();
  340. mm = m < 10 ? '0' + m : m;
  341. // 获取秒钟
  342. var s = time.getSeconds();
  343. ss = s < 10 ? '0' + s : s;
  344. console.log(timeFormat);
  345. if (timeFormat == "today") {
  346. var date = `${year}-${month}-${dd}`
  347. } else if (timeFormat == "yesterday") {
  348. var date = `${year}-${month}-${yd}`
  349. } else if (timeFormat == "mm-dd hhmm") {
  350. var date = `${month}-${dd} ${hh}${mm}`
  351. }
  352. console.log(date);
  353. return (date);
  354. }
  355. getSystemTime("today")
  356. let nav_topNav = document.querySelector(".topNav")
  357. let list = ["订单明细认购不含退户", "订单明细认购含退户", "资金流水"]
  358. list.forEach(element => {
  359. let li = document.createElement("li")
  360. li.innerHTML = `<button id="${element}">${element}</button>`
  361. nav_topNav.appendChild(li)
  362. });
  363.  
  364. async function getToken() {
  365. let res = await fetch("https://max.58corp.com/chart/view/4257", {
  366. "headers": {
  367. "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",
  368. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  369. "cache-control": "max-age=0",
  370. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  371. "sec-ch-ua-mobile": "?0",
  372. "sec-ch-ua-platform": "\"Windows\"",
  373. "sec-fetch-dest": "document",
  374. "sec-fetch-mode": "navigate",
  375. "sec-fetch-site": "same-origin",
  376. "sec-fetch-user": "?1",
  377. "upgrade-insecure-requests": "1"
  378. },
  379. "referrer": "https://max.58corp.com/chart/view/4493",
  380. "referrerPolicy": "strict-origin-when-cross-origin",
  381. "body": null,
  382. "method": "GET",
  383. "mode": "cors",
  384. "credentials": "include"
  385. })
  386. let text = await res.text()
  387. var token = text.match(/Token=(.*?),/)[1]
  388. console.log(token)
  389.  
  390. function download(id, fileName) {
  391. fetch("https://datamap.58.com/report/order/download?downloadId=" + id + "&fileName=" + fileName + "", {
  392. "headers": {
  393. "accept": "*/*",
  394. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  395. "content-type": "application/json",
  396. "responsetype": "blob",
  397. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  398. "sec-ch-ua-mobile": "?0",
  399. "sec-ch-ua-platform": "\"Windows\"",
  400. "sec-fetch-dest": "empty",
  401. "sec-fetch-mode": "cors",
  402. "sec-fetch-site": "cross-site",
  403. "token": token
  404. },
  405. "referrer": "https://max.58corp.com/",
  406. "referrerPolicy": "strict-origin-when-cross-origin",
  407. "body": null,
  408. "method": "GET",
  409. "mode": "cors",
  410. "credentials": "omit"
  411. }).then(res => res.blob().then(blob => {
  412. let url = window.URL.createObjectURL(blob)
  413. let a = document.createElement('a')
  414. a.style.display = 'none'
  415. a.href = url
  416. a.download = fileName + ".xlsx"
  417. document.body.appendChild(a)
  418. a.click()
  419. document.body.removeChild(a)
  420. window.URL.revokeObjectURL(url)
  421. }))
  422. }
  423.  
  424. function getExcelId(fileName) {
  425. fetch("https://datamap.58.com/report/order/list?page=1&limit=1000&key=" + fileName + "&menuId=1154", {
  426. "headers": {
  427. "accept": "*/*",
  428. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  429. "content-type": "application/json",
  430. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  431. "sec-ch-ua-mobile": "?0",
  432. "sec-ch-ua-platform": "\"Windows\"",
  433. "sec-fetch-dest": "empty",
  434. "sec-fetch-mode": "cors",
  435. "sec-fetch-site": "cross-site",
  436. "token": token
  437. },
  438. "referrer": "https://max.58corp.com/",
  439. "referrerPolicy": "strict-origin-when-cross-origin",
  440. "body": null,
  441. "method": "GET",
  442. "mode": "cors",
  443. "credentials": "omit"
  444. }).then(res => {
  445. return res.json()
  446. }).then(json => {
  447. let id = json["page"]["list"][0]["id"].toString()
  448. let status = json["page"]["list"][0]["status"]
  449. console.log(status)
  450. console.log(json)
  451. if (status != 2) {
  452. getExcelId(fileName)
  453. } else {
  454. download(id, fileName)
  455. }
  456.  
  457. });
  458.  
  459. }
  460.  
  461. function getExcel(fileName, body) {
  462. fetch("https://datamap.58.com/report/order/export", {
  463. "headers": {
  464. "accept": "*/*",
  465. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
  466. "content-type": "application/json",
  467. "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
  468. "sec-ch-ua-mobile": "?0",
  469. "sec-ch-ua-platform": "\"Windows\"",
  470. "sec-fetch-dest": "empty",
  471. "sec-fetch-mode": "cors",
  472. "sec-fetch-site": "cross-site",
  473. "token": token
  474. },
  475. "referrer": "https://max.58corp.com/",
  476. "referrerPolicy": "strict-origin-when-cross-origin",
  477. "body": body,
  478. "method": "POST",
  479. "mode": "cors",
  480. "credentials": "omit"
  481. }).then(res => {
  482. return res.json()
  483. }).then(json => {
  484. console.log(json.msg)
  485. if (json.msg != "success") {
  486. getExcel(fileName, body.replace(today, yesterday))
  487. } else {
  488. getExcelId(fileName)
  489. }
  490. }
  491. );
  492. }
  493.  
  494.  
  495. 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]`
  496. var refundStatus = `[0,1,2,3]`
  497. var today = getSystemTime("today")
  498. var yesterday = getSystemTime("yesterday")
  499. let rengoubutui = document.querySelector("#订单明细认购不含退户")
  500. rengoubutui.onclick = function () {
  501. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购)"
  502. var refundStatus = `[0,1,2]`
  503. var body = "{\"fileName\":\"" + fileName +
  504. "\",\"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\"]}"
  505. console.log(body)
  506. getExcel(fileName = fileName, body = body)
  507. }
  508. let rengoutui = document.querySelector("#订单明细认购含退户")
  509. rengoutui.onclick = function () {
  510. let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购含退户)"
  511. var refundStatus = `[0,1,2,3]`
  512. var body = "{\"fileName\":\"" + fileName +
  513. "\",\"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\"]}"
  514. console.log(body)
  515. getExcel(fileName = fileName, body = body)
  516. }
  517.  
  518.  
  519. }
  520.  
  521. getToken()
  522.  
  523.  
  524. }
  525. else if (window.location.href.indexOf("masterContractSee") > -1 && document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
  526. async function getData() {
  527. 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", {
  528. "headers": {
  529. "accept": "application/json, text/plain, */*",
  530. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7,eu;q=0.6",
  531. "authorization": "",
  532. "cache-control": "no-cache",
  533. "login-type": "pc",
  534. "pragma": "no-cache",
  535. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  536. "sec-ch-ua-mobile": "?0",
  537. "sec-ch-ua-platform": "\"Windows\"",
  538. "sec-fetch-dest": "empty",
  539. "sec-fetch-mode": "cors",
  540. "sec-fetch-site": "same-origin",
  541. "sw8": "1-ZjRkMWNhZDIzYzYzNDA0ODk0Yzc5YmVlMjBkMjIyNzg=-NzBiOGNmNWM0Yjg2NGUyM2EyZTE1MzhjOGZkYjNjM2Y=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2RldGFpbA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  542. "sw8-correlation": "c291cmNl:YmVpZG91",
  543. "timestamp": "1665834595"
  544. },
  545. "referrer": "https://daiketong.58corp.com/",
  546. "referrerPolicy": "strict-origin-when-cross-origin",
  547. "body": null,
  548. "method": "GET",
  549. "mode": "cors",
  550. "credentials": "include"
  551. });
  552. let json = await res.json()
  553. console.table(json.data);
  554.  
  555.  
  556. }
  557.  
  558. getData()
  559. }
  560. else if (window.location.href.indexOf("evidenceChainList") > -1) {
  561. // location.reload()
  562.  
  563. let timer1 = setInterval(function checkElement() {
  564. // 获取元素
  565. var element = document.querySelector(".is-plain");
  566. // 如果元素存在,打印它的文本内容,并清除定时器
  567. if (element) {
  568. element.addEventListener('click', function () {
  569. console.log('绑定成功')
  570. var timer = setInterval(() => {
  571. // 获取表格行集合
  572. var rows = document.querySelectorAll(".el-table__row")
  573. console.log(rows.length);
  574.  
  575. // 如果表格行存在,执行addChild函数,并清除定时器
  576. if (rows.length > 0) {
  577. addChild(rows)
  578. clearInterval(timer);
  579. }
  580. }, 1000);
  581. })
  582.  
  583. clearInterval(timer1);
  584. }
  585.  
  586. }, 500);
  587.  
  588.  
  589. // 添加订单审核链接到每一行
  590. function addChild() {
  591. let nav_topNav = document.querySelectorAll(".el-table__row")
  592. nav_topNav.forEach((nav) => {
  593. let idNode = nav.querySelectorAll("td")[4]
  594. let ID = idNode.querySelector(".cell").innerHTML
  595. let handleNode = nav.querySelectorAll("td")[12]
  596. let aList = nav.querySelectorAll("a")
  597. console.log(ID, aList)
  598. if (aList.length > 0) {
  599. aList.forEach((c) => {
  600. if (c) {
  601. // console.log("123", a)
  602. handleNode.removeChild(c)
  603. console.log(c, '删除成功')
  604. }
  605. })
  606. }
  607. let a = document.createElement("a")
  608. a.href = `https://daiketong.58corp.com/#/orderManagementFolder/transactionInformationAudit/transactionAudit/transactionAuditBase/transactionAuditDetail?order_id=${ID}&examineNode=SIGNED&approvalStatus=PASSED`
  609. a.textContent = '订单审核界面'
  610. a.target = "_Blank"
  611. handleNode.appendChild(a)
  612.  
  613. // console.log(ID, handleNode)
  614.  
  615. async function getData() {
  616. let res = await fetch(`https://daiketong.58corp.com/daiketong/v1/success-sale/audit-list?page=1&status=PASSED&order_id=${ID}`, {
  617. "headers": {
  618. "accept": "application/json, text/plain, */*",
  619. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  620. "authorization": "",
  621. "cache-control": "no-cache",
  622. "login-type": "pc",
  623. "pragma": "no-cache",
  624. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  625. "sec-ch-ua-mobile": "?0",
  626. "sec-ch-ua-platform": "\"Windows\"",
  627. "sec-fetch-dest": "empty",
  628. "sec-fetch-mode": "cors",
  629. "sec-fetch-site": "same-origin",
  630. "sw8": "1-YjQyNzY4ZDFiMDM0NGRlZjg2NTI2NmFhYmM0Njc2YzU=-Y2I2YTg3YzM1MmZiNGVlN2JiMTM5ODgyYmFkZGQyMDc=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9zdWNjZXNzLXNhbGUvYXVkaXQtbGlzdA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  631. "sw8-correlation": "c291cmNl:YmVpZG91",
  632. "timestamp": "1679399184"
  633. },
  634. "referrer": "https://daiketong.58corp.com/",
  635. "referrerPolicy": "strict-origin-when-cross-origin",
  636. "body": null,
  637. "method": "GET",
  638. "mode": "cors",
  639. "credentials": "include"
  640. });
  641. let json = await res.json()
  642. if (json.data.data[0]) {
  643. // console.log(ID, json.data.data[0])
  644. return json.data.data[0]['batch_id']
  645. }
  646.  
  647. }
  648.  
  649. async function useData() {
  650. let value = await getData(); // value等于data.data的值
  651. if (value) {
  652. let a = document.createElement("a")
  653. a.href = `https://daiketong.58corp.com/#/salesManagement/examine/examineDetails?isExamine=false&batch_id=${value}`
  654. a.textContent = ' | 成销界面'
  655. a.target = "_Blank"
  656. handleNode.appendChild(a)
  657. }
  658. }
  659.  
  660. useData()
  661.  
  662. })
  663. }
  664.  
  665.  
  666. }
  667. else if (window.location.href.indexOf("orderFolderList") > -1) {
  668.  
  669. async function getData(name) {
  670. let res = fetch(`https://daiketong.58corp.com/daiketong/v1/order/order-customer-list?page=1&customer_name_or_telephone=${name.trim()}`, {
  671. "headers": {
  672. "accept": "application/json, text/plain, */*",
  673. "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
  674. "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjo0MjcyMTksImV4cCI6MTY4MDcwMDgxNiwiaWF0IjoxNjc5NDA0ODE2LCJqdGkiOiI0MjcyMTk6YzA5MWYwOTQtOTQwMy00NjAzLTgzOWItMGU0YTQ1Njg1OGEyOjIwMjMwMzIxMTAwNjM4NTg5In0.kYgJNKMyTukRTDICB29Zf_vasX5Hbl2kmDRXwlRZFpqIoli_1vdS14wBuaK2Hdf6xiOyS3a-CAq7RR7HO96nJm9zuo2YwJMcONy5t_XZTWppB1ob6-y97ZyCFVUBqpyFtys42a_nB89jBJ-1atCbzWdiMc0W-CDBdpBflPdNh8_w5NcB7MvA4UGhRhXlc2ADuNF-D7gEMyW5FvFRvGhbYQfmGYeM4k2xMhQ2wUiYlXiTi4R6MqJXV2E0cwl342B0dFN-Narbijr3hRhlPeETmNhjtB188s7jkG-mqzcjuORSupJRayqKwr7aqg-3owNpPLzrs2qzFyrn8dPUnIp2cQ",
  675. "cache-control": "no-cache",
  676. "login-type": "pc",
  677. "pragma": "no-cache",
  678. "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
  679. "sec-ch-ua-mobile": "?0",
  680. "sec-ch-ua-platform": "\"Windows\"",
  681. "sec-fetch-dest": "empty",
  682. "sec-fetch-mode": "cors",
  683. "sec-fetch-site": "same-origin",
  684. "sw8": "1-YzY1NmJiMDg1NTAyNDJmY2JiNzgwZjM5ZjZkOGJmMTc=-ZDUwY2YzMzkxZDBkNDAwMmIzNjgwM2QzM2MyNzJlMWE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9vcmRlci9vcmRlci1jdXN0b21lci1saXN0-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
  685. "sw8-correlation": "c291cmNl:YmVpZG91",
  686. "timestamp": "1679407390"
  687. },
  688. "referrer": "https://daiketong.58corp.com/",
  689. "referrerPolicy": "strict-origin-when-cross-origin",
  690. "body": null,
  691. "method": "GET",
  692. "mode": "cors",
  693. "credentials": "include"
  694. });
  695. let json = (await res).json()
  696. return json.then(
  697. function (a) {
  698. var list = a.data.data
  699. console.log(list)
  700. var newlist = list.filter((b) => {
  701. 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
  702. })
  703. return newlist
  704. }
  705. )
  706. }
  707.  
  708.  
  709. async function useData(name) {
  710. let value = await getData(name); // value等于data.data的值
  711. if (value) {
  712. console.log(value)
  713. let ID = value[0].order_id
  714. console.log(ID)
  715. var input = document.querySelector('input[placeholder="请输入订单ID"]');
  716. let name = document.querySelector('#consumerName')
  717. var inputEvent = new Event('input', {bubbles: true});
  718. input.value = ID;
  719. input.dispatchEvent(inputEvent);
  720. name.value = ''
  721. var element = document.querySelector(".is-plain span");
  722. console.log(element);
  723. element.click()
  724. alert("查询成功")
  725.  
  726. }
  727. }
  728.  
  729. let timer = setInterval(function checkElement() {
  730. // 获取元素
  731. var element = document.querySelector(".is-plain");
  732. // 如果元素存在,打印它的文本内容,并清除定时器
  733. if (element) {
  734. let querycriteria = document.querySelector('.query-criteria')
  735. let div = document.createElement("div")
  736. 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>`
  737. querycriteria.appendChild(div)
  738. let input = document.querySelector('input[placeholder="请输入订单ID"]');
  739. let name = document.querySelector('#consumerName')
  740. element.addEventListener('click', function () {
  741. console.log("绑定成功");
  742. if (name.value != "") {
  743. // console.log(2323232323)
  744. useData(name.value)
  745. }
  746. })
  747.  
  748.  
  749. clearInterval(timer);
  750. }
  751.  
  752. }, 1000);
  753.  
  754. }
  755.  
  756.  
  757. // 更新当前URL地址
  758. currentUrl = window.location.href;
  759. }
  760. }, 500);
  761.  
  762. };