Greasy Fork

Greasy Fork is available in English.

亚马逊后台下载工具(个人使用)

30天订单|库存|店铺高亮|自动化|跨境卫士|紫鸟浏览器

当前为 2022-07-15 提交的版本,查看 最新版本

    // ==UserScript==
    // @name         亚马逊后台下载工具(个人使用)
    // @namespace    http://greasyfork.icu/zh-CN/scripts/447889-%E4%BA%9A%E9%A9%AC%E9%80%8A%E4%B8%8B%E8%BD%BD%E5%B7%A5%E5%85%B7
    // @version      0.11
    // @description  30天订单|库存|店铺高亮|自动化|跨境卫士|紫鸟浏览器
    // @author       menkeng
    // @match        https://sellercentral.amazon.com/*
    // @icon         https://www.google.com/s2/favicons?domain=amazon.com
    // @grant        unsafeWindow
    // @require           https://unpkg.com/[email protected]/dist/jquery.min.js
    // ==/UserScript==
    /* globals jQuery, $, waitForKeyElements */
    // This is how site search get access to the shadow root
    // var shadowRoot = $(element.shadowRoot);
    // 定制服务  Q:605011383

    var href = window.location.href
    // 日期范围报告
    var reporthref = "https://sellercentral.amazon.com/payments/reports/custom/request?ref_=xx_report_ttab_dash&tbla_daterangereportstable=sort:%7B%22sortOrder%22%3A%22DESCENDING%22%7D;search:undefined;pagination:1;"
    // 业务报告
    var rdailyhref = /sellercentral.amazon.com\/business-reports\/ref=xx_sitemetric_dnav_xx*/
    // 订单报告
    var orderhref = "https://sellercentral.amazon.com/reportcentral/FlatFileAllOrdersReport/1"
    var button1 = document.createElement("button")
    setInterval(function(){
        if (href == orderhref){Cbutton()}
        else{
            document.querySelector("body").removeChild(button1)
        }
    },5000);
    setTimeout(function(){red()},3000);
    // 业务报告点击前一天
    if (rdailyhref.test(href)) {yday()}
    function yday() {
        setTimeout(function(){
            alert("000")
            // document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box:nth-child(3) > div > div.css-wb79wd > div > kat-dropdown").shadowRoot.querySelector("div.kat-select-container > div.select-options > div > slot > kat-option:nth-child(5)").click()

            var dom1 = document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box:nth-child(3) > div > div.css-wb79wd > div > kat-dropdown").shadowRoot.querySelector("div.kat-select-container > div.select-options")

            $(dom1,"div > slot > kat-option:nth-child(5)").click()

            // setTimeout(function(){
            // alert("001")
            //     $("#root > div > div.css-1hwrlfd > div > kat-box:nth-child(3) > div > div.css-wb79wd > div.css-1nvf2ph > kat-date-picker:nth-child(1)").shadowRoot.querySelector("kat-calendar").shadowRoot.querySelector("div > div.cal-container > table > tbody button[aria-label='2022年7月2日']").click()
            //     alert("002")
            //     setTimeout(function(){
            //         alert("0031")
            //         document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box:nth-child(3) > div > div.css-wb79wd > div.css-1nvf2ph > kat-date-picker:nth-child(2)").shadowRoot.querySelector("kat-calendar").shadowRoot.querySelector("div > div.cal-container > table > tbody button[aria-label='2022年7月2日']").click()
                // alert("003")
                // },2000);
            // },3000);
        },4000);
    }
    // 创建下载按钮
    function Cbutton(){
        button1.setAttribute("type", "button1");
        button1.style.cssText = "width: 50px;height: 50px;position: fixed;top: 100px;right: 50px;background: rgb(0, 0, 0);color: white;"
        button1.onclick =function(){dingdan()}
        button1.innerText="下载"
        document.querySelector("body").appendChild(button1)
    }
    // 店铺高亮
    function red()
    {
        document.querySelector("#partner-switcher > button").style.height="80px";
        document.querySelector("#partner-switcher > button").style.fontSize="30px";
        document.querySelector("#partner-switcher > button").style.color="red";
    }
    // 订单下载
    function dingdan(){
            document.querySelector("#daily-time-picker-style > kat-dropdown").value="30"
            document.querySelector("#report-page-kat-box > kat-button").shadowRoot.querySelector("button").click()
            setTimeout(function(){
            document.querySelector("a[href='/reportcentral/FBA_MYI_UNSUPPRESSED_INVENTORY/1']").click()
            },100);
            setTimeout(function(){
            document.querySelector("kat-button.download-report-page-kat-button-primary").click()
            },6000);
    }
    function dingdan_pass()
    {
        document.querySelector("#daily-time-picker-style > kat-dropdown").value="-1"
        document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.start").value=""
    }


//      // This is how site search get access to the shadow root
//   var shadowRoot = $(element.shadowRoot);

//   // Use the shadow root to resolve to the cotnainer by ID
//   // and then finding any other elements in the shadow DOM
//   // works as expected.
//   var container = shadowRoot.find('#container');
//   var span = container.find('span');

//   console.log('jQuery set count: ' + span.length);