diff --git a/public/rules_10.json b/public/rules_10.json new file mode 100644 index 0000000..fc8c52c --- /dev/null +++ b/public/rules_10.json @@ -0,0 +1,24 @@ +[ + { + "id": 21, + "priority": 1, + "action": { + "type": "modifyHeaders", + "requestHeaders": [ + { + "header": "Origin", + "operation": "set", + "value": "https://oms.goodcang.com/" + }, + { + "header": "Referer", + "operation": "set", + "value": "https://oms.goodcang.com/" + } + ] + }, + "condition": { + "urlFilter": "||oms.goodcang.com" + } + } +] \ No newline at end of file diff --git a/src/api/chromeApi.js b/src/api/chromeApi.js index 36368b0..b90203a 100644 --- a/src/api/chromeApi.js +++ b/src/api/chromeApi.js @@ -138,3 +138,17 @@ export function sendAliexpressAPIMessage(message) { chrome.runtime.sendMessage(message, resolve) }) } + +/** + * 向Chrome发送消息 + * @param message 消息 + */ +export function sendGoodcangAPIMessage(message) { + message.type = 'goodcangApi' + if (!message.url.startsWith('http')) { + message.url = "https://oms.goodcang.com/" + message.url; + } + return new Promise((resolve) => { + chrome.runtime.sendMessage(message, resolve) + }) +} diff --git a/src/entry/background.js b/src/entry/background.js index 43636e0..3938a6c 100644 --- a/src/entry/background.js +++ b/src/entry/background.js @@ -186,6 +186,18 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { resolve({success: false, errorCode: -1}) }); }).then(sendResponse); + } else if (request.type == 'goodcangApi') { + new Promise((resolve) => { + let headers = {}; + headers['Content-Type'] = 'application/json'; + Promise.resolve().then(() => fetch(request.url, { + 'headers': headers, 'method': request.method, 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'body': JSON.stringify(request.data), 'mode': 'cors' + })).then((res) => { + resolve(res.json()); + }).catch(() => { + resolve({success: false, errorCode: -1}) + }); + }).then(sendResponse); } else if (request.type == 'notify') { chrome.notifications.create("" + Math.random(), { type: "basic", title: "TEMU助手", message: "您店铺【" + request.mallName + "】的商品【" + request.productName + "】成功加入发货台,请尽快处理", iconUrl: "./icons/48.png" diff --git a/src/manifest.development.json b/src/manifest.development.json index e4ec88e..0b1d3dd 100644 --- a/src/manifest.development.json +++ b/src/manifest.development.json @@ -22,7 +22,8 @@ "*://*.amazon.com/", "*://*.shein.com/", "*://*.geiwohuo.com/", - "*://*.ltwebstatic.com/" + "*://*.ltwebstatic.com/", + "*://*.goodcang.com/" ], "permissions": [ "cookies", @@ -64,6 +65,10 @@ "id": "9", "enabled": true, "path": "rules_9.json" + },{ + "id": "10", + "enabled": true, + "path": "rules_10.json" }] }, "content_scripts": [ diff --git a/src/manifest.production.json b/src/manifest.production.json index 7a9efd4..da4aded 100644 --- a/src/manifest.production.json +++ b/src/manifest.production.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "TEMU助手", "description": "TEMU助手 - 自动化提高生产效率", - "version": "3.2.11", + "version": "3.2.12", "background": { "service_worker": "/background.js" }, diff --git a/src/router/index.js b/src/router/index.js index 26ab376..bc41083 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -252,6 +252,16 @@ const router = new VueRouter({ name: 'returnRecordShein', component: () => import('../view/shein/ReturnRecordShein.vue') }, + { + path: 'labelInfoShein', + name: 'labelInfoShein', + component: () => import('../view/shein/LabelInfoShein.vue') + }, + { + path: 'purchaseOrderListShein', + name: 'purchaseOrderListShein', + component: () => import('../view/shein/PurchaseOrderListShein.vue') + }, // { // path: 'statistics', diff --git a/src/view/Home.vue b/src/view/Home.vue index e18c3f4..4e90783 100644 --- a/src/view/Home.vue +++ b/src/view/Home.vue @@ -149,6 +149,12 @@ 商品复制 发货订单 退货与报废单列表 + + 标签管理 + + + 发货单列表 + 商家账单统计 @@ -216,7 +222,7 @@ + + diff --git a/src/view/shein/PurchaseOrderListShein.vue b/src/view/shein/PurchaseOrderListShein.vue new file mode 100644 index 0000000..d7508cd --- /dev/null +++ b/src/view/shein/PurchaseOrderListShein.vue @@ -0,0 +1,255 @@ + + + + + diff --git a/src/view/shipping/NormalSendGoods.vue b/src/view/shipping/NormalSendGoods.vue index 0a14014..7e6dca2 100644 --- a/src/view/shipping/NormalSendGoods.vue +++ b/src/view/shipping/NormalSendGoods.vue @@ -537,8 +537,9 @@ } }) }, - getList (data, mallId, mallName, currentPage) { - sendChromeAPIMessage({ + async getList (data, mallId, mallName, currentPage) { + await this.sleepSync(300 + Math.floor(Math.random() * 100)) + let res = await sendChromeAPIMessage({ url: 'oms/bg/venom/api/supplier/purchase/manager/querySubOrderList', needMallId: true, mallId: mallId, @@ -552,56 +553,55 @@ ], productSkcIdList: this.skc? this.skc.split(','): null, subPurchaseOrderSnList: this.searchSns? this.searchSns.split(','): null - }}).then((res) => { - if (res.errorCode == 1000000) { - let length = res.result.subOrderForSupplierList.length - res.result.subOrderForSupplierList = res.result.subOrderForSupplierList.filter((item) => { - return item.isCanJoinDeliverPlatform; - }) - res.result.subOrderForSupplierList.map((item) => { - let temp = data.filter(i => { - return i.subPurchaseOrderSn == item.subPurchaseOrderSn - }) - if (temp.length == 0) { - data.push({ - robTotal: 0, - subPurchaseOrderSn: item.subPurchaseOrderSn, - originalPurchaseOrderSn: item.originalPurchaseOrderSn, - productName: item.productName, - productSn: item.productSn, - productSkcId: item.productSkcId, - productSkcPicture: item.productSkcPicture, - status: item.status, - detailList: item.skuQuantityDetailList, - category: item.category, - mallId: mallId, - mallName: mallName - }) - } + }}) + if (res.errorCode == 1000000) { + let length = res.result.subOrderForSupplierList.length + res.result.subOrderForSupplierList = res.result.subOrderForSupplierList.filter((item) => { + return item.isCanJoinDeliverPlatform; + }) + res.result.subOrderForSupplierList.map((item) => { + let temp = data.filter(i => { + return i.subPurchaseOrderSn == item.subPurchaseOrderSn + }) + if (temp.length == 0) { + data.push({ + robTotal: 0, + subPurchaseOrderSn: item.subPurchaseOrderSn, + originalPurchaseOrderSn: item.originalPurchaseOrderSn, + productName: item.productName, + productSn: item.productSn, + productSkcId: item.productSkcId, + productSkcPicture: item.productSkcPicture, + status: item.status, + detailList: item.skuQuantityDetailList, + category: item.category, + mallId: mallId, + mallName: mallName }) + } + }) - if (this.pageSize == length) { - currentPage ++ - this.getList(data, mallId, mallName, currentPage) + if (this.pageSize == length) { + currentPage ++ + this.getList(data, mallId, mallName, currentPage) + } else { + if (this.loadMode == 1) { + this.loadMallIndex ++ + if (this.loadMallIndex < this.mallList.length) { + this.getList(data, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1) } else { - if (this.loadMode == 1) { - this.loadMallIndex ++ - if (this.loadMallIndex < this.mallList.length) { - this.getList(data, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1) - } else { - this.isLoading = false - this.isDlgLoading = false - Message.success("所有店铺备货单已加载完成") - } - } else { - this.isLoading = false - this.isDlgLoading = false - } + this.isLoading = false + this.isDlgLoading = false + Message.success("所有店铺备货单已加载完成") } } else { - this.getList(data, mallId, mallName, currentPage) + this.isLoading = false + this.isDlgLoading = false } - }) + } + } else { + this.getList(data, mallId, mallName, currentPage) + } }, remove(sn) { for (let i = 0; i < this.choosedList.length; i++) { @@ -851,7 +851,10 @@ }, sendNotification(obj) { sendChromeNotification({productName: obj.productName, mallName: obj.mallName}) - } + }, + sleepSync(milliseconds) { + return new Promise(resolve => setTimeout(resolve, milliseconds)); + }, } }