爱房JS脚本

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

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

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