NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name XYZ
// @namespace Violentmonkey Scripts
// @match https://fhgo-manage.newhopedairy.cn/xyz/order/confirmlist/detail/**
// @grant none
// @version 1.8
// @author Joey
// @license MIT
// @description 2025/6/12 21:01:46
// ==/UserScript==
console.log("use sc");
// @ts-check
let btn;
function getInfo() {
const nodes = document.querySelectorAll(".box-container>div");
const list = Array.from(nodes).map((el) => {
const label = el.querySelector(".info-div-title").textContent;
const value = el.querySelector(".info-div-value").textContent;
return [label, value];
});
const obj = Object.fromEntries(list);
// {
// "订单/平台编号:": "LY25061200006612006 (6943443982962857514)",
// "订单来源:": "抖音",
// "下单时间:": "2025/06/12 20:50:37",
// "订单金额:": "¥1,089.00",
// "实付金额:": "¥899.40",
// "买家备注:": "-",
// "内部备注:": "-编辑",
// "卖家备注:": "-",
// "收货人:": "匡可可",
// "收货人电话:": "17843998283",
// "小区地址:": "四川省成都市郫都区郫筒街道一里阳光小区(1号门)",
// "小区名称:": "一里阳光",
// "门牌号:备注": "-1 ",
// "配送奶站:": "郫县(旭阳)订户中心",
// "送奶员:": "-",
// "备注:": ""
// }
// ROW
const row = document.querySelectorAll("ul.ant-list-items>div>div");
const rowData = Array.from(row)
.map((el) => {
return el.querySelector(":last-child");
})
.map((el) => {
const first = el.querySelector(":first-child");
const name = first.querySelector(".ant-space:last-child").textContent.split("|").pop();
const giftEl = first.querySelector("div:nth-child(2) > div > div:nth-child(3) > div");
const gift = giftEl ? giftEl.textContent : "";
const second = el.querySelector("div.index-module-flex_between-f8b0b > div:nth-child(2) > div > div:last-child");
const price = second ? second.textContent : "";
return {
name,
price,
gift,
};
});
const rowText = rowData
.map((el) => {
return `${el.name}\n${el.price}${el.gift ? "\n" + el.gift : ""}`;
})
.join("\n");
const text = `${obj["订单/平台编号:"]}
${obj["买家备注:"]}
${obj["收货人:"]}
${obj["收货人电话:"]}
${obj["小区地址:"]}
${obj["小区名称:"]}
${obj["门牌号:备注"]}
${rowText}`;
console.log(obj, rowData);
console.log(text);
navigator.clipboard.writeText(text).then(() => {
btn.textContent = `复制成功 (${Date.now()})`;
});
}
function setCopy() {
btn = document.createElement("button");
btn.classList.add("ant-btn", "ant-btn-primary", "css-mzwlov", "button__BaseButton-sc-1cnw6ky-0", "gBPfYX");
btn.textContent = "复制";
btn.style.cssText = `
position: fixed;
left: 400px;
top: 9px;
z-index: 9999;
`;
btn.onclick = getInfo;
document.body.appendChild(btn);
}
window.requestIdleCallback(setCopy);