This commit is contained in:
liushiwei
2023-09-05 23:28:50 +08:00
parent 37bafe6279
commit b9991b4af2
4 changed files with 72 additions and 78 deletions

View File

@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "TEMU助手",
"description": "TEMU助手 - 自动化提高生产效率",
"version": "2.2.3",
"version": "2.2.4",
"background": {
"service_worker": "/background.js"
},
@@ -19,10 +19,13 @@
"permissions": [
"cookies",
"notifications",
"tabs",
"scripting",
"webRequest",
"declarativeNetRequest",
"declarativeNetRequestWithHostAccess",
"declarativeNetRequestFeedback",
"webRequest"
"activeTab"
],
"content_scripts": [
{

View File

@@ -1,5 +1,5 @@
<template>
<ai-list class="list" v-loading="isLoading">
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="销售数据"
@@ -290,6 +290,23 @@ import { Message } from 'element-ui'
return a.productTotalPrice - b.productTotalPrice
}
},
{
prop: 'purchaseConfig',
label: '备货逻辑',
align: 'center',
fixed: "right",
sortable: true,
'sort-method': (a, b) => {
if (a.purchaseConfig > b.purchaseConfig) {
return 1
} else if (a.purchaseConfig == b.purchaseConfig) {
return 0
} else {
return -1
}
}
},
]
},
@@ -338,7 +355,13 @@ import { Message } from 'element-ui'
align: 'center',
sortable: true,
'sort-method': (a, b) => {
return new Number(a[dateStr]) - new Number(b[dateStr])
if (a > b) {
return 1
} else if (a == b) {
return 0
} else {
return -1
}
}})
}
@@ -422,7 +445,13 @@ import { Message } from 'element-ui'
align: 'center',
sortable: true,
'sort-method': (a, b) => {
return new Number(a[dateStr]) - new Number(b[dateStr])
if (a > b) {
return 1
} else if (a == b) {
return 0
} else {
return -1
}
}})
}

View File

@@ -1,6 +1,6 @@
<template>
<div>
<ai-list class="list">
<ai-list class="list" v-loading="isLoading">
<ai-title
slot="title"
title="抢仓发货"
@@ -20,15 +20,7 @@
<el-button type="primary" :disabled="isBegin" @click="loadAll">一键加载全部</el-button>-->
</el-dropdown>
<el-button v-if="!isBegin" type="button" :class="'el-button el-button--primary'" @click="beginRobConfirm">开始抢仓</el-button>
<!--<el-dropdown @command="handleRobClick" v-if="!isBegin">
<el-button type="button" :class="'el-button el-button--primary'">开始抢仓</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :disabled="isBegin" command="normal">普通抢仓</el-dropdown-item>
<el-dropdown-item :disabled="isBegin" command="faster">极速抢仓</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>-->
<el-button v-else type="button" :icon="isBegin? 'el-icon-loading': ''" :class="isBegin ? 'el-button el-button--danger': 'el-button el-button--primary'" @click="beginRob()">{{ `结束抢仓(${choosedList.length}/${robTotal})` }}</el-button>
<!--<el-checkbox :disabled="isBegin" v-model="isCreateDeliveryBill">立即创建发货单</el-checkbox>-->
</template>
<template #right>
@@ -125,6 +117,7 @@
:total="total"
:isShowPagination="false"
style="margin-top: 8px;"
v-loading="isDlgLoading"
@selection-change="onChooseChange">
<el-table-column slot="productName" width="400px" label="商品信息" align="center">
<template slot-scope="scope">
@@ -293,15 +286,13 @@
pageSize: 100,
currentPage: 1,
robForm: {
step: "1000",
randomValue: 1000,
step: "500",
randomValue: 500,
isCreateDeliveryBill: false,
isModifyMaxNum: false
},
timer: [],
loadMallIndex: 0,
loadMode: 0, // 加载模式0表示单个店铺加载1表示一键加载
robMode: 0, // 抢仓模式0表示普通抢仓1表示极速抢仓
// 网络超时次数
networkErrorCount: 0,
@@ -310,6 +301,10 @@
successMallId: '',
successList: [],
// 加载数据
isLoading: false,
isDlgLoading: false,
robDlgShow: false,
}
},
@@ -345,6 +340,7 @@
this.loadMode = 0
this.tableData = []
this.currentPage = 1
this.isDlgLoading = true
this.getList(this.tableData, this.mallId, this.mallName, 1)
}).catch((err) => {
console.log(err)
@@ -370,6 +366,7 @@
this.choosedList = []
this.loadMallIndex = 0
this.loadMode = 1
this.isLoading = true
this.getList(this.choosedList, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1)
});
},
@@ -391,22 +388,12 @@
beforeBegin() {
this.$refs.robForm.validate((valid) => {
if (valid) {
this.handleRobClick('normal')
this.networkErrorCount = 0
this.robDlgShow = false
this.beginRob()
}
})
},
handleRobClick (e) {
this.networkErrorCount = 0
if (e === 'normal') {
this.robMode = 0
} else if (e === 'faster') {
this.robMode = 1
}
this.beginRob()
},
getList (data, mallId, mallName, currentPage) {
sendChromeAPIMessage({
url: 'oms/bg/venom/api/supplier/purchase/manager/querySubOrderList',
@@ -452,12 +439,15 @@
if (this.loadMallIndex < this.mallList.length) {
this.getList(data, this.mallList[this.loadMallIndex].mallId, this.mallList[this.loadMallIndex].mallName, 1)
} else {
this.isLoading = false
Message.success("所有店铺备货单已加载完成")
}
} else {
this.isDlgLoading = false
}
}
} else {
Message.error("【拼多多】" + res.errorMsg)
this.getList(data, mallId, mallName, currentPage)
}
})
},
@@ -475,9 +465,6 @@
beginRob() {
if (this.isBegin) {
this.isBegin = false;
for (let i = 0;i < this.timer.length; i++) {
clearInterval(this.timer[i].timer);
}
return;
}
@@ -487,24 +474,8 @@
this.robTotal = this.choosedList.length
this.isBegin = true;
this.timer = [];
if (0 == this.robMode) {
this.rob()
}
/*for (let i = 0;i < this.choosedList.length; i++) {
if (0 == this.robMode) {
setTimeout(() => {
this.rob(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId)
}, this.step * i)
} else {
setTimeout(() => {
let t = setInterval(this.robFunc(this.choosedList[i].subPurchaseOrderSn, this.choosedList[i].mallId), 1000);
this.timer.push({id: this.choosedList[i].subPurchaseOrderSn, timer: t})
}, 100 * i)
}
}*/
this.rob()
let _this = this;
let tt = setInterval(function() {
@@ -535,16 +506,7 @@
data: {
"subPurchaseOrderSn": sn
}}).then((res) => {
if (res.errorCode == 1000000) {
if (1 == this.robMode) {
let t = this.timer.filter((item) => {
return item.id == sn;
})
if (t.length > 0) {
clearInterval(t[0].timer)
}
}
if (res.errorCode == 1000000) {
for (let j = 0; j < this.choosedList.length; j++) {
if (this.choosedList[j].subPurchaseOrderSn == sn) {
this.successList.push(this.choosedList[j])
@@ -567,23 +529,14 @@
break;
}
}
/*if (0 == this.robMode) {
if (this.isBegin) {
setTimeout(() => {
this.rob(sn, mallId)
}, this.choosedList.length * this.step)
}
}*/
}
if (!res.errorCode && res.error_code && (res.error_code == 40001)) {
this.networkErrorCount ++
}
if (0 == this.robMode) {
// 继续抢
setTimeout(() => {
this.rob()
}, parseInt(this.robForm.step) + Math.floor(Math.random() * parseInt(this.robForm.randomValue)))
}
// 继续抢
setTimeout(() => {
this.rob()
}, parseInt(this.robForm.step) + Math.floor(Math.random() * parseInt(this.robForm.randomValue)))
})
},
createDeliveryBill(sn, mallId) {

View File

@@ -1,5 +1,5 @@
<template>
<ai-list class="list" v-loading="isLoading">
<ai-list class="list" v-loading="isLoading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
<ai-title
slot="title"
title="已收货发货单列表"
@@ -148,6 +148,10 @@ import { Message } from 'element-ui'
})
},
beginSync() {
if (!this.search.mallId) {
Message.error("请先选择店铺")
return
}
this.isLoading = true
this.currentPage = 1
this.packageNumber = 0
@@ -184,8 +188,8 @@ import { Message } from 'element-ui'
"status": 2
}
if (this.lastDeliveryTimestamp) {
data.deliverTimeFrom = this.lastDeliveryTimestamp
data.deliverTimeTo = Date.now() / 1000
data.deliverTimeFrom = this.lastDeliveryTimestamp * 1000
data.deliverTimeTo = Date.now()
}
sendChromeAPIMessage({
url: 'bgSongbird-api/supplier/deliverGoods/management/pageQueryDeliveryOrders',
@@ -237,6 +241,7 @@ import { Message } from 'element-ui'
}, 1500)
}
}).catch(() => {
Message.error("同步发货单失败")
this.isLoading = false
})
},
@@ -260,8 +265,12 @@ import { Message } from 'element-ui'
list.push(data)
}
this.packageNumber = this.packageNumber - res.result.deliveryOrderDetails.length
console.log(this.packageNumber)
if (this.packageNumber < 5) this.isLoading = false
if (this.packageNumber < 10) {
this.isLoading = false
this.getInfo()
}
this.$http.post('/api/deliveryOrderDetail/add',list)
} else {
setTimeout(() => {