您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
自动30天订单,库存|退货|账单|店铺高亮|业务报告|自动化|跨境卫士|紫鸟浏览器
当前为
// ==UserScript== // @name 亚马逊后台下载工具(个人使用) // @namespace http://greasyfork.icu/zh-CN/scripts/447889 // @version 0.182 // @description 自动30天订单,库存|退货|账单|店铺高亮|业务报告|自动化|跨境卫士|紫鸟浏览器 // @author menkeng // @match https://sellercentral.amazon.com/* // @match https://advertising.amazon.com/cm/* // @exclude https://advertising.amazon.com/cm/sp/* // @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 // 定制服务 Q:605011383 // 定制服务 Q:605011383 //时间格式化问题 *特殊处理 昨日 UTC Date.prototype.Format = function (fmt) { var o = { "M+": this.getUTCMonth() + 1, //月份 "d+": this.getUTCDate() - 1, //昨日 "H+": this.getUTCHours(), //小时 "m+": this.getUTCMinutes(), //分 "s+": this.getUTCSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds(), //毫秒 "R+": this.getUTCMonth(), //上月月份 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } var yesterday_cn = new Date().Format("yyyy年M月d日") var Premonth_first = new Date().Format("yyyy年R月1日") function y_lastday() { var y1 = new Date().Format("yyyy") var y2 = new Date().Format("R") var last = new Date(y1,y2,0) var Premonth_last = last.getDate() return Premonth_last } function lastday() { var y1 = new Date().Format("yyyy") var y2 = new Date().Format("M") var last = new Date(y1,y2,0) var lastday = last.getDate() return lastday } var Premonth_last = new Date().Format("yyyy年R月"+y_lastday()+"日") // 获取地址 var href = window.location.href // 日期范围报告 var reporthref = /sellercentral.amazon.com\/payments\/reports\/custom\/request/ // 退货报告 var returnhref = /sellercentral.amazon.com\/reportcentral\/CUSTOMER_RETURNS\/1/ // 业务报告 var rdailyhref = /sellercentral.amazon.com\/business-reports\/ref=xx_sitemetric_dnav_xx#\/dashboard/ // 业务报告_销量与访问量 var r_daily_visit_href_reg = /sellercentral.amazon.com\/business-reports\/ref=xx_sitemetric_dnav_xx#\/report\?id=102:SalesTrafficTimeSeries&chartCols=5\/18&columns/ // 销量与访问量 var month_sell_href = /sellercentral.amazon.com\/business-reports\/ref=xx_sitemetric_dnav_xx#\/report\?id=102%3ASalesTrafficTimeSeries&chartCols/ // Send to Amazon var STAhref = /sellercentral.amazon.com\/fba\/sendtoamazon/ // 订单欢迎页面 var order_welhref = /sellercentral.amazon.com\/reportcentral\/WelcomePage/ // 订单报告 var orderhref = "https://sellercentral.amazon.com/reportcentral/FlatFileAllOrdersReport/1" // 管理订单 var now_orderhref = /sellercentral.amazon.com\/orders-v3\?/ // 后台 var homehref = /sellercentral.amazon.com\/gp\/homepage.html\/ref=xx_home_logo_xx|sellercentral.amazon.com\/home/ // 付款控制面板 var payhref = /sellercentral.amazon.com\/payments\/dashboard\/index.html\/ref=xx_payments_dnav_xx/ // 广告页面 var adhref = /advertising.amazon.com\/cm/ // 定 // 时 // 器 setTimeout(function(){ // alert("00") },200); var button_css = "class: button; width: 50px;height: 50px;position: fixed;top: 100px;right: 50px;background: rgb(0, 130, 150);color: white;" var txtarea_css = "width: 34px;height: 24px;position: absolute;top: 4px;left: 108px;background: rgb(0 130 150);color: white;font:400 13.3333px Arial;box-shadow:0 1px 2px 0 #b5b5b5;border-radius:inherit;" var Abutton = document.createElement("textarea") var copy_area = document.createElement("textarea") var link = document.createElement("button") var adbtn = document.createElement("button") var li = document.createElement("li") var a = document.createElement("a") var button1 = document.createElement("button") var button3 = document.createElement("button") var button4 = document.createElement("button") var button5 = document.createElement("button") // 此处手动添加链接至收藏夹 var r_ad_repo_href = "https://advertising.amazon.com/cm/?adrepo"/* 日报_广告报表 */ var r_daily_visit_href = "https://sellercentral.amazon.com/business-reports/ref=xx_sitemetric_dnav_xx#/report?id=102:SalesTrafficTimeSeries"/* 日报_销量与访问量报表 */ var r_cash_href = "https://sellercentral.amazon.com/payments/disburse/details?accountType=PAYABLE?auto"/* 日报_提现 */ var n_orderlist_href = "https://sellercentral.amazon.com/reportcentral/WelcomePage?30orderlist"/* 备货_30日订单下载 */ var n_invage_href = "https://sellercentral.amazon.com/reportcentral/MANAGE_INVENTORY_HEALTH/1?auto"/* 备货_库龄下载 */ var w_newship_href = "https://sellercentral.amazon.com/fba/sendtoamazon/?new"/* 创建新货件 */ var w_daterange_repo_href ="https://sellercentral.amazon.com/payments/reports/custom/request?thismonth"/* 周报_本月日期范围报告 */ var w_orderlist_href = "https://sellercentral.amazon.com/reportcentral/WelcomePage?thismonthorder"/* 周报_本月订单下载 */ var w_daily_visit_href = "https://sellercentral.amazon.com/business-reports/ref=thismonth#/report?id=102:SalesTrafficTimeSeries"/* 周报_销量与访问量报表 */ var m_daily_visit_href = "https://sellercentral.amazon.com/business-reports/ref=lastmonth#/report?id=102:SalesTrafficTimeSeries"/* 月报_销量与访问量报表 */ var m_daterange_repo_href ="https://sellercentral.amazon.com/payments/reports/custom/request?lastmonth"/* 月报_上月日期范围报告 */ var m_refound_repo_href = "https://sellercentral.amazon.com/reportcentral/CUSTOMER_RETURNS/1?lastmonth"/* 月报_上月退货报告 */ var m_orderlist_href = "https://sellercentral.amazon.com/reportcentral/WelcomePage?30orderlist_month"/* 月报_上月订单下载 */ var m_shipment_href = "https://sellercentral.amazon.com/gp/ssof/shipping-queue.html#fbashipment"/* 月报_上月货件下载 */ // 页面未跳转 if (href == r_daily_visit_href) {r_sale_download()} if (href == r_ad_repo_href) {r_ad_repo()} if (href == r_cash_href) {r_cash_auto()} if (href == n_invage_href) {n_invage_auto()} if (href == n_orderlist_href) {n_orderlist_auto()} if (href == w_orderlist_href) {w_orderlist_auto()} if (href == w_daterange_repo_href) {setTimeout(() => {w_range_repo_auto()}, 1000)} if (href == w_daily_visit_href) {setTimeout(() => {w_sale_download()}, 5000)} if (href == m_daily_visit_href) {setTimeout(() => {m_sale_download()}, 5000)} if (href == m_daterange_repo_href) {setTimeout(() => {m_range_repo_auto()}, 1000)} if (href == m_refound_repo_href) {setTimeout(() => {m_refound_repo_auto()}, 2000)} if (href == m_orderlist_href) {m_orderlist_auto()} if (href == m_shipment_href) {setTimeout(() => {m_shipment_auto()}, 2000)} // 页面加载完毕 $().ready(function(){ var href = window.location.href // 店铺高亮 setInterval(function(){red()},1000); // 主页按钮 if (homehref.test(href)) {home_page()} // 订单下载 if (order_welhref.test(href)) {Cbutton()} // 管理订单sku详情 if (now_orderhref.test(href)) {order_skuinfo()} // 业务报告点击前一天 if (rdailyhref.test(href)) {yday()} // 发货填箱 if (STAhref.test(href)) {Ebutton()} // 上月账单(日期范围报告) if (reporthref.test(href)) {Fbutton()} // 退货报告生成按钮 if (returnhref.test(href)) {Gbutton()} // 复制广告情况 if (adhref.test(href)) {setTimeout(() => {adinfo_button()}, 5000)} }) // 店铺高亮 function red(){ document.querySelector("#partner-switcher > button").style.height="37px"; document.querySelector("#partner-switcher > button").style.fontSize="25px"; document.querySelector("#partner-switcher > button").style.color="red"; } // 主页 function home_page(){ } // 日报部分 // 点击前一天 function yday() { setTimeout(function(){ // 或许是shadowdom解决方法 // var sr = $("[name='remark']")[0].shadowRoot; // $(sr).find("button").click() // alert("000") document.querySelectorAll("kat-dropdown")[0].shadowRoot.querySelector("div.kat-select-container > div.select-options > div > div > slot > kat-option:nth-child(5)").click() setTimeout(function(){ var dom1 = $("div.css-wb79wd > div.css-1nvf2ph > kat-date-picker:nth-child(1)")[0].shadowRoot var dom1_1 = $(dom1).find("kat-calendar")[0].shadowRoot $(dom1_1).find('button[aria-label="'+ yesterday_cn +'"]').click() setTimeout(function(){ var dom2 = $("div.css-wb79wd > div.css-1nvf2ph > kat-date-picker:nth-child(2)")[0].shadowRoot var dom2_1 = $(dom2).find("kat-calendar")[0].shadowRoot $(dom2_1).find('button[aria-label="'+ yesterday_cn +'"]').click() document.querySelector("div.css-1om0prg > kat-button").shadowRoot.querySelector("button").click() setInterval(function(){ copy_button() copy_report() },1700); },100); },1500); },4000); } // 创建复制按钮 function copy_button(){ document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box.css-1ff7o6c > div.css-2imjyh").style.cssText = "position: relative;" Abutton.setAttribute("type", "copy_button"); Abutton.style.cssText = txtarea_css Abutton.setAttribute("class","button"); // Abutton.onclick =function(){copy_txt()} Abutton.innerText="复制" document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box.css-1ff7o6c > div.css-2imjyh > div:nth-child(1)").appendChild(Abutton) // document.querySelector("body").appendChild(Abutton) } // 复制分支 业务报告 function copy_report() { Abutton.onclick =function(){ var t1 = document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box.css-1ff7o6c > div.css-2imjyh > div:nth-child(1) > h2").innerHTML var t2 = document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box.css-1ff7o6c > div.css-2imjyh > div:nth-child(2) > h2").innerHTML var t3 = document.querySelector("#root > div > div.css-1hwrlfd > div > kat-box.css-1ff7o6c > div.css-2imjyh > div:nth-child(3) > h2").innerHTML Abutton.value = t1+"\t"+t2+"\t"+t3 Abutton.select(); document.execCommand("copy"); } } // 创建复制按钮 广告详情 function adinfo_button() { setTimeout(function(){ adbtn.setAttribute("type", "button"); var adbtn_css = document.querySelector("#J_AACChromePivotNav > div > button:nth-last-child(1)").className adbtn.setAttribute("class", adbtn_css); var text = document.createTextNode("复制") var adspan = document.createElement("span") var adspan_css = document.querySelector("#J_AACChromePivotNav > div > button:nth-last-child(1) > span").className adspan.setAttribute("class",adspan_css) adspan.onclick = function() {ad_copy()} adspan.appendChild(text) adbtn.appendChild(adspan) document.querySelector("#J_AACChromePivotNav > div").appendChild(adbtn) document.querySelector("#J_AACChromePivotNav > div").appendChild(copy_area) // 广告花费复制 setInterval(() => { $("#UCM-CM-APP\\:campaignsDashboard\\:chart\\:kpiCards > div").each(function(i,obj) { $(this).children("button").click(function(){ var t1 = $(this).text() copy_area.value= t1 copy_area.select(); document.execCommand("copy"); }); }) }, 1000); },1000); } // 下载广告报表 function r_ad_repo() { setTimeout(function(){ document.querySelector("#UCM-CM-APP\\:campaignsDashboard\\:campaignsDashboard\\:dateRangeFilter\\:openContainer").click() setTimeout(function(){ document.querySelector("#UCM-CM-APP\\:campaignsDashboard\\:campaignsDashboard\\:dateRangeFilter\\:container button[value='YESTERDAY']").click() // setTimeout(function(){ // document.querySelector("#UCM-CM-APP\\:campaignsDashboard\\:campaignsDashboard\\:dateRangeFilter\\:container button:nth-last-child(1)").click() // },400); },400); },5 * 1000); } // 销量下载 function r_sale_download() { setTimeout(function(){ document.querySelector("kat-button[label='下载 (.csv)']").shadowRoot.querySelector("button").click() },4000); } // 自动提现 function r_cash_auto() { setTimeout(function() { alert("01") document.querySelector("#disburseToBankAccountBtn").click() },3000); } // 发/备货 // 创建下载按钮 订单 function Cbutton(){ button1.setAttribute("type", "button1"); button1.style.cssText = button_css button1.onclick =function(){n_orderlist_auto()} button1.innerText="下载" document.querySelector("body").appendChild(button1) } // 自动选择箱子(未完成 function Ebutton(){ button3.setAttribute("type", "button3"); button3.style.cssText = button_css button3.onclick =function(){boxtool()} button3.innerText="箱子" document.querySelector("body").appendChild(button3) } // 周 // 报 // 部 // 分 // 当月日期范围报告 function w_range_repo_auto() { $("#drrGenerateReportButton-announce").click() $("#drrReportTypeRadioSummary").click() $("#drrReportRangeTypeRadioCustom").click() setTimeout(() => { $("#drrFromDate")[0].click() // 开始时间 setTimeout(() => { $(".a-declarative.a-cal-date-anchor")[0].click() setTimeout(() => { $("#drrToDate").click() setTimeout(() => { // 天数双倍,两天前-2,0开始-1 var day = lastday()+new Date().getUTCDate()-3 $(".a-declarative.a-cal-date-anchor")[day].click() $("#drrGenerateReportsGenerateButton-announce").click() setTimeout(() => { $("#drrGenerateReportButton-announce").click() setTimeout(() => { $("#drrReportTypeRadioTransaction")[0].click() setTimeout(() => { $("#drrGenerateReportsGenerateButton-announce").click() }, 1000); }, 1000); }, 2000); }, 1000); }, 1000); }, 1000); }, 1000); // 检测下载是否完成 var Interval_1 = setInterval(function(){ $(".drrRefreshTable")[0].click() setTimeout(() => { if($("tbody > tr:nth-child(2) > td:nth-last-child(1) #downloadButton").length > 0){ if($("tbody > tr:nth-child(3) > td:nth-last-child(1) #downloadButton").length > 0){ clearInterval(Interval_1) document.querySelector("tbody > tr:nth-child(2) > td:nth-last-child(1) > span > span > a").click() setTimeout(() => { document.querySelector("tbody > tr:nth-child(3) > td:nth-last-child(1) > span > span > a").click() }, 1000); } } }, 2000); }, 7000); } // 本月订单下载 function w_orderlist_auto(){ setTimeout(function(){ document.querySelector("a[href='/reportcentral/FlatFileAllOrdersReport/1']").click() setTimeout(function(){ $("div.kat-select-container").click() $($("#daily-time-picker-style > kat-dropdown")[0].shadowRoot).find("kat-option[part='dropdown-option5']").click() // 本月选择时间 time_picker_thismonth() // setTimeout(function(){document.querySelector("kat-button.download-report-page-kat-button-primary").click()},5000); },200); },2 * 1000); // 判断是否下完报表 var Interval_1 = setInterval(function(){ if(document.querySelector("#download-notification-banner-kat-box > a")) { clearInterval(Interval_1) setTimeout(function(){ document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) kat-button").shadowRoot.querySelector("button").click() },2000); } },2000) } // 本月销量与访问量报告 function w_sale_download() { setTimeout(function(){ var dom1 = $("#daily-time-picker-kat-date-range-picker")[0].shadowRoot var dom1_1 = $(dom1).find("kat-date-picker.start")[0].shadowRoot var dom1_2 = $(dom1_1).find("kat-calendar")[0].shadowRoot $(dom1_2).find('button[data-day="1"]').click() // var dom1 = $("kat-date-picker")[0].shadowRoot // var dom1_1 = $(dom1).find("kat-calendar")[0].shadowRoot // $(dom1_1).find('button[data-day="1"]').click() },200); } // 月 // 报 // 部 // 份 // 生成上月账单_按钮 function Fbutton(){ button4.setAttribute("type", "button4"); button4.style.cssText = button_css button4.onclick =function(){m_range_repo_auto()} button4.innerText="账单" document.querySelector("body").appendChild(button4) } // 生成上月退货_按钮 function Gbutton(){ button5.setAttribute("type", "button5"); button5.style.cssText = button_css button5.onclick =function(){m_refound_repo_auto()} button5.innerText="退货" document.querySelector("body").appendChild(button5) } // 上月销量与访问量报告 function m_sale_download() { setTimeout(function(){ var dom1 = $("kat-date-picker")[0].shadowRoot var dom1_1 = $(dom1).find("kat-calendar")[0].shadowRoot $(dom1_1).find('button[data-day="1"]').click() // 结束时间 setTimeout(function(){ document.querySelectorAll("kat-date-picker")[1].shadowRoot.querySelector("kat-calendar").shadowRoot.querySelector("div > div.cal-header > button.cal-lft").click() setTimeout(function(){ var dom2 = $("kat-date-picker")[1].shadowRoot var dom2_1 = $(dom2).find("kat-calendar")[0].shadowRoot $(dom2_1).find('td.day.on.last-day').click() setTimeout(function(){ document.querySelector("kat-button[label='下载 (.csv)']").shadowRoot.querySelector("button").click() },200); },200); },200); },200); } // 上月订单报告 function m_orderlist_auto(){ setTimeout(function(){ document.querySelector("a[href='/reportcentral/FlatFileAllOrdersReport/1']").click() // 选择上个月初到月末 setTimeout(function() {m_refound_repo_auto()},2000); var Interval_1 = setInterval(() => { if(document.querySelector("#download-notification-banner-kat-box > a")){ document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-child(4) > kat-button").click() clearInterval(Interval_1) } }, 1000); },5 * 1000); } // 退货报告 //上月日期选择 function m_refound_repo_auto() { document.querySelector("#daily-time-picker-style > kat-dropdown").shadowRoot.querySelector("div.kat-select-container > div.select-options > div kat-option[value='-1']").click() document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.start").shadowRoot.querySelector("div > div.input__container > kat-input").click() time_picker_lastmonth() var Interval_1 = setInterval(function(){ if(document.querySelector("#download-notification-banner-kat-box > a")){ clearInterval(Interval_1) document.querySelector("kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-last-child(1) > kat-button").click() // document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-child(4) > kat-button").click() } }, 1000); } // 确切日期-上月初-月末通用 function time_picker_lastmonth() { setTimeout(function(){ document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.start").shadowRoot.querySelector("kat-calendar").shadowRoot.querySelector("div > div.cal-header > button.cal-lft").click() setTimeout(function(){ var dom1 = $("#daily-time-picker-kat-date-range-picker")[0].shadowRoot var dom1_1 = $(dom1).find("kat-date-picker.start")[0].shadowRoot var dom1_2 = $(dom1_1).find("kat-calendar")[0].shadowRoot $(dom1_2).find('button[data-day="1"]').click() // 结束时间 setTimeout(function(){ document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.end").shadowRoot.querySelector("div > div.input__container > kat-input").click() setTimeout(function(){ document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.end").shadowRoot.querySelector("kat-calendar").shadowRoot.querySelector("div > div.cal-header > button.cal-lft").click() setTimeout(function(){ var dom2 = $("#daily-time-picker-kat-date-range-picker")[0].shadowRoot var dom2_1 = $(dom2).find("kat-date-picker.end")[0].shadowRoot var dom2_2 = $(dom2_1).find("kat-calendar")[0].shadowRoot $(dom2_2).find('button[aria-label="'+ Premonth_last +'"]').click() document.querySelector("#report-page-kat-box > kat-button.download-report-page-kat-button-primary").shadowRoot.querySelector("button > div.content > slot > span").click() },200); },200); },200); },200); },200); } // 确切日期-本月初-本月减2 通用 function time_picker_thismonth() { setTimeout(function(){ setTimeout(function(){ var dom1 = $("#daily-time-picker-kat-date-range-picker")[0].shadowRoot var dom1_1 = $(dom1).find("kat-date-picker.start")[0].shadowRoot var dom1_2 = $(dom1_1).find("kat-calendar")[0].shadowRoot $(dom1_2).find('button[data-day="1"]').click() // 结束时间 setTimeout(function(){ document.querySelector("#daily-time-picker-kat-date-range-picker").shadowRoot.querySelector("kat-date-picker.end").shadowRoot.querySelector("div > div.input__container > kat-input").click() setTimeout(function(){ var dom2 = $("#daily-time-picker-kat-date-range-picker")[0].shadowRoot var dom2_1 = $(dom2).find("kat-date-picker.end")[0].shadowRoot var dom2_2 = $(dom2_1).find("kat-calendar")[0].shadowRoot var day = new Date().getUTCDate()-2 $(dom2_2).find('button[data-day="'+ day +'"]').click() document.querySelector("#report-page-kat-box > kat-button.download-report-page-kat-button-primary").shadowRoot.querySelector("button > div.content > slot > span").click() },200); },200); },200); },200); } // 生成上月账单 function m_range_repo_auto() { $("#drrGenerateReportButton-announce").click() $("#drrReportTypeRadioSummary").click() $("#drrGenerateReportsGenerateButton-announce").click() setTimeout(function(){ $("#drrGenerateReportButton-announce").click() $("#drrReportTypeRadioTransaction").click() $("#drrGenerateReportsGenerateButton-announce").click() },1000); var Interval_1 = setInterval(function(){ $(".drrRefreshTable")[0].click() setTimeout(() => { if($("tbody > tr:nth-child(2) > td:nth-last-child(1) #downloadButton").length > 0){ if($("tbody > tr:nth-child(3) > td:nth-last-child(1) #downloadButton").length > 0){ clearInterval(Interval_1) document.querySelector("tbody > tr:nth-child(2) > td:nth-last-child(1) > span > span > a").click() setTimeout(() => { document.querySelector("tbody > tr:nth-child(3) > td:nth-last-child(1) > span > span > a").click() }, 1000); } } }, 2000); }, 7000); } // 选择箱子 function boxtool() { $("kat-radiobutton[label='需要多个包装箱']").click() $("kat-button[label='确认']").click() setTimeout(function(){ $("div.pack-group-row-body > div.flo-athens-border-left > div > div:nth-child(2) > kat-dropdown > div > div.select-header").click() setTimeout(function(){ $("#FILE_UPLOAD1").click() },100); },100); } // 30天订单下载 function n_orderlist_auto(){ setTimeout(function(){ document.querySelector("a[href='/reportcentral/FlatFileAllOrdersReport/1']").click() setTimeout(function(){ 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() },5000); document.querySelector("body").removeChild(button1) button1.innerText="下载2" button1.onclick =function(){dingdan_over()} document.querySelector("body").appendChild(button1) dingdan_over() setTimeout(function(){ document.querySelector("body").removeChild(button1) },10000) },200); },2 * 1000); } // 订单下载2 function dingdan_over() { // 判断是否下完两个报表 var Interval_1 = setInterval(function(){ if(document.querySelector("#download-notification-banner-kat-box > a:nth-child(3)")) { clearInterval(Interval_1) document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-child(5) > kat-button").shadowRoot.querySelector("button").click() document.querySelector("a[href='/reportcentral/FlatFileAllOrdersReport/1']").click() setTimeout(function(){ document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-child(4) > kat-button").shadowRoot.querySelector("button").click() alert("done") },1500); } },2000) } // 库龄下载 function n_invage_auto() { setTimeout(() => { document.querySelector("#report-page-kat-box > kat-button.download-report-page-kat-button-primary").shadowRoot.querySelector("button").click() var Interval_1 = setInterval(function(){ if(document.querySelector("#download-notification-banner-kat-box > a")) { clearInterval(Interval_1) document.querySelector("#report-page-margin-style > kat-table > kat-table-body > kat-table-row:nth-child(1) > kat-table-cell:nth-child(5) > kat-button").shadowRoot.querySelector("button").click() } },1500); }, 2000); } // 管理订单sku详情 function order_skuinfo() { setTimeout(function(){ var SKU = {} var href = {} var a = '<a href="" target="_blank"></a>' $("div.myo-list-orders-product-name-cell").each(function(i,obj) { SKU[i] = ($(this).find("div:nth-child(3) > div").text()).replace("SKU: ","") href[i] = "https://sellercentral.amazon.com/skucentral?mSku="+SKU[i]+"&ref=myi_skuc" $(this).find("div:nth-child(3) > div").append(a) $(this).find("div:nth-child(3) > div > a").attr('href',href[i]); $(this).find("div:nth-child(3) > div > a").text(SKU[i]) }); },5000); } // 广告复制 function ad_copy(){ // var ad_copy_type = "#UCM-CM-APP\\\\:campaignsDashboard\\\\:chart\\\\:kpiCards" // var ad_copy_type = "#UCM-CM-APP\\:campaignsDashboard\\:chart\\:kpiCard" // var ad_list_typoe = "UCM-CM-APP\\:campaignsDashboard\\:dropdown-item-" // var huafei = $(ad_copy_type+"\\:spend").innerText // var baoguang = $(ad_copy_type+"\\:impressions").innerText // var dianji = $(ad_copy_type+"\\:clicks").innerText // var danci = $(ad_copy_type+"\\:cpc").innerText // var dianjiv = $(ad_copy_type+"\\:ctr").innerText // var xiaoshou = $(ad_copy_type+"\\:sales").innerText // var dingdan = $(ad_copy_type+"\\:orders").innerText // var acos = $(ad_copy_type+"\\:acos").innerText // kpicard 与 kpicards(默认) // $(ad_copy_type+"s > div:nth-last-child(1) > div > div:nth-child(1) > button").click() // $("button[data-takt-id='"+ad_list_typoe+"orders']").click() var ad_table_btm = ".ag-floating-bottom-viewport > div > div > " var baoguang = $(ad_table_btm+"div:nth-child(3)").text() var dianji = $(ad_table_btm+"div:nth-child(5)").text() var dianjiv =$(ad_table_btm+"div:nth-child(6)").text() var huafei =$(ad_table_btm+"div:nth-child(7)").text() var danci =$(ad_table_btm+"div:nth-child(8)").text() var dingdan =$(ad_table_btm+"div:nth-child(9)").text() var xiaoshou =$(ad_table_btm+"div:nth-child(10)").text() var acos =$(ad_table_btm+"div:nth-child(11)").text() // 处理多余的空格和换行 var reg = /\s|\n/g huafei = huafei.replace(reg,"") baoguang = baoguang.replace(reg,"") dianji = dianji.replace(reg,"") danci = danci.replace(reg,"") dianjiv = dianjiv.replace(reg,"") xiaoshou = xiaoshou.replace(reg,"") dingdan = dingdan.replace(reg,"") acos = acos.replace(reg,"") var zhuanhua = parseInt(dingdan) / parseInt(dianji) // 待添加 copy_area.value = baoguang+"\t"+dianji+"\t"+dianjiv+"\t"+huafei+"\t"+zhuanhua+"\t"+dingdan+"\t"+xiaoshou+"\t"+acos // copy_area.value = baoguang+"\n"+dianji+"\n"+dianjiv+"\n"+huafei+"\n"+danci+"\n"+dingdan+"\n"+xiaoshou copy_area.select(); document.execCommand("copy"); } // function dingdan(){ // // $.ajax({ // // type: "POST", // // url: "/reportcentral/api/v1/submitDownloadReport", // // data: JSON.stringify(p_30day), // // dataType: "json", // // contentType: "application/json;charset=utf-8", // // success: function (responsde) { // // alert("ok") // // } // // }); // alert("001") // $.post("/reportcentral/api/v1/submitDownloadReport", {reportFileFormat:"TSV",xdaysBeforeUntilToday:1, // startDateTimeOffset:0,endDateTimeOffset:0,reportFRPId:2400,disableTimezone:true}); // alert("002") // $.post("/reportcentral/api/v1/submitDownloadReport", {reportFileFormat:"CSV",reportFRPId: 2651,startDateTimeOffset: -86400},); // alert("003") // }