爱房JS脚本

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name                爱房JS脚本
// @namespace           http://tampermonkey.net/
// @version             1.4
// @description         可以跳转项目页,打开合同扫描件,一键下载订单明细
// @author              熊伟良
// @match               https://daiketong.58corp.com/*
// @match               https://max.58corp.com/*
// @icon                https://pages.anjukestatic.com/fe/ifang_node_admin_web/favicon.ico
// @grant               none
// @license             MIT
// ==/UserScript==
var currentUrl = 1;

async function getyushou(id) {
  let result = await fetch(`https://daiketong.58corp.com/japi/buildings/up-off-detail/${id}`, {
    "headers": {
      "accept": "application/json, text/plain, */*",
      "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
      "authorization": "",
      "cache-control": "no-cache",
      "login-type": "pc",
      "pragma": "no-cache",
      "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": "\"Windows\"",
      "sec-fetch-dest": "empty",
      "sec-fetch-mode": "cors",
      "sec-fetch-site": "same-origin",
      "sw8": "1-MmE5ZTU5Yjc1MmMwNDRjOThlODRjYmIwNmFjZTUyOTg=-YjRjNTA5NTY5Y2E1NDBjNzg2NmIwNWQ0NmFlYWNmZjk=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL3VwLW9mZi1kZXRhaWwvMTIwMzI5-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
      "sw8-correlation": "c291cmNl:YmVpZG91",
      "timestamp": "1681199724"
    },
    "referrer": "https://daiketong.58corp.com/",
    "referrerPolicy": "strict-origin-when-cross-origin",
    "body": null,
    "method": "GET",
    "mode": "cors",
    "credentials": "include"
  });
  let resultData = await result.json()
  let data = resultData.data
  let range = data.presale_license_range

  // 查找 detail 类中的第二个 section-content 类
  const sectionContentElement = document.querySelector('.detail > :nth-child(5)');

// 如果找到了该元素,则向其中追加新的 <div> 元素
  if (sectionContentElement) {
    // 创建新的 <div> 元素
    const newDiv = document.createElement('div');
    newDiv.setAttribute('data-v-7bf5ef12', '');
    newDiv.className = 'section-content-item';

    // 在新的 <div> 元素中添加 <span> 元素
    const labelSpan = document.createElement('span');
    labelSpan.setAttribute('data-v-7bf5ef12', '');
    labelSpan.className = 'section-content-item-label';
    labelSpan.innerText = '预售范围:';

    if (["xiongweiliang", "zhanghui54"].includes(document.querySelector(".header-menu").childNodes[2].innerText)) {
      const companyName = document.querySelector('.detail > .section-content > :nth-child(2) > :nth-child(2)').innerText;
      const encodedCompanyName = encodeURIComponent(companyName);
      const url = `https://fsfc.fszj.foshan.gov.cn/loupan/xuke/c${encodedCompanyName}_f-1/`;
      // console.log(url)
      labelSpan.addEventListener('click', function () {
        window.open(url, '_blank');
      });
    }

    const valueSpan = document.createElement('span');
    valueSpan.setAttribute('data-v-7bf5ef12', '');
    valueSpan.className = 'section-content-item-value';
    valueSpan.innerText = range;

    newDiv.appendChild(labelSpan);
    newDiv.appendChild(valueSpan);

    // 在第二个 section-content 元素的第三个子元素后面插入新的 <div> 元素
    const thirdChild = sectionContentElement.children[2];
    sectionContentElement.insertBefore(newDiv, thirdChild.nextSibling);
  }


}


window.onload = function () {

  setInterval(function () {

    if (window.location.href != currentUrl) {
      // URL地址发生变化,触发事件

      if (window.location.href.indexOf("commissionall") > -1) {

        setTimeout(function () {
          let el_col = document.querySelectorAll(".el-col-22")[5]
          console.log(el_col)
          let btn = document.createElement("div")
          btn.innerHTML = `<button id="关闭暗佣" class="el-button el-button--default el-button--small" style="margin-left:20px">关闭暗佣</button>`
          el_col.appendChild(btn)
          console.log(btn)
          console.log(typeof (el_col), typeof (btn))
          document.querySelector("#关闭暗佣").addEventListener("click", function () {
            let fontColorList = document.querySelectorAll(".fontColor")
            if (fontColorList.length > 0) {
              fontColorList.forEach(function (item) {
                if (item.innerText == "关闭暗佣") {
                  console.log(item.innerHTML)
                  item.click()
                }
              })
            } else {
              console.log("待加载")
              // guanbianyong()
            }
          }, false)
          console.log(el_col)
        }, 2000)

      } else if (window.location.href.indexOf("approvalStatus")) {


// 监听文档的 keyup 事件,当松开键盘上的 a 键时执行处理函数
        document.addEventListener('keyup', (event) => {
          if (event.code === 'KeyA') {
            document.querySelector('.viewer-rotate-left').click();
          } else if (event.code === 'KeyD') {
            document.querySelector('.viewer-rotate-right').click();
          } else if (event.code === 'KeyQ') {
            // 获取所有类名包含 el-button 的元素
            const elButtonElements = document.querySelectorAll('[class*=el-button]');

// 遍历所有元素,找出内部包含 <span>通过</span> 的按钮
            for (const elButtonElement of elButtonElements) {
              // 获取元素内部所有 <span> 元素
              const spanElements = elButtonElement.querySelectorAll('span');

              // 遍历所有 <span> 元素,找出包含文本“通过”的元素
              for (const spanElement of spanElements) {
                if (spanElement.innerText === '通过') {
                  // 如果找到了包含文本“通过”的元素,就打印该元素
                  elButtonElement.click();
                  break;
                }
              }
            }

          }
        });

        const cookie = document.cookie;
        var bc_id = "1"
        setTimeout(function () {
          // 获取第一个类名为 el-tabs__nav is-top 的元素
          const elTabsNavElement = document.querySelector('.el-tabs__nav.is-top');

// 如果找到了该元素,则点击其最后一个子元素
          if (elTabsNavElement) {
            elTabsNavElement.lastElementChild.click();
          }
          let contentList = document.querySelectorAll(".section-content-item-value")
          contentList.forEach(function (contract, contractindex) {
            let reg = /^B/
            if (reg.test(contract.innerText) == true) {
              var buildingId = contract.innerText.substring(3, 8).toString();
              var bc_code = contract.innerText;
              contentList[0].onclick = function () {
                let win = window.open(`https://daiketong.58corp.com/#/refactorProject/projectManager/projectManagerIndex/projectManagerDetail?building_id=${buildingId}&active=4&city_id=362`)
              }


              fetch("https://daiketong.58corp.com/japi/buildings/contract/list", {
                "headers": {
                  "accept": "application/json, text/plain, */*",
                  "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
                  "authorization": "",
                  "content-type": "application/json;charset=UTF-8",
                  "login-type": "pc",
                  "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
                  "sec-ch-ua-mobile": "?0",
                  "sec-ch-ua-platform": "\"Windows\"",
                  "sec-fetch-dest": "empty",
                  "sec-fetch-mode": "cors",
                  "sec-fetch-site": "same-origin",
                  "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
                  "sw8-correlation": "c291cmNl:YmVpZG91",
                  "timestamp": "1665145024"
                },
                "referrer": "https://daiketong.58corp.com/",
                "referrerPolicy": "strict-origin-when-cross-origin",
                "body": "{\"building_id\":\"" + buildingId + "\"}",
                "method": "POST",
                "mode": "cors",
                "credentials": "include"
              }).then(res => {
                return res.json()
              }).then(json => {
                // console.log(json)
                json["data"].forEach(function (item, index) {
                  if (item["bc_code"] == bc_code) {
                    let bc_id = item["bc_id"]
                    // console.log(bc_id)
                    fetch("https://daiketong.58corp.com/japi/buildings/contract/get-packing-list", {
                      "headers": {
                        "accept": "application/json, text/plain, */*",
                        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
                        "authorization": "",
                        "content-type": "application/json;charset=UTF-8",
                        "login-type": "pc",
                        "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
                        "sec-ch-ua-mobile": "?0",
                        "sec-ch-ua-platform": "\"Windows\"",
                        "sec-fetch-dest": "empty",
                        "sec-fetch-mode": "cors",
                        "sec-fetch-site": "same-origin",
                        "sw8": "1-MWE1YmNiZTAzOTE5NDIyOTk4MDgwODNhNDAwZDg2NDA=-ODNiMmUwMWU2YTc2NDMyMTkyNmQ1NTI1ZjNjZDUyNzE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2xpc3Q=-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
                        "sw8-correlation": "c291cmNl:YmVpZG91",
                        "timestamp": "1665146852"
                      },
                      "referrer": "https://daiketong.58corp.com/",
                      "referrerPolicy": "strict-origin-when-cross-origin",
                      "body": "{\"contract_id\":" + bc_id.toString() + ",\"contract_type\":\"1\",\"status\":\"\"}",
                      "method": "POST",
                      "mode": "cors",
                      "credentials": "include"
                    }).then(res => {
                      return res.json()
                    }).then(json => {
                      json["data"].forEach(function (item, index) {
                        contract.addEventListener("click", function () {
                          // console.log("qwwqqwqw")
                          window.open(item["url"])
                        }, false)
                        // console.log(item["url"])
                      })
                    })
                  }
                })
              });

              console.log(buildingId)
              let result = getyushou(buildingId)
              console.log(result)


            }
          })


          if (document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {

            let re = setInterval(function () {
              let viewerHalf = document.querySelector(".viewerHalf")
              if (viewerHalf) {
                viewerHalf.className = "viewer-container viewer-backdrop viewer-fixed viewer-fade viewer-transition viewer-in"
                clearInterval(re)
              } else {
                // console.log(1)
              }
            }, 1000)

            // let select = setInterval(function () {
            //     var currentSelect = document.querySelectorAll('div[aria-selected="true"]')[1].innerText;
            //     console.log(currentSelect)
            //     if(currentSelect=="草签合同关键页"){
            //         let viewer_move = document.querySelector(".viewer-move")
            //         if (viewer_move) {
            //             console.log(234,viewer_move)
            //         }
            //     }
            //
            // }, 500)
            document.onkeyup = function (event) {
              let viewer_move = document.querySelector(".viewer-move")
              if (viewer_move) {
                let a = document.documentElement.clientWidth / 2
                let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
                viewer_move.style["margin-left"] = (a - b) + "px"
              }
            }
            document.onmousewheel = function (event) {
              let viewer_move = document.querySelector(".viewer-move")
              if (viewer_move) {
                let a = document.documentElement.clientWidth / 2
                let b = viewer_move.style["width"].slice(0, -2) * 1 / 2
                viewer_move.style["margin-left"] = (a - b) + "px"
              }
            }
          }
        }, 500)


      } else if (window.location.href.indexOf("max") > -1) {
        function getSystemTime(timeFormat) {
          // 实例化日期类
          var time = new Date();
          // 获取完整的年份(4位)
          var year = time.getFullYear();
          // 获取月份(0-11,0代表1月)
          var month = time.getMonth() + 1;
          month = month < 10 ? '0' + month : month;
          // 获取日期(1-31)
          var day = time.getDate();
          dd = day < 10 ? '0' + day : day;
          yd = day - 1 < 10 ? '0' + (day - 1).toString() : day - 1;
          // 获取小时
          var h = time.getHours();
          hh = h < 10 ? '0' + h : h;
          // 获取分钟
          var m = time.getMinutes();
          mm = m < 10 ? '0' + m : m;
          // 获取秒钟
          var s = time.getSeconds();
          ss = s < 10 ? '0' + s : s;
          console.log(timeFormat);
          if (timeFormat == "today") {
            var date = `${year}-${month}-${dd}`
          } else if (timeFormat == "yesterday") {
            var date = `${year}-${month}-${yd}`
          } else if (timeFormat == "mm-dd hhmm") {
            var date = `${month}-${dd} ${hh}${mm}`
          }
          console.log(date);
          return (date);
        }

        getSystemTime("today")
        let nav_topNav = document.querySelector(".topNav")
        let list = ["订单明细认购不含退户", "订单明细认购含退户", "资金流水"]
        list.forEach(element => {
          let li = document.createElement("li")
          li.innerHTML = `<button id="${element}">${element}</button>`
          nav_topNav.appendChild(li)
        });

        async function getToken() {
          let res = await fetch("https://max.58corp.com/chart/view/4257", {
            "headers": {
              "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",
              "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
              "cache-control": "max-age=0",
              "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
              "sec-ch-ua-mobile": "?0",
              "sec-ch-ua-platform": "\"Windows\"",
              "sec-fetch-dest": "document",
              "sec-fetch-mode": "navigate",
              "sec-fetch-site": "same-origin",
              "sec-fetch-user": "?1",
              "upgrade-insecure-requests": "1"
            },
            "referrer": "https://max.58corp.com/chart/view/4493",
            "referrerPolicy": "strict-origin-when-cross-origin",
            "body": null,
            "method": "GET",
            "mode": "cors",
            "credentials": "include"
          })
          let text = await res.text()
          var token = text.match(/Token=(.*?),/)[1]
          console.log(token)

          function download(id, fileName) {
            fetch("https://datamap.58.com/report/order/download?downloadId=" + id + "&fileName=" + fileName + "", {
              "headers": {
                "accept": "*/*",
                "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
                "content-type": "application/json",
                "responsetype": "blob",
                "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
                "sec-ch-ua-mobile": "?0",
                "sec-ch-ua-platform": "\"Windows\"",
                "sec-fetch-dest": "empty",
                "sec-fetch-mode": "cors",
                "sec-fetch-site": "cross-site",
                "token": token
              },
              "referrer": "https://max.58corp.com/",
              "referrerPolicy": "strict-origin-when-cross-origin",
              "body": null,
              "method": "GET",
              "mode": "cors",
              "credentials": "omit"
            }).then(res => res.blob().then(blob => {
              let url = window.URL.createObjectURL(blob)
              let a = document.createElement('a')
              a.style.display = 'none'
              a.href = url
              a.download = fileName + ".xlsx"
              document.body.appendChild(a)
              a.click()
              document.body.removeChild(a)
              window.URL.revokeObjectURL(url)
            }))
          }

          function getExcelId(fileName) {
            fetch("https://datamap.58.com/report/order/list?page=1&limit=1000&key=" + fileName + "&menuId=1154", {
              "headers": {
                "accept": "*/*",
                "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
                "content-type": "application/json",
                "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
                "sec-ch-ua-mobile": "?0",
                "sec-ch-ua-platform": "\"Windows\"",
                "sec-fetch-dest": "empty",
                "sec-fetch-mode": "cors",
                "sec-fetch-site": "cross-site",
                "token": token
              },
              "referrer": "https://max.58corp.com/",
              "referrerPolicy": "strict-origin-when-cross-origin",
              "body": null,
              "method": "GET",
              "mode": "cors",
              "credentials": "omit"
            }).then(res => {
              return res.json()
            }).then(json => {
              let id = json["page"]["list"][0]["id"].toString()
              let status = json["page"]["list"][0]["status"]
              console.log(status)
              console.log(json)
              if (status != 2) {
                getExcelId(fileName)
              } else {
                download(id, fileName)
              }

            });

          }

          function getExcel(fileName, body) {
            fetch("https://datamap.58.com/report/order/export", {
              "headers": {
                "accept": "*/*",
                "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7",
                "content-type": "application/json",
                "sec-ch-ua": "\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"",
                "sec-ch-ua-mobile": "?0",
                "sec-ch-ua-platform": "\"Windows\"",
                "sec-fetch-dest": "empty",
                "sec-fetch-mode": "cors",
                "sec-fetch-site": "cross-site",
                "token": token
              },
              "referrer": "https://max.58corp.com/",
              "referrerPolicy": "strict-origin-when-cross-origin",
              "body": body,
              "method": "POST",
              "mode": "cors",
              "credentials": "omit"
            }).then(res => {
              return res.json()
            }).then(json => {
                console.log(json.msg)
                if (json.msg != "success") {
                  getExcel(fileName, body.replace(today, yesterday))
                } else {
                  getExcelId(fileName)
                }
              }
            );
          }


          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]`
          var refundStatus = `[0,1,2,3]`
          var today = getSystemTime("today")
          var yesterday = getSystemTime("yesterday")
          let rengoubutui = document.querySelector("#订单明细认购不含退户")
          rengoubutui.onclick = function () {
            let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购)"
            var refundStatus = `[0,1,2]`
            var body = "{\"fileName\":\"" + fileName +
              "\",\"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\"]}"
            console.log(body)
            getExcel(fileName = fileName, body = body)
          }
          let rengoutui = document.querySelector("#订单明细认购含退户")
          rengoutui.onclick = function () {
            let fileName = getSystemTime("mm-dd hhmm") + " 订单明细(认购含退户)"
            var refundStatus = `[0,1,2,3]`
            var body = "{\"fileName\":\"" + fileName +
              "\",\"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\"]}"
            console.log(body)
            getExcel(fileName = fileName, body = body)
          }


        }

        getToken()


      } else if (window.location.href.indexOf("masterContractSee") > -1 && document.querySelector(".header-menu").childNodes[2].innerText == "xiongweiliang") {
        async function getData() {
          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", {
            "headers": {
              "accept": "application/json, text/plain, */*",
              "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7,eu;q=0.6",
              "authorization": "",
              "cache-control": "no-cache",
              "login-type": "pc",
              "pragma": "no-cache",
              "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
              "sec-ch-ua-mobile": "?0",
              "sec-ch-ua-platform": "\"Windows\"",
              "sec-fetch-dest": "empty",
              "sec-fetch-mode": "cors",
              "sec-fetch-site": "same-origin",
              "sw8": "1-ZjRkMWNhZDIzYzYzNDA0ODk0Yzc5YmVlMjBkMjIyNzg=-NzBiOGNmNWM0Yjg2NGUyM2EyZTE1MzhjOGZkYjNjM2Y=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2phcGkvYnVpbGRpbmdzL2NvbnRyYWN0L2RldGFpbA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
              "sw8-correlation": "c291cmNl:YmVpZG91",
              "timestamp": "1665834595"
            },
            "referrer": "https://daiketong.58corp.com/",
            "referrerPolicy": "strict-origin-when-cross-origin",
            "body": null,
            "method": "GET",
            "mode": "cors",
            "credentials": "include"
          });
          let json = await res.json()
          console.table(json.data);


        }

        getData()
      } else if (window.location.href.indexOf("evidenceChainList") > -1) {
        // location.reload()

        let timer1 = setInterval(function checkElement() {
          // 获取元素
          var element = document.querySelector(".is-plain");
          // 如果元素存在,打印它的文本内容,并清除定时器
          if (element) {
            element.addEventListener('click', function () {
              console.log('绑定成功')
              var timer = setInterval(() => {
                // 获取表格行集合
                var rows = document.querySelectorAll(".el-table__row")
                console.log(rows.length);

                // 如果表格行存在,执行addChild函数,并清除定时器
                if (rows.length > 0) {
                  addChild(rows)
                  clearInterval(timer);
                }
              }, 1000);
            })

            clearInterval(timer1);
          }

        }, 500);


        // 添加订单审核链接到每一行
        function addChild() {
          let nav_topNav = document.querySelectorAll(".el-table__row")
          nav_topNav.forEach((nav) => {
            let idNode = nav.querySelectorAll("td")[4]
            let ID = idNode.querySelector(".cell").innerHTML
            let handleNode = nav.querySelectorAll("td")[12]
            let aList = nav.querySelectorAll("a")
            console.log(ID, aList)
            if (aList.length > 0) {
              aList.forEach((c) => {
                if (c) {
                  // console.log("123", a)
                  handleNode.removeChild(c)
                  console.log(c, '删除成功')
                }
              })
            }
            let a = document.createElement("a")
            a.href = `https://daiketong.58corp.com/#/orderManagementFolder/transactionInformationAudit/transactionAudit/transactionAuditBase/transactionAuditDetail?order_id=${ID}&examineNode=SIGNED&approvalStatus=PASSED`
            a.textContent = '订单审核界面'
            a.target = "_Blank"
            handleNode.appendChild(a)

            // console.log(ID, handleNode)

            async function getData() {
              let res = await fetch(`https://daiketong.58corp.com/daiketong/v1/success-sale/audit-list?page=1&status=PASSED&order_id=${ID}`, {
                "headers": {
                  "accept": "application/json, text/plain, */*",
                  "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
                  "authorization": "",
                  "cache-control": "no-cache",
                  "login-type": "pc",
                  "pragma": "no-cache",
                  "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
                  "sec-ch-ua-mobile": "?0",
                  "sec-ch-ua-platform": "\"Windows\"",
                  "sec-fetch-dest": "empty",
                  "sec-fetch-mode": "cors",
                  "sec-fetch-site": "same-origin",
                  "sw8": "1-YjQyNzY4ZDFiMDM0NGRlZjg2NTI2NmFhYmM0Njc2YzU=-Y2I2YTg3YzM1MmZiNGVlN2JiMTM5ODgyYmFkZGQyMDc=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9zdWNjZXNzLXNhbGUvYXVkaXQtbGlzdA==-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
                  "sw8-correlation": "c291cmNl:YmVpZG91",
                  "timestamp": "1679399184"
                },
                "referrer": "https://daiketong.58corp.com/",
                "referrerPolicy": "strict-origin-when-cross-origin",
                "body": null,
                "method": "GET",
                "mode": "cors",
                "credentials": "include"
              });
              let json = await res.json()
              if (json.data.data[0]) {
                // console.log(ID, json.data.data[0])
                return json.data.data[0]['batch_id']
              }

            }

            async function useData() {
              let value = await getData(); // value等于data.data的值
              if (value) {
                let a = document.createElement("a")
                a.href = `https://daiketong.58corp.com/#/salesManagement/examine/examineDetails?isExamine=false&batch_id=${value}`
                a.textContent = '     |    成销界面'
                a.target = "_Blank"
                handleNode.appendChild(a)
              }
            }

            useData()

          })
        }


      } else if (window.location.href.indexOf("orderFolderList") > -1) {

        async function getData(name) {
          let res = fetch(`https://daiketong.58corp.com/daiketong/v1/order/order-customer-list?page=1&customer_name_or_telephone=${name.trim()}`, {
            "headers": {
              "accept": "application/json, text/plain, */*",
              "accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
              "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjo0MjcyMTksImV4cCI6MTY4MDcwMDgxNiwiaWF0IjoxNjc5NDA0ODE2LCJqdGkiOiI0MjcyMTk6YzA5MWYwOTQtOTQwMy00NjAzLTgzOWItMGU0YTQ1Njg1OGEyOjIwMjMwMzIxMTAwNjM4NTg5In0.kYgJNKMyTukRTDICB29Zf_vasX5Hbl2kmDRXwlRZFpqIoli_1vdS14wBuaK2Hdf6xiOyS3a-CAq7RR7HO96nJm9zuo2YwJMcONy5t_XZTWppB1ob6-y97ZyCFVUBqpyFtys42a_nB89jBJ-1atCbzWdiMc0W-CDBdpBflPdNh8_w5NcB7MvA4UGhRhXlc2ADuNF-D7gEMyW5FvFRvGhbYQfmGYeM4k2xMhQ2wUiYlXiTi4R6MqJXV2E0cwl342B0dFN-Narbijr3hRhlPeETmNhjtB188s7jkG-mqzcjuORSupJRayqKwr7aqg-3owNpPLzrs2qzFyrn8dPUnIp2cQ",
              "cache-control": "no-cache",
              "login-type": "pc",
              "pragma": "no-cache",
              "sec-ch-ua": "\"Chromium\";v=\"106\", \"Google Chrome\";v=\"106\", \"Not;A=Brand\";v=\"99\"",
              "sec-ch-ua-mobile": "?0",
              "sec-ch-ua-platform": "\"Windows\"",
              "sec-fetch-dest": "empty",
              "sec-fetch-mode": "cors",
              "sec-fetch-site": "same-origin",
              "sw8": "1-YzY1NmJiMDg1NTAyNDJmY2JiNzgwZjM5ZjZkOGJmMTc=-ZDUwY2YzMzkxZDBkNDAwMmIzNjgwM2QzM2MyNzJlMWE=-0-NTAz-aHR0cHM6Ly9kYWlrZXRvbmcuNThjb3JwLmNvbQ==-L2RhaWtldG9uZy92MS9vcmRlci9vcmRlci1jdXN0b21lci1saXN0-ZGFpa2V0b25nLjU4Y29ycC5jb20=-0",
              "sw8-correlation": "c291cmNl:YmVpZG91",
              "timestamp": "1679407390"
            },
            "referrer": "https://daiketong.58corp.com/",
            "referrerPolicy": "strict-origin-when-cross-origin",
            "body": null,
            "method": "GET",
            "mode": "cors",
            "credentials": "include"
          });
          let json = (await res).json()
          return json.then(
            function (a) {
              var list = a.data.data
              console.log(list)
              var newlist = list.filter((b) => {
                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
              })
              return newlist
            }
          )
        }


        async function useData(name) {
          let value = await getData(name); // value等于data.data的值
          if (value) {
            console.log(value)
            let ID = value[0].order_id
            console.log(ID)
            var input = document.querySelector('input[placeholder="请输入订单ID"]');
            let name = document.querySelector('#consumerName')
            var inputEvent = new Event('input', {bubbles: true});
            input.value = ID;
            input.dispatchEvent(inputEvent);
            name.value = ''
            var element = document.querySelector(".is-plain span");
            console.log(element);
            element.click()
            alert("查询成功")

          }
        }

        let timer = setInterval(function checkElement() {
          // 获取元素
          var element = document.querySelector(".is-plain");
          // 如果元素存在,打印它的文本内容,并清除定时器
          if (element) {
            let querycriteria = document.querySelector('.query-criteria')
            let div = document.createElement("div")
            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>`
            querycriteria.appendChild(div)
            let input = document.querySelector('input[placeholder="请输入订单ID"]');
            let name = document.querySelector('#consumerName')
            element.addEventListener('click', function () {
              console.log("绑定成功");
              if (name.value != "") {
                // console.log(2323232323)
                useData(name.value)
              }
            })


            clearInterval(timer);
          }

        }, 1000);

      }


      // 更新当前URL地址
      currentUrl = window.location.href;
    }
  }, 500);

};